eww: fix currentWindow logic

This commit is contained in:
Simon Gardling 2025-09-17 12:43:04 -04:00
parent 355c92bd08
commit 8cd7d14a2c
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D
3 changed files with 18 additions and 11 deletions

View File

@ -1,10 +0,0 @@
#!/usr/bin/env fish
name=$(niri msg focused-window | rg Title | sed -E "s/[[:space:]]+Title\: //g" | sed "s/\"//g")
proc_name=$(echo "$name" | head -c 55)
# TODO! fix this logic, add a '...' at the end
if ["$name" != "$proc_name"]
proc_name="$proc_name..."
end
echo "$proc_name"

View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
niri_data=$(niri msg --json focused-window)
if [[ "$niri_data" == "null" ]]; then
exit 0
fi
name=$(echo "$niri_data" | jq -r '.["app_id"], .["title"]' | tr '\n' ' ' | sed 's/.$//')
proc_name=$(echo "$name" | head -c 55)
# TODO! fix this logic, add a '...' at the end
if [[ "$name" != "$proc_name" ]]; then
proc_name="$proc_name..."
fi
echo "$proc_name"

View File

@ -34,7 +34,7 @@
:onchange command)
(label :text "${value}%" :class color)))
(defpoll windowtitle :interval "1s" `scripts/currentWindow.fish`)
(defpoll windowtitle :interval "1s" `scripts/currentWindow.sh`)
(defwidget window-title []
(label