diff --git a/ring_mon/example-state.json b/ring_mon/example-state.json new file mode 100644 index 0000000..f58889c --- /dev/null +++ b/ring_mon/example-state.json @@ -0,0 +1,3 @@ +{ +"devices": {"1": "up", "2": "onair"} +} diff --git a/ring_mon/get-status b/ring_mon/get-status new file mode 100755 index 0000000..acca7ba --- /dev/null +++ b/ring_mon/get-status @@ -0,0 +1,3 @@ +#!/bin/sh +set -eu +jq -rM < example-state.json ".devices[\"$1\"]" diff --git a/ring_mon/set-light b/ring_mon/set-light new file mode 100755 index 0000000..943f51d --- /dev/null +++ b/ring_mon/set-light @@ -0,0 +1,18 @@ +#!/bin/sh + +set -eu + +if [ "$DEVICE_NUMBER" = 0 ]; then + [ "$1" = on ] && exec numlockx on + [ "$1" = off ] && exec numlockx off +elif [ "$DEVICE_NUMBER" = 1 ]; then + [ "$1" = on ] && exec xset led named "Scroll Lock" + [ "$1" = off ] && exec xset -led named "Scroll Lock" +else + echo "Device number not supported" >&2 + exit 2 +fi + +echo "Invalid usage" >&2 +exit 2 +