fedora15 conky 有配置、有过程、更有真相!~

最近开始,打算使用 Fedora 15 作为办公主要的操作系统,以前刚接触linux的时候,使用的是 Red Flag Desktop 6 sp1、sp2、sp3 ,这一用就差不多有快三年的时间,感觉有点被“绑架”的感觉,以至于现在对其他桌面操作系统都很陌生,即使都是linux系统。为了改变这一囧状,打算从RPM系列的 Fedora 15开始用起。

以前在RedFlag Desktop 6 sp3 工作时,使用过 conky ,因为没有源,所以当时是找比较新的源码进行编译,安装上后,没有原始配置文件,所以大量google搜索配置文件模板和成功案例,结合自身需求,不断修改、测试,虽然有点折腾,但最终看到效果时,还是比较开心的。

所以,打算在 Fedora 15上,也要把conky用起来,废话不多说了,下面看下具体过程吧:

###########################################################################################################

1、安装:
fedora的源还是很给力的,直接yum安装即可;
[php]
yum install conky
[/php]

2、配置:
conky安装完,默认会在 /etc/conky/ 下产生一个配置文件,该文件很基本,如果有兴趣可以自己进行修改,当然,下面有一些模板,例如:
[php]
wget http://blog.fedora-fr.org/public/bioinfornatics/conky/beautiful_conky.tar.xz
tar -xvf beautiful_conky.tar.xz
cd beautiful_conky; ./install.sh CHXX0008
[/php]
上述三条命令,是下载一个比较漂亮的conky模板,并在install时,输入城市代码(如CHXX0008为北京),会产生一个比较漂亮的天气预报,先来个效果图:

如果使用上面的方法,需要注意一些事项:
1、该方法默认会启动两个conky进程,分别是:
conky -c ~/.conky/weather.conky &
conky -c ~/.conky/conkyrc &
并且,安装时的install脚本,会将这两条命令写在用户家目录下的 .bash_profile 中,实现开机自启动目的。
我不太喜欢这种方式,所以,将 .bash_prifile 中的这几行删除后,使用 gnome-session-properties 来添加启动项。(如果没有gnome-session-properties ,可以自行yum安装)

2、该天气虽然华丽,但太占地方,不太喜欢,所以,自己修改了下conkyrc文件,并把天气weather.conky配置文件移除来,大概效果如下:

配置文件如下:
(点开下面的 show source,展开代码)
[css collapse=”true”]
# Conky settings #
background yes
update_interval 1

cpu_avg_samples 2
net_avg_samples 2

override_utf8_locale yes

double_buffer yes
no_buffers yes

text_buffer_size 2048
#imlib_cache_size 0

#temperature_unit fahrenheit

# Window specifications #

own_window yes
#own_window_type override
own_window_type normal
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below

border_inner_margin 0
border_outer_margin 0

minimum_size 250 250
maximum_width 200

alignment tr
gap_x 35
gap_y 0

# Graphics settings #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no

# Text settings #
use_xft yes
xftfont caviar dreams:size=8
xftalpha 0.5

uppercase no

temperature_unit celsius

default_color FFFFFF

# Lua Load #
lua_load ~/.conky/clock_rings.lua
lua_draw_hook_pre clock_rings

TEXT
${voffset 2}${color FF6600}${font caviar dreams:size=16}${time %A}${font}${voffset -8}${alignr 50}${color FFFFFF}${font caviar dreams:size=38}${time %e}${font}
${color FFFFFF}${voffset -30}${color FFFFFF}${font caviar dreams:size=18}${time %b}${font}${voffset -3} ${color FFFFFF}${font caviar dreams:size=20}${time %Y}${font}${color FF6600}${hr}
${image ~/.conky/fedora-logo.png -p 64,125 -s 70×20}
${voffset 130}
${color FFFFFF}${goto 25}${voffset 35}${cpu cpu0}%
${color FF6600}${goto 25}CPU
${color FFFFFF}${goto 50}${voffset 23}${memperc}%
${color FF6600}${goto 50}RAM
${color FFFFFF}${goto 75}${voffset 23}${swapperc}%
${color FF6600}${goto 75}Swap
${color FFFFFF}${goto 100}${voffset 23}${fs_used_perc /}%
${color FF6600}${goto 100}Disk
${color FFFFFF}${goto 125}${voffset 25}${downspeed eth0}
${color FFFFFF}${goto 125}${upspeed eth0}
${color FF6600}${goto 125}Net

$color}$sysname ${color}${exec head -n 1 /etc/issue}
${offset 1}${color FFFFFF}${font caviar dreams:size=8}Uptime: ${uptime_short} ${offset 6}${color}$nodename
${color FFFFFF}${font caviar dreams:size=8}Processes:${processes}${offset 8}${color FFFFFF}${font caviar dreams:size=8}Running: ${running_processes}
${color orange}File Systems:${color orange}${hr 1}
${color }/${offset 29}${color }${fs_used /}/${fs_size /}/${fs_free /} ${color #5b6dad}${fs_bar /}
${color }/data ${color }${fs_used /data}/${fs_size /data}/${fs_free /data} ${color #5b6dad}${fs_bar /data}
${color orange}Basic Information:${color orange}${hr 1}
${color }MEM:${color }${offset 3}${exec sudo /usr/sbin/dmidecode -t memory |grep Size |awk ‘BEGIN{total=0}{total+=$2}END{print total $3}’}${offset 6}${exec sudo /usr/sbin/dmidecode -t memory |grep Type |grep -v Detail |grep -v Error |sort |uniq |awk ‘{print $2}’}${offset 6}${exec sudo /usr/sbin/dmidecode -t memory |grep Speed |sort |uniq |awk ‘{print $2$3}’}${offset 6}[${exec sudo /usr/sbin/dmidecode -t memory |grep Memory\ Device |wc -l}${offset 3}*${exec sudo /usr/sbin/dmidecode -t memory |grep Size |sort |uniq |awk ‘{print $2}’}]
${color }CPU:${offset 3}${exec sudo /usr/sbin/dmidecode -t processor |grep Version |awk ‘{print $2}’}${offset 3}${exec sudo /usr/sbin/dmidecode -t processor |grep Version |awk ‘{print $3}’}${offset 5}${exec sudo /usr/sbin/dmidecode -t processor |grep Version |awk ‘{print $5}’}${offset 5}${exec sudo /usr/sbin/dmidecode -t processor |grep Version |awk ‘{print $6}’}${offset 5}${exec sudo /usr/sbin/dmidecode -t processor |grep Version |awk ‘{print $7}’}
${color orange}Highest CPU:${color orange}${hr 1}
${color lightgrey} ${top name 1}${top_mem cpu 1}${offset 39}${top pid 1}
${color lightgrey} ${top name 2}${top cpu 2}${offset 39}${top pid 2}
${color lightgrey} ${top name 3}${top cpu 3}${offset 39}${top pid 3}
${color lightgrey} ${top name 4}${top cpu 4}${offset 39}${top pid 4}
${color lightgrey} ${top name 5}${top cpu 5}${offset 39}${top pid 5}

[/css]