Gcalcli – Google Calendar in Command Line /Desktop Widget

Last updated: August 16, 2014

Google Calendar desktop widget command line

Gcalcli is a command line tool for Linux users to manage Google Calendar. It allows you to get your agenda, search for, add, delete, edit events and even import those annoying ICS/vCal invites from Microsoft Exchange and/or other sources.

Additionally, gcalcli can be used as a reminder service and execute any application you want when an event is coming up.

Google Calender in Command Line

Gcalcli features:

  • OAuth2 authention with your Google account
  • list your calendars
  • show an agenda using a specified start/end date and time
  • ascii text graphical calendar display with variable width
  • search for past and/or future events
  • “quick add” new events to a specified calendar
  • “add” a new event to a specified calendar (interactively or automatically)
  • “delete” event(s) from a calendar(s) (interactively or automatically)
  • “edit” event(s) interactively
  • import events from ICS/vCal files to a specified calendar
  • support for URL shortening via goo.gl
  • easy integration with your favorite mail client (attachment handler)
  • run as a cron job and execute a command for reminders
  • work against specific calendars (by calendar name w/ regex)
  • flag file support for specifying option defaults
  • colored output and unicode character support
  • super fun hacking with shell scripts, cron, screen, tmux, conky, etc

Install Gcalcli in Ubuntu:

This python app is available in the default repositories of Ubuntu 14.04, Ubuntu 14.10, and Ubuntu 12.04. So we can easily install it by running below command (or via Software Center):

sudo apt-get install gcalcli

For Ubuntu 14.04 LTS, due to this bug, we need to download & install the latest parsedatetime 1.2 to get gcalcli work.

cd /tmp

wget https://launchpad.net/ubuntu/+archive/primary/+files/python-parsedatetime_1.2-1_all.deb

sudo dpkg -i python-parsedatetime_1.2-1_all.deb

How to Use Gcalcli:

Before getting started, set up your Google Account via:

nano ~/.gcalclirc

Type in below as its content:

[gcalcli]
user: GMAIL-ACCOUNT
pw: PASSWORD

gcalcli-googleaccount

After saving the changes by Ctrl+X, type y, and hit Enter, use the tool via below commands:

To get your agenda:

gcalcli agenda

To get a month agenda in a nice calendar format:

gcalcli calm

Quick add an event:

gcalcli quick 'text here'

For more, run:

gcalcli --help

Display Google Calendar as Desktop Widget:

With this command line tool, you can also display Google Calendar on your desktop through conky. To do so, first install the required packages:

sudo apt-get install conky ttf-dejavu ttf-dejavu-core ttf-dejavu-extra

Then download the conky script (thanks to lffl.org):

cd && wget https://dl.dropboxusercontent.com/u/209784349/lffl/.conkyrc.txt && mv .conkyrc.txt .conkyrc

Finally run conky from terminal or Alt+F2 command box and you’ll see something like below:

Google-Calendar-widget

via: github, lffl.org

Twitter

I'm a freelance blogger who started using Ubuntu in 2007 and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please comment to let me know if the tutorial is outdated! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via [email protected] Buy me a coffee: https://ko-fi.com/ubuntuhandbook1

4 responses to Gcalcli – Google Calendar in Command Line /Desktop Widget

  1. This looks like a helpful tool. Is there a more secure way to store my google credentials than in a plain text file?

  2. Hello! I was wondering if you could help me out with some issues I’m experiencing using this method.. Apparently I’m missing some modules.

    Here is the code:

    ~$ gcalcli agenda
    ERROR: Missing module – cannot import name __version__

  3. What if your gmail account has a security lock?

    I get Error: Incorrect username or password!

  4. Traceback (most recent call last):
    File “/usr/bin/gcalcli”, line 2065, in
    BowChickaWowWow()
    File “/usr/bin/gcalcli”, line 1924, in BowChickaWowWow
    customLocale=customLocale)
    File “/usr/bin/gcalcli”, line 515, in __init__
    self.allCals = self.gcal.GetAllCalendarsFeed()
    File “/usr/lib/python2.7/dist-packages/gdata/calendar/service.py”, line 81, in GetAllCalendarsFeed
    return self.Get(uri, converter=gdata.calendar.CalendarListFeedFromString)
    File “/usr/lib/python2.7/dist-packages/gdata/service.py”, line 1107, in Get
    ‘reason’: server_response.reason, ‘body’: result_body}
    gdata.service.RequestError: {‘status’: 403, ‘body’: ‘\n\nForbidden\n\n\nForbidden\nError 403\n\n\n’, ‘reason’: ‘Forbidden’}