mirror of
https://github.com/SqrtMinusOne/dotfiles.git
synced 2025-12-10 11:13:04 +03:00
16 lines
607 B
Bash
Executable file
16 lines
607 B
Bash
Executable file
#!/bin/bash
|
|
afk_event=$(curl -s -X GET "http://localhost:5600/api/0/buckets/aw-watcher-afk_$(hostname)/events?limit=1" -H "accept: application/json")
|
|
status=$(echo ${afk_event} | jq -r '.[0].data.status')
|
|
afk_time=$(echo "${afk_event}" | jq -r '.[0].duration' | xargs -I ! date -u -d @! +"%H:%M")
|
|
|
|
uptime=$(datediff "$(uptime -s | xargs -I ! date -d ! -Iseconds)" "$(date -Iseconds)" -f '%H:%M' | xargs -I ! date -d ! +"%H:%M")
|
|
res="${afk_time}/${uptime}"
|
|
if [[ $status == 'afk' ]]; then
|
|
echo "$res [AFK]"
|
|
echo "$res [AFK]"
|
|
echo "#FF7D68"
|
|
else
|
|
echo $res
|
|
echo $res
|
|
echo "#68FFF3"
|
|
fi
|