#!/usr/bin/env bash ARG=${1:-$BLOCK_BUTTON} # echo -en '' | xxd -p - 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" \ "$(cal -w -m --color=always \ | xxd -p - \ | tr -d '\n' \ | sed -Ee "s/1b5b376d/${TODAY_BEGIN}/g;s/1b5b32376d/${TODAY_END}/g" \ | xxd -p -r -)" ;; 3) notify-send --urgency=low \ "Weather" \ "$(weather)" ;; esac date +'%F %R'