blob: dc8c8861193b3ad3ab73b51fd50f8d15a316f038 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#!/bin/sh
IFS="
"
APIDATA=$(curl -s "http://status.mainframe.io/api/spaceInfo")
NAME=$(echo $APIDATA | jq -r '.space' -)
OPEN=$(echo $APIDATA | jq '.state.open' -)
MSG=$(echo $APIDATA | jq -r '.state.message' -)
PEOPLE=$(echo $APIDATA | jq -r '.sensors.people_now_present[0].names[]' -)
ENERGY_FRONT=$(echo $APIDATA | jq '.sensors.power_consumption[0].value' -)
ENERGY_BACK=$(echo $APIDATA | jq '.sensors.power_consumption[1].value' -)
echo '<openbox_pipe_menu>'
echo ' <separator label="'$NAME'" />'
echo ' <item label="State: '$OPEN'" />'
echo ' <item label="Energy Front: '$ENERGY_FRONT' W" />'
echo ' <item label="Energy Back: '$ENERGY_BACK' W" />'
echo ' <menu id="space-people" label="People">'
for person in ${PEOPLE}; do
echo ' <item label="'$person'" />'
done
echo ' </menu>'
echo '</openbox_pipe_menu>'
|