Skip to content

Commit

Permalink
Fix compton-trans -c
Browse files Browse the repository at this point in the history
The pipeline used to retrieve the WID of the active window returns a bad WID because xprop returns several hex numbers and ".*" in the sed regex is greedy. For instance, running "xprop -root -notype _NET_ACTIVE_WINDOW" gives me:
_NET_ACTIVE_WINDOW: window id # 0x1a0003d, 0x0
Filtering this output with the sed substitution then gives "0x0", since the first ".*" matches everything up to *the last* hex number.

The fix is simply to grep hex numbers instead of using a sed substitution, and then choose the first one.
  • Loading branch information
Corax26 committed Mar 26, 2015
1 parent 0ab80bd commit e4c0b83
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bin/compton-trans
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ while test $# -gt 0; do
s) wprefix=''; window='' ;;
c)
active=$(xprop -root -notype _NET_ACTIVE_WINDOW \
| sed 's/^.*\(0x\S*\).*$/\1/')
| grep -Eo '0x[[:xdigit:]]+' | head -n 1)
wprefix='-id'; window=$active
;;
r) action='reset' ;;
Expand Down

0 comments on commit e4c0b83

Please sign in to comment.