calcurse: sync with Google Calendar via calcurse-caldav

Hourly timer started from xmonad, plus UI hooks that sync before load and after exit. calcurse-sync notifies once when the OAuth login expires and restarts the daemon after imports, since it never re-reads its files.
This commit is contained in:
Daniele Fucini committed 2026-11-12 14:16:36 +01:00
1 parent 84eec8c855
commit 3bb25669ea
7 files changed
+78

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
#!/bin/sh
# Sync the UI's saved changes once it exits (syncing while it runs would change files under it).
[ "$(ps -o args= -p "$PPID")" = calcurse ] && [ "$(ps -o tty= -p "$PPID" | tr -d ' ')" != '?' ] || exit 0
# shellcheck disable=SC2016 # $1 expands in the inner shell
setsid -f sh -c 'while kill -0 "$1" 2>/dev/null; do sleep 1; done; systemctl --user start calcurse-sync.service' \
sh "$PPID" >/dev/null 2>&1
+5
View File
@@ -0,0 +1,5 @@
#!/bin/sh
# Sync with Google before the UI loads. Non-interactive calls (-Q, -d, -i, calcurse-caldav's own) run this hook
# too, so act only for the UI: a bare "calcurse" with a terminal (the daemon is bare too, but has none).
[ "$(ps -o args= -p "$PPID")" = calcurse ] && [ "$(ps -o tty= -p "$PPID" | tr -d ' ')" != '?' ] || exit 0
calcurse-sync --now 2>&1 | systemd-cat -t calcurse-sync
@@ -0,0 +1,6 @@
[Unit]
Description=Sync calcurse with Google Calendar
[Service]
Type=oneshot
ExecStart=%h/.local/bin/calcurse-sync
+7
View File
@@ -0,0 +1,7 @@
[Unit]
Description=Sync calcurse with Google Calendar hourly
[Timer]
OnActiveSec=1min
OnCalendar=hourly
Persistent=true
@@ -1,5 +1,6 @@
[Unit]
Description=Notify today's calcurse events
After=calcurse-sync.service
[Service]
Type=oneshot
+1
View File
@@ -359,6 +359,7 @@ myStartupHook = do
spawnOnce "arch-audit-gtk"
spawnOnce "calcurse --daemon"
spawnOnce "systemctl --user start calcurse-today.timer"
spawnOnce "systemctl --user start calcurse-sync.timer"
spawnOnce "systemctl --user start dunst"
spawnOnce "lxpolkit"
spawnOnce "numlockx"