conky - 行者无疆 始于足下 - 行走,思考,在路上

conky

xiaohanyu posted @ Thu, 25 Mar 2010 17:40:41 +0800 in Linux with tags conky gentoo , 2483 readers

Conky is a free, light-weight system monitor for X, that displays any information on your desktop. Conky is licensed under the GPL and runs on Linux and BSD.

Features

Conky has more than 300 built in objects, including support for:

  • a plethora of OS stats (uname, uptime, CPU usage, mem usage, disk usage, "top" like process stats, and network monitoring, just to name a few)
  • built in IMAP and POP3 support
  • built in support for many popular music players (MPD, XMMS2, BMPx, Audacious)
  • can be extended using built in Lua support, or any of your own scripts and programs (tell me more!)
  • built in Imlib2 and Cairo bindings for arbitrary drawing with Lua (tell me more!)

... and much much more.

Conky can display this info either as text, or using simple progress bars and graph widgets, with different fonts and colours.

Installation

In gentoo, it is very simple to install a software, just emerge what you want. But before you really do it, try -pv options to see what will be installed and make your own choice:

Calculating dependencies... done!
[ebuild   R   ] app-admin/conky-1.7.2-r2  USE="X alsa apcupsd imlib portmon truetype vim-syntax weather-xoap -audacious -curl -debug -eve -hddtemp -iostats -lua -lua-cairo -lua-imlib -math -moc -mpd -nano-syntax -nvidia -rss -thinkpad -weather-metar -wifi" 0 kB

For example, if you use moc as a console music player you must add moc USE. What is  USE? Refer to gentoo handbook.

For archlinux, just type "pacman -S conky" and for ubuntu and deb, maybe "apt-get install conky". Refer to your system handbook.

Cofiguration

Usually there is a sample configuration file located in /etc. My file is /etc/conky/conky.conf, just copy this file into your home diretory and rename it to .conkyrc:

sudo cp /etc/conky/conky.conf ~/.conkyrc

then let conky startup with the system.  If you use startx, add this line to your ~/.xinitrc

conky -d 

-d means conky would run as a daemon process.

If you use a desktop environment such as gnome or kde, use the graphical tools, easy job.

And if you feel disappointed about the ugly default configuration, you can configure it by yourself. First you should refer to the man page to know some details about the configuration grammer and configuration choices. Then, I think you'd better refer to google to download a sample .conkyrc and modify it. Here is a sample configuration file:

########## basic configuration ##########
use_spacer right
use_xft yes
font Comic Sans MS:size=9
xftfont Comic Sans MS:size=9
override_utf8_locale yes
update_interval 1.0
own_window no
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 206 5
maximum_width 400
draw_shades yes
draw_outline yes
draw_borders no
draw_graph_borders yes
default_color 00ffe1
default_shade_color ffffff
default_outline_color 000000
alignment top_right
gap_x 10
gap_y 10
cpu_avg_samples 2
uppercase no # set to yes if you want all text to be in uppercase

# predefined color for title
color0 5511dd
# predefined color for hr line
color1 ffd700
# predefined color for graph_bar
color2 ff00ff
# predefined color for any use
color5 ffaa00
color6 b5ff00
########## basic configuration end ##########


TEXT
########## time ##########

${font Comic Sans MS:style=Bold:pixelsize=40}${alignc}${time %H:%M:%S}${font}
${color1}${stippled_hr}${font}$color
#
########## system information ##########
#
OS: $alignr${color}$sysname $kernel${color}
Uptime: $alignr$uptime
Processes:${alignr}$processes ($running_processes running)
#
########## CPU information ##########
#
${cpugraph cpu1 00FF00 FF0000}${cpugraph cpu1}${alignr}
${cpugraph cpu2 0000FF 00FF00}${cpugraph cpu2}${alignr}
# CPU frequency information
# ${color #00FFE1}CPU Frequency: ${color #00ff00}${alignr}${freq 0} MHz
#
########## processes information ##########
#
${font Comic Sans MS:size=14}${color0}Processes ${color1}${stippled_hr 1}$font$color
${color}Highest CPU $alignr CPU% MEM%${color5}
${top name 1}$alignr${top cpu 1}   ${top mem 1}
${top name 2}$alignr${top cpu 2}   ${top mem 2}
${top name 3}$alignr${top cpu 3}   ${top mem 3}
${top name 4}$alignr${top cpu 4}   ${top mem 4}
${top name 5}$alignr${top cpu 5}   ${top mem 5}
${color}Highest MEM $alignr CPU% MEM%${color6}
${top_mem name 1}$alignr${top_mem cpu 1}   ${top_mem mem 1}
${top_mem name 2}$alignr${top_mem cpu 2}   ${top_mem mem 2}
${top_mem name 3}$alignr${top_mem cpu 3}   ${top_mem mem 3}
#
########## ram and disk usage ##########
#
${font Comic Sans MS:size=14}${color0}RAM and Disk ${color1}${stippled_hr 1}$font$color
${color}RAM:${color #4169e1}$alignr ${color}$mem ${color #98c2c7}/${color}$memmax${color #4169e1}${color #FF3500} $memperc%
${color2}${membar}
${color}Root: ${color}${alignr}${fs_free /} / ${fs_size /}
${color2}${fs_bar 4 /}
${color}Home: ${color}${alignr}${fs_free /home} / ${fs_size /home}
${color2}${fs_bar 4 /home}
#
########## networking information ##########
#
${font Comic Sans MS:regular:size=14}${color0}NetWorking ${color1}${stippled_hr 1}$font$color
${color}Down:${color} ${downspeed eth0} k/s ${alignr}${color #00FFE1}Up:${color} ${upspeed eth0} k/s
${downspeedgraph eth0 20,115 556B2F 9ACD32}${alignr}${upspeedgraph eth0 20,115 556B2F 9ACD32}
${color}Totat: ${totaldown eth0}${alignr} Total: ${totalup eth0}$color

The grammer is simple, the first part is some basic settings, the second part is the content to show. But the grammer itself is not elegant, to second part is similar to markup language, ${font}${color}Something${color}${font}, just like this, but not so good.

And the following is the result:

Not bad. Enjoy it.


Login *


loading captcha image...
(type the code from the image)
or Ctrl+Enter
Host by is-Programmer.com | Power by Chito 1.3.3 beta | © 2007 LinuxGem | Design by Matthew "Agent Spork" McGee