picom-trans: fixes when setting transparency with window id

Two problems:

1) the regex used to match the wid in the window tree can match the wid
   appearing in window titles as well.
2) instead of picking the parent window of the target window to set
   transparency, a random window which is listed just below the target
   window will be chosen. not sure why was there a + 1.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2020-08-25 19:21:31 +01:00
parent 933f2cfe80
commit 5207996232
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
1 changed files with 2 additions and 2 deletions

View File

@ -160,7 +160,7 @@ else
fi
# Find the line number of the target window in the window tree
lineno=$(echo -n "$treeout" | grep -nw "$wid" | head -n1 | cut -d ':' -f 1)
lineno=$(echo -n "$treeout" | grep -nw "^\s*$wid" | head -n1 | cut -d ':' -f 1)
if test -z "$lineno"; then
echo 'Failed to find window in window tree.'
@ -169,7 +169,7 @@ else
# Find the highest ancestor of the target window below
topmost=$(echo -n "$treeout" \
| head -n $((lineno + 1)) \
| head -n $lineno \
| sed -n 's/^ \(0x[[:xdigit:]]*\).*/\1/p' \
| tail -n 1)
fi