From 52079962322b3910dc4f5e1a0490fef663d23768 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Tue, 25 Aug 2020 19:21:31 +0100 Subject: [PATCH] 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 --- bin/picom-trans | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/picom-trans b/bin/picom-trans index 6b1d1df..331487c 100755 --- a/bin/picom-trans +++ b/bin/picom-trans @@ -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