#!/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 "motion" tick and removes it # on every "no motion" tick, so this is a clean, standalone signal — true even # during a manual caffeine session (where the daemon never starts its own # inhibitor). 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