‹ jan0sch.de

aerc mail: Switching to khard and khal for addresses and calendars.


The default expectation of the wonderful aerc email client is the usage of abook as address book. Also most people seem to use calcurse for calendars. However what if we want to switch?

While I was never that happy with abook, I really like[d] calcurse and would have continued using it if it supported more than one calendar properly but alas I need multiple calendar support. For setting up khard, khal and data synchronisation please see my other article.

Using khal

That is quite simple because you can do whatever you like. As for me, I like to start it with aerc using the embedded terminal of it, so the following line in your ~/.config/aerc/aerc.conf should do it:

aerc-startup=aerc :terminal khal interactive && aerc :next-tab

This will fire up the interactive calendar view of khal.

Using khard

To use khard as address book we need to replace the address-book-cmd either globally in ~/.config/aerc/aerc.conf or per account in ~/.config/aerc/accounts.conf. The latter is likely the way to go if you have multiple accounts and don’t want to mix up contacts (e.g. private and work).

khard email --addressbook ADDRESS_BOOK_NAME --parsable --search-in-source-files --remove-first-line %s

That line should have you covered and work with the autocomplete of addresses within aerc. As you can see it is easy to restrict the query to a specific address book. To search across all address books simply omit the whole --addressbook ADDRESS_BOOK_NAME part.

Have fun and enjoy a great console mail client with improved address books