aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwisatong <[email protected]>2021-01-02 07:13:21 +0700
committerwisatong <[email protected]>2021-01-02 07:13:21 +0700
commitb99e6c06249670422c58bcd995bc1e552fc77d94 (patch)
tree4dd0bb0906d709a678393d04c87e038dd00cbc67
parent239d5ece0514ec5ad40a3ab0fbd088300a92497b (diff)
Fix get_class() only grab last class
-rwxr-xr-xbspswallow4
1 files changed, 3 insertions, 1 deletions
diff --git a/bspswallow b/bspswallow
index 35784a2..51ed528 100755
--- a/bspswallow
+++ b/bspswallow
@@ -6,7 +6,9 @@ get_class() {
if [ -z "$id" ]; then
echo ""
else
- xprop -id "$id" | sed -n '/WM_CLASS\|WM_COMMAND/s/.*"\(.*\)".*/\1/p'
+ xprop -id "$id" | sed -n \
+ -e '/WM_CLASS/s/\( "\)/\n/g; s/[^\n]*\n\([^"]*\)[^\n]*/\1\n/g' \
+ -e '/WM_COMMAND/s/[^"]*/\n\n/1; s/\n"//1; s/\n\([^"]*\)".*/\n\1/; /\n/p'
fi
}