Page 1 of 1

Configuring Conky Rate Topic: -----

#1 erik.price  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 485
  • View blog
  • Posts: 2,690
  • Joined: 18-December 08

Posted 02 April 2010 - 06:36 PM

Configuring Conky

Hey everyone, this will be a rather brief tutorial on customizing Conky, a lightweight, highly extensible system monitor available for X. It runs on flavors of Linux, and BSD.

If you want to check out some configurations others have used, look at the screenshots from the official site, and the massive 1200+ page thread on Ubuntu Forums, here

Are you excited yet? Good! Go ahead and install it with your distro's package manager. (sudo apt-get install conky for Debian, pacman -S conky on Arch, etc.) Or, if you want, grab the source, and install it from there.

Make sure you have a file named .conkyrc in your home directory (this is the configuration file) if you don't, simply create one.

Alright, now let's fire up your favorite text editor, and see what we can do.
I suggest modifying someone else's theme first rather than writing one entirely from scratch, just so you can get a feel for it first. Here is a very simple config, which will just write out "Hello, World!" to the top right corner of the screen.

background yes

update_interval 1 #update every 1 second
use_xft yes #use pretty fonts
own_window yes 
own_window_type normal
own_window_transparent yes #window has no background, see right through to the desktop
own_window_hints undecorated # doesn't draw title bars, just a window

minimum_size 200 5 #sets a min size for the conky window (200x5)
maximum_width 200 #max size

double_buffer yes  #prevents flickering

alignment top_right #places in top right corner

Hello, World! #And hello to you, Conky!

A # designates a line comment. Everything above the "TEXT" line is settings, changing the window type, background colors, and all that good stuff. There are way more settings, but this is just an example afterall. Everything after the "TEXT" line is placed on the window. Anything that isn't recognized as a variable (which we'll get to in just a bit) is placed onto the window verbatim.

Let's say we wanted to center our message, rather than having it off to the left. We would use the variable alignc, which will align all the text on that line (or until another alignment is specified (you can have multiple alignments in a single line)) to the center.

Just so there's no confusion: although they are called variables, things like alignc behave like functions in other languages, in that they do something, rather than store something

So there are two ways to use variables in Conky:
$alignc Hello, World!
${alignc}Hello, World!

In this case, these two forms will produce the same results, but if you wanted to pass an argument to them, you would have to use the second form:
#${color someColor} sets the color of the text to someColor
#$color (same variable, but with no arguments) sets the color back
#to the default color (specified in the configuration section)

${color blue}I'm feeling rather blue :-(
$color Now I'm better! #same as  ${color}Now I'm better!

That's basically it for the syntax. Easy stuff, right?

Now let's move on to making our config file a bit more descriptive.

Check out the Variable Documentation for the list of every available variable you can use to add information to your conky bar.
NOTE: if you see something like this: addr (interface) it means that the interface argument is optional. Anything in parentheses can be omitted, and default options for the variable will be used. Read the description, as that will usually provide useful information on the usage, and the parameters.

Now, let's add a simple CPU monitor and graph to our config.
Check the documentation for the variables cpu, and cpubar

Here is the TEXT section:
CPU Usage: $alignr $cpu %

Here's what it should look like:
Attached Image

If you have a multicore CPU, use the optional parameter cpuN to specify which CPU to measure
For example:
#on a dual core CPU
CPU Usage:
    Core 1: $alignr ${cpu0}%
    ${cpubar cpu0}
    Core 2: $alignr ${cpu1}%
    ${cpubar cpu1}

Alright,so that about wraps up the tutorial. You (hopefully) now know how to customize a Conky configuration. I obviously didn't include how to do everything, but hopefully with the syntax down, you'll be able to create some masterpieces!

If you need more help with usage, you could either leave a comment here, or hop on the #conky channel on freenode, where you'll get help from people much more experienced than I :)

