aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Wilken2022-12-11 21:50:08 +0100
committerTimo Wilken2022-12-11 21:50:08 +0100
commitaadef8480341091ae2c909bc952dfe9904cd2a2e (patch)
tree686391ceb024572a0abff834b985839f3678840e
parent5b0f70233edc1f527c977ce1379734e1389e20f4 (diff)
Use vdirsyncer and khal to access calendar
-rw-r--r--home-configuration.scm12
-rw-r--r--khal.conf39
-rw-r--r--mailcap3
-rw-r--r--muttrc2
-rw-r--r--vdirsyncer.conf77
5 files changed, 131 insertions, 2 deletions
diff --git a/home-configuration.scm b/home-configuration.scm
index 1fdad1e0..4847462b 100644
--- a/home-configuration.scm
+++ b/home-configuration.scm
@@ -27,6 +27,7 @@
(gnu home services)
(gnu home services desktop)
(gnu home services guix)
+ (gnu home services mcron)
(gnu home services pm)
(gnu home services shells)
(gnu home services shepherd)
@@ -337,6 +338,8 @@ replacement spec (to which `regexp-substitute/global' is applied)."
"source-highlight" "tk" "tmux" "tree" "xxd" "zip" "unzip"
"get-iplayer" "ffmpeg" "atomicparsley" "yt-dlp"
"neomutt" "mailcap" "lynx" ; mail (lynx for HTML mail)
+ "vdirsyncer" "khal"
+
;; Ranger can do code highlighting using python-pygments and
;; image previews in kitty using python-pillow.
"ranger" "python-pygments" "python-pillow" "mediainfo" "python-pdftotext"
@@ -438,6 +441,13 @@ replacement spec (to which `regexp-substitute/global' is applied)."
(stop #~(lambda _
(invoke "gpg-connect-agent" "killagent" "/bye"))))))
+ (simple-service
+ 'terminal-cronjobs home-mcron-service-type
+ (list #~(job "15 */2 * * *" ; every two hours at HH:15
+ (string-append #$(package-binary "vdirsyncer") " metasync"))
+ #~(job "0,30 * * * *" ; every half hour
+ (string-append #$(package-binary "vdirsyncer") " sync"))))
+
;; Configuration files for terminal-only programs in $XDG_CONFIG_HOME.
(service
home-xdg-configuration-files-service-type
@@ -446,6 +456,7 @@ replacement spec (to which `regexp-substitute/global' is applied)."
,(plain-file "alibuild-disable-analytics" ""))
("git/config" ,(local-file "gitconfig"))
("htop/htoprc" ,(local-file "htoprc"))
+ ("khal/config" ,(local-file "khal.conf"))
("mutt/muttrc" ,(local-file "muttrc"))
("mutt/catppuccin.muttrc"
,(local-file #.(if (string=? catppuccin-theme-variant "latte")
@@ -455,6 +466,7 @@ replacement spec (to which `regexp-substitute/global' is applied)."
("ranger/rc.conf" ,(local-file "ranger.conf"))
("user-dirs.locale" ,(plain-file "user-dirs.locale" "C")) ; Not sure if this is needed. Arch has it.
("user-dirs.dirs" ,(local-file "user-dirs.dirs"))
+ ("vdirsyncer/config" ,(local-file "vdirsyncer.conf"))
("X11/XCompose" ,(local-file "XCompose")) ; see also: $XCOMPOSEFILE variable
("X11/Xresources" ,(local-file "Xresources"))))
diff --git a/khal.conf b/khal.conf
new file mode 100644
index 00000000..73bb5c19
--- /dev/null
+++ b/khal.conf
@@ -0,0 +1,39 @@
+# https://lostpackets.de/khal/configure.html
+
+[default]
+default_calendar = Personal
+highlight_event_days = True
+show_all_days = True
+timedelta = 7d
+
+[highlight_days]
+default_color = dark gray
+method = foreground
+
+[locale]
+timeformat = %H:%M
+dateformat = %d/%m
+longdateformat = %d/%m/%Y
+datetimeformat = %d/%m %H:%M
+longdatetimeformat = %d/%m/%Y %H:%M
+weeknumbers = off
+
+[view]
+monthdisplay = firstfullweek
+
+[calendars]
+[[birthdays]]
+type = birthdays
+path = ~/.local/share/vdirsyncer/main-contacts/contacts
+color = dark red
+# Prefer other events' colours when colouring days.
+priority = -1
+
+[[indico]]
+path = ~/.local/share/vdirsyncer/indico
+color = yellow
+readonly = True
+
+[[calendars]]
+type = discover
+path = ~/.local/share/vdirsyncer/calendars/imported-*ics
diff --git a/mailcap b/mailcap
index ea0d2318..904ce065 100644
--- a/mailcap
+++ b/mailcap
@@ -4,6 +4,7 @@
# in place of the attachment directly in the message view.
text/html; lynx -display_charset=UTF-8 -dump %s; copiousoutput; nametemplate=%s.html
+text/calendar; khal printics %s; copiousoutput
image/*; kitty +kitten icat %s; copiousoutput
audio/*; mpv --no-video %s
-application/pdf; zathura %s; nametempalte=%s.pdf
+application/pdf; zathura %s
diff --git a/muttrc b/muttrc
index 858d99a5..bb8d8d1a 100644
--- a/muttrc
+++ b/muttrc
@@ -73,7 +73,7 @@ set header_cache = `echo "\$XDG_CACHE_HOME/neomutt/"`
ignore x-mailer user-agent
alternative_order text/plain text/enriched text/html text image
-auto_view text/html image/jpeg image/png
+auto_view text/html text/calendar image/jpeg image/png
set my_mythic = "imaps://oncilla.mythic-beasts.com/"
account-hook "$my_mythic" 'unmailboxes *'
diff --git a/vdirsyncer.conf b/vdirsyncer.conf
new file mode 100644
index 00000000..5dac2686
--- /dev/null
+++ b/vdirsyncer.conf
@@ -0,0 +1,77 @@
+[general]
+status_path = "~/.local/share/vdirsyncer/status"
+
+# Main contact list from Nextcloud.
+[pair main_contacts]
+a = "nextcloud_main_contacts"
+b = "local_main_contacts"
+metadata = ["displayname", "description"]
+collections = ["from a", "from b"]
+conflict_resolution = "a wins"
+
+[storage local_main_contacts]
+type = "filesystem"
+path = "~/.local/share/vdirsyncer/main-contacts"
+fileext = ".vcf"
+
+[storage nextcloud_main_contacts]
+type = "carddav"
+url = "https://cloud.wilkenfamily.de/remote.php/dav/addressbooks/users/timo/contacts/"
+username.fetch = ["shell", "pass www/nextcloud/timo | awk '/^username: /{print $2}'"]
+password.fetch = ["shell", "pass www/nextcloud/timo | head -1"]
+
+# "Sandbox Contacts" from Nextcloud, mostly for WhatsApp.
+[pair sandbox_contacts]
+a = "nextcloud_sandbox_contacts"
+b = "local_sandbox_contacts"
+metadata = ["displayname", "description"]
+collections = ["from a", "from b"]
+conflict_resolution = "a wins"
+
+[storage local_sandbox_contacts]
+type = "filesystem"
+path = "~/.local/share/vdirsyncer/sandbox-contacts"
+fileext = ".vcf"
+
+[storage nextcloud_sandbox_contacts]
+type = "carddav"
+url = "https://cloud.wilkenfamily.de/remote.php/dav/addressbooks/users/timo/sandbox-contacts/"
+username.fetch = ["shell", "pass www/nextcloud/timo | awk '/^username: /{print $2}'"]
+password.fetch = ["shell", "pass www/nextcloud/timo | head -1"]
+
+# Calendar from Nextcloud.
+[pair calendars]
+a = "nextcloud_calendars"
+b = "local_calendars"
+metadata = ["color", "displayname", "description", "order"]
+collections = ["from a", "from b"]
+conflict_resolution = "a wins"
+
+[storage local_calendars]
+type = "filesystem"
+path = "~/.local/share/vdirsyncer/calendars"
+fileext = ".ics"
+
+[storage nextcloud_calendars]
+type = "caldav"
+url = "https://cloud.wilkenfamily.de/remote.php/dav/principals/users/timo/"
+username.fetch = ["shell", "pass www/nextcloud/timo | awk '/^username: /{print $2}'"]
+password.fetch = ["shell", "pass www/nextcloud/timo | head -1"]
+
+# Work Indico calendar (read-only).
+[pair indico]
+a = "indico_calendar"
+b = "local_indico_calendar"
+metadata = []
+collections = null
+conflict_resolution = "a wins"
+
+[storage local_indico_calendar]
+type = "filesystem"
+path = "~/.local/share/vdirsyncer/indico"
+fileext = ".ics"
+
+[storage indico_calendar]
+type = "http"
+# The URL contains an access token, so get it from pass.
+url.fetch = ["shell", "~/.guix-home/profile/bin/pass cern/indico-calendar-url | head -1"]