Easy configuring conky with conkyconf

Overview

conky](http://conky.sourceforge.net/) is a light-weight powerful monitoring tool that displays information about CPU load and temperature, file systems and RAM usage, hard disk IO and temperature, network traffic, top CPU and memory processes, weather forecast and many other things.

conkyconf is a bash script that generates a conky system or user configuration file based on the information gathered from your system. It has several options which let you add a few things you want to monitor. In addition to this script, the conkyconf package includes a lua script that adds functionality that can’t be done in conky alone and improves conky’s appearance. conkyconf has the following dependencies under openSUSE:

The following NEW packages are going to be installed:
  conky conky-devel conkyconf conkyweather hddtemp imlib2 imlib2-loaders tolua++ 

Credits

The conky version installed with conkyconf is the one with nvidia support I branched from @malcolmlewis’s repo - thanks go to him! It allows conky to monitor nvidia graphics card frequency and temperature. I added curl and rss support to Malcolm’s build - the latter is needed by conkyconf - as well as hddtemp prerequisite.

conkyweather, also installed with conkyconf, is based on google weather](http://hardikmehta.wordpress.com/2009/08/04/a-script-to-display-weather-forecast-for-conkyconky-screen-shot/) by Hardik Mehta. Thanks go to him too!

Installation

To install conkyconf with all dependencies, just install my repo (if you don’t have it already) and the package:

su -l
zypper ar [noparse]http://download.opensuse.org/repositories/home:/please_try_again/openSUSE_11.4/[/noparse]  PTA
zypper refresh 
zypper in conkyconf

Basic Usage

To write a basic conky configuration, just type:

conkyconf

Kde users might want to type the following instead:

conkyconf -k

This command creates the file .conkyrc in the user’s home directory (~/.conkyrc).

The difference between conkyconf an conkyconf -k resides in this conky setting:

--- /root/.conkyrc.kde  2011-08-30 20:51:58.000000000 -0700
+++ /root/.conkyrc      2011-08-30 20:52:20.000000000 -0700
@@ -17,7 +17,7 @@
 own_window_type normal
 own_window_transparent yes
 own_window_class Conky
-own_window_argb_visual yes
+own_window_argb_visual no
 own_window_colour 082103
 own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

To achieve conky’s transparency under kde (and some xfce but not the one in openSUSE 11.4), own_window_argb_visual has to be set to no. Older conkyconf versions used to write a different config file for KDE. Now the conky wrapper (conky.sh) installed with the package takes care of that. There is also a function setargb in the lua script which can switch this value while initializing conky but I wasn’t too happy with this function and disabled it by default.

You can create a standard or KDE-specific system-wide conky configuration by using respectively:

conkyconf -s

or

conkyconf -sk

However the conky wrapper won’t modify the system-wide /etc/conky/conky.conf in user’s session. And it’s not necessary to create a system-wide configuration for conky - but the feature exists.

The basic configuration file generated by conkyconf while used without options displays:

  • Current Date & time and system uptime
  • CPU(s) info and load
  • available and used RAM
  • CPU & Mainboard temperature (if sensors were found). Critical temperatures are displayed in red.
  • Default network interface up and down traffic
  • local IP, gateway and DNS
  • space utilization of mounted filesystems (in GB and percentage)
  • top 5 CPU processes
  • top 3 memory processes

Everytime you run conkyconf, the configuration file gets overwritten with the new settings. When the configuration file has been changed, such as after running conkyconf, conky reloads itself to reflect the new configuration. It is sometimes necessary to kill and restart conky.

Display options

conkyconf has several options that can be used to add other monitoring panels. Each option as a short and a long name.

You can print the available options with:

conkyconf -h

-d --diskio
Monitors write/read IO and temperature of all found hard disks.

-N --nvidia
Monitors nvidia GPU frequency and temperature. This option is ignored if the nvidia module is not loaded or the conky version used doesn’t have nvidia support.
The temperature sensor might not be available on older nvidia chipsets (such as GeForce 6150). In this case N/AC will be displayed (I’ll fix this detail later). A lua function defined in /etc/conky/conky.lua returns the temperature in red if it exceeds the threshold given by the sensor.

-w --weather
-f --forecast
Weather and weather forecast. Simply use -wf for both. These options requires conkyweather, installed with conkyconf.

**-g --geo **<location>
Specifies the geographical location as City,Country State for weather info and forecast above. You have to use this option, as the default location defined in conkyconf is unlikely to be your place. Don’t try too many locations or you will get banned fom Google weather site (it happened to me). Last time I checkecd, locations like the following were valid:

-g London,UK
-g Sydney,AU
-g Austin,TX
-g Paris,FR

You can (and you should) also modify the default location by editing /usr/bin/conkyconf as root and changing the value of the variable LOC in the script. Then you won’t have to specify it on the command line.

**-r --rss **<RSS feed>
Displays RSS feed in one line of horizontal scrolling text. The default rss feed for openSUSE is ‘http://forums.opensuse.org/external.php?type=RSS2’. It can be changed in /usr/bin/conkyconf. Horizontal scrolling doesn’t work properly in conky 1.8.0. It got fixed in conky 1.8.1 at the cost of new line parsing. Basically both conky versions are buggy, but I would say that the bug in 1.8.1 is worse. It prevents conky from parsing strings returned by the lua script (or by any external command) correctly as soon as they include more they one line. Thus conkyconf checks which conky version is installed and generates a configuration file accordingly. Version 1.8.0 makes internally a better use of the lua functions but the appearance of conky shows no difference.

-l --log <logfile>
-n --lines <lines>
Displays the number of lines of the given logfile. You need read access to this file. It doesn’t work very well because of the bugs mentioned above.

other options

-k --kde
generates a config file appropriate for kde transparency

**-i --interval **<n.n>
This option sets the given update interval in ~/.conkyrc but doesn’t overwrite other settings or variables. The default update interval is 1 second. Increasing this value will drasticaly reduce conky’s CPU usage. You can try

conkyconf -i 5

and (just for fun):

conkyconf -i 0.1

and watch the difference.

-p --print
prints the generated config file to standard output rather than writing it - useful for testing.

other variables you can change

You can change several default values in the script itself. Some of them have can be set by command line options.

variables/default value        cli option        	 

LOC="Victoria,BC"	      -g --geo	        # City/State, province or country for weather info.
interval=1.0		      -i --interval	# Update interval  
log=/var/log/messages	      -l --log          # default log file				 	
lines=5			      -n --lines        # number of log lines to display


topcpu=5				        # Number of top CPU processes to display - 0 to disable
topmem=3				        # Number of top MEM processes to display - 0 to disable
vspace=3				        # vertical space in pixels between panels
alignment=top_right		                # top_left, top_right, bottom_left, bottom_right, none

Colors

There are 5 color themes predefined in conkyconf. The one used by default is determined by the first 3 letters of the Distributor ID returned by lsb_release: sus fed man arc and ubu - or the first 3 letters of the value stored in the variable OS in all other cases. You can overwrite some of all colors in the theme by uncommenting these colors and changing their value:

# You can define some colors here to overwrite the distro themes.
# You have to to define the colors here if the distro colors are not defined!
# !!! When specifying the color value in hex, omit the leading hash (#) !!! 

#own_window_color=black
#default_color=white
#label_color=goldenrod	
#caption_color=white
#hr_color=white
#fs_color=white
#fs_used_color=red
#fs_free_color=green
#weather_label_color=yellow
#weather_color=yellow
#value_color=yellow
#frame_color=ivory1
#forecast_color=LightGray
#critical_color=red
#fs_pct_color=yellow
#cpu_pct_color=white
#shade_color=black
#outline_color=black
#uptime_color=DarkOrange1
#netup_color=red
#netdown_color=yellow
#proc_run_color=red
#forecasticon_color=LightGray
#rss_color=yellow

# !!! The following colors must be specified in hex.
#fs_bar_color=00ff00
#cpubar_color=ffa500
#cpugd1_color=ffe421
#cpugd2_color=ff0000
#netdowngd1_color=000000
#netdowngd2_color=00ff00
#netdupgd1_color=000000
#netdupgd2_color=ff0000
#log_color=af0000

http://www.unixversal.com/linux/openSUSE/conkyconf_thumb.png](http://www.unixversal.com/linux/openSUSE/conkyconf.png)

More settings from here

conkyconf covers only a few of the many conky variables. You can modify the ~/.conkyrc file created by conkyconf to suit your needs. Be aware though that this file will be overwritten next time you run conkyconf. For more info, read the documentation about conky variables and config file settings.

The conky wrapper

The conky wrapper (/usr/bin/conky.sh) is a small bash script that you can use to start conky. It checks if conky is already running before starting it - don’t use it if you want to launch several instances of conky! It set the value of own_window_argb_visual to yes or no by checking the value of the environment variable DESKTOP_SESSION. This variable is set by kdm and gdm. It won’t work if your kde session is not called ‘kde’. It works for me because I try to organize things in the way that seems the most clean and the most logical to me, and so my kde session is called ‘kde’. If yours is called ‘default’ - as explained in this post by jdmcdaniel3, either modify your session name or the conky wrapper, or don’t use it. It is only useful if you often switch between KDE an other desktops and want to preserve conky’s transparency. Transparency only works under KDE when compositing (desktop effects) is enable. Most people use desktop effects under KDE and there are on by default. However, the conky wrapper checks if KDE compositing is enable and if not, starts the simple compositing manager xcompmgr (if present), providing a way to have conky’s transparency under KDE without desktop effects.

compositor

Compositor is a bash script that set/unset composting on the fly under various desktops. As I originally wrote it to test conky transparency, it is included in conkyconf.

Autostarting conky

conkyconf includes /etc/xdg/autostart/conky.desktop wich starts conky.sh by default in Gnome, XFCE, LXDE and other sessions evaluating the files in /etc/xdg/autostart, such as openbox-session running xdg-autostart in ~/.config/openbox/autostart.sh:

# Run XDG autostart things.  By default don't run anything desktop-specific
# See xdg-autostart --help more info
DESKTOP_ENV="OPENBOX"
if which /usr/lib64/openbox/xdg-autostart >/dev/null; then
  /usr/lib64/openbox/xdg-autostart $DESKTOP_ENV
fi

To prevent the conky wrapper from starting automatically, you can disable it in the desktop’s sessions and autostart setup or edit the /etc/xdg/autostart/conky.desktop and change these values:

--- /etc/xdg/autostart/conky.desktop.orig       2011-08-31 11:02:49.000000000 -0700
+++ /etc/xdg/autostart/conky.desktop    2011-08-31 11:03:34.000000000 -0700
@@ -6,7 +6,7 @@
 Exec=conky.sh
 StartupNotify=false
 Terminal=false
-Hidden=false
+Hidden=true
 X-KDE-autostart-phase=2
 NotShowIn=KDE;
-X-GNOME-Autostart-enabled=true
+X-GNOME-Autostart-enabled=false

To start conky rather than the wrapper, replace Exec=conky.sh with Exec=conky.

To autostart conky or conky.sh in kde, create the file ~/.kde4/Autostart/conky.desktop with the following content:

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Name=conky
Exec=conky
StartupNotify=false
Terminal=false
Hidden=false
**X-KDE-autostart-phase=2**
OnlyShowIn=KDE;

X-KDE-autostart-phase=2 is needed to start conky after the saved session, so that it doesn’t get both restored and autostarted. This variable seems to be evaluated only in ~/.kde4/Autostart but NOT in ~/.config/autostart (and the system-wide /etc/xdg/autostart). Alternatively, you can add excludeApps=conky in the [General] section of ~/.kde4/share/config/ksmserverrc to exclude conky from sessions.

To autostart conky in icewm-session, create the file ~/.icewm/startup with following content:

#!/bin/bash
( sleep 1 && conky.sh ) 

|Another broken thing in Conky 1.8.1 is apcupsd support. Since it was working in the previous version, I reversed a patch to restore apcupsd.c and apcupsd.h from the previous version. It worked (as shown on the picture right). Not sure how clever it was, but it worked on all distros I applied the patch. The reverse patched version of conky is available in my repo. This version should get installed together with conkyconf.
|
I also added an option in conkyconf to monitor ups status, load,charge and time left. It requires the apcupsd daemon to run. If apcupsd is not running, the option wil be ignored.
If apcupsd is not installed, you can install it with zypper:

zypper in apcupsd

conkyconf options

[TABLE=“class: grid, width: 80%, align: center”]
[TR]
[TD]monitors|option|
|

  • Current Date & time and system uptime
  • CPU(s) info and load
  • available and used RAM
  • CPU & Mainboard temperature
  • Default network interface up and down traffic
  • local IP, gateway and DNS
  • space utilization of mounted filesystems
  • top 5 CPU processes
  • top 3 memory processes

|none|
|

  • ups status,load, charge, time left

|**
-u --ups
**|
|

  • Nvidia GPU frequency and temperature

|**
-N -nvidia**|
|

  • Hard disk read/write IO and temperature

|**
-d --diskio**|
|

  • Weather info
  • Weather forecast
  • location
  • Or set the default value of LOC in /usr/bin/conkyconf
    to match your location.|**
    -w --weather
    -f --forecast
    -g --geo **|
    |

    • rss feed
  • or set the devault value of sus_rss in /usr/sbin/conkyconf|**
    -r --rss** |
    |

    • latest n lines of a log

|-l --log
-n --lines |
|

  • update interval (in seconds with 1 decimal place)

|**
-i --interval** <n.m>|
|

  • KDE transparency

|**
-k --kde
**|

[/TD]
[TD]http://img197.imageshack.us/img197/3197/conkyopensuse.png[/TD]
[/TR]
[/TABLE]

Short options can be combined if they don’t have arguments. Here’s the ~/.conkyrc generated by conkyconf -wfduNr on my system. This file doesn’t show all conky’s variables. Everything in red in the example below is returned to conky by the lua script /etc/conky/conky.lua, included in the conkyconf package.

# check http://conky.sourceforge.net/config_settings.html for the list of settings
# Check http://conky.sourceforge.net/variables.html for the list of variables

background yes

font 7x13
# Use Xft?
use_xft yes
xftfont Bitstream Vera Sans Mono:size=9
xftalpha 0.8
override_utf8_locale no
short_units

update_interval 1.0
total_run_times 0

own_window yes
own_window_type normal
own_window_transparent yes
own_window_class Conky
own_window_argb_visual no
own_window_colour 082103
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

double_buffer yes
minimum_size 320 5
maximum_width 320
max_text_width 0

draw_shades yes
draw_outline no
draw_borders no
draw_graph_borders yes
stippled_borders 5
border_inner_margin 0
border_outer_margin 0
border_width 1

default_color white 
default_shade_color black 
default_outline_color black
color0 PaleGreen
color1 DarkSeaGreen
color2 SeaGreen
color3 GreenYellow
color4 red
color5 white
color6 DarkOliveGreen3
color7 DarkOliveGreen2
color8 white
color9 ForestGreen
default_bar_size 115 10

alignment top_right
gap_x 8
gap_y 2 

no_buffers yes
uppercase no
cpu_avg_samples 2
net_avg_samples 2
use_spacer none

top_name_width 18
top_cpu_separate false

lua_load /etc/conky/conky.lua
lua_startup_hook init

TEXT
${if_running plasma-desktop}${voffset 35}${endif}${color}${time %a, %d %b %Y, %H:%M:%S} ${goto 190}${color0}Uptime:${color DarkOrange1} ${uptime}
${color2}${stippled_hr}
${color0}Linux Kernel: ${color8}${kernel} on ${machine}
${color0}CPU Details:  ${color8}${machine}, $freq(MHz)
${color0}CPU1:${offset +4}${lua_parse cpubar 1 ffa500 ffffff}${goto 165}${color0}CPU2:${offset +4}${lua_parse cpubar 2 ffa500 ffffff}
${voffset 3}${color0}RAM used:${color8}${alignr 160} ${mem} ($memperc%)${goto 165}${lua_parse temperature CPU}
${color0}Available RAM:${color8}${goto 100}${memmax}${goto 165}${lua_parse temperature MB}
${color9}${cpugraph 3dba19 aecf4c -t -l}
${if_running apcupsd}${apcupsd localhost 3551}${if_match "${apcupsd_model}" != "N/A"}${voffset 3}${color1}APC: ${color6}${apcupsd_model}${color2}${hr}
${color6}status${goto 60}load${goto 190}charge${goto 250}time left
${lua_parse apcbar 7cdd17 white}${endif}${endif}
${voffset 3}${color1}Nvidia Gfx card ${color2}${hr}
${color0}GPU Frequency:${color8}${goto 110}${nvidia gpufreq} Mhz ${lua_parse gputemp temp}
${color0}Mem Frequency:${color8}${goto 110}${nvidia memfreq} Mhz${goto 165}${color0}Image quality:${color8}${alignr}${nvidia imagequality} 
${if_up eth0}${voffset 3}${color1}Network ${color}($nodename) ${color2}${hr}
 ${color}eth0: ${color0}Down:${color yellow1} ${downspeed eth0}/s${color0}${goto 190}Up:${color OrangeRed1} ${upspeed eth0}/s
 ${color9}${downspeedgraph eth0 24,150 000000 91ec31} ${color9}${upspeedgraph eth0 24,150 000000 ec3131}
 ${color0}Address: ${color}${addr eth0}${alignr}${color0}TCP Connections: ${color}${tcp_portmon 1 65535 count}
 ${if_gw}${color0}gateway: ${color}${gw_ip}$endif${alignr}${color0}dns: ${color}${nameserver}${endif}
${voffset 3}${color1}File Systems ${color2}${hr}
${if_mounted /}${color3}/${goto 80}${alignr}${color4}${fs_used /}${color}/${alignr 10}${color5}${fs_size /}${goto 200}${alignr}${lua_parse fsbar / 7fff00 white}${endif}
${if_mounted /usr}${color3}/usr${goto 80}${alignr}${color4}${fs_used /usr}${color}/${alignr 10}${color5}${fs_size /usr}${goto 200}${alignr}${lua_parse fsbar /usr 7fff00 white}${endif}
${if_mounted /local}${color3}/local${goto 80}${alignr}${color4}${fs_used /local}${color}/${alignr 10}${color5}${fs_size /local}${goto 200}${alignr}${lua_parse fsbar /local 7fff00 white}${endif}
${if_mounted /var}${color3}/var${goto 80}${alignr}${color4}${fs_used /var}${color}/${alignr 10}${color5}${fs_size /var}${goto 200}${alignr}${lua_parse fsbar /var 7fff00 white}${endif}
${if_mounted /home}${color3}/home${goto 80}${alignr}${color4}${fs_used /home}${color}/${alignr 10}${color5}${fs_size /home}${goto 200}${alignr}${lua_parse fsbar /home 7fff00 white}${endif}
${if_mounted /srv}${color3}/srv${goto 80}${alignr}${color4}${fs_used /srv}${color}/${alignr 10}${color5}${fs_size /srv}${goto 200}${alignr}${lua_parse fsbar /srv 7fff00 white}${endif}
${if_mounted /misc}${color3}/misc${goto 80}${alignr}${color4}${fs_used /misc}${color}/${alignr 10}${color5}${fs_size /misc}${goto 200}${alignr}${lua_parse fsbar /misc 7fff00 white}${endif}
${voffset 3}${color1}Disk IO ${color2}${hr}
${color0}dev${alignr 165}write${alignr 122}read${alignr 90}temp
${color3}sda${alignr 110}${color white}${diskio_write sda}${alignr 50}${color8}${diskio_read sda}${alignr 20}${color white}${hddtemp /dev/sda}${lua_parse deg}${alignr 5}${color9}${diskiograph sda 12,70 3dba19 aecf4c 0 -t -l}
${color3}sdb${alignr 110}${color white}${diskio_write sdb}${alignr 50}${color8}${diskio_read sdb}${alignr 20}${color white}${hddtemp /dev/sdb}${lua_parse deg}${alignr 5}${color9}${diskiograph sdb 12,70 3dba19 aecf4c 0 -t -l}
${color3}sdc${alignr 110}${color white}${diskio_write sdc}${alignr 50}${color8}${diskio_read sdc}${alignr 20}${color white}${hddtemp /dev/sdc}${lua_parse deg}${alignr 5}${color9}${diskiograph sdc 12,70 3dba19 aecf4c 0 -t -l}
${voffset 3}${color1}Processes:${color} ${processes}  ${color1}Running:${color red1} ${running_processes} ${color2}${hr 1}
${alignc}${color0}(top 5 sorted by CPU usage)
${color0}NAME${alignr 110}PID${alignr 60}CPU%${alignr 20}MEM%
${lua_parse top cpu 1}${top name 1}${alignr 80}${top pid 1}${alignr 45}${top cpu 1}${alignr 20}${top mem 1}
${lua_parse top cpu 2}${top name 2}${alignr 80}${top pid 2}${alignr 45}${top cpu 2}${alignr 20}${top mem 2}
${lua_parse top cpu 3}${top name 3}${alignr 80}${top pid 3}${alignr 45}${top cpu 3}${alignr 20}${top mem 3}
${lua_parse top cpu 4}${top name 4}${alignr 80}${top pid 4}${alignr 45}${top cpu 4}${alignr 20}${top mem 4}
${lua_parse top cpu 5}${top name 5}${alignr 80}${top pid 5}${alignr 45}${top cpu 5}${alignr 20}${top mem 5}
${alignc}${color0}(top 3 sorted by MEM usage)
${color0}NAME${alignr 110}PID${alignr 60}CPU%${alignr 20}MEM%
${lua_parse top mem 1}${top_mem name 1}${alignr 80}${top_mem pid 1}${alignr 45}${top_mem cpu 1}${alignr 20}${top_mem mem 1}
${lua_parse top mem 2}${top_mem name 2}${alignr 80}${top_mem pid 2}${alignr 45}${top_mem cpu 2}${alignr 20}${top_mem mem 2}
${lua_parse top mem 3}${top_mem name 3}${alignr 80}${top_mem pid 3}${alignr 45}${top_mem cpu 3}${alignr 20}${top_mem mem 3}
${voffset 3}${color1}Weather ${color6} (Victoria,BC)${color2}${hr 1}
${font weather:size=45}${alignr 30} ${lua_parse weather_icon /usr/bin/conkyweather "Victoria,BC"}${font}${voffset -50}
${color6}Temperature:${goto 100}${color7}${execi 1800 /usr/bin/conkyweather "Victoria,BC" ct}
${color6}Conditions:${goto 100}${color7}${execi 1800 /usr/bin/conkyweather "Victoria,BC" cc}
${color6}Humidity:${goto 100}${color7}${execi 1800 /usr/bin/conkyweather "Victoria,BC" ch}
${color6}Wind:${goto 100}${color7}${execi 1800 /usr/bin/conkyweather "Victoria,BC" cw}
${voffset 3}${offset 12}${color aaaaaa}${execi 3600 /usr/bin/conkyweather "Victoria,BC" dl}
${offset 12}${color aaaaaa}${font weather:size=36}${execi 3600 /usr/bin/conkyweather "Victoria,BC" fcp}${font}
${offset 12}${color aaaaaa}${execi 3600 /usr/bin/conkyweather "Victoria,BC" fct}
${voffset -3}${color2}${hr}
${offset 10}${scroll 44 ${color yellow}${rss http://www.planetsuse.org/global/rss20.xml 1 item_titles 10 1}}
#
${voffset -3}${color2}${hr 1}

What doesn’t work … or not so well.

  • To work around the new line parsing bug in version 1.8.1, I never return more than 1 line of text from the lua script. This makes ~/.conkysrc longer and using more lua calls. The ~/.conkysrc generated by conkyconf while using conky 1.8.0 is significantly shorter. This version also supports apcupsd (I had to reverse patch version 1.8.1 to regain this feature as I explained before).

  • When monitoring rss feed from this forum (or others), you’ll get garbage from non UTF-8 titles containing special characters. It might also prevent conky from starting. In this case, just rerun conkyconf withouth the option -r
    or choose another rss feed.

  • I didn’t manage to right justify correctly the Disk IO write an read columns and didn’t want to use a new line and negative vertical offset (because the result was worse at the end).

  • I could not make Conky print the degree symbol (°) with the workaround suggested on Conky’s site:

${iconv_start UTF-8 ISO_8859-1}° ${iconv_stop}

iconv didn’t recognize UTF-8 but used the value of $LANG (for example en_US.UTF-8). It would have required to read this variable before, which wouldn’t have been a big problem if it had worked, but even by converting from the right charset, I wasn’t able to print the degree symbol. So I applied the following trick which might probably not work for everyone.

[LIST]

  • Use this setting in ~/.conkyrc:
override_utf8_locale no
  • Set this (constant) variable in /etc/conky/conky.lua:
local DEG   = "°C"

and use a lua_parse in conky to get this value. From what I can see now, the degree symbol is displayed correctly on all machines I have tested so far. If it doesn’t work for you, because you’re using another charset, try to change this symbol in /etc/conky/conky.lua.

[/LIST]

|conkyconf v. 2.6
|

  • New options added for tcp ports and Internet ip monitoring
  • More efficient syntax error checking
  • Default update interval set to 5s instead of 1s.

[TABLE=“class: grid, width: 90%, align: center”]
[TR]
[TD]monitors|cli options|conkyconf variables/default|
|

  • Internet IP address

The external IP will be checked every 10 minutes. You can set another interval in the variable ipCheck in conkyconf.|-I --ip|ipCheck (600)|
|

  • tcp ports (tcp_portmon)

By default all tcp ports (1-65535) are monitored. ssh and nfs connections are highlighted in red ; connections to the local machine are displaye in grey.|-t -tcp||
|

  • first tcp port to monitor (default:1)

|-b --begin <port>|startport (1)|
|

  • last tcp port to monitor (default: 65535)

|**
-e --end <port>**|endport (65535)|
|

  • number of tcp connections to display (default 5)

|-c --connections <n>|toptcp (5)|

The .conkyrc of the example at right was generated with the command:

conkyconf -uIt -c 20

Other examples:

monitoring first 10 connections on tcp ports 22 to 2049 (including ssh and nfs connections)

conkyconf -t -b 22 -e 2049 -c 20

monitoring only ssh connections on port 22. Since the -c option is not specified, the first 5 connections will be displayed by default.

conkyconf -t -b 22 -e 22

[/TD]
[TD]http://img826.imageshack.us/img826/8265/conkytcpmon.png[/TD]
[/TR]
[/TABLE]

The code:

The repo:

It’s actually the opposite. own_window_argb_visual has to be set to yes for KDE and no for Gnome. conky.sh does it right though. The only issue I still have with KDE transparency is that it doesn’t work the first time I start KDE after switching this value - I don’t know why since conky.sh is started from ~/.kde4/Autostart (and not ~/.config/autostart!) with the option X-KDE-autostart-phase=2, so it gets started after plasma and the panel and is not saved in the session. Adding a delay of 3 and even 10 seconds in conky.sh didn’t help. It only occures the first time though. The issue resolves on it’s own at next KDE login, or by killing ans restarting conky, or by manually editing ~/.conkyrc before starting KDE and setting own_window_argb_visual to yes.

Notice that it happens in both cases with and without desktop effects (when desktop effects are disabled, the conky wrapper starts xcompmgr - if available - to achieve transparency).

Possibles values of own_window_argb_visual for conky transparency

       ||wm compositing|on|off|

|—|—|—|—|
|KDE 4.7.1 (ArchLinux)|on_windows_argb_visual|yes|yes*|
|KDE 4.6.5 (Fedora 15)|on_windows_argb_visual|yes|yes*|
|KDE 4.6.0 (openSUSE 11.4)|on_windows_argb_visual|yes|yes*|
|Gnome2 & Gnome3 fallback|on_windows_argb_visual|yes or no|no|
|Gnome3 (gnome-shell)|on_windows_argb_visual|yes or no|N/A|
|Xfce 4.8.0 + xfwm4 4.8.1 (GTK±2.22.1 - openSUSE 11.4)|on_windows_argb_visual|yes or no|no|
|Xfce 4.8.0 + xfwm4 4.8.1 (GTK±2.24.4 - Fedora 15)|on_windows_argb_visual|yes|yes*|
|Xfce 4.8.0 + xfwm4 4.8.1 (GTK±2.24.6 - ArchLinux)|on_windows_argb_visual|yes|yes*|
|||||
||xcompmgr compositing|
|LXDE + Openbox/ Openbox stand alone|on_windows_argb_visual|yes or no|no|
|icewm|on_windows_argb_visual|no|no|
|sawfish|on_windows_argv_visual|yes or no|no|
|fvwm2|on_windows_argv_visual|yes or no|no|

  • requires xcompmgr for transparency.

This version of the conky wrapper tries to achieve transparency in all cases:

#! /bin/bash

# switches the value of own_window_argb_visual for transparency.
# is has to be set to "yes" under KDE and "no" under the 
# other desktops.
 
# Transparency under KDE only works if compositing is enabled. 
# uncomment the line below to start conky when KDE compositing
# is disabled. if xcompmgr is installed, it will be started
# to provide soft shadows, translucency and a smooth fade effect.
# If neither KDE nor xcompmgr compositing is available, conky
# will have a black background :-(
COMPOSITING=no 
xcompmgr_options="-c -f -t-5 -l-5 -r4.2 -o.55"

cfg=/etc/conky/conky.conf
 -f ~/.conkyrc ] && cfg=~/.conkyrc
 -w $cfg ] || echo "You're not allow to write $cfg"
argb=$(awk '/own_window_argb_visual/ { print $2 }' $cfg)
 "x$argb" == "x" ] && exit

