Created
September 4, 2021 15:42
-
-
Save 2xsaiko/d1b8a7741e63f6211081911904e48b32 to your computer and use it in GitHub Desktop.
swaywm: displays an [I] indicator in idle-inhibiting windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
current="" | |
while true; do | |
new="$(swaymsg -t get_tree | jq -c 'recurse(.nodes[]) | del(.nodes) | select(.type == "con") | select(.inhibit_idle) | .id')" | |
for id in $new; do | |
re="\\b$id\\b" | |
if ! [[ "$current" =~ $re ]]; then | |
swaymsg "[con_id=$id] title_format \"[I] %title\"" | |
fi | |
done | |
for id in $current; do | |
re="\\b$id\\b" | |
if ! [[ "$new" =~ $re ]]; then | |
swaymsg "[con_id=$id] title_format \"%title\"" | |
fi | |
done | |
current="$new" | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment