#!/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