[X11] Further tinkering with X11 root window – Conky

This post reffers to the one before and I recommend you to read it:

Root windows

As we made through our attempt to write a screensaver for XScreenSaver server we stepped on a concept of virtual root windows.
As the Wikipedia states:

 The virtual root window is also used by XScreenSaver: when the screensaver is activated, this program creates a virtual root window, places it at the top of all other windows, and calls one of its hacks (modules), which finds the virtual root window and draws in it.

Our program found the virtual root window that XScreenSaver created when 1 minute of idleness passed and used its window handle to do OpenGL calls. But as you probably imagine, if we can find the root window, which is your desktop, we can draw whatever we want over it. And apparently, that’s how widgets (aka screenlets) work.
There’s a program called Conky (named after a doll from Trailer Park Boys TV series),
that does exactly the same thing. As its FAQ states:

Conky is a program which can display arbitrary information (such as the date, CPU temperature from i2c, MPD info, and anything else you desire) to the root window in X11. Conky normally does this by drawing to the root window, however Conky can also be run in windowed mode (though this is not how conky was meant to be used).

As the concept by which Conky’s screenlets work is similiar to our screensaver’s, let’s install it and check anatomy of screenlets.


Process of installing either from sources or packages is described on their wiki:
…and I’m assuming that when you type ‘conky‘ in your terminal, it starts Conky process.
I’m using Ubuntu 16.04 with Compiz.

What’s optional is conky-manager, you may build it from source:

Sample screenlet

As Conky has built-in support for Lua scripts, it doesn’t mean that conky configuration files are written in Lua (they use Lua syntax since Conky 1.10). They’re more like configuration files that define what is drawn and where, and to get some values, or draw something, they can call Lua scripts. They can also call bash scripts. For some values they need no Lua nor bash, because they are handled by Conky itself.

Conky developers even distribute Conky-related Lua tutorial:

Making a sample screenlet consists of:

  1. Writing ~/.conkyrc file, possibly copy-pasting some portions of configuration from other screenlets because it’s redundant.
    Possible configuration settings are defined here:
  2. (optional) Writing Lua script or bash script that you may want to call in it, maybe also putting some images/other resources into script directory. You can refer to the tutorial linked above.

Example conkyrc with Lua script (not mine):


One particularly creative conky

As a fan of Thinkpads, when I’ve seen this:

I immediately downloaded scripts this guy shared and set them up on my own Ubuntu.
What was needed:

  1. Download this config file and save it as ~/.conkyrc file:
  2. Download shell scripts and save them under ~/.bin directory:
  3. Edit those sh scripts, they relate to /home/u0xpsec directory, change it to your own.
  4. In terminal, type ‘conky’.

I experienced one annoying bug; on clicking desktop, this conky disappeared.
Link below helped disappearing on desktop click, but didn’t help disappearing on alt+tab to desktop (which hides everything):

What helped me on disappearing on ‘hide all windows’ was the tip i found on Arch Linux Wiki:

Using Compiz: If the ‘Show Desktop’ button or key-binding minimizes Conky along with all other windows, start the Compiz configuration settings manager, go to “General Options” and uncheck the “Hide Skip Taskbar Windows” option.

To download Compiz configuration settings manager type:

sudo apt-get install compizconfig-settings-manager

And run it via ‘ccsm’.

Alas, this conky took ~2% of CPU (quering system status is costly), so you may think twice before installing it.


Conky has its own subreddits:


And you can find more screenlets on deviantart, i.e this one:


Which is also very amusing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s