khal, vdirsyncer and todoman with nextcloud

In this post I want to show you how I use khal, vdirsyncer and todoman together with nextcloud in order to have calendars and todos synced and also available in my terminal. Please note that I will not cover how to install these tools on a computer. But I will show you how I have configured and wired them together. Of course I will also not cover how to create a calendar in nextcloud or how to install a nextcloud instance.

I also want to encourage you to read the documentation of each tool in case things don’t work out on your end. Mostly it is just a configuration issue like using the wrong date/time settings for your OS at your location.

configure vdirsyncer

First you want to start with vdirsyncer. After the installation your will / should find ~/.config/vdirsyncer/ in your home directory. In there create a file called config and open it with an editor of your choice. The config file should look like the screenshot below. In case you want to copy paste thing, please have a look at the config in my git repo.

vdirsyncer nextcloud config file
vdirsyncer nextcloud config file

Once the configuration is set, you need to run some commands in order to get vdirsyncer started. Additionally you may want to run vdirsynver sync as a cronjob afterwards in order to have your calendar stuff synced periodically.

vdirsyncer discover
vdirsyncer metasync
vdirsyncer sync

During vdirsyncer discover you will get some warnings like No collection "default" found for storage local_calendar. Should vdirsyncer attempt to create it? [y/N] which you can simply answer with y to create the local variant of the calendar. After discover, metasync and sync have finished, your calendars and tasks have been downloaded to your local disk and you are ready for the next step.

configure khal

Create the file: ~/.config/khal/config and feed it with the following configuration. Find the copy and paste ready variant in my git repo.

khal configuration to work with vdirsyncer and nextcloud
khal configuration to work with vdirsyncer and nextcloud

Once you have finished this step, you can simply run khal list. I prefer this format:

khal list today 1d --format "{calendar-color} {start-date} {start-time} {title} {repeat-symbol}" 2>/dev/null

And now comes the the part I use to create appointments right in my calendar in my terminal. In order to get this done the Quick and Dirty way, I just fixed a bash function that takes care to things. The copy and paste variant is also in my git repo. Please make sure you adjust it to your calendar / your setup and then you can use just like:

newcal --date 05.02 --time 15:30 --title "get a new haircut"
Add an appointment to your calendar in your terminal.
Add an appointment to your calendar in your terminal.

configure todoman

Now one last thing is left. todoman wants to be configured as well. Create the file ~/.config/todoman/config.py . Please find the copy and paste ready version in my git repo.

Todoman configuration with vdirsynver, khal and nextcloud.
Todoman configuration with vdirsynver, khal and nextcloud.

And that is basically it. todoman list will display your todos and with todman new you can create new ones. Please check out todoman --help for more options and how to use todoman.

At work it looks like that in my terminal an I really love it.

Thats how my day to day terminal looks like. It shows mi ip4,ip6,the date, calendar entries and my todos.

Paste this in your bashrc:

echo -e "\n## ## ## ##"
khal list today 1d --format "{calendar-color} {calendar} {start-date} {start-time} {title} {repeat-symbol}" 2>/dev/null
echo -e "---------------"
todoman list --sort priority 2>/dev/null
echo -e "---------------\n"

Leave a Comment