Hacker News new | ask | show | jobs
by dotancohen 1457 days ago
In general, I use vdirsync to sync my contacts and calendars locally, keeping the remote system's values to resolve conflicts as I intend to only read the values from the CLI. Vdirsync uses an application-agnostic format, so I could in theory read from any application that supports standard file formats:

    $ cat ~/.vdirsyncer/config

    [general]
    status_path = "~/.vdirsyncer/status/"

    # Contacts

    [storage contacts_personal_local]
    type = "filesystem"
    path = "~/.vdirsyncer/contacts/"
    fileext = ".vcf"

    [storage contacts_personal_remote]
    type = "carddav"
    url = "https://example.com/remote.php/carddav/"
    username = "bloodninja"
    password = "hunter2"

    [pair contacts_personal]
    a = "contacts_personal_local"
    b = "contacts_personal_remote"
    collections = ["from a", "from b"]
    conflict_resolution = "b wins"

    # Calendars

    [storage calendar_personal_local]
    type = "filesystem"
    path = "~/.vdirsyncer/calendars/"
    fileext = ".ics"

    [storage calendar_personal_remote]
    type = "caldav"
    url = "https://example.com/remote.php/caldav/"
    username = "bloodninja"
    password = "hunter2"

    [pair calendars_personal]
    a = "calendar_personal_local"
    b = "calendar_personal_remote"
    collections = ["from a", "from b"]
    conflict_resolution = "b wins"
    metadata = ["color"]

Then I set up khal to read from the directory that vdirsync stores data in, and display three months with events and use the ISO-8601 date format:

    $ cat ~/.config/khal/config
    [calendars]

    [[personal]]
    path = ~/.vdirsyncer/calendars/*
    type = discover



    [default]
    default_calendar = personal
    highlight_event_days = True
    timedelta = 45d

    [locale]
    firstweekday = 6
    timeformat = %H:%M
    dateformat = %Y-%m-%d
    longdateformat = %Y-%m-%d
    datetimeformat = %Y-%m-%d %H:%M
    longdatetimeformat = %Y-%m-%d %H:%M
    default_timezone = Asia/Jerusalem
    unicode_symbols = False

    [highlight_days]
    color = light green
    method = fg
If you have any questions or suggestions I'll be watching this thread.