要点:
1.安装conky和mpd,命令sudo apt-get install conky mpd
2.已安装雅黑字体,将msyh.ttf和msyhbd.ttf都拷贝到/usr/share/fonts/msyh目录下,然后执行命令sudo fc-cache -fv
3.在用户家目录下新建文件名为.conkyrc的空文件,将以下代码复制进去,并保存即可启动conky
4.自启动在“系统-首选项-会话”中添加
代码如下:
use_spacer right
use_xft yes
font ">Microsoft YaHei:size=8
xftfont Microsoft YaHei:size=8
override_utf8_locale yes
update_interval 1.0
own_window yes
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 no
draw_borders no
draw_graph_borders no
default_color ffffff
default_shade_color 000000
default_outline_color 000000
alignment top_right
gap_x 5
gap_y 30
cpu_avg_samples 2
uppercase no # set to yes if you want all text to be in uppercase
TEXT
${font Microsoft YaHei:style=Bold:pixelsize=30}${alignc}${time %H:%M:%S}
${font Microsoft YaHei:pixelsize=18}${alignc}${time %G年%b%d日 星期%a}${font Microsoft YaHei:pixelsize=12}
${color #ffd700}${hr 1}$color
${color #98c2c7}主机名:${color #db7093} $alignr$nodename
${color #98c2c7}内核: ${color #db7093}$alignr$kernel
${color #98c2c7}已运行时间: ${color #db7093}$alignr$uptime
${color #98c2c7}CPU使用率: ${color #db7093} $alignr$cpu%
${color #78af78}$cpubar
${color #98c2c7}进程总数:$alignr${color }$processes ($running_processes 个运行中)
${color #98c2c7}CPU 最高占用:$alignr PID CPU%
${color #ddaa00} ${top name 1}$alignr ${top pid 1}${top cpu 1}
${color lightgrey} ${top name 2}$alignr ${top pid 2}${top cpu 2}
${color lightgrey} ${top name 3} $alignr${top pid 3}${top cpu 3}
${color #98c2c7}总内存:${color #4169e1}$alignr ${color}$mem ${color #98c2c7}已用/总${color}$memmax${color #4169e1}${color #db7093}$memperc%
${color #78af78}${membar}
${color #98c2c7}SWAP:${color} $alignr ${color}$swap${color #98c2c7}已用/总${color}$swapmax${color #4169e1}${color #db7093}$swapperc%
${color #78af78}${fs_bar 4 /dev/sda1}
${color #98c2c7}内存最高占用:$alignr PID MEM%
${color #ddaa00}${top_mem name 1}$alignr${top_mem pid 1}${top_mem mem 1}
${color}${top_mem name 2}$alignr${top_mem pid 2}${top_mem mem 2}
${color}${top_mem name 3}$alignr${top_mem pid 3}${top_mem mem 3}
${color #98c2c7}网络 $alignr ${color #98c2c7}IP地址: ${color DDAA00}${addr ppp0}${color}
${voffset 1}${color #98c2c7}ppp0(上行):${color #db7093} ${upspeed ppp0} k/s ${alignr}${color #98c2c7}全部发送: ${color #db7093}${totalup ppp0}
${upspeedgraph ppp0 20,160 dcff82 ffffff}
${voffset 1}${color #98c2c7}ppp0(下行):${color #ddaa00} ${downspeed ppp0} k/s ${alignr}${color #98c2c7}全部接收:${color #ddaa00}${totaldown ppp0}
${downspeedgraph ppp0 20,160 dcff82 ffffff}
${color #98c2c7}根分区: ${color}${alignr}${fs_free /} 可用/总 ${fs_size /}
${color #78af78}${fs_bar 4 /}
${color #98c2c7}Home分区: ${color}${alignr}${fs_free /home} 可用/总 ${fs_size /home}
${color #78af78}${fs_bar 4 /home}
${color #98c2c7}Tools分区: ${color}${alignr}${fs_free /media/Tools} 可用/总 ${fs_size /media/Tools}
${color #78af78}${fs_bar 4 /media/Tools}
${color #98c2c7}Data分区: ${color}${alignr}${fs_free /media/Data} 可用/总 ${fs_size /media/Data}
${color #78af78}${fs_bar 4 /media/Data}
${color #98c2c7}aMuleDown分区: ${color}${alignr}${fs_free /media/Temp} 可用/总 ${fs_size /media/Temp}
${color #78af78}${fs_bar 4 /media/Temp}
${color #ffd700}${hr 1}$color
效果图如下: