hmbrg.xyz

PIM Setup

Table Of Contents:
In today’s log I’ll document my current PIM (Personal Information Management) setup. Before diving into the current workflow some words about what I’ve used before and why I’ve to/want to switch.

Till now I’ve used calcurse to handle my tasks and appointments which worked as desired. Contacts I’ve managed via abook which was satisfying as well.

As circumstances change over time, beloved workflows and sometimes tools need to be adjusted. So it behaves in my current situation, because unfortunately I am forced to use among my Mailcow calendars also a Google calendar 😥. Since calcurse does not cope with different time zones, an adequate alternative was needed and the choice was khal ̚ + vdirsyncer ̚ . Since I am enthusiastic about the minimalism of khal, I immediately looked at khard ̚ , which now replaces the previously used abook. As khal is reduced to the pure management of calendars, I needed a tool for my tasks. My choice fell on Todoman ̚ which is as minimalistic as the aforementioned.

All these little helpers work great together with vdirsyncer which adds up to a perfect setup for me.

Installing the new PIM tool set

1
pacman -S khal khard todoman vdirsyncer ⏎

Configuring each tool

vdirsyncer

1
nvim ~/.config/vdirsyncer/config ⏎
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
###  ---------------
###  Mailcow CardDAV
###  ---------------
[general]
status_path = "~/.config/vdirsyncer/status/"

[pair mailcow_contacts]
a = "mailcow_contacts_lokal"
b = "mailcow_contacts_remote"
collections = ["from a", "from b"]
conflict_resolution = "b wins"

[storage mailcow_contacts_lokal]
type = "filesystem"
path = "~/.config/vdirsyncer/mailcow-contacts"
fileext = ".vcf"

[storage mailcow_contacts_remote]
type = "carddav"
url = "https://hosted.mailcow.de/SOGo/dav/you@example.org/Contacts/personal/"
auth = "basic"
username = "you@example.org"
password.fetch = ["command", "pass", "you@example.org"]


###  --------------
###  Mailcow CalDAV
###  --------------

[pair mailcow_calendar]
a = "mailcow_calendar_lokal"
b = "mailcow_calendar_remote"
collections = ["from a", "from b"]
conflict_resolution = "b wins"
metadata = ["color"]

[storage mailcow_calendar_lokal]
type = "filesystem"
path = "~/.config/vdirsyncer/mailcow-calendar/"
fileext = ".ics"

[storage mailcow_calendar_remote]
type = "caldav"
url = "https://hosted.mailcow.de/SOGo/dav/you@example.org/Calendar/personal.ics"
auth = "basic"
username = "you@example.org"
password.fetch = ["command", "pass", "you@example.org"]


###  -------------
###  Google CalDAV
###  -------------

[pair google_calendar]
a = "google_calendar_local"
b = "google_calendar_remote"
collections = ["from a", "from b"]
conflict_resolution = "b wins"
metadata = ["color"]

[storage google_calendar_local]
type = "filesystem"
path = "~/.config/vdirsyncer/google-calendar/"
fileext = ".ics"

[storage google_calendar_remote]
type = "google_calendar"
token_file = "~/.config/vdirsyncer/gcalendar_token"
client_id.fetch = ["command", "pass", "gcalendar_cid"]
client_secret.fetch = ["command", "pass", "gcalendar_csecret"]
#start_date = null
#end_date = null
item_types = []

khal

To generate the basic configuration it’s necessary to execute the following and answer a couple of questions:

1
khal configure ⏎

Afterwards the generated config file needs some tweaking therefore open it with the preferred editor:

1
nvim ~/.config/khal/config ⏎

Search for the section which lists the path of contacts and remove it so that the final file looks like the following:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
[calendars]

[[mailcow]]
path = ~/.config/vdirsyncer/mailcow-calendar/*
type = discover
color = dark magenta

[[google]]
path = ~/.config/vdirsyncer/google-calendar/*
type = discover
color = light green

[locale]
timeformat = %H:%M
dateformat = %d.%m.%Y
longdateformat = %d.%m.%Y
datetimeformat = %d.%m.%Y %H:%M
longdatetimeformat = %d.%m.%Y %H:%M

[default]
default_calendar = you@example@group.calendar.google.com

khard

Configuration of khard is done via the following file:

1
nvim ~/.config/khard/khard.conf ⏎
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
[addressbooks]
[[contacts]]
path = ~/.config/vdirsyncer/mailcow-contacts/personal

[general]
debug = no
default_action = list
# These are either strings or comma seperated lists
editor = nvim
merge_editor = vimdiff

[contact table]
# display names by first or last name: first_name / last_name / formatted_name
display = last_name
# group by address book: yes / no
group_by_addressbook = no
# reverse table ordering: yes / no
reverse = no
# append nicknames to name column: yes / no
show_nicknames = no
# show uid table column: yes / no
show_uids = yes
# sort by first or last name: first_name / last_name / formatted_name
sort = last_name
# localize dates: yes / no
localize_dates = yes
# set a comma separated list of preferred phone number types in descending priority
# or nothing for non-filtered alphabetical order
preferred_phone_number_type = pref, cell, home
# set a comma separated list of preferred email address types in descending priority
# or nothing for non-filtered alphabetical order
preferred_email_address_type = pref, work, home

[vcard]
# extend contacts with your own private objects
# these objects are stored with a leading "X-" before the object name in the vcard files
# every object label may only contain letters, digits and the - character
# example:
#   private_objects = Jabber, Skype, Twitter
# default: ,  (the empty list)
private_objects = Jabber, Skype, Twitter
# preferred vcard version: 3.0 / 4.0
preferred_version = 3.0
# Look into source vcf files to speed up search queries: yes / no
search_in_source_files = yes
# skip unparsable vcard files: yes / no
skip_unparsable = no

Of interest is the section [[addressbooks]] For each addressbook there has to be a section similar to the following:

1
2
[[friends]]
path = ~/.config/vdirsyncer/mailcow-contacts/friends

To get right paths have a look into the directory structure:

1
ls ~/.config/vdirsyncer/mailcow-contacts ⏎

Each sub directory represents an address book!

Todoman

Configuration for Todoman is done via the following command:

1
nvim ~/.config/todoman/config.py ⏎

Paste the following rows and adjust the line stating path = accordingly and lines stating date_format and time_format to your liking:

1
2
3
4
5
6
# A glob expression which matches all directories relevant.
path = "~/.config/vdirsyncer/mailcow-calendar/*"
date_format = "%d.%m.%Y"
time_format = "%H:%M"
default_list = "Personal"
default_due = 48

First run of vdirsyncer

To initially test configuration and discover calendars, tasks and contacts and sync metadata the following needs to be executed which also creates all the directory structures needed:

1
vdirsyncer discover && vdirsyncer metasync ⏎

Synchronize calendars, contacts and tasks

1
vdirsyncer sync ⏎

What to do if changes where made to the configuration

If e. g. new calendars where added it’s as simple as executing:

1
vdirsyncer discover && vdirsyncer metasync ⏎

Usage of khal, khard and Todoman

khal

To see which appointments are coming up the next days run:

1
khal calendar ⏎

To see a larger time span use:

1
khal calendar today 8d ⏎

Which prints the list of know entries of the current as well as the next seven days

There is also a way to have a more interactive use of khal which come up if you either run ikhal or khal interactive

To get help regarding the usage press ‘?’

khard

By running khard a list of contacts will be generated.

There is also a way the generate more special lists for birthday, email addresses, phone numbers and addresses by either executing:

To add a new contact simply run khard new which well open a template within the default editor which needs to be filled.

Todoman

A get a list of current tasks a simple todo is all what’s needed. For a more detailed view of a task execute todo show # where # stands for the index number of the corresponding task. Those numbers are shown as fist value of the list of to does, e. g.:

1
todo ⏎
1
2
3
1  [ ]  !!!    Write log article regarding my PIM setup
2  [ ]  !			 Publish log article regarding PIM setup
3  [ ]	!!		 At the grocery buy coffee and milk

As shown above the listed tasks have corresponding index numbers (first value of each row) of ‘1’, ‘2’ and ‘3’.

Final notes

crontab for vdirsyncer

To regularly run vdirsyncer without the need of interaction create a new crontab entry like the following:

1
2
# Sync Cal- and CardDAV:
*/10 * * * * vdirsyncer sync

This will initiate the synchronization of Cal- and CardDAV data every 10 minutes.

neomutt

As I no longer use abook for my contacts neomutt needs some tweaking to rely on khard, therefore edit the file muttrc by running:

1
nvim ~/.config/mutt/muttrc ⏎

Paste the following lines:

1
2
3
4
5
6
set query_command= "khard email --parsable --search-in-source-files %s"
bind editor <Tab> complete-query
bind editor ^T    complete
macro index,pager A \
    "<pipe-message>khard add-email<return>" \
        "add the sender email address to khard"

Now when writing a new email tab-completion rely on khard regarding email addresses. Furthermore senders email addresses can be added to khard by pressing A.


Tags: khal, khard, Todoman, vdirsyncer

This page was last updated on: 28. September 2021