From 216441c7b04b81b5c54a9552f4b1273f87cf8ce2 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sat, 4 May 2013 20:40:01 -0500 Subject: [PATCH] compton-trans: add reset option. --- bin/compton-trans | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/bin/compton-trans b/bin/compton-trans index 25f4669..5444e17 100755 --- a/bin/compton-trans +++ b/bin/compton-trans @@ -37,6 +37,8 @@ treeout= wid= topmost= lineno= +option= +v= # Workaround: replace '-5' with '~5' so as not to confuse getopts. for v in "$@"; do @@ -52,10 +54,10 @@ while test $# -gt 0; do OPTIND=1 # Read options - while getopts 'scdgn:w:o:-:' option "$@"; do + while getopts 'scrdgn:w:o:-:' option "$@"; do if test "$option" = '-'; then case "$OPTARG" in - select | current | delete | get) + select | current | reset | delete | get) v='' ;; name | window | opacity) @@ -80,6 +82,7 @@ while test $# -gt 0; do | sed 's/^.*\(0x\S*\).*$/\1/') wprefix='-id'; window=$active ;; + r) action='reset' ;; d) action='delete' ;; g) action='get' ;; n) wprefix='-name'; window=$OPTARG ;; @@ -103,6 +106,16 @@ if test -z "$action" && ! echo "$opacity" | grep -q '^[+-]\?[0-9]\+$'; then exit 1 fi +# Reset opacity for all windows +if test x"$action" = x'reset'; then + xwininfo -root -tree \ + | sed -n 's/^ \(0x[[:xdigit:]]*\).*/\1/p' \ + | while IFS=$'\n' read wid; do + xprop -id "$wid" -remove _NET_WM_WINDOW_OPACITY + done + exit 0 +fi + # Get ID of the target window if test -z "$wprefix"; then treeout=$(xwininfo -children -frame)