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

20 lines
763 B
Bash
Executable File

#!/bin/bash
# Reports the PRESENCE input for the Eww caffeine widget: whether the webcam
# presence-detect daemon currently sees the user (motion 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. Note: during a
# MANUAL caffeine session the daemon stops reading the camera (to leave it free)
# and clears the flag, so presence reads false there. 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