blob: 762a4901c9cc079ff923ccc2693343de979fc9ec (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#!/usr/bin/env bash
ARG=${1:-$BLOCK_BUTTON}
# echo -en '<b><u>' | xxd -p -
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" \
"$(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'
|