22

Note: If you have your Google Calendar synced to iCal via CalDAV, then this Geeklet that uses iCalBuddy is a much easier option. If you'd rather not use iCal at all, then read on...

There is a command line application called gcalcli that allows you to access your Google Calendar from the Terminal or from GeekTool. It is a bit complicated to install though.

Installation instructions:

  1. Download the latest gdata python client
  2. Double-click the file to un-zip
  3. Open Terminal
  4. Type cd followed by a space, then drag the gdata-#.#.# folder onto the window.
  5. Press return
  6. Type ./setup.py install and press return.
  7. You can now delete the gdata folder and zip file
  8. Download the latest version of gcalcli
  9. Double-click the file to un-zip
  10. Open the file in TextEdit by dragging onto the TextEdit icon
  11. Change the first line to #!/usr/bin/python -W ignore::DeprecationWarning
  12. Save the file
  13. In Finder choose "Go to Folder…" from the Go menu
  14. Type in /usr/local/bin/
  15. Drag gcalcli to this folder (Enter admin password if needed)
  16. In TextEdit create a new text file with the following three lines:

    [gcalcli]
    user: **username**
    pw: **password**
    
  17. Choose "Make Plain Text" from the Format menu

  18. Save as .gcalclirc in you user home folder.

There are lots of different options for gcalcli. Detailed usage instructions are here.

Some example commands you can use in Terminal or GeekTool:

/usr/local/bin/gcalcli --width=15 calw 2

/usr/local/bin/gcalcli agenda

/usr/local/bin/gcalcli --cals=owner calm

/usr/local/bin/gcalcli agenda '11/26/2009' '11/30/2009'

Useful options:

calw 3 displays a calendar of the next three weeks

calm displays a calendar of this month

agenda '11/26/2009' '11/30/2009' displays a list of events from the 26th to the 30th

--nc for no colour (the default colours look pretty horrible in GeekTool)

--cals=owner for only the calendars you own (to remove subscriptions)

--width=20 for wider columns (useful for GeekTool on a wide screen)

The Geeklet files attached have the following commands:

/usr/local/bin/gcalcli --nc --width=25 calw 3
/usr/local/bin/gcalcli --nc agenda

Screenshot

Geeklet files to download

Comments

User Avatar
aronweiss19 1417 days ago
I'm pretty new to all of this, so naturally I'm having some trouble. My most recent attempt ended with a bunch of error messages indicating a failure to authenticate my google account. Also, I'm pretty unclear what to do...after step 18. Through the process of this guide I've made three different text edit files and I'm not sure how they all play into my final product. What should the script read for the terminal that is displayed on the desktop? Thanks again!
User Avatar
matt 1417 days ago
It's a long while since I wrote this, and I don't actually use this Geeklet on a regular basis, so I'm not sure I'll be much help. This is also definitely one of the more tricky ones to set up!

Try this:

Open up Terminal and paste in "/usr/local/bin/gcalcli --width=15 calw 2" without the quotes. If the error you get is "Error: Failed to authenticate with Google Calendar!" then it suggests that gcalcli installed fine, but there is a problem to do with file with your username and password.

Make sure you named it right - there is a dot at the start and no file extension. If you did name it right, you shouldn't actually be able to see it - files starting with a dot are hidden. To show hidden files, go to Terminal and paste in

defaults write com.apple.finder AppleShowAllFiles -bool YES

then restart the Finder by holding Control and Option, clicking on the Finder icon in the Dock and choosing "Relaunch." You will want to repeat this process with NO at the end of the command to hide the hidden files again once you are done.

Now you should be able to find the .glcalcirc file in your user folder. If the name is fine, open it with TextEdit and check the contents are exactly right:

[gcalcli]

user: *PutYourGoogleUserNameHere*

pw: *PutYourGooglePasswordHere*
User Avatar
David 1171 days ago
Hope it's OK to comment on an old geeklet but I've just installed this and it works a charm! Couple of points that might help others out:

I received an error on line 6, running it via sudo worked fine 'sudo ./setup.py install' Return then enter your pw when prompted.

Also regarding the plain text file with google username and password - I suggest using two step authentication, go into your google account and then create a new password to authorise this app and use that in the .gcalclirc file. Bit more secure.

Other than that, Matt, if you still check in on this post, thanks for such a clear and well explained walkthrough. My calendar is now burned onto my desktop, no more excuses! (Wedding anniversary next week, woah! ;) )



Cheers,

David.
User Avatar
jelleverkleij 1151 days ago
I hope you are still around matt... I stall at step 14. There is no /usr/local/bin on Mac OS X Lion. I tried /usr/bin/ but then the script just gives a blank screen. Any tips?
User Avatar
matt 1151 days ago
I think you can just create it. So instead you can do:

1. In Finder choose "Go to Folder…" from the Go menu

2. Type in `/usr/`

3. Check if there is a `local` folder, create it if not

4. Inside create a folder called `bin`

5. Continue as described above.
User Avatar
denisr 1131 days ago
This is just amazing Matt, thank you for sharing.

Can you help me with this? The geeklets work fine, but the columns are not aligned (some rows take more space than others).

When trying it in the terminal, the columns are aligned and I get this error after the traceback: UnicodeEncodeError: 'ascii' codec can't encode character u'\xec' in position 29: ordinal not in range(128)

What could it be?
User Avatar
matt 1131 days ago
Not sure about the error, but in your Geeklets, make sure you are using a fixed width font like Courier or Menlo to ensure the the columns line up.
User Avatar
denisr 1130 days ago
Ooook! I didn't know that some fonts could have a fixed width. Now it just looks amazing! Thank you!
User Avatar
KiraXenZ 1115 days ago
Hello! I am very new to GeekTools and this is a very complicated one to install. I was able to get it mostly working though. The main problem I have is one line of it is misaligned. It was fine at first but I deleted some events on line and when it updated it was misaligned. Here is a link to a screen shot I took of it to show what I mean. http://i.imgur.com/DZpUS.png Any ideas?

Log in to comment or register here.