Last active
September 5, 2024 13:08
-
-
Save phuntik/90ea6bb03c955cdc1ba3e0cc465b234d to your computer and use it in GitHub Desktop.
i3blocks notify-send calendar
This file contains 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 | |
# dunstctl set-paused false | |
send_current() { | |
TODAY=$(date '+%-d') | |
month=$(ncal -bhMw) | |
BODY=$( tail -n7 <<< $month | sed "s/| /▕ /" | sed -z "s/ \($TODAY\) /<span bgcolor='white' color='black'> \1 <\/span>/1" | sed "s/\(.*\)\(.\{8\}\)$/\1<span color='IndianRed'>\2<\/span>/") | |
HEAD=$(echo "$month" | head -n1) | |
notify-send -a 'calendar' \ | |
"$HEAD" "$BODY" | |
} | |
send_next() { | |
MONTH_n=$(date -d "+1 month" '+%m %Y') | |
month=$(ncal -bhMw $MONTH_n) | |
BODY=$( tail -n7 <<< $month | sed "s/| /▕ /" | sed "s/\(.*\)\(.\{8\}\)$/\1<span color='IndianRed'>\2<\/span>/" ) | |
HEAD=$( head -n1 <<< $month) | |
notify-send -a 'calendar' \ | |
"$HEAD" "$BODY" | |
} | |
send_prev() { | |
MONTH_n=$(date -d "-1 month" '+%m %Y') | |
month=$(ncal -bhMw $MONTH_n) | |
BODY=$( tail -n7 <<< $month | sed "s/| /▕ /" | sed "s/\(.*\)\(.\{8\}\)$/\1<span color='IndianRed'>\2<\/span>/" ) | |
HEAD=$( head -n1 <<< $month) | |
notify-send -a 'calendar' \ | |
"$HEAD" "$BODY" | |
} | |
handle_action() { | |
send_prev; | |
send_current; | |
send_next; | |
} | |
handle_action |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I use this script to spawn 3-month calendar with notify-send by clicking on datetime section with below i3blocks config:
Critical level of notification is optional. I just use it for dunst to not to dismiss notifications by timer, so they go away only by clicking.
Also It has some bugs in visual on weekends AFAIK but i don't really struggle with it.