How to write a conky config file

Status
Not open for further replies.
G

Guest

Guest
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 :
Code:
background yes
alignment top_right
cpu_avg_samples 4
use_xft yes
xftfont Andale Mono-11
update_interval 0.5
total_run_times 0
update_interval_on_battery 10
double_buffer yes
own_window yes
own_window_type override
own_window_transparent yes
default_bar_size 80 8
gap_y 20
gap_x 20
use_spacer left
pad_percents 3
temperature_unit Celsius

TEXT

${color red}$alignc$kernel $sysname
${color red} ${alignc}System: $nodename
$alignc $gw_ip
${hr}
$alignc CPU Usage
${hr}
${color green}core_1: ${cpu cpu1}%  ${cpubar cpu1} ${freq_g 1}Ghz
core_2: ${color green}${cpu cpu2}%  ${cpubar cpu2} ${freq_g 2}Ghz
Temperature: ${acpitemp}C
${color red}$hr
$alignc Memory 
$hr
${color green}Total: $memmax
In use: $mem 
Free: $memfree	
Using $memperc% ${membar memperc}
${color red}$hr
$alignc Battery 
$hr
${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.



 
Status
Not open for further replies.