Synchronising mail, contacts, and calendars

Email, contacts, and calendars are all synchronised to folders ~/mail, ~/contacts, and ~/calendars respectively. Many people make these dotfiles to hide them in the filesystem, but my view is that these things are documents, rather than some hidden application state. If I really want to I can directly edit, for example, vcard files in my editor. I just happen to use a few pcrogrammes to make interacting with these documents a bit easier.

Secrets management with GNOME/Keyring

These documents are synchronised with remote servers, and therefore I use GNOME/Keyring and a CLI tool called secret-tool (from core/libsecret). Each of these should follow a similar format (they don't yet but I will change this). See Security for more details about how the keyring works and is structured, but for these services, each can have its password retrieved using the following command:

secret-tool lookup service <service_name>

For example, for my iCloud calendar and contacts synchronisation, <service_name> is replaced with icloud. Similarly for runbox and gmail (although these are currently stored under mail=runbox and mail=gmail respectively).

<aside> ✅ I should move all these things to have the format service=<name> and type=username|password for a more consistent and structured approach, but it'll take a bit of work.

</aside>

Synchronising emails

Email is synchronised with mbsync (from community/isync). This is configured in ~/.config/isync/mbsyncrc and has a couple of complicated features to deal with some of the idiosyncrasies of Runbox and Gmail respectively.

Runbox's services do not cope well with parallel operations, so I have had to set the PipelineDepth 1 directive for the Runbox account. Gmail is more complicated because they have this structure of storing everything in All Mail and having a load of subfolders under /[Google Mail]. This caused all sorts of pain and so I create a Channel per mailbox, which allows me to rename it appropriately. It makes the configuration file somewhat verbose but at least the setup works.

<aside> ✅ The ideal solution which I need to implement is to just synchronise the All Mail folder and use notmuch tags to create virtual mailboxes for the inbox, sent mail, spam, etc. but I have not got around to it.

</aside>

Synchronising contacts and calendars

I tried getting this to work with Runbox so I could move away from iCloud but their service for carddav/caldav synchronisation is quite nascent, and the online interface is very ugly, so I am continuing to use iCloud (for which one has to set up an application password, like all MFA-protected services).

Calendars and contacts are synchronised using vdirsyncer (from community/vdirsyncer). This is a bit complicated for iCloud as they use UUIDs to identify the calendars. Once you have set up your pair and storage directives then you can use vdirsyncer discover to find out exactly what exists on the remote end and sort of alias it by defining the collection as an array of the name you wish to use for the collection, then the name used on a and the name used on b. For example, I have my "home" calendar (which is actually called "General" in my iCloud account). This is defined as follows:

[pair calendar_icloud_sync]
a = "calendar_local"
b = "calendar_icloud"
conflict_resolution = "b wins"
collections = [["home", "home", "900F1C8F-D2F0-493C-A4AB-FF0D89529568-2doapp"]]

Using neomutt as an email client

<aside> 🤩 I have never really found an email client I loved, to be honest. The best experience I've had is with the Gmail interface using vim-like keybindings. neomutt gets me the closest I've been to a completely keyboard-driven email experience, and it is really fast. I have a few gripes, for example that I find some of the commands and how they work a bit mysterious, and I'm forever having to say "no I do not want to exit neomutt" when I'm trying to back out of a command. The biggest problem for me is that so many emails are unreadable in plain text form (which I think is really a problem of how we treat email) and so I'm forever using my V macro to open the emails in my browser. It's actually a remarkably smooth workflow, however, and the key advantage is that I can allow most images to load while blocking all the tracking images using µMatrix.

</aside>

Moving between mailboxes

Lots of people use the sidebar in neomutt, but I don't like it. Instead, I have a macro go which opens a list of mailboxes and allows me to move quickly between them. I also have setup the macros gi (go to inbox), gt (go to sent), ga (go to archives), gd (go to drafts), gj (go to spam), and gb (go to the bin) for each account.