29 lines
822 B
Bash
Executable file
29 lines
822 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" " — Tokodon")
|
|
icons=(" " " " " " " " " " " " " " " " "")
|
|
|
|
function get_window_name() {
|
|
output=$(swaymsg -t get_tree | jq -r '.. | select(.type?) | select(.focused==true).name')
|
|
for s in "${!titles[@]}";do
|
|
if [[ "${output}" == *"${titles[${s}]}"* ]]; then
|
|
output="${output/${titles[s]}/}"
|
|
output="${icons[${s}]} ${output}"
|
|
fi
|
|
done
|
|
if [ ${#output} -ge 30 ];then
|
|
echo "${output:0:30}..."
|
|
else
|
|
echo "${output}"
|
|
fi
|
|
}
|
|
|
|
get_window_name
|
|
|
|
swaymsg -t subscribe '["window"]' --monitor | {
|
|
while read -r event; do
|
|
get_window_name
|
|
done
|
|
}
|