case $DESKTOP_SESSION in
kde*)
if  "$(kreadconfig --file kwinrc --group Compositing --key Enabled)" == "false" ] ; then
    if  "x$COMPOSITING" == "xno" ] ; then
        which xcompmgr &>/dev/null && ( ps nc -C  xcompmgr >/dev/null || xcompmgr $xcompmgr_options & )
    else
        exec echo "compositing is off"
    fi
fi
 "$argb" == "no" ] && sed -i 's/own_window_argb_visual.*/own_window_argb_visual yes/' $cfg
;;

xfce*)
compositing=$(xfconf-query -c xfwm4 -p /general/use_compositing)
if  "$compositing" == "false" ] ; then
    if  "x$COMPOSITING" == "xno" ] ; then
        which xcompmgr &>/dev/null && ( ps nc -C  xcompmgr >/dev/null || xcompmgr $xcompmgr_options & )
        sleep 1
    else
         "$argb" == "yes" ] && sed -i 's/own_window_argb_visual.*/own_window_argb_visual no/' $cfg
    fi
fi
;;

*)  "$argb" == "yes" ] && sed -i 's/own_window_argb_visual.*/own_window_argb_visual no/' $cfg ;;
esac

ps nc -C conky >/dev/null || exec conky
echo "conky is already running"

