Linux Format

Monitoring: Using Conky

Do you want a unique and attractive desktop? Neil Bothwick shows you how to add the Conky system monitor.

- Neil Bothwick has a great deal of experience with booting up, as he has a computer in every room, but not as much with rebooting since he made the switch to Linux.

System monitors are plentiful. Most desktops environmen­ts come with a program that opens a window containing various statistics about your running system: things like uptime, system load, free memory and temperatur­es etc. These generally open in their own window or appear as an applet in the system tray. However, when trying different live distributi­ons (distros) from the LXFDVD, you may have noticed some that display informatio­n directly on the desktop background, in a way that looks more attractive than a separate window. You may also have noticed that the display is different on each distro. The program they use for this is Conky and it’s highly configurab­le, enabling you to choose exactly what is displayed and where.

Conky should be in your distro’s package manager, so install it in the usual way. If you are using Ubuntu, install the conky-all package, which pulls in some useful extras. Now run conky from a terminal. Apologies if you were expecting an instant beautiful display, all you get is a rather stark black window with white text, which we will need to start to configurin­g. Kill it with Ctrl+c – that’s why we started it from a terminal. If you didn’t, open one now and run killall conky . There’s no window border with a Close button here. Conky reads its settings from ~/.conkyrc, as this file is not present it loads defaults from /etc/conky/conky.conf. You could start with a new config file but let’s make things a little easier for ourselves by copying /etc/conky/conky.conf to ~/.conkyrc and loading it into your favourite editor. The file is split into two sections: the first part defines properties of Conky’s window and the second part, following the line TEXT , determines the contents of the window.

Let’s make a few changes, first we will move the window, find the alignment line and change it to alignment top_right choosing one of top, bottom, middle followed by one of left, right, middle. You may also want to set gap_x and gap_y to set an offset from the left/right and top/bottom of the screen. Now lets get rid of that black background, find the own_window settings (the order doesn’t actually matter but it makes maintenanc­e easier if you keep related setting together and add own_window_transparen­t yes .

While you are in here, you may want to change the font and size. You do not need to restart Conky after changing the config, if you send it a HUP signal from a terminal it will re-read its configurat­ion file, like this $ killall -HUP conky .

If you are using Gnome or KDE you may not get the result you expect, because of the way they draw their wallpaper in a root window on top of the desktop. ( SeetheWhyn­o Transparen­cy?box,p81,onforasolu­tion.)

Getting more informatio­n

Now that we have a reasonable display, let’s get onto the important part and set what is shown in it. The lines following the TEXT line are displayed in Conky’s window. These lines contain plain text and variables and settings, the last two denoted by a leading $, eg the default configurat­ion contains ${color grey}Uptime:$color $uptime .

This sets the text colour to grey, prints the word Uptime, resets the colour to the default then prints the contents of the variable $uptime , which just happens to contain the system uptime. There are two entries in the top part of .conkyrc that affect this, one sets the default colour and the other sets the refresh rate for the variable contents: default_color white update_interval 1.0

There are many variables you can use in conkyrc to show uptime, CPU usage, free memory, network transfer rates, temperatur­es and much more. The Conky man page helpfully lists them all, and there are documented lists of settings and variables to be found at http://conky. sourceforg­e.net/config_settings.html and at

http://conky.sourceforg­e.net/variables.html. Variables are prefixed with a $, if you want to pass an option to it, as with the $color example above, enclose both the variable name and option in braces. If you want a text display all you need to do is add a line for each to conkyrc along the line of

Label $variable . You may want to add some alignment informatio­n. To have the labels left-aligned with the values right-justified, use lines like this: RAM:$alignr$mem/$memmax Disk usage:$alignr${fs_used /home}/${fs_size /home}

These show the amount of RAM and disk space used along with the total amount available. Text displays are very informativ­e, and with some tweaking of transparen­cy and fonts can look attractive, but Conky goes way beyond one item per line tables. First of all, you can vary the position as well as the font with offset and voffset , which can be specified multiple times on the line, look at the Gotham example on the LXFDVD for a fairly extreme example of this. Then you can add images with the image variable, which uses this syntax ${image path/to/image -p X,Y -s WxH} .

The position and size settings are optional, they default to the top left corner of the window at the original size. If the image is larger than the size set for the window, it is cropped, use -s if you need to scale it.

 ??  ?? The difference a single tweak to conkyrc makes, the default display is on left.
The difference a single tweak to conkyrc makes, the default display is on left.
 ??  ??

Newspapers in English

Newspapers from Australia