How to embed Google Calendar widget on Linux desktop background
This article explains how to embed the Google Calendar widget on the Linux desktop background. It also includes some custom prompts.
Conky and gcalcli are used to display Google calendar events on top of the desktop wallpaper:
- Conkey It is a tool for displaying information on the desktop. It can act as a system monitor, with some built-in functions to display CPU usage, RAM, etc., as well as display custom command output.
- Calcium It is the command line interface of Google Calendar. Use OAuth2 to connect with your Google account, the tool can list your Google calendar, add, edit and delete calendar events, etc.
Related: MineTime: Desktop calendar application with Google Calendar, Outlook.com, Microsoft Exchange, iCloud and CalDAV support
Follow the steps below to install Conky and gcalcli, and use these tools to embed Google Calendar into your desktop background. There are some optional steps to customize Conky, calendar colors, etc., as well as optional steps to add this widget to the launch.
The Conky configuration file in this article uses Conky 1.10 syntax. You need Conky 1.10 or higher to use Conky Configuration 1 below. Install gcalcli and Conky.
In Debian, Ubuntu or Linux Mint, use:
sudo apt install gcalcli conky-all
You also need to install the Ubuntu Mono font (or you can change the font in the .conkyrc code below). It should be installed in Ubuntu 2. by default. Link gcalcli to your Google account.
You need to run gcalcli with any options to start the OAuth2 authentication process. Let’s run list
The command is as follows:
gcalcli list
gcalcli should open a new page in the default web browser, asking if you want to authorize gcalcli with your Google account. Allow it and proceed to the next step 3. Create and populate Conky configuration file (~/.conkyrc
).
Create a file called .conkyrc
In your home folder (use Ctrl + H
Switch between hiding and showing hidden files and folders) and paste the following into the file:
conky.config = {
background = true,
update_interval = 1.5,
cpu_avg_samples = 2,
net_avg_samples = 2,
out_to_console = false,
override_utf8_locale = true,
double_buffer = true,
no_buffers = true,
text_buffer_size = 32768,
imlib_cache_size = 0,
own_window = true,
own_window_type = 'desktop',
own_window_argb_visual = true,
own_window_argb_value = 120,
own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',
border_inner_margin = 10,
border_outer_margin = 0,
xinerama_head = 1,
alignment = 'top_right',
gap_x = 90,
gap_y = 90,
draw_shades = true,
draw_outline = false,
draw_borders = false,
draw_graph_borders = false,
use_xft = true,
font = 'Ubuntu Mono:size=12',
xftalpha = 0.8,
uppercase = false,
default_color = '#FFFFFF',
own_window_colour = '#000000',
minimum_width = 0, minimum_height = 0,
};
conky.text = [[
${execpi 300 PYTHONIOENCODING=utf8 gcalcli --conky --nolineart calm --monday}
]];
For Linux distributions with gcalcli 4.0.0 or higher (not old 4.0.0a4, 4.0.0a3, etc.), such as Ubuntu 19.04, use --lineart=ascii
Instead --nolineart
In the Conky code above. You can easily know whether your gcalcli version supports --nolineart
By running gcalcli --conky --nolineart calm
In the terminal-if the error message “Unrecognized parameter: –nolineart” appears, you are using an updated version of gcalcli --nolineart
And you need to use --lineart=ascii
instead(--lineart=unicode
You can also).
Now, run Conky by entering the following command in the terminal:
conky
You should now see the embedded Google Calendar widget in the desktop background, as shown below:
If you already have a Conky configuration, name the file .conkyrc2
(Or .conkyrc3
Etc.), and whenever you see the “conky” command in this article (run the command or add it to startup), please append -c ~/.conkyrc2
(Or whatever you named the file). For example, run another Conky instance using the following ~/.conkyrc2
As its configuration file, use the following command:
conky -c ~/.conkyrc2
If you want to close all running Conky instances, use:
killall -9 conky
4. (Optional) Customize gcalcli and ConkyI. Basic Conky configuration
You can modify the content .conkyrc
Documents to meet your needs. Every time you save, Google Calendar displayed on the desktop using Conky should be automatically updated. .conkyrc
Configuration file. If this does not happen, please use the following command to kill all running Conky processes killall -9 conky
And then run Conky again.
For example, change gap_x
with gap_y
Value to bring the calendar displayed on the desktop closer or farther away from the upper right corner. The upper right corner is alignment = 'top_right'
Options, and then make changes to move the calendar to the other corner of the screen.
Most options are self-explanatory, such as font values, set it to Ubuntu Mono in the Conky code above. Make sure that the Ubuntu font is installed, or change the font value to a monospaced font installed on the system.
If you have multiple monitors and you want to move the calendar widget to another monitor, please change xinerama_head
value.
In addition to this, the values used in the example Conky configuration in step 3 should only be valid for most users. Consult Conky Help (conky --help
) For more information. Change calendar color
To use .conkyrc
In the code listed in step 3, the default gcalcli value will be used to display the Google calendar. The color can be changed.
For example, you can add --nocolor
To performer ~/.conkyrc
The line (before the last line) does not use any gcalcli color, but instead relies on Conky as the text color by changing the line to the following form:
-For gcalcli 4.0.0 stable version or higher:
${execpi 300 PYTHONIOENCODING=utf8 gcalcli --conky --lineart=ascii --nocolor calm --monday}
-For older gcalcli (eg 4.0.0a4):
${execpi 300 PYTHONIOENCODING=utf8 gcalcli --conky --nolineart --nocolor calm --monday}
You can then specify the color of the calendar text by changing the default_color value (hex or color name can be used) from: ~/.conkyrc
file. This is how it looks when used default_color = 'green'
E.g:
However, this only allows one color for the entire calendar. If you want to change a single color, such as the color of the date, the current mark, etc., make sure not to add --nocolor
Go to the excepci line and instead add the following options using the color you want to use:
--color_border: Color of line borders
(default: 'white')
--color_date: Color for the date
(default: 'yellow')
--color_freebusy: Color for free/busy calendars
(default: 'default')
--color_now_marker: Color for the now marker
(default: 'brightred')
--color_owner: Color for owned calendars
(default: 'cyan')
--color_reader: Color for read-only calendars
(default: 'magenta')
--color_writer: Color for writable calendars
(default: 'green')
Although there are not many supported colors. Comment on This one The bug report mentions support for black, red, green, yellow, blue, magenta, cyan, and white.
For example, to change the calendar color of the now tag to blue and the date color to white, while other elements retain their default colors, you can change the execpi line to:
-For gcalcli 4.0.0 stable version or higher:
${execpi 300 PYTHONIOENCODING=utf8 gcalcli --conky --lineart=ascii calm --monday --color_now_marker blue --color_date white}
-For older gcalcli (eg 4.0.0a4):
${execpi 300 PYTHONIOENCODING=utf8 gcalcli --conky --nolineart calm --monday --color_now_marker blue --color_date white}
Three, gcalcli options
gcalcli has many options. of --monday
For example, has been added to our options .conkyrc
The file sets the first day of the week to Monday. Remove it from the execpi line (at .conkyrc
File) Set the first day of the week to Sunday.
of calm
The option sets gcalcli to display the current month’s agenda in calendar format. To display the current week instead of the month, use calw
Instead calm
, like this:
-For gcalcli 4.0.0 stable version or higher:
${execpi 300 PYTHONIOENCODING=utf8 gcalcli --conky --lineart=ascii calw --monday}
-For older gcalcli (eg 4.0.0a4):
${execpi 300 PYTHONIOENCODING=utf8 gcalcli --conky --nolineart calw --monday}
This is how the widget looks on the desktop:
Another possible view is agenda
, The default is to start at 12 o’clock in the day (and display the next 5 days of events), but you can accept a custom date. Replace calm
versus agenda
Use it and delete --monday
If it’s there (you don’t need it in this view, and gcalcli will throw an error), like this:
-For gcalcli 4.0.0 stable version or higher:
${execpi 300 PYTHONIOENCODING=utf8 gcalcli --conky --lineart=ascii agenda}
-For older gcalcli (eg 4.0.0a4):
${execpi 300 PYTHONIOENCODING=utf8 gcalcli --conky --nolineart agenda}
In the next 5 days, only 1 incident occurred, the results are as follows:
You can also display two months on the current calendar instead of showing a 5-day agenda at the top of the current calendar by adding two execpi lines instead ~/.conkyrc
The file looks like this:
-For gcalcli 4.0.0 stable version or higher:
conky.text = [[
${execpi 300 PYTHONIOENCODING=utf8 gcalcli --conky --lineart=ascii agenda}
${execpi 300 PYTHONIOENCODING=utf8 gcalcli --conky --lineart=ascii calm}
]];
-For older gcalcli (eg 4.0.0a4):
conky.text = [[
${execpi 300 PYTHONIOENCODING=utf8 gcalcli --conky --nolineart agenda}
${execpi 300 PYTHONIOENCODING=utf8 gcalcli --conky --nolineart calm}
]];
This is what it looks like on the desktop:For more customization, please check
gcalcli --help
And the GitHub project page.
Incidentally, gcalcli is used PYTHONIOENCODING=utf8
To avoid some possible problems with the calendar display-if the calendar is displayed correctly, you can delete it. In addition, I used --nolineart
gcalcli option (or --lineart=ascii
Instead, for newer gcalcli versions), this disables line art because Conky cannot display gcalcli line art correctly. 5. (Optional) Add the Google Calendar Conky desktop widget to the launch.
To add it to the launch, open the “launch app” or equivalent from the app launcher, add a new launcher, enter Conky Google Calendar as its name, and use the following command in the command field:
conky --daemonize --pause=5
Alternatively, you can create a file called conky.desktop
In ~/.config/autostart/
Has the following content:
[Desktop Entry]
Type=Application
Exec=conky --daemonize --pause=5
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name=Conky Google Calendar