Is this thread still active?

I’m not new to Linux but I am too openSuse. How can I change all the temp readings to read imperial/standard. I live in the US.

Good question! I don’t know why I never worried about that. I have no excuse. I’ll have to add an option — but OBS has been down for me for about 36 hours now.

For now, if you have installed conkyweather (it is automatically installed with conkyconf) you can apply this patch to get the temperature in F.


--- ./share/conkyweather/currentTemp.xslt.orig  2012-04-13 16:52:04.717571660 -0700
+++ ./share/conkyweather/currentTemp.xslt       2012-04-13 16:52:40.233289021 -0700
@@ -21,7 +21,7 @@
  
        
     <xsl:template match="weather">
-        <xsl:value-of select="current_conditions/**temp_c**/@data"/>
-        <xsl:text> **C**</xsl:text>
+        <xsl:value-of select="current_conditions/**temp_f**/@data"/>
+        <xsl:text> **F**</xsl:text>
     </xsl:template>
 </xsl:stylesheet>

--- ./bin/conkyweather.orig     2012-04-13 16:44:07.507932242 -0700
+++ ./bin/conkyweather  2012-04-13 16:44:22.642237953 -0700
@@ -30,7 +30,7 @@
 #echo $CONDITIONS
 
 # s=standard units, m=metric units
