Sign in with
Sign up | Sign in
Closed

How to write a conky config file

This Tutorial addresses:
Conky is a powerful and lightweight monitoring tool for linux. After you successfully installed conky on your distro you will need to create a custom config file named " .conkyrc " and located to /home/yourusername/ . You may also use existing config files from http://conky.sourceforge.net/screenshots.html however these config files may not work well with your system so creating and understanding how the conky config works is good as it allows you to create "your conky". Personally I use a very simple one made it by myself because I like to keep things simple.

1.) The conky variables and settings and the form of the config file :

The typical form of the config file starts with the settings

ConfigSettings : This is a complete table of the settings of conky. These are the very first lines of your conky file you are going to create. Settings define things like the size of conky, fonts, units etc.

after settings the word TEXT follows and then you begin using the objects of conky to get what you want conky show to you.

Variables

a sample and actually my code which is pretty simple :
  1. background yes
  2. alignment top_right
  3. cpu_avg_samples 4
  4. use_xft yes
  5. xftfont Andale Mono-11
  6. update_interval 0.5
  7. total_run_times 0
  8. update_interval_on_battery 10
  9. double_buffer yes
  10. own_window yes
  11. own_window_type override
  12. own_window_transparent yes
  13. default_bar_size 80 8
  14. gap_y 20
  15. gap_x 20
  16. use_spacer left
  17. pad_percents 3
  18. temperature_unit Celsius
  19.  
  20. TEXT
  21.  
  22. ${color red}$alignc$kernel $sysname
  23. ${color red} ${alignc}System: $nodename
  24. $alignc $gw_ip
  25. ${hr}
  26. $alignc CPU Usage
  27. ${hr}
  28. ${color green}core_1: ${cpu cpu1}% ${cpubar cpu1} ${freq_g 1}Ghz
  29. core_2: ${color green}${cpu cpu2}% ${cpubar cpu2} ${freq_g 2}Ghz
  30. Temperature: ${acpitemp}C
  31. ${color red}$hr
  32. $alignc Memory
  33. $hr
  34. ${color green}Total: $memmax
  35. In use: $mem
  36. Free: $memfree
  37. Using $memperc% ${membar memperc}
  38. ${color red}$hr
  39. $alignc Battery
  40. $hr
  41. ${color green}${battery BAT1}


And this is the output on screen:



2.) Understanding the Basics about settings

Let's begin with the settings and the most important ones:

background yes -> means I want conky to be forked in background when it starts
alignment top_right -> pretty obvious I want conky to appear in the top right corner

gap_y 20
gap_x 20 These commands will adjust the position of conky tweak em your way


use_xft yes
xftfont Andale Mono-11
use_spacer left
pad_percents 3

|||| These 4 commands are very important because they may make your life easier, the first defines I will use an xft font, the second is the font I am using and its size, the third and 4th are solving a known issue with conky that actually moves when a percentage value hits double or triple digits, for example cpu usage from 1% to 15% will move conky horizontally to your desktop which is very annoying. This to work needs a Mono font. pad_percents 3 are set to 3 because it can also sometimes be a 3-digit number like cpu usage 100% which actually happens sometimes when you encode videos or etc.


double_buffer yes
own_window yes
own_window_type override
own_window_transparent yes

These commands define how the conky window will be. I found these 4 to make the most beautiful combination as conky will be transparent and without window bars and menu buttons. double_buffer solves some flickering issues.

That cover the basic settings of conky. Someone may want to customize it further. The tools are in the table I linked in the beginning.

Now let's get on with the output of conky, after settings do not forget the TEXT command.

3.)Variables and objects syntax

I do not have to cover much in this section as it's up to you how you are going to configure it. However I will explain how the syntax works.

Every variable needs to have an " $ " before it, for example $hr will draw a line.
Some objects have arguments. I will explain one line of my code which will cover you I think with the syntax and the arguments :

defines the color
of following text
^
|
${color green}core_1: ${cpu cpu1}% ${cpubar cpu1} ${freq_g 1}Ghz

core_1: % Ghz are all just text
Please note that the color will stay the same until you change it to something else


${cpu cpu1} -> this is how arguments of specific objects are being used, if you used ${cpu} would have shown you the average use of cores. The way it is now shows core1 use. Same goes with ${freq_g 1} 1 is the argument which defines that you want to show the frequency of 1st core.

4.) Custom Conky themes, advanced look

http://custom-linux.deviantart.com/gallery/39357745

which you can install with the advanced packaging tool (aka apt) some also support wget.



Can't find your answer ? Ask !