summaryrefslogtreecommitdiffstats
path: root/.local/bin/i3-get-window-criteria
diff options
context:
space:
mode:
authorYigit Sever2021-11-04 12:25:04 +0300
committerYigit Sever2021-11-04 12:25:04 +0300
commita0bb023d782dd2d8703670d560b5ccd8d25d640e (patch)
tree1c11a649e2201e1458c4011894086f49da5ded15 /.local/bin/i3-get-window-criteria
parent93cdb13eada4e803fb4db71fb581d9e4a03d2119 (diff)
downloaddotfiles-a0bb023d782dd2d8703670d560b5ccd8d25d640e.tar.gz
dotfiles-a0bb023d782dd2d8703670d560b5ccd8d25d640e.tar.bz2
dotfiles-a0bb023d782dd2d8703670d560b5ccd8d25d640e.zip
bins: shfmt, weasel suite, spark
Diffstat (limited to '.local/bin/i3-get-window-criteria')
-rwxr-xr-x.local/bin/i3-get-window-criteria8
1 files changed, 4 insertions, 4 deletions
diff --git a/.local/bin/i3-get-window-criteria b/.local/bin/i3-get-window-criteria
index f46f65e..6d6ea1b 100755
--- a/.local/bin/i3-get-window-criteria
+++ b/.local/bin/i3-get-window-criteria
@@ -9,7 +9,7 @@
9# quotes in "<string>" are not escaped properly. This is a problem with the output of `xprop`, 9# quotes in "<string>" are not escaped properly. This is a problem with the output of `xprop`,
10# reported upstream: https://bugs.freedesktop.org/show_bug.cgi?id=66807 10# reported upstream: https://bugs.freedesktop.org/show_bug.cgi?id=66807
11 11
12PROGNAME=`basename "$0"` 12PROGNAME=$(basename "$0")
13 13
14# Check for xwininfo and xprop 14# Check for xwininfo and xprop
15for cmd in xwininfo xprop; do 15for cmd in xwininfo xprop; do
@@ -25,13 +25,13 @@ match_qstring='"[^"\\]*(\\.[^"\\]*)*"' # NOTE: Adds 1 backreference
25 25
26{ 26{
27 # Run xwininfo, get window id 27 # Run xwininfo, get window id
28 window_id=`xwininfo -int | sed -nre "s/^xwininfo: Window id: ($match_int) .*$/\1/p"` 28 window_id=$(xwininfo -int | sed -nre "s/^xwininfo: Window id: ($match_int) .*$/\1/p")
29 echo "id=$window_id" 29 echo "id=$window_id"
30 30
31 # Run xprop, transform its output into i3 criteria. Handle fallback to 31 # Run xprop, transform its output into i3 criteria. Handle fallback to
32 # WM_NAME when _NET_WM_NAME isn't set 32 # WM_NAME when _NET_WM_NAME isn't set
33 xprop -id $window_id | 33 xprop -id $window_id \
34 sed -nr \ 34 | sed -nr \
35 -e "s/^WM_CLASS\(STRING\) = ($match_qstring), ($match_qstring)$/instance=\1\nclass=\3/p" \ 35 -e "s/^WM_CLASS\(STRING\) = ($match_qstring), ($match_qstring)$/instance=\1\nclass=\3/p" \
36 -e "s/^WM_WINDOW_ROLE\(STRING\) = ($match_qstring)$/window_role=\1/p" \ 36 -e "s/^WM_WINDOW_ROLE\(STRING\) = ($match_qstring)$/window_role=\1/p" \
37 -e "/^WM_NAME\(STRING\) = ($match_string)$/{s//title=\1/; h}" \ 37 -e "/^WM_NAME\(STRING\) = ($match_string)$/{s//title=\1/; h}" \