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=
|
cur=
|
||||||
i=
|
i=
|
||||||
|
|
||||||
|
# Read options
|
||||||
while getopts "scn:w:o:" option; do
|
while getopts "scn:w:o:" option; do
|
||||||
case "$option" in
|
case "$option" in
|
||||||
s) wprefix=''; window='' ;;
|
s) wprefix=''; window='' ;;
|
||||||
|
@ -37,9 +38,14 @@ while getopts "scn:w:o:" option; do
|
||||||
n) wprefix='-name '; window="$OPTARG" ;;
|
n) wprefix='-name '; window="$OPTARG" ;;
|
||||||
w) wprefix='-id '; window="$OPTARG" ;;
|
w) wprefix='-id '; window="$OPTARG" ;;
|
||||||
o) opacity="$OPTARG" ;;
|
o) opacity="$OPTARG" ;;
|
||||||
|
\?) exit 1;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Read positional arguments
|
||||||
|
shift $(($OPTIND - 1))
|
||||||
|
[ -n "$1" ] && opacity="$1"
|
||||||
|
|
||||||
# Validate opacity value
|
# Validate opacity value
|
||||||
if [ -z "$opacity" ]; then
|
if [ -z "$opacity" ]; then
|
||||||
echo "No opacity specified."
|
echo "No opacity specified."
|
||||||
|
|
|
@ -6,7 +6,7 @@ compton\-trans \- an opacity setter tool
|
||||||
|
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.nf
|
.nf
|
||||||
.B compton-trans [-wncs] [window] -o [opacity]
|
.B compton-trans [-w WINDOW_ID] [-n WINDOW_NAME] [-c] [-s] OPACITY
|
||||||
.fi
|
.fi
|
||||||
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
|
|
Loading…
Reference in New Issue