-
-
Save ai7ch/9c997341cf5f23de3893d599a8b762ec to your computer and use it in GitHub Desktop.
i3blocks notify-send calendar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
send_current() { | |
TODAY=$(date '+%-d') | |
month=$(ncal -bhM) | |
BODY=$( tail -n7 <<< $month | sed -z "s/$TODAY/<span bgcolor='white' color='black'>$TODAY<\/span>/1" | sed "s/\(.*\)\(.\{7\}\)$/\1<span color='IndianRed'>\2<\/span>/") | |
HEAD=$(echo "$month" | head -n1) | |
notify-send -u critical \ | |
"$HEAD" "$BODY" | |
} | |
send_next() { | |
MONTH_n=$(date -d "+1 month" '+%m %Y') | |
month=$(ncal -bhM $MONTH_n) | |
BODY=$( tail -n7 <<< $month | sed "s/\(.*\)\(.\{7\}\)$/\1<span color='IndianRed'>\2<\/span>/" ) | |
HEAD=$( head -n1 <<< $month) | |
notify-send -u critical \ | |
"$HEAD" "$BODY" | |
} | |
send_prev() { | |
MONTH_n=$(date -d "-1 month" '+%m %Y') | |
month=$(ncal -bhM $MONTH_n) | |
BODY=$( tail -n7 <<< $month | sed "s/\(.*\)\(.\{7\}\)$/\1<span color='IndianRed'>\2<\/span>/" ) | |
HEAD=$( head -n1 <<< $month) | |
notify-send -u critical \ | |
"$HEAD" "$BODY" | |
} | |
handle_action() { | |
send_next; | |
send_current; | |
send_prev; | |
} | |
handle_action |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment