eww replacement of waybar
This commit is contained in:
24
eww/scripts/get-active-workspace.sh
Normal file
24
eww/scripts/get-active-workspace.sh
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
OUTPUT="${1:-DP-2}"
|
||||
|
||||
emit() {
|
||||
local monitor title
|
||||
|
||||
monitor=$(hyprctl monitors -j 2>/dev/null \
|
||||
| jq -r ".[] | select(.name==\"$OUTPUT\") | .activeWorkspace.id")
|
||||
|
||||
title=$(hyprctl clients -j 2>/dev/null \
|
||||
| jq -r ".[] | select(.workspace.id==$monitor and .focusHistoryID==0) | .title" \
|
||||
| head -n1)
|
||||
|
||||
printf '%s\n' "${title:-}"
|
||||
}
|
||||
|
||||
emit
|
||||
|
||||
socat -u "UNIX-CONNECT:/tmp/hypr/${HYPRLAND_INSTANCE_SIGNATURE}/.socket2.sock" - \
|
||||
| stdbuf -oL grep -E "^(activewindow|focusedmon|workspace|closewindow)>" \
|
||||
| while IFS= read -r _; do
|
||||
sleep 0.05
|
||||
emit
|
||||
done
|
||||
Reference in New Issue
Block a user