#!/usr/bin/env bash # desk-active.sh — the strongest presence signal (weight 0.90), sourced from # the WORKSTATION (hyprland), not homesrv. Posts one desk_active fact to # mavweb's /api/signal over the wg tunnel. mavweb (on homesrv) writes it # through CoreAPI; the fact's fresh timestamp is all the presence scorer reads. # # This is a DUMB one-shot poster — no idle detection here. Idle-gating is # hypridle's job (it already owns the ext-idle protocol; re-querying it from a # script is the fragile path). Wire it so "active" = the poster runs, "idle" = # it doesn't, and the signal decays out (τ=8min) exactly as intended: # # # ~/.config/systemd/user/maven-desk.timer → OnUnitActiveSec=60s, calls this # # ~/.config/hypridle.conf: # listener { # timeout = 120 # 2min no input # on-timeout = systemctl --user stop maven-desk.timer # idle → stop posting # on-resume = systemctl --user start maven-desk.timer # active → resume # } # # Until the pc app ships this signal natively, this is the stopgap. # # Usage: MAVEN_URL=https://maven.kvmx.ru:9443 ./desk-active.sh set -euo pipefail URL="${MAVEN_URL:-https://maven.kvmx.ru:9443}" curl -fsS -k -X POST "$URL/api/signal?key=desk_active" >/dev/null