Misc: compton-trans: Allow reading opacity from positional arguments
- compton-trans: Allow reading opacity value from positional arguments, like the version in master branch. - compton-trans: Quit when meeting an unrecognized option.
This commit is contained in:
parent
ce7f686f9e
commit
fd9c9ba38d
|
@ -26,6 +26,7 @@ opacity=
|
|||
cur=
|
||||
i=
|
||||
|
||||
# Read options
|
||||
while getopts "scn:w:o:" option; do
|
||||
case "$option" in
|
||||
s) wprefix=''; window='' ;;
|
||||
|
@ -37,9 +38,14 @@ while getopts "scn:w:o:" option; do
|
|||
n) wprefix='-name '; window="$OPTARG" ;;
|
||||
w) wprefix='-id '; window="$OPTARG" ;;
|
||||
o) opacity="$OPTARG" ;;
|
||||
\?) exit 1;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Read positional arguments
|
||||
shift $(($OPTIND - 1))
|
||||
[ -n "$1" ] && opacity="$1"
|
||||
|
||||
# Validate opacity value
|
||||
if [ -z "$opacity" ]; then
|
||||
echo "No opacity specified."
|
||||
|
|
|
@ -6,7 +6,7 @@ compton\-trans \- an opacity setter tool
|
|||
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B compton-trans [-wncs] [window] -o [opacity]
|
||||
.B compton-trans [-w WINDOW_ID] [-n WINDOW_NAME] [-c] [-s] OPACITY
|
||||
.fi
|
||||
|
||||
.SH DESCRIPTION
|
||||
|
|
Loading…
Reference in New Issue