DEV Community

loading...

My conky setup

rndmh3ro profile image rndmh3ro Originally published at zufallsheld.de on ・6 min read

I’ve been a longtime fan of conky setups and watched many threads where users post their configurations, but I couldn’t bother writing my own configuration.

But now that I got a second screen at home I thought that I could use the extra space it gives me with some monitoring. And without further annoying text, here it is:

conky

And here is the correspondending configuration:

# Use Xft?
use_xft yes
xftfont DejaVu Sans:size=8
xftalpha 0.8
text_buffer_size 2048

# Update interval in seconds
update_interval 2

# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
total_run_times 0

own_window yes
own_window_transparent yes
own_window_type dock

# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# Draw shades?
draw_shades no

# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders no

# Stippled borders?
stippled_borders 0

# Default colors and also border colors
default_color black

# Subtract file system buffers from used memory?
no_buffers yes

# number of cpu samples to average
# set to 1 to disable averaging
cpu_avg_samples 2

# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 2

# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes

#  Specify a default width and height for bars. Example: 'default_bar_size 0 6'. This is particularly useful for execbar and execibar as they do not take size arguments. 
default_bar_size 60 8

TEXT

CALENDAR ${hr 2}
${font DejaVu Sans Mono:size=8}${execpi 3600 DJS=`date +%_d`; cal -m | sed '1d' | sed '/./!d' | sed 's/$/                     /' | fold -w 21 | sed -n '/^.\{21\}/p' | sed 's/^/${alignc} /' | sed /" $DJS "/s/" $DJS "/" "'${color2}'"$DJS"'${color}'" "/}${font}

SYSTEM ${hr 2}

${alignc 24}${font Arial Black:size=14}${nodename}${font}
${font OpenLogos:size=16}u${font} Kernel: ${alignr}${kernel}
${font StyleBats:size=16}A${font} CPU1: ${cpu cpu1}% ${alignr}${cpubar cpu1 8,60}
${font StyleBats:size=16}A${font} CPU2: ${cpu cpu2}% ${alignr}${cpubar cpu2 8,60}
${font StyleBats:size=16}h${font} GPU:${execi 60 aticonfig --od-getclocks | awk '/load/ {print $4}' | sed 's/%//'}%${alignr}${execibar 60 aticonfig --od-getclocks | awk '/load/ {print $4}'| sed 's/%//'}
${font StyleBats:size=16}g${font} RAM: $memperc% ${alignr}${membar 8,60}
${font StyleBats:size=16}q${font} Uptime: ${alignr}${uptime}

PROCESSES ${hr 2}

NAME ${goto 120}CPU%${goto 180}IO%${alignr}MEM%
${top name 1}${goto 120}${top cpu 1}${goto 170}${top io_perc 1}${alignr}${top mem 1}
${top name 2}${goto 120}${top cpu 2}${goto 170}${top io_perc 2}${alignr}${top mem 2}
${top name 3}${goto 120}${top cpu 3}${goto 170}${top io_perc 3}${alignr}${top mem 3}

DISK SPACE ${hr 2}

/${goto 45}${fs_bar 8,50 /}${goto 95} Used: ${fs_used /}${goto 185} Free: ${fs_free /}
/home ${goto 45}${fs_bar 8,50 /home}${goto 95} Used: ${fs_used /home}${goto 185} Free: ${fs_free /home}
/tmp ${goto 45}${fs_bar 8,50 /tmp}${goto 95} Used: ${fs_used /tmp}${goto 185} Free: ${fs_free /tmp}

FAN SPEEDS & TEMPERATURES ${hr 2}

CPU Fan Speed ${alignr}${exec sensors | grep fan1 | cut -d " " -f 9,10}
Fan Speed ${alignr}${exec sensors | grep fan2 | cut -d " " -f 9,10}
GPU Fan Speed ${alignr}${exec aticonfig --pplib-cmd "get fanspeed 0" | awk '/Result/ {print $4}'}
Thermistor ${alignr}${execi 10 sensors | grep temp1 | cut -d " " -f 9| grep -v "^$"}
Thermal diode ${alignr} ${execi 10 sensors | grep temp2 | cut -d " " -f 9| grep -v "^$"}
INTEL PECI ${alignr}${execi 10 sensors | grep temp3 | cut -d " " -f 9| grep -v "^$"}
AMD Radeon HD5750 ${alignr}${execi 60 aticonfig --od-gettemperature | grep Temperature | cut -d " " -f 23}°C
${execi 60 sudo hddtemp SATA:/dev/sda1 | awk '{print $2,$3}'} ${alignr}${execi 60 sudo hddtemp SATA:/dev/sda1 | awk '{print $4}'}
${execi 60 sudo hddtemp SATA:/dev/sdc1 | awk '{print $2,$3}'} ${alignr}${execi 60 sudo hddtemp SATA:/dev/sdc1 | awk '{print $4}'}
${execi 60 sudo hddtemp SATA:/dev/sdb1 | awk '{print $2,$3}'} ${alignr}${execi 60 sudo hddtemp SATA:/dev/sdb1 | awk '{print $4}'}

NETWORK ${hr 2}

${if_existing /proc/net/route eth0}
${voffset -6}${font PizzaDude Bullets:size=14}O${font} Up: ${upspeed eth0}${alignr}${upspeedgraph eth0 8,60 black black}
${voffset 4}${font PizzaDude Bullets:size=14}U${font} Down: ${downspeed eth0}${alignr}${downspeedgraph eth0 8,60 black black}
${voffset 4}${font PizzaDude Bullets:size=14}N${font} Upload: ${alignr}${totalup eth0}
${voffset 4}${font PizzaDude Bullets:size=14}T${font} Download: ${alignr}${totaldown eth0}
${endif}

