Friday, August 30, 2013

Sync Orage and Google Calendar

I wrote in my previous post that Orage, the calendar application in XFCE, does not Sync with Google Calendar. This is true, but there is a way to enable Orage to sync with Google Calendar, so that events added to Google Calendar will appear in Orage, but not the other way round.

To sync Orage with Google Calendar, it's possible to download Google Calendar in iCalendar format and import this into Orage.

To download the file, go to calendar settings and right click the green ICAL button next to Private Address.

Select Save Link As (or similar, according to browser) and save the file.

To import into Orage, Go to File > Exchange data > Foreign files, click the Open button, navigate to the saved file (basic.ics) and click Add. Events from Google Calendar will be added to any local Orage events.

To automate the process, we can use a cron command.
wget -N
The -N parameter will overwrite the file if it is newer on the sever, rather than adding files bacis.ics.1, bacis.ics.2 etc etc which we don't want.

To get the calendar URL, right click on the green ICAL button again but this time select Copy Link Location (or similar, according to browser).

Paste the address into a text editor to see it. There is a problem here because the Google email address that the URL contains will have been transformed into HTML URL Encoding,  so will have become (see: Try It Yourself) and the % character will not work in a cron command. Edit %40 back to @, so the full command looks like this:
wget -N
Now we need to run the command once a day. Corenominal has a cron tutorial which covers this. Note: it may be necessary to specify the full path to wget with this method: /usr/bin/wget. I used a GUI application which uses cron to schedule tasks: Gnome-schedule, where the above command worked OK. Although it's a Gnome app, it installs in XFCE without needing any dependencies, and is simple to use.

The Run button didn't seem to work for me, perhaps because it is a Gnome app and is not properly configured to launch a terminal in XFCE. If you want to check your cron command is working, change Date & Time to Every minute and watch the basic.ics file appear in your home directory, then reset to daily, of course.


  1. That's what I've been looking for. Thanks for handy instruction.

  2. I do the same thing, but use the following options, wget -T 5 -r -nH -nd -O /home/[username]/.local/share/orage/orage.ics [URL]. The -T 5 is a five second timeout, -r recursive, -nH and -nd is no hostname and no directory based upon the URL and path. This lets you specify the output directory and file name. Orage then always has your Google Cal updates. My cron job runs every hour.

  3. Thanks to you and JM, this is good.

    1. and it Just Works™ in the unix spririt of things

    2. lol. the unix philosophy is 'do one thing and do it well'. you're thinking of Apple.

  4. For anyone still interested in this, the URL to use and the method to get your ICAL file manually from Google has changed quite a bit.
    Go to calendar > settings, then you should 3 links listed horizontally like tabs, choose "Calendars", then you should see your calendar listed with your Name and a calendar icon beside it. Click that link, and then down near the bottom of the page you will see the green ICAL button next to "Private Address". Right click and copy the link location (or however you save a link in your browser ) and plug that into the command given by JM earlier. Note this link will be much different from the one described in the article.

  5. Rather than Wget, try this handles the synchronization and (should) makes it bi-directional.