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

@@ -554,8 +554,8 @@
"xmonad-contrib": "xmonad-contrib"
},
"locked": {
"lastModified": 1771379683,
"narHash": "sha256-849/9t0hXF1Xwv6ygMWoZFGKwZ3xNqUSk2bSm4jZi/E=",
"lastModified": 1771578172,
"narHash": "sha256-MOtI2hzDngvc2e+PhDDkUwQ0j6PlPwRKZOvcqt8cO04=",
"path": "/home/imalison/dotfiles/dotfiles/config/taffybar/taffybar",
"type": "path"
},

View File

@@ -19,7 +19,9 @@ executable taffybar
, X11
, bytestring
, containers
, directory
, filepath
, gi-gdk3
, gi-gtk3
, gi-gdkpixbuf
, gtk-sni-tray
@@ -29,6 +31,7 @@ executable taffybar
, hslogger
, process
, split
, status-notifier-item
, text
, time
, taffybar>=3.2.0

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

View File

@@ -9,10 +9,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

View File

@@ -301,6 +301,15 @@
letter-spacing: 0.2px;
}
.wakeup-debug label {
font-size: 10px;
}
.wakeup-debug-hit {
background-color: rgba(255, 255, 255, 0.22);
border-radius: 5px;
}
/* ASUS platform profile widget */
.asus-profile { }

View File

@@ -501,6 +501,10 @@ sunLockWidget :: TaffyIO Gtk.Widget
sunLockWidget =
stackInPill "sun-lock" [simplifiedWlsunsetWidget, simplifiedScreenLockWidget]
wakeupDebugWidget :: TaffyIO Gtk.Widget
wakeupDebugWidget =
decorateWithClassAndBoxM "wakeup-debug" wakeupDebugWidgetNew
type SNIPriorityMap = M.Map String Int
sniPriorityStateRelativePath :: FilePath
@@ -676,6 +680,7 @@ endWidgetsForHost hostName =
-- tray immediately left of it.)
let baseEndWidgets =
[ sniTrayWidget,
wakeupDebugWidget,
audioWidget,
ramSwapWidget,
diskUsageWidget,
@@ -686,6 +691,7 @@ endWidgetsForHost hostName =
laptopEndWidgets =
[ batteryNetworkWidget,
sniTrayWidget,
wakeupDebugWidget,
asusDiskUsageWidget,
audioBacklightWidget,
ramSwapWidget,