compton-trans: ensure wid format. misc.

xwininfo falls back to cursor selection if the window ID is formatted
improperly.
This commit is contained in:
Christopher Jeffrey 2013-05-04 20:50:42 -05:00
parent 216441c7b0
commit a9a3b015e1
1 changed files with 8 additions and 1 deletions

View File

@ -19,6 +19,10 @@
# $ compton-trans -s 75
# Increment current window 5%
# $ compton-trans -c +5
# Delete current window's opacity
# $ compton-trans -c --delete
# Reset all windows
# $ compton-trans --reset
# "command" is a shell built-in, faster than "which"
if test -z "$(command -v xprop)" -o -z "$(command -v xwininfo)"; then
@ -120,6 +124,9 @@ fi
if test -z "$wprefix"; then
treeout=$(xwininfo -children -frame)
else
test "$wprefix" = '-id' \
&& ! echo "$window" | grep -q '^\(0x\)\?[0-9a-fA-F]\+$' \
&& echo 'Bad window ID.' && exit 1
treeout=$(xwininfo -children $wprefix "$window")
fi
@ -189,7 +196,7 @@ fi
# Calculate the desired opacity
if echo "$opacity" | grep -q '^[+-]'; then
opacity=$(($cur + $opacity))
opacity=$((cur + opacity))
fi
test $opacity -lt 0 && opacity=0