banner
Previous Page
PCLinuxOS Magazine
PCLinuxOS
Article List
Disclaimer
Next Page

Tip Top Tips: Linking Your ORAGE Calendar To Google Calendar


Editor's Note: Tip Top Tips is a semi-monthly column in The PCLinuxOS Magazine. Periodically, we will feature -- and possibly even expand upon -- one tip from the PCLinuxOS forum. The magazine will not accept independent tip submissions specifically intended for inclusion in the Tip Top Tips column. Rather, if you have a tip, share it in the PCLinuxOS forum's "Tips & Tricks" section. Your tip just may be selected for publication in The PCLinuxOS Magazine.

This month's tip comes from davecs. Instead of the Tips & Tricks section of the forum, this tip appeared in the Xfce section of the PCLinuxOS Forum. Orage is the Xfce calendar program.

I posted about this a few years back, but that solution doesn't work any more. I've done some research, and found another way to do this. It seems a little complicated, but just follow everything as I've set out, and you should be OK!



BEGIN>

In order to sync Orage to your Google Calendar, you need add a program called "python3-pip" from Synaptic. This enables you to install some useful python-based programs direct from the internet.

Then you'll need to open a terminal as root, and install two further programs using pip. All you have to do is type in the following two lines:

pip3 install vdirsyncer
pip3 install requests_oauthlib

Then you need to log in to the Google API dashboard:

https://console.cloud.google.com/apis/dashboard

Once there click on "+ ENABLE APIS AND SERVICES" near the top of the screen.

This takes you to a search screen, and in the search box, enter "caldav". You will get a box to click on, "CalDAV API" which you should select. You will need to Create Credentials. In return, you will get two long IDs, client_id and client_secret.

Open your File Manager, and Show Hidden Files, click into .config and create a folder within that called vdirsyncer -- and inside that create a text file called config.

You should create a folder under ~/.local/share/orage/ which is your gmail address (shown as youraddress@gmail.com in the file that follows).

config should look like this. You will use your own gmail address, client_id and client_secret, but everything else should be typed exactly as I have:

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

[pair mygoogle_calendar]
a = "mygoogle_calendar_local"
b = "mygoogle_calendar_remote"
collections = ["from a", "from b"]

[storage mygoogle_calendar_local]
type = "singlefile"
path = "~/.local/share/orage/youraddress@gmail.com/%s.ics"

[storage mygoogle_calendar_remote]
type = "google_calendar"
token_file = "~/.vdirsyncer/google_token"
client_id = "1235467890abcdefghijklmnopqrstuvwxyz.apps.googleusercontent.com"
client_secret = "1234567890abcdefghijklmnop"

Now, make a folder in your home folder (not under .config) called "./vdirsyncer", inside that, create another folder called "status", and inside that, another folder called "calendar".

That's the preparation done. Now for the moment of truth. You need to open a terminal, and run the following command as user:

vdirsyncer discover

A browser window should pop up to complete the authorisation, and that will create an access token, another long string of characters, which you need to copy to your clipboard. Meanwhile, the terminal goes into a "waiting" state. If you click on the terminal and hit a key, you will be prompted for the access token, which you should paste in. Keep an eye on the text that outputs to the terminal, in order to know that everything has gone ok.

Once this is done, you need to make the first synchronisation. You do this by typing the next line into the terminal:

vdirsyncer sync

When the sync finishes, you should have one or more files in the folder "/home/your-user-name/.local/share/orage/youraddress@gmail.com/" which you can now link to orage.

To do this, you have to click on your panel orage time and date to bring up the calendar. You link the calendars by clicking on File>Exchange Data, and the tab called Foreign Files. Look for them in the the folder I just mentioned.

There may be a few with very long random names, which you will link as READ ONLY, except one that is almost human-readable, shorter and similar to your email address, who you should link as READ WRITE (but I am ready to be corrected because I'm not sure if that's right. It seems to work). At the moment I am getting down-syncing from Google OK but not up-syncing to Google, so if anyone can correct this for me? Still that's better than nothing, provided you use your browser or phone to add new entries to your calendar.

Setting up a cron job seems fairly easy. You have to open a terminal as user, and type in the command crontab -e. An editor called vi will run. If you're not familiar with vi, in order to start entering text, you type "i".

Type in a line like:

26 * * * * /usr/local/bin/vdirsyncer sync

followed by ENTER.

To save it, type ESC (which takes you back to command mode), followed by :wq which writes your file then quits. The line entered above will cause the job to run on the 26th minute of every hour. If you have more than one scheduled task running it's best that they don't all start at the same time, but you can change 26 if you like.

If you want to get more control over timing and frequency, I suggest you read up some help on crontab.



Previous Page              Top              Next Page