-UNITS=**m**
+UNITS=**s**
 
 # where this script and the XSLT lives
 RUNDIR=/usr/share/conkyweather 

In case you don’t know how to apply the patch and for anyone else, here’s how to proceed:

  • save the code above in a text file that you call conkyweather.patch and place in /tmp
  • type:

$ cd /usr
$ sudo patch -b -p0 < /tmp/conkyweather.patch

It should modify the files /usr/bin/conkyweather and /usr/share/conkyweather/currentTemp.xslt.

If the patch doesn’t work (got broken by copy/pasting), replace the text in red with the text in blue in these two files.

OK. It was simply missing in conkyweather. I didn’t write this program. I think the author, Hardik Mehta, lives in Germany. I use celsius and never paid attention. So I added this feature in conkyweather as well as an option in conkyconf to turn it on. You should update conkyconf and conkyweather.

To display the temperature in farhrenheit, use the option -F.
Example: to display weather + weather forecast in F:

conkyconf -wfF

Without the option -F, conkyconf will use celsius by default.

You can combine different options with conkyconf.

Example:

conkyconf -wfFduNt

= displays weather + weather forecast in F, monitors disk IO, UPS, Nvidia graphics card and (by default) 5 tcp/ip connections.

That did it, thanks.

It seems google weather API is not available anymore. Google is planning to close this awesome service.
Is it possible to switch for worldweatheronline.com ? Actually, google uses this service.

