Conky

From ArchWiki

Jump to: navigation, search
i18n
English
简体中文
Italiano
Русский
Türkçe

Conky is a system monitor software for the X Window System. It is available for GNU/Linux and FreeBSD. It is free software released under the terms of the BSD license. Conky is able to monitor many systems variables including CPU, memory, swap, disk space, temperature, top, upload, download, system messages, and much more. It is extremely configurable, however, the configuration can be a little hard to understand. Conky is a fork of torsmo.

Contents

Installation and configuration

  • Conky is available in the Extra repository
# pacman -S conky
$ nano ~/.conkyrc
  • Alternatively, you can use the default config at /etc/conky/conky.conf:
$ cp /etc/conky/conky.conf ~/.conkyrc

Tips and tricks

How to prevent flickering

Conky needs Double Buffer Extension (DBE) support from X server to prevent flickering, because it can't update window fast enough without it. It can be enabled in /etc/X11/xorg.conf with Load "dbe" line in Section "Module". To enable double-buffer check to have in ~/.conkyrc:

double_buffer yes

Integration with Kdesktop

Conky with screenshot configuration generate problems with icons visualization. So there are some steps to follow.

  • Add these lines to ~/.conkyrc:
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
  • if this setting is on, comment it out or delete the line
minimum_size
  • To autostart conky create this link
$ ln -s /usr/bin/conky ~/.kde/share/autostart/conkylink
  • Install feh
# pacman -S feh
  • Make a script to allow transparency with the desktop

For KDE3 users

$ nano -w ~/.kde/share/autostart/fehconky 
#!/bin/bash
feh --bg-scale `dcop kdesktop KBackgroundIface currentWallpaper 1`

For KDE4 users

$ nano -w ~/.kde4/share/autostart/fehconky
#!/bin/bash
feh --bg-scale "`grep 'wallpaper=' ~/.kde4/share/config/plasma-desktop-appletsrc | tail --lines=1 | sed 's/wallpaper=//'`"

use --bg-center if you use a centered wallpaper.

  • Make it executable
$ chmod +x ~/.kde/share/autostart/fehconky
  • Optionally instead using a script you can add the corresponding line to the bottom of .conkyrc
$ nano ~/.conkyrc

For KDE3

${exec feh --bg-scale `dcop kdesktop KBackgroundIface currentWallpaper 1`}

For KDE4

${exec feh --bg-scale "`grep 'wallpaper=' ~/.kde4/share/config/plasma-desktop-appletsrc | tail --lines=1 | sed 's/wallpaper=//'`"}

How to display Information about available package updates in Conky

Take a look at the following threads for scripts to display information about available updates in conky:

How to display a weather forecast in Conky

See this thread.

How To display RSS feeds in Conky

Conky has the ability to display RSS feeds natively without the need for an outside script to run and output into conky. For example, to display the titles of the ten most recent Planet Arch updates and refresh the feed every minute you would put this into your .conkyrc:

${rss http://planet.archlinux.org/rss20.xml 1 item_titles 10 }

How to display rtorrent stats in Conky

See this thread.

How to display the number of new emails (Gmail) in Conky

Create a file named gmail.py in a convenient location (this example uses ~/.scripts/) with the folowing Python code:

import os
import string
 
#Enter your username and password below within double quotes
# eg. username="username" and password="password"
username="****"
password="****"
com="wget -O - https://"+username+":"+password+"@mail.google.com/mail/feed/atom --no-check-certificate"

temp=os.popen(com)
msg=temp.read()
index=string.find(msg,"<fullcount>")
index2=string.find(msg,"</fullcount>")
fc=int(msg[index+11:index2])

if fc==0:
   print "0 new"
else:
   print str(fc)+" new"

Add the folowing string to your .conkyrc in order the check your gmail account for new email every five minutes (300 seconds) and display: # new

${execi 300 python ~/.scripts/gmail.py}

User supplied example .conkyrc files

Graysky's .conkyrc

[Screenshot]

Modify to fit your system. Optimized for a quad core chip w/ three hdds (although two of them aren't connected for this screenshot) and an nvidia graphics card. You can easily modify this to a dual or single core system with one or whatever number of hdds.

# for this to work you need both lm-sensors and hddtemp
# get both from main repos

# set to yes if you want Conky to be forked in the background
background no

own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

out_to_console no

# X font when Xft is disabled, you can pick one with program xfontsel
#font 7x12
#font 6x10
#font 7x13
#font 8x13
#font 7x12
#font *mintsmild.se*
#font -*-*-*-*-*-*-34-*-*-*-*-*-*-*
#font -artwiz-snap-normal-r-normal-*-*-100-*-*-p-*-iso8859-1

# Use Xft?
use_xft yes

# Xft font when Xft is enabled
xftfont Bitstream Vera Sans Mono:size=8
#
#
#own_window_transparent no
#own_window_colour hotpink
# Text alpha when using Xft
xftalpha 0.8

#on_bottom yes

# Update interval in seconds
update_interval 2
# Create own window instead of using desktop (required in nautilus)
#own_window no

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

# Minimum size of text area
#minimum_size 250 5
maximum_width 258

# Draw shades?
draw_shades no

# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders no

# Stippled borders?
stippled_borders 10

# border margins
border_margin 4

# border width
border_width 1

# Default colors and also border colors
default_color white
default_shade_color white
default_outline_color white

# Text alignment, other possible values are commented
#alignment top_left
#minimum_size 10 10
#alignment top_right
alignment bottom_left
#alignment bottom_right

# Gap between borders of screen and text
gap_x 12
gap_y 37
# Add spaces to keep things from moving about?  This only affects certain objects.
use_spacer no

# Subtract file system buffers from used memory?
no_buffers yes

# set to yes if you want all text to be in uppercase
uppercase no

TEXT
${color #ddaa00}$nodename$color
$sysname $kernel on $machine
${color lightgrey}Uptime:$color $uptime ${color lightgrey}- Load:$color $loadavg${color lightgrey}
RAM Usage:$color $memperc% or $mem of $memmax${color lightgrey}
Swap Usage:$color $swapperc%${color lightgrey}
$color$stippled_hr${color lightgrey}
Intel Xeon X3360 @ $color${freq_g} GHz${color lightgrey} (Vcc: ${execi 8 sensors | grep in0 | cut -c15-19} V)
${color black}${cpugraph 000000 5000a0}${color lightgrey}
 ${color lightgrey}Core0:$color ${execi 8 sensors | grep -A 1 'Core 0' | cut -c15-16 | sed '/^$/d'} °C${color grey} @$color ${cpu cpu1}%   ${alignr}${cpubar cpu1 6,120}
 ${color lightgrey}Core1:$color ${execi 8 sensors | grep -A 1 'Core 1' | cut -c15-16 | sed '/^$/d'} °C${color grey} @$color ${cpu cpu2}%   ${alignr}${cpubar cpu2 6,120}
 ${color lightgrey}Core2:$color ${execi 8 sensors | grep -A 1 'Core 2' | cut -c15-16 | sed '/^$/d'} °C${color grey} @$color ${cpu cpu3}%   ${alignr}${cpubar cpu3 6,120}
 ${color lightgrey}Core3:$color ${execi 8 sensors | grep -A 1 'Core 3' | cut -c15-16 | sed '/^$/d'} °C${color grey} @$color ${cpu cpu4}%   ${alignr}${cpubar cpu4 6,120}${color grey}
$color$stippled_hr${color lightgrey}
${color grey} sda:$color ${execi 300 sudo hddtemp /dev/sda | cut -c25-26} °C    ${color grey} sdb:$color ${execi 300 sudo hddtemp /dev/sdb | cut -c24-25} °C    ${color grey} sdc:$color ${execi 300 sudo hddtemp /dev/sdc | cut -c34-35} °C
${color grey} GPU:$color ${execi 8 nvclock -T | grep 'GPU t' | cut -c21-22} °C    ${color grey} M/B:$color ${execi 8 sensors | grep temp2 | cut -c15-16} °C     ${color grey} NB:$color ${execi 8 sensors | grep temp3 | cut -c15-16} °C
$color$stippled_hr${color lightgrey}
${color slate grey} /dev/shm: ${color }${fs_used_perc  /dev/shm} %  ${fs_bar /dev/shm}
${color grey}$stippled_hr${color light grey}
${color lightgrey}Processes:$color $processes  ${color grey}Running:$color $running_processes
${color}Name              PID     CPU%   MEM%
${color #ddaa00} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
${color}Mem usage
${color #ddaa00} ${top_mem name 1} ${top_mem pid 1} ${top_mem cpu 1} ${top_mem mem 1}
${color lightgrey} ${top_mem name 2} ${top_mem pid 2} ${top_mem cpu 2} ${top_mem mem 2}
${color lightgrey} ${top_mem name 3} ${top_mem pid 3} ${top_mem cpu 3} ${top_mem mem 3}

A Oneliner Conky

Especially useful with fluxbox, the following configuration file provides a one-line conky, for a single cpu laptop, that fits a 1280-wide screen and shows the following info on top of the screen: Date, cpu frequency + load + application that busies the cpu the most (with percentage), ram load and application that busies ram the most (with percentage), network upload and download speeds and total downloaded data size, cpu temperature, batery status (as a bar graph), and i/o read and write amounts. Change to taste (and appropriate variables such as BAT0 etc) :)

# Conky sample configuration
#
# the list of variables has been removed from this file in favour
# of keeping the documentation more maintainable.
# Check http://conky.sf.net for an up-to-date-list.

# set to true if you want Conky to be forked in the background
background true
# background no

# X font when Xft is disabled, you can pick one with program xfontsel artwiz package?
#font 5x8
font 6x9
#font 6x10
#font 6x13
#font 8x13
#font 9x15
#font *mintsmild.se*
#font -*-*-*-*-*-*-34-*-*-*-*-*-*-*

# Use Xft?
use_xft no

# Set conky on the bottom of all other applications
# on_bottom no

# Xft font when Xft is enabled
xftfont Mono:size=6

# Text alpha when using Xft
xftalpha 0.8

# Print everything to stdout?
# out_to_console no

# MPD host/port
# mpd_host localhost
# mpd_port 6600
# mpd_password tinker_bell

# Print everything to console?
# out_to_console no

# mail spool
# mail_spool $MAIL

# Update interval in seconds
update_interval 1.0

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

# Create own window instead of using desktop (required in nautilus)
#own_window yes
#own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

# Use pseudo transparency with own_window?
own_window_transparent yes

# If own_window_transparent is set to no, you can set the background colour here
# own_window_colour grey

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

# Minimum size of text area
minimum_size 280 5

# Draw shades?
draw_shades yes

# Draw outlines?
draw_outline yes

# Draw borders around text
draw_borders no

# Stippled borders?
stippled_borders 8

# border margins
border_margin 4

# border width
border_width 1

# Default colors and also border colors
default_color white
default_shade_color white
default_outline_color black

# Text alignment, other possible values are commented
alignment top_left
#alignment top_right
#alignment bottom_left
#alignment bottom_right
#alignment none

# Gap between borders of screen and text
# same thing as passing -x at command line
gap_x 1
gap_y 1

# Subtract file system buffers from used memory?
no_buffers yes

# set to yes if you want all text to be in uppercase
uppercase 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 no


# Add spaces to keep things from moving about?  This only affects certain objects.
use_spacer none

#   mldonkey_hostname     Hostname for mldonkey stuff, defaults to localhost
#   mldonkey_port         Mldonkey port, 4001 default
#   mldonkey_login        Mldonkey login, default none
#   mldonkey_password     Mldonkey password, default none

# boinc (seti) dir
# seti_dir /opt/seti

# variable is given either in format $variable or in ${variable}. Latter
# allows characters right after the variable and must be used in network
# stuff because of an argument

# stuff after 'TEXT' will be formatted on screen

TEXT
${color light grey}${time %a %D %k:%M} ${color grey}cpu:$color ${freq_g}Ghz ${cpubar 4,50}$color ($cpu) ${color grey}hog:$color ${top name 1}${offset -35}${top cpu 1}${color grey} |ram:$color ${membar 4,50} ${color grey}hog:$color ${top_mem name 1}${offset -35}${top_mem mem 1}${color grey} |network:$color ${upspeed wlan0} up, ${downspeed wlan0} down, ${totaldown wlan0} downloaded${color grey} |temp:$color $acpitemp${color grey} |battery:$color ${color red}${battery_bar 4,50 BAT1}${color grey} |w/r:$color$diskio_write $diskio_read

External links

Personal tools