From a9a3b015e1413c00f817c20ef724d3b6c4ea5082 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sat, 4 May 2013 20:50:42 -0500 Subject: [PATCH] compton-trans: ensure wid format. misc. xwininfo falls back to cursor selection if the window ID is formatted improperly. --- bin/compton-trans | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/compton-trans b/bin/compton-trans index 5444e17..6beeabf 100755 --- a/bin/compton-trans +++ b/bin/compton-trans @@ -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