They did already: Google Silently Kills Popular API, Breaks Weather Apps Everywhere | Lifehacker Australia

In theory, but people have to register to use this api and get their own key. I’m not sure how many will do that. … I’ll look if I can start something with the rss feed from theweathernetwork.com - not as convenient as an api though.

|OK. I rewrote conkyweather entirely (Actually I wrote it this time. I didn’t write the original googleweather, just added some features and packaged it). I guess I can just copy/paste the new package description from the spec file:
|

%description
This new version of conkyweather retrieves weather information from
theweathernetwork.com and displays it in conky. It has nothing to do
anymore with the previous version (0.3.2) originally written by Hardik Mehta,
which used the Google api. A complete rewriting of this script was
necessary because the Google free api is not available anymore.
This version doesn’t use the conkyweather True Type font but .png icons (which
requires conky to be compiled with imlib2 support).
This package still includes the old script, xslt files and patches in a .tgz
archive, in case somebody would like to try to make them work wit another api.
This new version downloads and parses the RSS feed (not an api).

As stated above, this script uses the RSS feed from theweathernetwork.com. It’s a good news for Canadians … I hope it will be acceptable for the rest of the world - maybe not everywhere though.

Of course I had to do a lot of changes in conkyconf too, but functionality and usage remain the same.

new options:

