diff --git a/.config/systemd/user/calcurse-today.service b/.config/systemd/user/calcurse-today.service new file mode 100644 index 0000000..2a8514f --- /dev/null +++ b/.config/systemd/user/calcurse-today.service @@ -0,0 +1,6 @@ +[Unit] +Description=Notify today's calcurse events + +[Service] +Type=oneshot +ExecStart=%h/.local/bin/calcurse-today diff --git a/.config/systemd/user/calcurse-today.timer b/.config/systemd/user/calcurse-today.timer new file mode 100644 index 0000000..0fc0edf --- /dev/null +++ b/.config/systemd/user/calcurse-today.timer @@ -0,0 +1,6 @@ +[Unit] +Description=Notify today's calcurse events every morning + +[Timer] +OnCalendar=*-*-* 09:00 +Persistent=true diff --git a/.config/xmonad/xmonad.hs b/.config/xmonad/xmonad.hs index 97b9aae..2bfa0b8 100644 --- a/.config/xmonad/xmonad.hs +++ b/.config/xmonad/xmonad.hs @@ -358,6 +358,7 @@ myStartupHook = do spawnOnce "nm-applet" spawnOnce "arch-audit-gtk" spawnOnce "calcurse --daemon" + spawnOnce "systemctl --user start calcurse-today.timer" spawnOnce "systemctl --user start dunst" spawnOnce "lxpolkit" spawnOnce "numlockx" diff --git a/.local/bin/calcurse-today b/.local/bin/calcurse-today new file mode 100755 index 0000000..4a4cc81 --- /dev/null +++ b/.local/bin/calcurse-today @@ -0,0 +1,9 @@ +#!/bin/bash +# Notify today's whole-day calcurse events (the daemon only alerts timed appointments). +set -euo pipefail + +events=$(calcurse -Q --filter-type event,recur-event --days 1 \ + --format-event '%m\n' --format-recur-event '%m\n' | tail -n +2) + +[[ -n $events ]] || exit 0 +notify-send -a calcurse -i x-office-calendar "Today" "$events"