dotfiles/de/home/.config/eww/scripts/activewindow
2025-03-04 02:15:01 -08:00

25 lines
728 B
Bash
Executable file

#!/bin/bash
#declare -A titles
#declare -A icons
titles=(" — Alacritty" " — LibreWolf" " — LibreOffice Calc" " — LibreOffice Writer" " — LibreOffice Draw" " — LibreOffice Math" " - KeePassXC" " — Dolphin")
icons=(" " " " " " " " " " " " " " " ")
function get_window_name() {
output=$(swaymsg -t get_tree | jq -r '.. | (.nodes? // empty)[] | select(.focused==true).name')
for s in "${!titles[@]}";do
if [[ "${output}" == *"${titles[${s}]}"* ]]; then
output="${output/${titles[s]}/}"
output="${icons[${s}]} ${output}"
fi
done
echo $output
}
get_window_name
swaymsg -t subscribe '["window"]' --monitor | {
while read -r event; do
get_window_name
done
}