-U --weatherupdate : update interval for weather data in minutes (default: 60)

changed options:

-g --geo <location> : doesn’t take “City,Country|State|Province” as argument anymore but just a city code.
Find out your city code on theweathernetwork.com. For example here’s the url for Portland, OR:

[noparse] http://www.theweathernetwork.com/weather/usor0275[/noparse]

](Portland, Oregon 7 Day Weather Forecast - The Weather Network)Thus you will use this code usor0275 (and option** -F** if you want the temperature in Fahrenheit):

conkyconf -wf -g usor0275 -F

- f --forecast : implies current weather info.** -wf is the same as -w**.
The reason is that it is not possible to positionate images relatively in conky - it’s certainly possible in lua+cairo, but I don’t know how. Therefore I also had to place the weather info at the top (but it looks better IMO).

|ImageShack - Best place for all of your image hosting and image sharing needs

Thanks, it does work!!!
Sorry to bother you, but it seems as we dont have opportunity to get parameters (temperature, humidity, wind etc.) separate. (maybe I’m wrong and there is keys to get it?)
It would be nice if we can do it like this old way
${color0}Temperature: ${goto 100}${color grey60}${execi 5000 /usr/bin/conkyweather -g usor0275 ct}
${color0}Conditions: ${goto 100}${color grey60}${execi 5000 /usr/bin/conkyweather -g usor0275 cc}
${color0}Humidity: ${goto 100}${color grey60}${execi 5000 /usr/bin/conkyweather -g usor0275 ch}

