2022-11-11 06:43:02 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
WAYVNCCTL=${WAYVNCCTL:-wayvncctl}
|
|
|
|
|
|
|
|
connection_count_now() {
|
2022-11-19 02:45:28 +00:00
|
|
|
echo "Total clients: $1"
|
2022-11-11 06:43:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
while IFS= read -r EVT; do
|
|
|
|
case "$(jq -r '.method' <<<"$EVT")" in
|
|
|
|
client-*onnected)
|
|
|
|
count=$(jq -r '.params.connection_count' <<<"$EVT")
|
|
|
|
connection_count_now "$count"
|
|
|
|
;;
|
2022-11-19 02:45:28 +00:00
|
|
|
wayvnc-shutdown)
|
|
|
|
echo "wayvncctl is no longer running"
|
|
|
|
connection_count_now 0
|
|
|
|
;;
|
|
|
|
wayvnc-startup)
|
|
|
|
echo "Ready to receive wayvnc events"
|
|
|
|
;;
|
2022-11-11 06:43:02 +00:00
|
|
|
esac
|
2022-11-16 00:57:16 +00:00
|
|
|
done < <("$WAYVNCCTL" --wait --reconnect --json event-receive)
|
2022-11-19 02:45:28 +00:00
|
|
|
|