If you want to see what a full Conky config looks like (disclaimer: I suck at designing things, picking colors, and being creative), here is what my current configuration looks like:
Attached Image
And here's the .conkyrc file

use_xft yes
xftfont HandelGotD:size=9
xftalpha 1

update_interval 1
total_run_times 0

own_window yes
own_window_type normal
own_window_transparent no
own_window_colour 222222
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

double_buffer yes

minimum_size 200 5
maximum_width 200

draw_shades yes
draw_outline no
draw_borders no
draw_graph_borders no

default_color white
default_shade_color black
default_outline_color black

alignment top_right
gap_x 12
gap_y 48

no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale no


$sysname $kernel on $machine
${color  red}
Uptime $alignr $color $uptime ${color  red}
Load $alignr $color $loadavg
${color  red}
Hostname $alignr $color $nodename ${color  red}
wlan0 $alignr $color ${addr wlan0}
${color  red}
Inbound $alignr $color ${downspeed wlan0} kb/s
${downspeedgraph wlan0}${color  red}
Outbound $alignr $color ${upspeed wlan0} kb/s
${upspeedgraph wlan0} ${color red}
Total Upload $alignc: $alignr $color ${totalup wlan0} ${color red}
Total Download $alignc: $alignr $color ${totaldown wlan0}
${color red}
$processes ${color}processes (${color red}$running_processes ${color}running)
${color red}
Process Name  $alignr   CPU % $alignr  Mem% ${color yellow}
${top name 1} $alignr ${top cpu 1} $alignr ${top mem 1} ${color orange}
${top name 2} $alignr ${top cpu 2} $alignr ${top mem 2} ${color brown}
${top name 3} $alignr ${top cpu 3} $alignr ${top mem 3} ${color green}
${top name 4} $alignr ${top cpu 4} $alignr ${top mem 4} ${color purple}
${top name 5} $alignr ${top cpu 5} $alignr ${top mem 5} ${color pink}
${color red}
CPU $alignr ${color}${cpu cpu0}%
${cpubar cpu0}
${color  red}
MEM $color $alignc $mem / $memmax $alignr $memperc%
${color  red}
/ $color $alignc ${fs_used /} / ${fs_size /} $alignr ${fs_free_perc /}%
${fs_bar /}
${color  red}
swap $color $alignc $swap / $swapmax $alignr $swapperc%
${color  red}
Disk IO: $color $alignc $diskio
    Read : $diskio_read $alignc ${diskiograph_read /dev/sda 00FF00 FF0000 0 -t }
    Write: $diskio_write $alignc ${diskiograph_write /dev/sda 00FF00 FF0000 0 -t }

As of ${weather KFWN last_update}:
${font 100}${color red}$alignc${weather KFWN weather} $font $color
- - ${color red} Temperature $color $alignc : $alignr${weather KFWN temperature}C
- - ${color red} Pressure $color $alignc : $alignr${weather KFWN pressure}MB
- - ${color red} Wind Speed $color $alignc : $alignr${weather KFWN temperature}km/h
- - ${color red} Humidity $color $alignc : $alignr${weather KFWN humidity}%
- - ${color red} Cloud Cover $color $alignc : $alignr${weather KFWN cloud_cover}

Unless you want the weather for a town near where I live, you'll have to change that to suit your needs :)

Extra Credit: Making Conky Partially Opaque
With Conky, you can either have it fully transparent, or specify a solid background color; you can't have it partially transparent. An easy fix for this is to specify a solid background (I like using #22222, a dark gray) and then go through the CompizConfig Settings Manager (ccsm)
Go to Accessibility > Opacity, Brightness, And Saturation > Add a window specific setting.

For the name, type in class=Conky, and set the slider to the opacity you want.

Here's the original:
Attached Image
And here it is at about 80% opacity, through ccsm:
Attached Image

Have fun! :D

Is This A Good Question/Topic? 0
  • +

Page 1 of 1