You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
508 B
Bash
15 lines
508 B
Bash
2 years ago
|
#!/usr/bin/env bash
|
||
|
|
||
|
# loops over i3 ipc events to prevent unnesecary polling
|
||
|
|
||
|
while :; do
|
||
|
# infinite loop
|
||
|
i3_msg=$(i3-msg -t SUBSCRIBE '[ "window" , "output" ]')
|
||
|
window=$(echo "$i3_msg" | gojq 'if .change == "focus" then .container.window_properties end | if .title == "tmux" then .title else .class end' | tr -d '"')
|
||
|
case "$window" in
|
||
|
'st-256color') echo 'st' ;;
|
||
|
'Brave-browser') echo 'Brave' ;;
|
||
|
*) echo "$window" ;;
|
||
|
esac
|
||
|
done
|