#!/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