this repo has no description
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

add calendar alarms

+69 -1
+65
hosts/profiles/desktop/cal-alarms.nix
··· 1 + { pkgs, ... }: 2 + 3 + { 4 + systemd.services.cal-alarms = { 5 + serviceConfig.Type = "simple"; 6 + path = [ 7 + pkgs.libnotify 8 + pkgs.dunstify 9 + pkgs.khal 10 + ]; 11 + startAt = "*08:00:00"; 12 + script = '' 13 + #!/usr/bin/env bash 14 + 15 + cache_file="${XDG_CACHE_HOME:-$HOME/.cache}/khal-events" 16 + # events starting in the next TIMESPAN will trigger an alarm 17 + timespan='60min' 18 + 19 + # this is needed for cronjobs and Xorg 20 + export DISPLAY=":0" 21 + snooze_string='💤 Snooze all.' 22 + dismiss_string='✅ Dismiss all.' 23 + # only show events with ⏰ symbol (=has alarm set) 24 + # remove arrows for all-day events to only have one notification 25 + # remove ⏰ symbol because it is obvious 26 + events="$(khal list --format \ 27 + '{cancelled}{start-style}{to-style}{end-style} {title}{description-separator}{description}{location}{repeat-symbol}{alarm-symbol}' \ 28 + now "${timespan}" \ 29 + | sed -ne '/⏰/ p' \ 30 + | sed -e 's/⏰//g' -e 's/\(↦\|↔\|⇥\)[^[:blank:]]*/all-day/g' \ 31 + | column -tl 3)" 32 + 33 + # get events that are new compared to cache file 34 + new_events="$(diff -NwU 0 "${cache_file}" - << EOF | sed -ne '/^\+[^+]/ p' \ 35 + | sed -ne 's/^\+\([[:print:]].*\)$/\1/p' 36 + ${events} 37 + EOF 38 + )" 39 + 40 + [ -z "${new_events}" ] && exit 0 41 + 42 + action="$(dunstify --action="default,Dismiss" --action="snooze,Snooze" "${new_events}")" 43 + 44 + case "${action}" in 45 + "snooze") 46 + ;; 47 + "default") 48 + printf '%s' "${events}" > "${cache_file}" 49 + ;; 50 + *) 51 + printf '%s' "${events}" | grep -Fve "${input}" > "${cache_file}" 52 + ;; 53 + esac 54 + ''; 55 + serviceConfig = { 56 + User = "anish"; 57 + Environment = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus"; 58 + }; 59 + }; 60 + systemd.timers.cal-alarms = { 61 + wantedBy = [ "timers.target" ]; 62 + partOf = [ "cal-alarms.service" ]; 63 + timerConfig.OnCalendar = [ "*:0/10" ]; 64 + }; 65 + }
+4 -1
hosts/profiles/desktop/default.nix
··· 16 16 in 17 17 { 18 18 # TODO modularize 19 - imports = [ ./battery-low-timer.nix ]; 19 + imports = [ 20 + ./battery-low-timer.nix 21 + ./cal-alarms.nix 22 + ]; 20 23 21 24 # Secrets used by home-manager modules 22 25 age.secrets.fastmail.file = "${self}/secrets/fastmail.age";