mirror of
https://github.com/SqrtMinusOne/dotfiles.git
synced 2025-12-11 03:33:03 +03:00
Sun and aw_afk blocks
This commit is contained in:
parent
9c6ae2446b
commit
4fe9afc57b
3 changed files with 46 additions and 2 deletions
16
bin/i3blocks/aw_afk
Executable file
16
bin/i3blocks/aw_afk
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
afk_event=$(curl -s -X GET "http://localhost:5600/api/0/buckets/aw-watcher-afk_pdsk/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
|
||||
23
bin/i3blocks/sun
Executable file
23
bin/i3blocks/sun
Executable file
|
|
@ -0,0 +1,23 @@
|
|||
#1/bin/bash
|
||||
time=$(sunwait poll daylight rise ${LAT} $LON)
|
||||
|
||||
function send_report {
|
||||
report="$(sunwait report ${LAT} ${LON} | sed 's/^[[:space:]]*//gm')"
|
||||
notify-send "Sunwait report" "$report"
|
||||
}
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) send_report
|
||||
esac
|
||||
|
||||
if [[ ${time} == 'DAY' ]]; then
|
||||
sunset=$(sunwait list daylight set ${LAT} ${LON})
|
||||
echo $sunset
|
||||
echo $sunset
|
||||
echo "#F4F200"
|
||||
else
|
||||
sunrise=$(sunwait list daylight rise ${LAT} ${LON})
|
||||
echo $sunrise
|
||||
echo $sunrise
|
||||
echo "#60E4FF"
|
||||
fi
|
||||
|
|
@ -64,9 +64,14 @@ PRINTF_COMMAND=printf "%.0f/%.0f\n", rx, wx;
|
|||
LOCATION="Saint-Petersburg"
|
||||
color=#FF9600
|
||||
interval=3600
|
||||
separator=false
|
||||
|
||||
[uptime]
|
||||
command=uptime | awk -F'( |,|:)+' '{if ($7 == "min") {print "00:"$6} else {print $6":"$7}}'
|
||||
[sun]
|
||||
LAT=59.944045N
|
||||
LON=30.281716E
|
||||
interval=600
|
||||
|
||||
[aw_afk]
|
||||
interval=60
|
||||
|
||||
[time]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue