April 4, 2008...3:25 pm

Create a custum conky setup

Jump to Comments

I’ve wrote about conky before here, but this time I’ll explain how I got the extra’s (gmail, weather, audio) to work with it.

There are some other guides for that, but they tend to be hard to follow and only cover 1 extra feature.

I’ll try to make it as simple as possible so everyone can use it.

updated: 22/08/08

The tutorial is going to based on my recent conky setup. It looks like this:

1. Install conky.

Look at my previous post for that.

2. Basics

Note: you are going to have to restart conky a lot. I suggest you put a terminal on a hotkey (f12) and use the command “killall conky” to kill conky and “conky” to start it again.

I presume you have followed the link in point 1 and have an empty .conkyrc before you.

Past this in the empty file.

background yes
use_xft yes
xftfont 123:size=8
xftalpha 0.1
update_interval 0.5
total_run_times 0
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 250 5
maximum_width 400
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color gray
default_shade_color red
default_outline_color green
alignment top_right
gap_x 10
gap_y 10
no_buffers yes
uppercase no
cpu_avg_samples 2
net_avg_samples 1
override_utf8_locale no
use_spacer yes

This will take care of the place conky is put on the desktop, the width it has, …

Take a good look at those lines.

maximum_width 400 -> changing the number to 200 will result in a smaller conky file, increasing to 500 will cause conky to be wider.

alignment top_right -> this tells conky to be at the top right of the screen.

If you put bottom_left, conky will be on the bottom left, if you put top_center, it will be in the middle of the screen, …

gap_x 10 -> increasing this number or decrease it to have a wider/smaller gap on the x axis of the screen
gap_y 10 -> increasing this number or decrease it to have a wider/smaller gap on the y axis of the screen

default_color gray -> this seems pretty obvious, replace gray with another color.

To get a list of colors, open this file in a browser or text editor:  file:///usr/share/X11/rgb.txt

Conky will be able to use 99% of those colors.

A list of all those things and what they do can be found here.

3. Adding things to conky

If you know run conky, you will not see anything.

You are going to need to add things to it.

Under the previously pasted text, put this

TEXT

Now, everything under TEXT will be visable on your desktop.

To add plain text, just type something. It will appear on your desktop.

You’ll find a list of variables here.

If you find a variable you would like to use, put them in your file like this:

$variable

An example would be

$membar

This will give you a bar with the amount of ram memory is used on your pc.

Other variables need to be put like this

${cpu cpu0}

This will become more logical once you take a peek at my conkyrc file and compare it to the screenshot.

Changes are you’ll want to have different colors in you conky file. Remember the previous list of colors? You can use those.

Before something you want to have a certain color, put this

${color DimGray}

Example:

${color white}This is my ${color red} conky ${color white}file

“This is my file” would be white and “conky” would be red.

Everything that will come after “file” would be white also, unless you specify another color.

It’s also possible to use different fonts.

Take a look at this:

${font Arial:bold:size=10}${color Tan1}PROCESSORS ${color DarkSlateGray}${hr 2}

You see you can specify a font using ${font fontname}. The bold:size=10 should also be obvious.

The ${hr 2} puts a horizontal line on the screen with a width of 2.

That line looks like this:

If you are wondering how people put symbols (like the linux pinguin or weather symbols) in their conky file, those are just fonts.

I suggest you go to dafont.com and look at some fonts with symbols (openlogos for example will give you all the linux/open source symbols).

Another thing to know before you start modifying a conky file you found online, or mine, is offsets.

They are a way to force something to be put higher or lower on the desktop.

You use ${voffset 50} to put somthing “50″ lower, or use ${voffset -50} to put something 50 higher.

This is usefull in quite some cases. You’ll see that this is used all the time in my conkyrc file.

Aligning something in conky is also needed all the time.

$alignr

Will align your text to right, $alignc will put it in the center.

You can also use ${alignc 20}

This will put something in the center, but 20 points of to the right.

The ${align 20} to gether with ${voffset 50} is used to put text next to eachother.

I suggest that at this time, you’ll take a look at my conkyrc file and start modifying it.

background yes
use_xft yes
xftfont 123:size=8
xftalpha 0.1
update_interval 0.5
total_run_times 0
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 250 5
maximum_width 400
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color gray
default_shade_color red
default_outline_color green
alignment top_right
gap_x 10
gap_y 10
no_buffers no
uppercase no
cpu_avg_samples 2
net_avg_samples 1
override_utf8_locale yes
use_spacer yes
text_buffer_size 256

TEXT

${font openlogos:size=20}U${font Arial:size=20}${color Tan1}GNU${color Ivory}LINUX${font openlogos:size=20}t

${voffset -90}
${color DimGray}
${font}
${font Arial:bold:size=10}${color Tan1}SYSTEM ${color DarkSlateGray} ${hr 2}
$font${color DimGray}$sysname $kernel $alignr $machine
Intel Pentium D $alignr${freq_g cpu0}Ghz
Uptime $alignr${uptime}
File System $alignr${fs_type}

