2021-06-14 20:01:00 +02:00
#!/bin/sh
# shellcheck shell=sh # Written to comply with IEEE Std 1003.1-2017
#@ Written by Jacob Hrbek <kreyren@fsfe.org> in 14/06/2021 17:39:35 UTC under the terms of GPLv3 license <https://www.gnu.org/licenses/gpl-3.0.en.html>
2022-10-26 01:49:22 +02:00
if command -v ${ GUIX :- guix } ; then
conky_conkyDir = " ${ conky_conkyDir :- " $HOME /.local/config/conky " } "
else
conky_conkyDir = " ${ conky_conkyDir :- " $HOME /.config/conky " } "
fi
2021-06-14 20:01:00 +02:00
2022-10-26 01:49:22 +02:00
while [ " $# " -ne 0 ] ; do case " $1 " in
2021-06-15 17:53:20 +02:00
kill ) pkill ${ CONKY :- "conky" } ; ;
2022-10-26 01:49:22 +02:00
start)
2021-06-15 17:53:20 +02:00
[ -d " $conky_conkyDir /data " ] || mkdir " $conky_conkyDir /data "
# NOTE(Krey): I have to do the fucking renaming, bcs pipelines!
# Capture data from a speedtest
2022-10-26 01:49:22 +02:00
while true; do
# --server 1363 # Doesn't work for some reason with the CLI?
${ SPEEDTEST :- speedtest } --secure --single --json > " $conky_conkyDir /data/speedtest.json.temp "
2021-06-15 17:53:20 +02:00
mv " $conky_conkyDir /data/speedtest.json.temp " " $conky_conkyDir /data/speedtest.json "
2022-10-26 01:49:22 +02:00
sleep 300
2021-06-15 17:53:20 +02:00
done &
# Capture data from a ping
while true; do
# | sed '2q;d' | sed -E "s#\w+\s+bytes\s+from\s+[a-z\.-]+\s+\([0-9.]+\):\s[a-z_=]+\w\s\w+=[0-9]+\stime=([0-9]+\.[0-9])\s+ms#\1#g"
2022-10-26 01:49:22 +02:00
ping -c 1 vodafone.cz > " $conky_conkyDir /data/ping.log.temp "
2021-06-15 17:53:20 +02:00
mv " $conky_conkyDir /data/ping.log.temp " " $conky_conkyDir /data/ping.log "
2022-10-26 01:49:22 +02:00
sleep 60
2021-06-15 17:53:20 +02:00
done &
${ CONKY :- "conky" } --config= " $conky_conkyDir /daemons/top_right.lua " &
2022-10-26 01:49:22 +02:00
#${CONKY:-"conky"} --config="$conky_conkyDir/daemons/top_middle.lua" &
2021-06-15 17:53:20 +02:00
${ CONKY :- "conky" } --config= " $conky_conkyDir /daemons/top_left.lua " &
2022-10-26 01:49:22 +02:00
${ CONKY :- "conky" } --config= " $conky_conkyDir /daemons/bottom_middle.lua " &
# ${CONKY:-"conky"} --config="$conky_conkyDir/daemons/bottom_right.lua" &
2021-06-15 17:53:20 +02:00
exit 0
esac ; shift 1; done