compton-trans: add reset option.

This commit is contained in:
Christopher Jeffrey 2013-05-04 20:40:01 -05:00
parent 7c451c10f7
commit 216441c7b0
1 changed files with 15 additions and 2 deletions

View File

@ -37,6 +37,8 @@ treeout=
wid= wid=
topmost= topmost=
lineno= lineno=
option=
v=
# Workaround: replace '-5' with '~5' so as not to confuse getopts. # Workaround: replace '-5' with '~5' so as not to confuse getopts.
for v in "$@"; do for v in "$@"; do
@ -52,10 +54,10 @@ while test $# -gt 0; do
OPTIND=1 OPTIND=1
# Read options # Read options
while getopts 'scdgn:w:o:-:' option "$@"; do while getopts 'scrdgn:w:o:-:' option "$@"; do
if test "$option" = '-'; then if test "$option" = '-'; then
case "$OPTARG" in case "$OPTARG" in
select | current | delete | get) select | current | reset | delete | get)
v='' v=''
;; ;;
name | window | opacity) name | window | opacity)
@ -80,6 +82,7 @@ while test $# -gt 0; do
| sed 's/^.*\(0x\S*\).*$/\1/') | sed 's/^.*\(0x\S*\).*$/\1/')
wprefix='-id'; window=$active wprefix='-id'; window=$active
;; ;;
r) action='reset' ;;
d) action='delete' ;; d) action='delete' ;;
g) action='get' ;; g) action='get' ;;
n) wprefix='-name'; window=$OPTARG ;; n) wprefix='-name'; window=$OPTARG ;;
@ -103,6 +106,16 @@ if test -z "$action" && ! echo "$opacity" | grep -q '^[+-]\?[0-9]\+$'; then
exit 1 exit 1
fi 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 # Get ID of the target window
if test -z "$wprefix"; then if test -z "$wprefix"; then
treeout=$(xwininfo -children -frame) treeout=$(xwininfo -children -frame)