diff options
| author | Yigit Sever | 2021-11-07 23:42:15 +0300 |
|---|---|---|
| committer | Yigit Sever | 2021-11-07 23:42:15 +0300 |
| commit | 9fa9973c2d2f91cef7bdd26cb52064c13f4d682e (patch) | |
| tree | 13aa64b09bc91e16f3dd3217bf3d647559af2cf9 /.local/bin/i3-get-window-criteria | |
| parent | 9382166b5522a5d9e2d62e93e702b4d0886cedb4 (diff) | |
| parent | fcb2237c01bcd2b7982bb844cea4cf9447f20d03 (diff) | |
| download | dotfiles-9fa9973c2d2f91cef7bdd26cb52064c13f4d682e.tar.gz dotfiles-9fa9973c2d2f91cef7bdd26cb52064c13f4d682e.tar.bz2 dotfiles-9fa9973c2d2f91cef7bdd26cb52064c13f4d682e.zip | |
Merge remote-tracking branch 'origin/main'
Diffstat (limited to '.local/bin/i3-get-window-criteria')
| -rwxr-xr-x | .local/bin/i3-get-window-criteria | 8 |
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 | ||
| 12 | PROGNAME=`basename "$0"` | 12 | PROGNAME=$(basename "$0") |
| 13 | 13 | ||
| 14 | # Check for xwininfo and xprop | 14 | # Check for xwininfo and xprop |
| 15 | for cmd in xwininfo xprop; do | 15 | for 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}" \ |
