diff options
| author | 0scar <qgt268@alumni.ku.dk> | 2023-03-22 11:06:00 +0000 |
|---|---|---|
| committer | 0scar <qgt268@alumni.ku.dk> | 2023-03-22 11:06:00 +0000 |
| commit | c990b20a8b6db9e6190e0ce775f0cc5ecb4bf1bb (patch) | |
| tree | 06f8bcbe92a2f27858e7e431799a13dbcd7cd3e1 /.local/bin/statusbar/timeinfo | |
| parent | fd8a737134eb92e204aa632731ea303fed1dc1b0 (diff) | |
Update statusbar scripts
Diffstat (limited to '.local/bin/statusbar/timeinfo')
| -rwxr-xr-x | .local/bin/statusbar/timeinfo | 15 |
1 files changed, 14 insertions, 1 deletions
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 '</b></u>' | 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" \ |
