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" "xmonad-contrib": "xmonad-contrib"
}, },
"locked": { "locked": {
"lastModified": 1771379683, "lastModified": 1771578172,
"narHash": "sha256-849/9t0hXF1Xwv6ygMWoZFGKwZ3xNqUSk2bSm4jZi/E=", "narHash": "sha256-MOtI2hzDngvc2e+PhDDkUwQ0j6PlPwRKZOvcqt8cO04=",
"path": "/home/imalison/dotfiles/dotfiles/config/taffybar/taffybar", "path": "/home/imalison/dotfiles/dotfiles/config/taffybar/taffybar",
"type": "path" "type": "path"
}, },

View File

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

View File

@@ -12,10 +12,11 @@ cd "$root"
# `hyprctl` calls inside the bar work. # `hyprctl` calls inside the bar work.
if command -v hyprctl >/dev/null 2>&1 && command -v jq >/dev/null 2>&1; then 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 if ! hyprctl monitors -j >/dev/null 2>&1; then
instances_json="$(hyprctl instances -j 2>/dev/null || true)"
if [[ -n "${WAYLAND_DISPLAY:-}" ]]; then 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 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 fi
if [[ -n "${inst:-}" ]]; then if [[ -n "${inst:-}" ]]; then

View File

@@ -9,10 +9,11 @@ cd "$root"
# `hyprctl` calls inside the bar work. # `hyprctl` calls inside the bar work.
if command -v hyprctl >/dev/null 2>&1 && command -v jq >/dev/null 2>&1; then 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 if ! hyprctl monitors -j >/dev/null 2>&1; then
instances_json="$(hyprctl instances -j 2>/dev/null || true)"
if [[ -n "${WAYLAND_DISPLAY:-}" ]]; then 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 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 fi
if [[ -n "${inst:-}" ]]; then if [[ -n "${inst:-}" ]]; then

View File

@@ -301,6 +301,15 @@
letter-spacing: 0.2px; 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 platform profile widget */
.asus-profile { } .asus-profile { }

View File

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