#!/bin/sh # xfce4-genmon panel indicator โ€” polls colibri daemon health. # Wired into a Generic Monitor panel item with 30s refresh. # Output: genmon XML with green/red dot + agent count + task count. # ๐ŸŸข 2 agents ยท 3 tasks # ๐Ÿ”ด daemon down SOCKET="${COLIBRI_SOCKET:-/var/run/colibri/colibri.sock}" have() { command -v "$1" >/dev/null 2>&1 } if ! have nc || ! have python3; then echo "โš  missing deps" echo "nc and python3 required for colibri panel indicator" exit 0 fi if [ ! -S "$SOCKET" ]; then echo "๐Ÿ”ด down" echo "Colibri daemon not running (no socket at ${SOCKET})" exit 0 fi STATUS=$(printf '{"cmd":"status"}\n' | nc -U "$SOCKET" -w 2 2>/dev/null) if [ -z "$STATUS" ]; then echo "๐Ÿ”ด no response" echo "Colibri socket exists but not responding" exit 0 fi AGENTS=$(echo "$STATUS" | python3 -c "import sys,json; print(json.load(sys.stdin)['data']['agents'])" 2>/dev/null) TASKS=$(echo "$STATUS" | python3 -c "import sys,json; print(json.load(sys.stdin)['data']['tasks']['started'])" 2>/dev/null) HOST=$(echo "$STATUS" | python3 -c "import sys,json; print(json.load(sys.stdin)['data']['host'])" 2>/dev/null) echo "๐ŸŸข ${AGENTS:-?} agents ยท ${TASKS:-?} tasks" echo "Colibri: ${HOST:-?} | socket: ${SOCKET} | agents: ${AGENTS:-?} | started tasks: ${TASKS:-?}" echo "kitty -T 'Colibri Status' colibri status"