So, we have got different color and styles for titles and values.

That’s right - I’m sorry. I rewrote conkyweahter from scratch. It’s a totally different script. It uses only 2 xslt files: weather.xslt and forecast.xslt (located in /usr/share/conkyweather) to parse the output of the RSS feed. I have to admit that using a RSS feed, which is intended to be human readable, is not the best approach. It would more efficient to use a “machine readable” api. But that’s all I have to offer for now.

No you can’t do that. But the new way is better because ${execi} in conky uses too much resources. This new version calls two lua functions “conky_weather” and “conky_forecast” (you can see them in /etc/conky/conky.lua) Unfortunately, aligning the values with ${goto} doesn’t work in lua. I thought it was because the input contained carriage returns (which I removed btw), but it had nothing to do with that. My guess is that it’s a bug in lua. It would work if I use two line feeds instead of one, but then it would add blank lines.


${lua_parse weather usor0275 60 /shome/agnelo /usr/local/share/conkyweather/images C}
${lua_parse forecast usor0275 60 /shome/agnelo /usr/local/share/conkyweather/images C}

where:

  • “weather” is a call to the lua function “conky_weather”
  • “usor0275” is the city code
  • 60 (minutes) is the update interval after which the RSS file will be downloaded again.
  • /shome/agnelo is an alternate location to save this file (here on a file server to avoid downloading it too often on several machines with the same IP and get banned from the site at some point - as it already happened to me with google api.) There is still bug which prevents this from working if the directory is a symlink. I already fixed it but haven’t update the package yet.
  • /usr/local/share/conkyweather/images is the directory where the icons are located. I’m posting from ArchLinux right now. On openSUSE, it will be /usr/share/conlyweather/images.
  • “C” means “Celsius”. It’s the default (see this post: http://forums.opensuse.org/english/other-forums/development/programming-scripting/477877-short-question-about-rss-feed-theweathernetwork-com-u-s-2.html#post2483580)

Actually the default colors for suse in conkyconf are different but very similar.

sus_weather_label_color=DarkOliveGreen3
sus_weather_color=DarkOliveGreen2

I’m going to change this default. You can also overwrite these colors in conkyconf:

# You can define some colors here to overwrite the distro themes.
# You have to define the colors here if the distro colors are not defined!
# !!! When specifying the color value in hex, omit the leading hash (#) !!! 

#own_window_color=black
#default_color=white
#label_color=goldenrod	
#caption_color=white
#hr_color=white
#fs_color=white
#fs_used_color=red
#fs_free_color=green
#weather_label_color=yellow
weather_color=yellow
....

But conkyconf will be overwritten when the package is updated.

Thanks for great explanation and your awesome work. :slight_smile:

Conky looks great, I just can’t seem to get it running on openSUSE 12.2 KDE 64-bit.

I created the conkyrc file with:

conkyconf -kwfdNIt -b 22 -e 22 -g cabc0054

Trying to run conky:

saultdon@opensuse12-2: conky.sh&
[1] 13403
saultdon@opensuse12-2:/sys/class/hwmon> Conky: forked to background, pid is 13411


Conky: desktop window (20001e9) is subwindow of root window (25f)
Conky: window type - normal
Conky: drawing to created window (0x1e00001)
Conky: drawing to double buffer
Conky: llua_do_call: function conky_forecast execution failed: /etc/conky/conky.lua:594: bad argument #1 to 'gmatch' (string expected, got nil)
Conky: can't open '/sys/class/hwmon/hwmon0/temp1_input': No such file or directory
please check your device or remove this var from Conky

I couldn’t find that temp1_input file but there are a bunch in the ‘device’ folder:

saultdon@opensuse12-2:/sys/class/hwmon> ls */*
hwmon0/uevent


hwmon0/device:
driver    name       temp2_crit        temp2_label  temp3_crit_alarm  temp3_max         temp4_input  temp5_crit        temp5_label
hwmon     power      temp2_crit_alarm  temp2_max    temp3_input       temp4_crit        temp4_label  temp5_crit_alarm  temp5_max
modalias  subsystem  temp2_input       temp3_crit   temp3_label       temp4_crit_alarm  temp4_max    temp5_input       uevent


hwmon0/power:
async                 control              runtime_active_time  runtime_status          runtime_usage
autosuspend_delay_ms  runtime_active_kids  runtime_enabled      runtime_suspended_time


hwmon0/subsystem:
hwmon0

Here are the contents of my .conkyrc file:

saultdon@opensuse12-2:/sys/class/hwmon> cat ~/.conkyrc
# check http://conky.sourceforge.net/config_settings.html for the list of settings
# Check http://conky.sourceforge.net/variables.html for the list of variables


background yes


font 7x13
# Use Xft?
use_xft yes
xftfont Bitstream Vera Sans Mono:size=9
xftalpha 0.8
override_utf8_locale no
short_units


update_interval 5
total_run_times 0


own_window yes
own_window_type normal
own_window_transparent yes
own_window_class Conky
own_window_argb_visual no
own_window_colour 082103
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager


double_buffer yes
minimum_size 320 5
maximum_width 320
max_text_width 0


draw_shades yes
draw_outline no
draw_borders no
draw_graph_borders yes
stippled_borders 5
border_inner_margin 0
border_outer_margin 0
border_width 1


default_color white 
default_shade_color black 
default_outline_color black
color0 PaleGreen
color1 DarkSeaGreen
color2 SeaGreen
color3 GreenYellow
color4 red
color5 white
color6 DarkOliveGreen3
color7 khaki1
color8 white
color9 ForestGreen
default_bar_size 100 10


alignment top_right
gap_x 8
gap_y 2 


no_buffers yes
uppercase no
cpu_avg_samples 2
net_avg_samples 2
use_spacer none


top_name_width 18
top_cpu_separate false


lua_load /etc/conky/conky.lua
lua_startup_hook init 5


TEXT
${if_running plasma-desktop}${voffset 35}${endif}${color}${time %a, %d %b %Y, %H:%M:%S} ${goto 190}${color0}Uptime:${color DarkOrange1} ${uptime}
${lua_parse weather cabc0054 60 /home/saultdon /usr/share/conkyweather/images C}
${lua_parse forecast cabc0054 60 /home/saultdon /usr/share/conkyweather/images C}
${color2}${stippled_hr}
${color0}Linux Kernel: ${color8}${kernel} on ${machine}
${color0}CPU Details:  ${color8}${machine}, $freq(MHz)
${color0}CPU1:${offset +4}${lua_parse cpubar 1 ffa500 ffffff}${goto 165}${color0}CPU2:${offset +4}${lua_parse cpubar 2 ffa500 ffffff}
${color0}CPU3:${offset +4}${lua_parse cpubar 3 ffa500 ffffff}${goto 165}${color0}CPU4:${offset +4}${lua_parse cpubar 4 ffa500 ffffff}
${voffset 3}${color0}RAM used:${color8}${alignr 160} ${mem} ($memperc%)${goto 165}${lua_parse temperature CPU}
${color0}Available RAM:${color8}${goto 100}${memmax}${goto 165}${lua_parse temperature MB}
${color9}${cpugraph 3dba19 aecf4c -t -l}
#
#
${if_up eth0}${voffset 3}${color1}Network ${color}($nodename) ${color2}${hr}
 ${color}eth0: ${color0}Down:${color yellow1} ${downspeed eth0}/s${color0}${goto 190}Up:${color OrangeRed1} ${upspeed eth0}/s
 ${color9}${downspeedgraph eth0 24,150 000000 91ec31} ${color9}${upspeedgraph eth0 24,150 000000 ec3131}
 ${color0}LAN IP: ${color}${goto 60}${addr eth0}${if_gw}${goto 180}${color0} gw: ${goto 215}${color}${gw_ip}
 ${color0}WAN IP: ${color4}${goto 60}${lua_parse wanip 600 }$endif${goto 180}${color0}dns: ${goto 215}${color}${nameserver}${endif}
${voffset 3}${color1}File Systems ${color2}${hr}
${lua_parse fs /windows/C /windows/C sda1 7fff00 white}
${lua_parse fs / / sda6 7fff00 white}
${lua_parse fs /home /home sda7 7fff00 white}
${lua_parse fs /windows/D /windows/D sdb1 7fff00 white}
#
${voffset 3}${color1}Processes:${color} ${processes}  ${color1}Running:${color red1} ${running_processes} ${color2}${hr 1}
${alignc}${color0}(top 5 sorted by CPU usage)
${color0}NAME${alignr 110}PID${alignr 60}CPU%${alignr 20}MEM%
${lua_parse top cpu 1}
${lua_parse top cpu 2}
${lua_parse top cpu 3}
${lua_parse top cpu 4}
${lua_parse top cpu 5}
${alignc}${color0}(top 3 sorted by MEM usage)
${color0}NAME${alignr 110}PID${alignr 60}CPU%${alignr 20}MEM%
${lua_parse top mem 1}
${lua_parse top mem 2}
${lua_parse top mem 3}
#
#
${voffset 3}${color1}Tcp connections: ${color5}${tcp_portmon 22 22 count} ${color6}(top 5)${color2}${hr}
${lua_parse tcpmon 22 22 0}
${lua_parse tcpmon 22 22 1}
${lua_parse tcpmon 22 22 2}
${lua_parse tcpmon 22 22 3}
${lua_parse tcpmon 22 22 4}
${voffset -3}${color2}${hr 1}

I’m not sure what I need to change in my conky.lua file. I’ve pasted it’s contents at SUSE Paste.

Thought these lines look interesting:

-- CPU and mainboard temperature
function conky_temperature (sensor)
        local t = ""
        if ( sensor == "CPU" ) then t = CPU     else t = MB end
        if ( t == nil ) then
                if ( sensor == "CPU" ) then t = "${color0}Temperature: ${color}${alignr}${hwmon temp 1}" .. DEG else t = "" end
        else
                t = t .. DEG
        end
        return t
end

Should I change “${hwmon temp 1}” to “${hwmon0 temp 2}”?

I got it running on my laptop that’s also running 12.2 KDE - 64bit but they both output that conky_forecast error:

Conky: llua_do_call: function conky_forecast execution failed: /etc/conky/conky.lua:594: bad argument #1 to 'gmatch' (string expected, got nil)

Sounds good. But looking at your .conkyrc, I noticed that option -N had no effect. It should have written something like this:

${if_match "${nvidia temp}" != "N/A"}${voffset 3}${color1}Nvidia Gfx card ${color2}${hr}
${color0}GPU Frequency:${color8}${goto 110}${nvidia gpufreq} Mhz ${lua_parse gputemp temp}
${color0}Mem Frequency:${color8}${goto 110}${nvidia memfreq} Mhz${goto 165}${color0}Image quality:${color8}${alignr}${nvidia imagequality}${else}${voffset -15}${endif}

Thus it makes me wonder if you are using the nvidia proprietary driver, if the module is loaded and if the conky version you’re using has nvidia support. It’s not related with the other issues though. Did you install conky from my repo?


# conky -v
Conky 1.9.0 compiled Fri Jun 22 01:27:06 UTC 2012 for Linux 3.1.9-1.4-default (x86_64)

Compiled in features:

System config file: /etc/conky/conky.conf
Package library path: /usr/lib64/conky

 X11:
  * Xdamage extension
  * XDBE (double buffer extension)
  * Xft
  * ARGB visual

 Music detection:
  * MPD
  * MOC

 General:
  * math
  * hddtemp
  * portmon
  * Curl
  * RSS
  * wireless
**  * nvidia**
  * config-output
  * Imlib2
  * apcupsd
  * iostats
  * ncurses
  * Lua

  Lua bindings:
   * Cairo
   * Imlib2

The first error looks like a bug in the lua script. I was able to reproduce it with your .conkyrc. Will try to fix it.
The second problem is tricky. Those sensors are organized differently on each mainboard. I also have machines where they will occasionally change names (more precisely numbers). I’m not sure I can fix it in a generic fashion. I’m not sure it’s doable with scripting actually. OK, it’s doable but … not today.

Yes or to something else. But that’s it. Make a copy of /etc/conky/conky.lua because it will be overwritten by the next update.