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

21 lines
443 B
Bash
Executable file

#!/bin/bash
title_rewrites=("— Alacritty" "")
function get_window_name() {
output=$(swaymsg -t get_tree | jq -r '.. | (.nodes? // empty)[] | select(.focused==true).name')
for s in "${title_rewrites[@]}";do
if [[ "${output}" == *"${s}"* ]]; then
output="${output/${s}/}"
fi
done
echo $output
}
get_window_name
swaymsg -t subscribe '["window"]' --monitor | {
while read -r event; do
get_window_name
done
}