Dotfiles/desktopenvs/hyprlua/scripts/caffeine-status.sh

8 lines
446 B
Bash
Executable File

#!/bin/bash
# Reports whether the caffeine idle inhibitor is currently active.
# Used by Eww widgets to poll state and update the caffeine icon/label.
PID_FILE="/tmp/caffeine-inhibit.pid"
# kill -0 does a liveness check without sending a real signal (stderr suppressed).
# Prints "true" if the PID file exists and its process is alive, else "false".
[[ -f "$PID_FILE" ]] && kill -0 "$(cat "$PID_FILE")" 2>/dev/null && echo "true" || echo "false"