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

20 lines
743 B
Bash
Executable File

#!/bin/bash
# Reports the PRESENCE input for the Eww caffeine widget: whether the
# presence-detect daemon currently sees a FIDO key plugged in (on its last
# tick), INDEPENDENT of whether the idle lock is held or who holds it.
#
# presence-detect.sh writes PRESENCE_FLAG on every "present" tick and removes
# it on every "away" tick, so this is a clean, standalone signal — it stays
# live even during a MANUAL caffeine session, since checking for the key is
# cheap and doesn't contend with anything. For the MANUAL-inhibit input, see
# caffeine-manual-status.sh.
#
# Prints "true" when presence is detected, else "false".
PRESENCE_FLAG="/tmp/presence-detected"
if [[ -f "$PRESENCE_FLAG" ]]; then
echo "true"
else
echo "false"
fi