Set up and sync your calendar with khal and vdirsyncer

Final 12 months, I introduced you 19 days of recent (to you) productiveness instruments for 2019. This 12 months, I am taking a distinct method: constructing an setting that can can help you be extra productive within the new 12 months, utilizing instruments it’s possible you’ll or might not already be utilizing.

Hold observe of your schedule with khal and vdirsyncer

Calendars are a


to cope with, and discovering good tooling is at all times arduous. However I’ve made some progress since final 12 months once I listed calendaring as

considered one of my “fails.”

Essentially the most troublesome factor about calendars right this moment is that now they virtually at all times must be shared on-line not directly. The 2 hottest on-line calendars are Google Calendar and Microsoft Outlook/Trade. Each are used closely in company environments, which suggests my calendar has to assist one or each choices.

Khal is a console-based calendar that reads and writes VCalendar information. It is pretty simple to configure, however it doesn’t assist syncing with different functions.

Luckily, khal works with vdirsyncer, a nifty command-line program that may synchronize on-line calendars (and contacts, which I will speak about in a separate article) to your native drive. And sure, this contains importing new occasions, too.

Vdirsyncer is a Python three program, and it may be put in by way of your package deal supervisor or pip. It could actually synchronize CalDAV, VCalendar/iCalendar, Google Calendar, and native information in a listing. Since I take advantage of Google Calendar, I will use that for example, though it isn’t the best factor to arrange.

Setting vdirsyncer up for Google is well-documented, so I will not go into the nuts and bolts right here. The vital factor is to ensure your sync pairs are arrange in a means that units Google Calendar because the “winner” for battle decision. That’s, if there are two updates to the identical occasion, it must know which one takes priority. Accomplish that with one thing like this:

status_path = “~/.calendars/standing”

[pair personal_sync]
a = “private”
b = “personallocal”
collections = [“from a”, “from b”]
conflict_resolution = “a wins”
metadata = [“color”]

[storage personal]
kind = “google_calendar”
token_file = “~/.vdirsyncer/google_calendar_token”
client_id = “google_client_id”
client_secret = “google_client_secret”

[storage personallocal]
kind = “filesystem”
path = “~/.calendars/Private”
fileext = “.ics”

After the primary sync of vdirsyncer, you’ll find yourself with a collection of directories within the storage path. Every will comprise a number of information, one for every entry within the calendar. The following step is to get them into khal. Begin by operating khal configure to do the preliminary setup.

Now, operating khal interactive will convey up the show proven originally of this text. Typing n will convey up the New Occasion dialog. One small factor to notice right here: the calendars are named to match the directories that vdirsyncer creates, however you possibly can change the khal config file to present them clearer names. Including colours to entries based mostly on which calendar they’re on may also assist you to establish which is which on the listing:

path = ~/.calendars/Private/
coloration = mild magenta
path = ~/.calendars/Private/cln2stbjc4hmgrrcd5i62ua0ctp6utbg5pr2sor1dhimsp31e8n6errfctm6abj3dtmg@digital/
coloration = mild blue
path = ~/.calendars/Private/c5i68sj5edpm4rrfdchm6rreehgm6t3j81jn4rrle0n7cbj3c5m6arj4c5p2sprfdtjmop9ecdnmq@digital/
coloration = brown

Now while you run khal interactive, every calendar shall be coloured to tell apart it from the others, and while you add a brand new entry, it should have a extra descriptive title.

The setup is a bit difficult, however as soon as it is carried out, khal with vdirsyncer provides you a straightforward strategy to handle calendar occasions and maintain them in sync along with your on-line providers.


Germany Devoted Server

Leave a Reply