mirror of
https://github.com/hydroxycarbamide/dotfiles.git
synced 2025-05-08 05:49:06 -04:00
Add waybar
This commit is contained in:
parent
e0c17f71e2
commit
1ff2d77058
19 changed files with 1043 additions and 0 deletions
31
dot_config/waybar/modules/executable_calendar.sh
Normal file
31
dot_config/waybar/modules/executable_calendar.sh
Normal file
|
@ -0,0 +1,31 @@
|
|||
#! /bin/bash
|
||||
|
||||
send_notification() {
|
||||
TODAY=$(date '+%-d')
|
||||
HEAD=$(cal "$1" | head -n1)
|
||||
BODY=$(cal "$1" | tail -n7 | sed -z "s|$TODAY|<u><b>$TODAY</b></u>|1")
|
||||
notify-send -h string:x-canonical-private-synchronous:calendar \
|
||||
"$HEAD" "$BODY$FOOT" -u NORMAL
|
||||
}
|
||||
|
||||
handle_action() {
|
||||
echo "$DIFF" > "$TMP"
|
||||
if [ "$DIFF" -ge 0 ]; then
|
||||
send_notification "+$DIFF months"
|
||||
else
|
||||
send_notification "$((-DIFF)) months ago"
|
||||
fi
|
||||
}
|
||||
|
||||
TMP=${XDG_RUNTIME_DIR:-/tmp}/"$UID"_calendar_notification_month
|
||||
touch "$TMP"
|
||||
|
||||
DIFF=$(<"$TMP")
|
||||
|
||||
case $1 in
|
||||
"curr") DIFF=0;;
|
||||
"next") DIFF=$((DIFF+1));;
|
||||
"prev") DIFF=$((DIFF-1));;
|
||||
esac
|
||||
|
||||
handle_action
|
Loading…
Add table
Add a link
Reference in a new issue