From c990b20a8b6db9e6190e0ce775f0cc5ecb4bf1bb Mon Sep 17 00:00:00 2001 From: 0scar Date: Wed, 22 Mar 2023 12:06:00 +0100 Subject: Update statusbar scripts --- .local/bin/statusbar/timeinfo | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to '.local/bin/statusbar/timeinfo') diff --git a/.local/bin/statusbar/timeinfo b/.local/bin/statusbar/timeinfo index 884e165..762a490 100755 --- a/.local/bin/statusbar/timeinfo +++ b/.local/bin/statusbar/timeinfo @@ -7,6 +7,19 @@ TODAY_BEGIN='3c623e3c753e' # echo -en '' | xxd -p - TODAY_END='3c2f753e3c2f623e' +function timeuntil() { + if ! [[ "${1}" =~ "[0-9]{4}-[0-9]{1,2}-[0-9]{1,2} [0-9]{2}:[0-9]{2}" ]]; then + echo "argument must be of the form \"YYYY-MM-DD hh:mm\"" + else + local TDIFF=$(($(date -d "${1}" +%s) - $(date +%s) - 24 * 60 * 60)) + if [ $(($TDIFF)) -lt 0 ]; then + echo 'YEEHAW' + else + date -u -d @${TDIFF} '+[%d %H:%M:%S]' + fi + fi +} + case $ARG in 1) notify-send --urgency=low \ "Calendar" \ @@ -14,7 +27,7 @@ case $ARG in | xxd -p - \ | tr -d '\n' \ | sed -Ee "s/1b5b376d/${TODAY_BEGIN}/g;s/1b5b32376d/${TODAY_END}/g" \ - | xxd -p -r -)" + | xxd -p -r -)" ;; 3) notify-send --urgency=low \ "Weather" \ -- cgit v1.3