Friday, October 24, 2008

gcalcli - Google Calendar on the Command Line

gcalcli gives you access to your Google Calendar on the command line. You can retrieve your calendar information for multiple calendars and in various formats. gcalcli can be found in the repositories for Ubuntu Hardy and Ibex.

If your Distro does not have gcalcli in it's repositories, instructions can be found here. gcalcli is written in python and just has a few dependencies for an easy install.

Once installed you may need to create a .gcalclirc file in your home directory. The file should be configured like this:

[gcalcli]
<config-item>: <value>
<config-item>: <value>
...

Mine looks like this:

[gcalcli]
user: username@gmail.com
pw: password
cals: all

Obviously, use your own Google Calendar username and password in the file. I have several calendars that follow, like a US Holiday calendar, a family birthday calendar and my Wife's calendar. I wanted to have access to all the calendars so I indicated that as an option in the config file. There are several other options that can be included within this configuration file specifically having different colors for each calendar.

On my laptop running CrunchBang! Linux, gcalcli was not correctly reading
the .gcalclirc file. So, I created the following alias in my .bashrc file:

alias gcalcli = "/usr/bin/gcalcli --user=username@gmail.com --pw=password"

This seemed like a reasonable work around for now.

To view my calendar I simply type:

$ gcalcli agenda


Notice my calendar in blue and my wife's calendar in magenta.
Using the agenda option without parameters will list one week of calendar information. You can include a date range to customize the output.

$ gcalcli agenda 11/15 11/31

This will give you all calendar items between 11/15 and 11/31 of the current year.

To view your calendar in a matrix with borders, type the following:

$ gcalcli calw

The calw option without parameters will display the current week's calendar items. You can add parameters to increase your ranges view.

$ gcalcli calw 3


This will display the current week and the following 2 weeks.

You can post to your calendar as well using the quick option in the following syntax.

$ gcalcli quick "10/31 7 pm Halloween Party"


This will create a calendar for a Halloween Party on 10/31 at 7 pm.
Please see the gcalcli site for more things you can do with this neat little app, including adding calendar items to gnu screen and receiving notices. For all you GUI lovers you can even use gcalcli to display your calendar items in conky.

Now you can do all your scheduling and calendaring on the CLI.

1 comment:

Sunday said...

thanks, very useful. I'll be using this now