feat(taffybar): add wakeup debug widget and safer hyprctl handling

This commit is contained in:
2026-02-20 01:07:07 -08:00
committed by Kat Huang
parent dfb3b79ec5
commit 791e63d616
7 changed files with 27 additions and 7 deletions

View File

@@ -12,10 +12,11 @@ cd "$root"
# `hyprctl` calls inside the bar work.
if command -v hyprctl >/dev/null 2>&1 && command -v jq >/dev/null 2>&1; then
if ! hyprctl monitors -j >/dev/null 2>&1; then
instances_json="$(hyprctl instances -j 2>/dev/null || true)"
if [[ -n "${WAYLAND_DISPLAY:-}" ]]; then
inst="$(hyprctl instances -j | jq -r --arg sock "$WAYLAND_DISPLAY" '.[] | select(.wl_socket == $sock) | .instance' | head -n1)"
inst="$(printf '%s\n' "$instances_json" | jq -r --arg sock "$WAYLAND_DISPLAY" '.[] | select(.wl_socket == $sock) | .instance' 2>/dev/null | head -n1 || true)"
else
inst="$(hyprctl instances -j | jq -r '.[0].instance // empty')"
inst="$(printf '%s\n' "$instances_json" | jq -r '.[0].instance // empty' 2>/dev/null || true)"
fi
if [[ -n "${inst:-}" ]]; then