calcurse: show tomorrow's whole-day events in xmobar, notify at 07:00
A grey icon for a whole-day event tomorrow when nothing else is due; calcurse-today runs at 07:00 and pulls in a sync first. Same change as calcurse-gcal b785416.
This commit is contained in:
3 files changed
+10
-5
No files matched your search
@@ -1,5 +1,7 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Notify today's calcurse events
|
Description=Notify today's calcurse events
|
||||||
|
# Sync first; Wants, not Requires: a failed sync (e.g. expired login) still notifies from the local data.
|
||||||
|
Wants=calcurse-sync.service
|
||||||
After=calcurse-sync.service
|
After=calcurse-sync.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
|
|||||||
@@ -2,5 +2,5 @@
|
|||||||
Description=Notify today's calcurse events every morning
|
Description=Notify today's calcurse events every morning
|
||||||
|
|
||||||
[Timer]
|
[Timer]
|
||||||
OnCalendar=*-*-* 09:00
|
OnCalendar=*-*-* 07:00
|
||||||
Persistent=true
|
Persistent=true
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Next calcurse item for xmobar: pink " 10:15 | " for an appointment later today, a cyan icon for a whole-day
|
# Next calcurse item for xmobar: pink " 10:15 | " for an appointment later today, a cyan icon for a whole-day
|
||||||
# event today, a pink icon alone when the next appointment is tomorrow; empty otherwise.
|
# event today, a pink icon alone when the next appointment is tomorrow, a grey icon for a whole-day event tomorrow;
|
||||||
|
# empty otherwise.
|
||||||
# With "list": show today's and tomorrow's items in a notification (for a click on the bar)
|
# With "list": show today's and tomorrow's items in a notification (for a click on the bar)
|
||||||
set -uo pipefail
|
set -uo pipefail
|
||||||
|
|
||||||
@@ -21,21 +22,23 @@ if [[ ${1:-} == list ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
now=$(date +%s)
|
now=$(date +%s)
|
||||||
day="" next="" event=false
|
day="" next="" event_today=false event_tomorrow=false
|
||||||
while read -r kind start; do
|
while read -r kind start; do
|
||||||
case $kind in
|
case $kind in
|
||||||
*:) day=${kind%:} ;;
|
*:) day=${kind%:} ;;
|
||||||
A) [[ -z $next ]] && ((start > now)) && next=$start ;;
|
A) [[ -z $next ]] && ((start > now)) && next=$start ;;
|
||||||
E) [[ $day == "$today" ]] && event=true ;;
|
E) if [[ $day == "$today" ]]; then event_today=true; else event_tomorrow=true; fi ;;
|
||||||
esac
|
esac
|
||||||
done < <(query --format-apt 'A %s\n' --format-recur-apt 'A %s\n' --format-event 'E\n' --format-recur-event 'E\n')
|
done < <(query --format-apt 'A %s\n' --format-recur-apt 'A %s\n' --format-event 'E\n' --format-recur-event 'E\n')
|
||||||
|
|
||||||
if [[ -n $next && $(date -d "@$next" +%F) == "$today" ]]; then
|
if [[ -n $next && $(date -d "@$next" +%F) == "$today" ]]; then
|
||||||
text="<fc=#ff79c6>$icon $(date -d "@$next" +%H:%M)</fc>"
|
text="<fc=#ff79c6>$icon $(date -d "@$next" +%H:%M)</fc>"
|
||||||
elif $event; then
|
elif $event_today; then
|
||||||
text="<fc=#8be9fd>$icon</fc>"
|
text="<fc=#8be9fd>$icon</fc>"
|
||||||
elif [[ -n $next ]]; then
|
elif [[ -n $next ]]; then
|
||||||
text="<fc=#ff79c6>$icon</fc>"
|
text="<fc=#ff79c6>$icon</fc>"
|
||||||
|
elif $event_tomorrow; then
|
||||||
|
text="<fc=#565f89>$icon</fc>"
|
||||||
else
|
else
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in new issue
Block a user