${font Arial:bold:size=10}${color Tan1}PROCESSORS ${color DarkSlateGray}${hr 2}
$font${color DimGray}CPU1  ${cpu cpu1}% ${cpubar cpu1}
CPU2  ${cpu cpu2}% ${cpubar cpu2}

${font Arial:bold:size=10}${color Tan1}MEMORY ${color DarkSlateGray}${hr 2}
$font${color DimGray}MEM $alignc $mem / $memmax $alignr $memperc%
$membar

${font Arial:bold:size=10}${color Tan1}HDD ${color DarkSlateGray}${hr 2}
$font${color DimGray}/home $alignc ${fs_used /home} / ${fs_size /home} $alignr ${fs_free_perc /home}%
${fs_bar /home}
/disk $alignc ${fs_used /media/disk} / ${fs_size /media/disk} $alignr ${fs_free_perc /media/disk}%
${fs_bar /media/disk}
/disk-1 $alignc ${fs_used /media/disk-1} / ${fs_size /media/disk-1} $alignr ${fs_free_perc /media/disk-1}%
${fs_bar /media/disk-1}

${font Arial:bold:size=10}${color Tan1}TOP PROCESSES ${color DarkSlateGray}${hr 2}
${color DimGray}$font${top_mem name 2}${alignr}${top mem 2} %
$font${top_mem name 3}${alignr}${top mem 3} %
$font${top_mem name 4}${alignr}${top mem 4} %
$font${top_mem name 5}${alignr}${top mem 5} %

${font Arial:bold:size=10}${color Tan2}NETWORK ${color DarkSlateGray}${hr 2}
$font${color DimGray}IP on eth0 $alignr ${addr eth0}

Down $alignr ${downspeed eth0} kb/s
Up $alignr ${upspeed eth0} kb/s

Downloaded: $alignr  ${totaldown eth0}
Uploaded: $alignr  ${totalup eth0}

${font Arial:bold:size=10}${color Tan2}WEATHER ${color DarkSlateGray}${hr 2}
${font}${color DimGray}

${voffset -25}${font Weather:size=45}${execi 1800 conkyForecast –location=BEXX0008 –datatype=WF}
${alignc 22}${voffset -60}${font Arial:bold:size=10}${color DimGray}${execi 1800 conkyForecast –location=BEXX0008 –datatype=HT}
$font${voffset -55}${alignr}${color DimGray}Wind: ${execi 1800 conkyForecast –location=BEXX0008 –datatype=WS}
${alignr}${color DimGray}Humidity: ${execi 1800 conkyForecast –location=BEXX0008 –datatype=HM}
${alignr}${color DimGray}Precipitation: ${execi 1800 conkyForecast –location=BEXX0008 –datatype=PC}

${color DimGray}Sunrise: $alignr${execi 1800 conkyForecast –location=BEXX0008 –datatype=SR}${alignr}
Sunset: $alignr${execi 1800 conkyForecast –location=BEXX0008 –datatype=SS}$color

${font Arial:bold:size=10}${color Tan2}MUSIC ${color DarkSlateGray}${hr 2}
${color DimGray}$font${if_running mpd}
$mpd_smart
$mpd_album
Bitrate $mpd_bitrate kbits/s
$mpd_status $mpd_elapsed/$mpd_length

${font Arial:bold:size=10}${color Tan2}TIME ${color DarkSlateGray}${hr 2}

${color DarkSlateGray} ${font :size=30}$alignc${time %H:%Mh}
${voffset -30}${font :bold:size=10}$alignc${time %d %b. %Y}
${font :bold:size=8}$alignc${time %A}
$endif

4. Get your external ip adress

To have conky display your external ip adress, use

${execi 3600 wget -O – http://whatismyip.org/ | tail}

I use it like this

External IP$alignr${execi 3600 wget -O – http://whatismyip.org/ | tail}

This looks like this:

5. Audio info

If you took a look at the variables page I linked to before, you’ll see that conky has build in support for audacious, mpd (music player deamon) and xmms2.

You saw how to use those if you took a look at my conkyrc file posted above this.

But you can use other also, a few examples:

Rythmbox:

${exec rhythmbox-client –print-playing –no-start}

Note: it is – - (without the space) instead of –, I can’t help it, WordPress does this automatically.

Exaile:

${execi 10 exaile –get-title} – ${execi 10 exaile –get-artist}

Note: it is – - (without the space) instead of –, I can’t help it, WordPress does this automatically.

6. Weather info

You’ll noticed I had weather info displayed on my screen and it didn’t work on you computer.

This is because it’s using scripts to work.

Take a look here for that.

7. Gmail support

It’s also possible for conky to display gmail info, take a look here for that.

Edit: info about starting conky on start up, or manually can be found in the link of point 1 of this guide.

27 Comments


Leave a Reply