Conky on Ubuntu 64 Bit – .conkyrc

Posted by on Mar 9, 2008 in Conky, Programming, Technology, Ubuntu27 comments

Conky ScreenshotI recently installed Conky, which is a highly configurable and “light weight system monitor”. As with many packages, it’s available via the Ubuntu Repositories:

sudo apt-get install conky

The default installation outputs some pretty useful information about the system – CPU usage, RAM/Swap usage, HD IO, HDD space and so on, and there are also some awesome scripts available to pull in other information to the display. The data monitored by Conky is controlled by the .conkyrc file locate in the user Home directory ~/.conkyrc. Opening and editing, or creating this file if it doesn’t exist (Applications -> Accessories -> Text Editor then Save As .conkyrc in the home directory), .conkyrc allows full control of how Conky gathers and displays information. The first section of the file, controls how the physical aspects of Conky is handled – the window size, transparency, position on the desctop etc., and the second part of the file takes a number of variables – both built in to Conky (which gather information such as RAM usage, etc.), and via exec, execi and texeci commands.

The Conky website has a great references on the configuration settings, available variables, and the man page.

I’ve also recently written a post which deals specifically with setting up Dual Core processors – Conky: Dual Core Processors in .conkyrc

As previously mentioned, in addition to Conky’s built in variables, it is possible to execute external shell commands, and even Perl/Python etc. scripts, and have the output sent to Conky for processing. I currently have two scripts installed, both obtained from Ubuntu Forums:

Conky Gmail Revisited, written by lvleph, is a Perl script, which logs into your Gmail account, and checks for new mail periodically (the interval of which is actually controlled via the .conkyrc). The Perl script is easy to download and use. Once I saved the script to ~/ConkyScripts/gmail/ I just had to modify the script to enter my Gmail username and password, and make it executable

cd ~/ConkyScripts/gmail/
sudo chmod a+x

I could then call the script from my .conkyrc:

You have ${texeci 360 perl ~/ConkyScripts/gmail/ n} new gmail(s).

texeci is a Conky command, to which I passed the parameters 360 (an interval in seconds which the script should run), and the shell command to execute – in this case, perl ~/ConkyScripts/gmail/ n (the n is actually a parameter passed to the script!). The original forum post has a great list of installation instructions, thanks to lvleph.

I also added

${execi 360 perl ~/ConkyScripts/gmail/ s}

to .conkyrc which calls the script again, but with “s” as the parameter, to output any new email subjects to Conky.

Conky Weather Revisited V2, also written by lvleph, grabs local weather information. It even comes with its own Weather Font! Again, it’s easy to download and incorporate into the .conkyrc file (I recommend the version from Page 3 of the forum thread – just remember to download the font from the front page). Again, I saved this to its own directory ~/ConkyScripts/weather/ and it was just a matter of calling the script from the .conkyrc as before. Running


in a terminal window outputs the possible parameters which can be passed to the script – the most important being the area code/city code – in my case THXX0027, for Mae Hongson. Again, the original forum post has a great list of installation instructions, thanks to lvleph.

I’ve also recently written a Perl script, which allows BOINC data to be viewed via Conky. See my recent post on BOINC and SETI@Home with Conky, on Ubuntu.

Desktop with Conky

So, here’s my full .conkyrc file, for anyone who’s interested, which outputs the image above – try and tested on an Acer Aspire 5052, with AMD Turion 64 X2 (Dual Core) Processor:

# set to yes if you want Conky to be forked in the background
background no
cpu_avg_samples 2
net_avg_samples 2
out_to_console no
# Use Xft?
use_xft yes
# Xft font when Xft is enabled
xftfont Bitstream Vera Sans Mono:size=8
# Text alpha when using Xft
xftalpha 0.8
on_bottom yes
# Update interval in seconds
update_interval 1
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_transparent yes
own_window_type override
# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes
# Minimum size of text area
minimum_size 260 5
maximum_width 260
# Draw shades?
draw_shades no
# Draw outlines?
draw_outline no
# Draw borders around text
draw_borders no
# Stippled borders?
stippled_borders no
# border margins
border_margin 4
# border width
border_width 1
# Default colors and also border colors
default_color white
default_shade_color white
default_outline_color white
# Text alignment, other possible values are commented
gap_x 15
gap_y 30
alignment top_right
# Gap between borders of screen and text
# Add spaces to keep things from moving about? This only affects certain objects.
use_spacer no
# Subtract file system buffers from used memory?
no_buffers yes
# set to yes if you want all text to be in uppercase
uppercase no
# boinc (seti) dir
seti_dir /usr/lib/boinc-app-seti/setiathome_enhanced
${color #42AE4A}$sysname $kernel $machine - $nodename
${color #42AE4A}Uptime:${color lightgrey} $uptime ${color #42AE4A} Load:${color lightgrey} $loadavg
${color lightgrey}${hr}
${color #42AE4A}Usage (Avg):${color #42AE4A} ${freq_dyn_g}Ghz ${color lightgrey}${cpu cpu0}% ${alignr}${color #42AE4A}${cpubar cpu0 5,80}
${color #42AE4A}Usage (Core 1):${color #42AE4A} ${freq_dyn_g cpu1}Ghz ${color lightgrey}${cpu cpu1}% ${alignr}${color #42AE4A}${cpubar cpu1 5,80}
${color #42AE4A}Usage (Core 2):${color #42AE4A} ${freq_dyn_g cpu2}Ghz ${color lightgrey}${cpu cpu2}% ${alignr}${color #42AE4A}${cpubar cpu2 5,80}
${color #42AE4A}Average
${cpugraph cpu0 42AE4A eeeeee}
${color #42AE4A}Core 1 $alignr Core 2
${color #42AE4A}${cpugraph cpu1 25,120 42AE4A eeeeee} ${color #42AE4A} $alignr${color #42AE4A}${cpugraph cpu2 25,120 42AE4A eeeeee}
${color #42AE4A}Processes:${color lightgrey} $processes ${color #42AE4A}Run:${color lightgrey} $running_processes ${color #42AE4A}CPU Temp:${color lightgrey} ${execi 1100 cat /proc/acpi/thermal_zone/THRM/temperature | grep 'temperature:' | sed -e 's/temperature: //'}
${color #42AE4A}Core 1 Temp: ${color lightgrey}${execi 8 sensors | grep -A 1 'Core0' | cut -c13-16 | sed '/^$/d'} C ${color #42AE4A}Core 2 Temp: ${color lightgrey}${execi 8 sensors | grep -A 1 'Core1' | cut -c13-16 | sed '/^$/d'} C
${color lightgrey}${hr}
${color #42AE4A}CPU Usage PID CPU% MEM%
${color lightgrey} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
${color #42AE4A} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
${color #42AE4A} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
${color #42AE4A}Mem Usage
${color lightgrey} ${top_mem name 1} ${top_mem pid 1} ${top_mem cpu 1} ${top_mem mem 1}
${color #42AE4A} ${top_mem name 2} ${top_mem pid 2} ${top_mem cpu 2} ${top_mem mem 2}
${color #42AE4A} ${top_mem name 3} ${top_mem pid 3} ${top_mem cpu 3} ${top_mem mem 3}
${color lightgrey}${hr}
${color #42AE4A}RAM:${color lightgrey} $mem/$memmax ($memperc%) ${alignr}${color #42AE4A}${membar 5,100}
${color #42AE4A}SWAP:${color lightgrey} $swap/$swapmax ($swapperc%) ${alignr}${color #42AE4A}${swapbar 5,100}
${color #42AE4A}HD IO: ${color lightgrey}${diskio}
${color #42AE4A}${diskiograph 42AE4A eeeeee}
${color #42AE4A}Hard Disk Space:
${color #42AE4A} Root ${color lightgrey}${fs_used /}/${fs_size /}${alignr}${color #42AE4A}${fs_bar 5,120 /}
${color #42AE4A} Win ${color lightgrey}${fs_used /media/hda1}/${fs_size /media/hda1}${alignr}${color #42AE4A}${fs_bar 5,120 /media/hda1}
${color #42AE4A} Data ${color lightgrey}${fs_used /media/hda5}/${fs_size /media/hda5}${alignr}${color #42AE4A}${fs_bar 5,120 /media/hda5}
${color lightgrey}${hr}
${color #42AE4A}Network: ${color lightgrey}${addr eth0}
${color #42AE4A}Down:${color lightgrey} ${downspeed eth0} k/s $alignr${color #42AE4A} Up:${color lightgrey} ${upspeed eth0} k/s
${color #42AE4A}${downspeedgraph eth0 27,120 42AE4A eeeeee 180} $alignr${color #42AE4A}${upspeedgraph eth0 27,120 42AE4A eeeeee 25}
${color lightgrey}${totaldown eth0} $alignr${color lightgrey}${totalup eth0}
${color #42AE4A}Power: ${color lightgrey}${execi 2 acpi | sed -e 's/ .*: //'}
${color #42AE4A}You have ${color lightgrey}${texeci 360 perl ~/ConkyScripts/gmail/ n} ${color #42AE4A}new gmail(s).
${color lightgrey}${execi 360 perl ~/ConkyScripts/gmail/ s}
${color #42AE4A}$font${alignc}Mae Hongson Weather
${color #42AE4A}$font${alignc}Today
${alignc}${voffset -5}${color lightgrey}${font weather:size=30}${execi 3600 perl ~/ConkyScripts/weather/ THXX0027 c cp}${font}$color${voffset -15}${offset 10}${color lightgrey}${execi 3600 perl ~/ConkyScripts/weather/ THXX0027 c c}
${voffset 5}${color #42AE4A}$font${alignc}5 Day Forcast
${voffset -5}${font weather:size=30}${alignc}${offset -45}${execi 3600 perl ~/ConkyScripts/weather/ THXX0027 c 1p}${offset 25}${color orange}${execi 3600 perl ~/ConkyScripts/weather/ THXX0027 c 2p}${offset 25}${color cyan}${execi 3600 perl ~/ConkyScripts/weather/ THXX0027 c 3p}${offset 24}${color green}${execi 3600 perl ~/ConkyScripts/weather/ THXX0027 c 4p}${offset 23}${color red}${execi 3600 perl ~/ConkyScripts/weather/ THXX0027 c 5p}${font}$color
${alignc}${offset -15}${execi 3600 perl ~/ConkyScripts/weather/ THXX0027 c 1}${offset 10}${execi 3600 perl ~/ConkyScripts/weather/ THXX0027 c 2}${offset 10}${execi 3600 perl ~/ConkyScripts/weather/ THXX0027 c 3}${offset 10}${execi 3600 perl ~/ConkyScripts/weather/ THXX0027 c 4}${offset 10}${execi 3600 perl ~/ConkyScripts/weather/ THXX0027 c 5}

The “Post your .conkyrc files w/ screenshots” thread over at Ubuntu Forums has many other .conkyrc examples to peruse.

Tags: , , , ,