PACMAN ${hr 2}

${execpi 1800 python2 /etc/conky/pacman.py}

CLEMENTINE ${hr 2}

${execp conkyClementine --template=/etc/conky/conkyclementine/conkyClementine.template}

WEATHER ${hr 2}

${goto 80}${font weather:size=46}${exec /etc/conky/google_weather/weather.sh "Dresden,Germany" cp}${font}
${exec /etc/conky/google_weather/weather.sh "Dresden,Germany"}

${alignc}${execi 60 /etc/conky/google_weather/weather.sh "Dresden,Germany" dl}
${font weather:size=46}${execi 60 /etc/conky/google_weather/weather.sh "Dresden,Germany" fcp}${font}
${alignc}${execi 60 /etc/conky/google_weather/weather.sh "Dresden,Germany" fct}

REDDIT ${hr 2}

${font}Messages: ${if_empty ${rss http://www.reddit.com/message/unread/.rss?feed=fb4759ead39540799fa7e2537320695c9cfe93f3&user=zufallsheld 1 item_titles 1}}${image /etc/conky/reddit/message.png -p 246,1274}${else}${image /etc/conky/reddit/newmessage.png -p 246,1274}${endif}

${font}Link Karma: ${alignr}${execpi 300 wget -O - http://www.reddit.com/user/zufallsheld/about.json | awk '{match($0, "k_karma\": ([0-9]+)", a); print a[1];}'}
${font}Comment Karma: ${alignr}${execpi 300 wget -O - http://www.reddit.com/user/zufallsheld/about.json | awk '{match($0, "t_karma\": ([0-9]+)", a); print a[1];}'}

Specific configurations

Graphics card monitoring

I have an AMD graphics card and wanted to monitor the load, fan speed and temperature of the card. Luckily there is the cli-tool “aticonfig” which comes with the closed-source drivers that lets you read the metrics you want to. I found them in the Arch Linux wiki article forAMD Catalyst and just used the part of the output that was interesting to me.

${font StyleBats:size=16}h${font} GPU:${execi 60 aticonfig --od-getclocks | awk '/load/ {print $4}' | sed 's/%//'}%${alignr}${execibar 60 aticonfig --od-getclocks | awk '/load/ {print $4}'| sed 's/%//'}
GPU Fan Speed ${alignr}${execi 60 aticonfig --pplib-cmd "get fanspeed 0" | awk '/Result/ {print $4}'}
AMD Radeon HD5750 ${alignr}${execi 60 aticonfig --od-gettemperature | grep Temperature | cut -d " " -f 23}°C

CPU+FAN monitoring

Monitoring the CPU and the speed of the fans is rather easy. All you need is to install “lm_sensors”, a collection of user space tools. After you installed and configured it, you can output all relevant information by just executing “sensors” on the cli. Then again just grep the useful parts.

CPU Fan Speed ${alignr}${execi 10 sensors | grep fan1 | cut -d " " -f 9,10}
Temp 1 ${alignr}${execi 10 sensors | grep temp1 | cut -d " " -f 9| grep -v "^$"}

HD temperature monitoring

Monitoring the temperature of your hard drives is as easy as monitoring the temperature of your processor. Just install “hddtemp” and again, get the relevant info by greping for it.

${execi 60 sudo hddtemp SATA:/dev/sdb1 | awk '{print $2,$3}'} ${alignr}${execi 60 sudo hddtemp SATA:/dev/sdb1 | awk '{print $4}'}

Pacman Updatecheck

Since I use Arch Linux I wanted to know weather there are any packages ready to upgrade or if my system is up-to-date. Luckily someone already had the same problem as me and wrote a python-script for it. You can read everything about it in the Arch Linux forum thread.

${execpi 3600 python2 /etc/conky/pacman.py}

Clementine

I use Clementine to play music and wanted to display what is currently playing. Luckily there’s also already a usable solution:conkyClementine. ConkyClementine is also in the AUR, so you can just install it in Arch Linux.

${execp conkyClementine --template=/etc/conky/conkyclementine/conkyClementine.template}

The template-file looks like this:

Status:[--datatype=ST]
Artist:[--datatype=AR]
Album:[--datatype=AL]
Title:[--datatype=TI]
Position:[--datatype=PT]/[--datatype=LE] - [--datatype=PP]%
Rating:[--datatype=RT]
Volume:[--datatype=VO]

There you can configure what (and how) to display in Conky.

Weather

To display the current weather and a forecast, I decided to use Hardik Metha’s weather script. I made some improvements to the script and forked it here. Feel free to use it.

${goto 80}${font weather:size=46}${exec /etc/conky/google_weather/weather.sh "Dresden,Germany" cp}${font}

To use it you have to create a free account atworldweatheronline.com and get a free API key which you’ll than have to use in the script.

Reddit

As a frequent reddit-user and narcissist I want to see my Karma and if I got any new messages.

${font}Messages: ${if_empty ${rss http://www.reddit.com/message/unread/.rss?feed=fb4759ead39540799fa7e2537320695c9cfe93f3&user=zufallsheld 1 item_titles 1}}${image /etc/conky/reddit/message.png -p 246,1274}${else}${image /etc/conky/reddit/newmessage.png -p 246,1274}${endif}

${font}Link Karma: ${alignr}${execpi 300 wget -O - http://www.reddit.com/user/zufallsheld/about.json | awk '{match($0, "k_karma\": ([0-9]+)", a); print a[1];}'}
${font}Comment Karma: ${alignr}${execpi 300 wget -O - http://www.reddit.com/user/zufallsheld/about.json | awk '{match($0, "t_karma\": ([0-9]+)", a); print a[1];}'}

That’s it! Feel free to use whatever you want or ask questions!

Discussion (0)

pic
Editor guide