Appointments synced from CalDav default to "Play a Sound"

I recently installed Evolution to be able to share appointments with someone using Apple Calendar. The set-up of CalDav synchronization was easy and worked immediately, so thanks for all the work that’s gone into that so far!

There’s only one minor thing that I was hoping to tweak a bit. When a new appointment is created in Apple Calendar, and is set-up with a reminder like “Alert 15 minutes before” or something, it gets synchronized to Evolution with a reminder that defaults to “Play a sound 15 minutes before”. I was hoping that there was some setting that would allow this to be configurable, as I would much rather have synchronized appointments use “Pop up a reminder 15 minutes before” instead of just playing the beeping sound.

I’m currently using Ubuntu 22.10 and Evolution 3.46.1-0ubuntu1 (installed via apt).

Thanks!

Hi,
I’m afraid that’s what the Apple Calendar defaults to. The CalDAV
calendar does not add reminders on its own and the default reminders
setting in the Evolution does mean “pop up a reminder” not “play a
sound” and, more importantly, it affects only newly created events in
the Evolution itself.

You can verify what the server has stored (and what it sends to the
evolution-data-server) when you run:

CALDAV_DEBUG=1 /usr/libexec/evolution-calendar-factory -w

from a terminal (the actual path can differ in your distribution), then
open Evolution, add an event in the Apple Calendar, then right-click
the calendar in the Evolution and pick Refresh. I suggest to use some
unique (or easily distinguishable) summary for the test event, thus you
can easily locate it in the log output. The text between BEGIN:VALARM
and END:VALARM is the reminder definition. It looks like the following
for the “pop up reminder” type:

BEGIN:VALARM
ACTION:DISPLAY
DESCRIPTION:reminder text
TRIGGER;RELATED=START:-PT10M
END:VALARM

Yours might have different ACTION value, I believe.

Bye,
Milan

I ran the command that you suggested and was able to get the following definition for the alarm:

< BEGIN:VALARM
< X-WR-ALARMUID:A35EDE94-860B-4141-B25F-EBC9EC365C3B
< UID:A35EDE94-860B-4141-B25F-EBC9EC365C3B
< TRIGGER:-PT5M
< ATTACH;VALUE=URI:Chord
< ACTION:AUDIO
< END:VALARM

So it’s definitely an “AUDIO” alarm type that Apple Calendar is creating. I don’t mind having the audio alarm, but having a notification as well would be great (similar to how Apple Calendar does alerts). I wonder if I could modify what Evolution receives from Apple Calendar by creating a simple plugin for Evolution?

I’ve done a bit of experimentation, and I think that I may be able to hack together a Python script using SyncEvolution to switch AUDIO alerts to DISPLAY notifications. I can manually update alerts as follows:

sudo apt install syncevolution
syncevolution --print-databases
mkdir need_new_empty_dir
syncevolution --export need_new_empty_dir backend=evolution-calendar database=<some_id_string>

Then I edit one of the files in the need_new_empty_dir directory, and copy that to a new directory named to_update. Then I can update that one appointment in Evolution with:

syncevolution --update to_update backend=evolution-calendar database=<some_id_string>

I’ll post the script here if I get something that works.

In case anyone’s curious, I did throw together a Python script to modify the reminders in my Calendar. Here’s the code:

import os, sys

CALENDAR_IDS = ["Put your ID from --print-databases here"]

WORKING_DIR = "/tmp/calendar_reminder_fix_working"


def get_modified_event(lines):
    needs_modification = False
    modified_event = []
    event_summary = ""

    in_vevent = False
    in_valarm = False

    for l in lines:
        if l == "BEGIN:VEVENT\n":
            in_vevent = True
        elif l == "END:VEVENT\n" and in_vevent == True:
            in_vevent = False
        elif l == "END:VEVENT\n" and in_vevent == False:
            print("ERROR: Found END:VEVENT outside a vevent block")
        elif l == "BEGIN:VALARM\n":
            in_valarm = True
        elif l == "END:VALARM\n" and in_valarm == True:
            in_valarm == False
        elif l == "END:VALARM\n" and in_valarm == False:
            print("ERROR: Found END:VALARM outside a valarm block")
        elif l.startswith("SUMMARY:") and in_vevent == True and in_valarm == False:
            event_summary = l[8:].strip()
        elif l == "ACTION:AUDIO\n" and in_vevent == True and in_valarm == True:
            needs_modification = True
            modified_event.append("ACTION:DISPLAY\n")
            modified_event.append(f"DESCRIPTION:{event_summary}\n")
            continue
        elif l == "ATTACH:Chord\n":
            continue
        modified_event.append(l)
    return needs_modification, modified_event


if os.path.isdir(WORKING_DIR) == False:
    os.mkdir(WORKING_DIR)

for cal_id in CALENDAR_IDS:
    EXPORT_DIR = os.path.join(WORKING_DIR, f"export_{cal_id}")
    UPDATE_DIR = os.path.join(WORKING_DIR, f"update_{cal_id}")

    if os.path.isdir(EXPORT_DIR) == False:
        os.mkdir(EXPORT_DIR)

    if os.path.isdir(UPDATE_DIR) == False:
        os.mkdir(UPDATE_DIR)

    os.system(f"syncevolution --export {EXPORT_DIR} backend=evolution-calendar database={cal_id}")

    files = os.listdir(EXPORT_DIR)
    print(f"Found {len(files)} files for calendar ID {cal_id}")

    total_needing_modification = 0
    for f in files:
        with open(os.path.join(EXPORT_DIR, f)) as fin:
            lines = fin.readlines()
            needs_mod, mod_event = get_modified_event(lines)
            if needs_mod == True:
                total_needing_modification += 1
                with open(os.path.join(UPDATE_DIR, f), 'w') as fout:
                    fout.writelines(mod_event)
    print(f"Found a total of {total_needing_modification} events that needed updating")

    os.system(f"syncevolution --update {UPDATE_DIR} backend=evolution-calendar database={cal_id}")

It seems to work so far, but I still haven’t tested it extensively, so use at your own risk!

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.