How to Manage Google Calendar From Command Line And Display It On Your Desktop
I don’t think I need to do any introduction on Google Calendar. It is one of the most popular web based calendar and if you have a Google account (or a Gmail account), you already have a Google Calendar account.
To add events/appointment to your Google Calendar, the most primitive way is to open your web browser, login to the Google Calendar site and add an event. What about the geekiest (and fastest) way? By the command line, of course.
Gcalcli is a Python application that allows you to access and manage your Google Calendar from a command line. You can use it to retrieve your agenda, event list, and quickly add new events. What’s more, it can also be used as a reminder service to help you remember the things that you need to do.
Installation
Gcalcli is included in the Ubuntu repository, which means you can easily install via the Ubuntu Software Center, Synaptic Package Manager, or simply with the command line:
sudo apt-get install gcalcli
Configuration
Before we start, we need to create the configuration file. Open a text editor. Paste the following lines:
[gcalcli] user: yourusername pw: yourpassword
Replace “yourusername” with your Google account login name, without the gmail.com.
Replace “yourpassword” with your Google login password.
Save the file in your home folder with the filename .gcalclirc (don’t forget the “.” in front of the galclirc and no file extension is required)
Usage
To test it, open a terminal and type
gcalcli agenda
It should show your agenda for the next 5 days.
To get a quick glance of your next 2 weeks agenda
gcalcli calw 2
Whole month agenda
gcalcli calm
You can also set gcalcli to show a reminder popup if the event is within 10 minutes from the current time.
gcalcli remind 10
One thing though, there is no automation for the reminder service, so you need to run the command everytime to remind you of your event. A good way to automate it is via crontab or using gnome-schedule
To add an event to Google calendar, use the command
gcalcli quick
Replace the <event> with a brief description of the time, date and event detail. For example:
gcalcli quick '5pm 31/7/2010 Meeting with Advertisers' # or gcalcli quick 'Dinner with Eric 7pm tomorrow'
Display Google Calendar on your desktop
To get Google Calendar onto your desktop, we are going to use a combination of gcalcli and conky.
Install conky:
sudo apt-get install conky
Open a text editor and paste the following text:
alignment top_right background no border_width 0 cpu_avg_samples 2 default_color white default_outline_color white default_shade_color white draw_borders no draw_graph_borders yes draw_outline no draw_shades no use_xft yes xftfont DejaVu Sans Mono:size=12 gap_x 5 gap_y 60 minimum_size 5 5 net_avg_samples 2 double_buffer yes out_to_console no out_to_stderr no extra_newline no own_window yes own_window_class Conky own_window_type override own_window_transparent yes own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager stippled_borders 0 update_interval 1.0 uppercase no use_spacer none show_graph_scale no show_graph_range no text_buffer_size 8096 TEXT ${execi 300 gcalcli --nc --cals=owner calw 4}
Save the file in your Home directory with the filename .conkyrc
Press Alt + F2. Type in “conky” and press Enter.
Your agenda for the next 4 weeks will now appear on your desktop and it will refresh every 5 minutes.
Need more help on gcalcli? Check out their HowTo wiki.
Try it out and let us know if it works for you.