1.安装conky
sudo apt-get install conky
2.设置conkyrc
在终端输入vim .conkyrc
在内容中填写:
default_color white
double_buffer yes
no_buffers yes
update_interval 1.0
total_run_times 0
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_colour 000000
own_window_argb_visual yes
own_window_argb_value 0
double_buffer yes
draw_shades yes
draw_outline no
draw_borders no
draw_graph_borders n0
minimum_size 300 1
maximum_width 406
default_color ffffff
default_shade_color 000000
default_outline_color 000000
alignment top_right
gap_x 6
gap_y 5
cpu_avg_samples 2
override_utf8_locale no
uppercase no # set to yes if you want all text to be in uppercase
use_spacer no
use_xft yes
xftfont WenQuanYi Zen Hei:pixelsize=12
override_utf8_locale yes
use_spacer no
minimum_size 300 1
TEXT
${font LCD:style=Bold:pixelsize=40}${alignc}${time %I:%M:%S}
${font LCD:style=Bold:pixelsize=20}${time %Y年%b%d日 星期%a}${alignc}
${font WenQuanYi Zen Hei:pixelsize=14}
${color #98c2c7}姓名: ${color}$deepin_linux
${color #98c2c7}内核: ${color}$alignr$kernel
${color #98c2c7}已开机: ${color}$alignr$uptime
${color #98c2c7}CPU使用率: ${color}$cpu%
$cpubar
CPU1 温度: $alignr${exec sensors | grep 'Core 0' | cut -c17-25}
CPU2 温度: $alignr${exec sensors | grep 'Core 1' | cut -c17-25}
${color #98c2c7}CPU占用:${color}
${top name 1} ${alignr}${top cpu 1}
${top name 2} ${alignr}${top cpu 2}
${top name 3} ${alignr}${top cpu 3}
${top name 4} ${alignr}${top cpu 4}
${top name 5} ${alignr}${top cpu 5}
${top name 6} ${alignr}${top cpu 6}
${color #98c2c7}物理内存:${color}${alignr}$mem / $memmax
${membar}
${color #98c2c7}根分区: ${color}${alignr}${fs_free /} / ${fs_size /}
${fs_bar 4 /}
${color #98c2c7}Home分区: ${color}${alignr}${fs_free /home} / ${fs_size /home}
${fs_bar 4 /home}
${color #98c2c7}网络使用:${color}
${color #FFFFFF}网络:${color}$alignr${addr wlp3s0}
下载速度:$alignr${downspeed wlp3s0} k/s
上传速度:$alignr${upspeed wlp3s0} k/s
3.添加开机启动
在终端输入
cd .config/autostart
新建文本
vim conky.desktop
在conky.desktop中输入以下内容
[Desktop Entry]
Type=Application
Version=1.0
Name=Conky
Comment= Desktop monitor Manager
Icon= Conky
Exec=/usr/bin/conky
Categories=Application;Graphics;
StartupNotify=true
Hidden=false
NoDisplay=false
4.修改conky.desktop 文件权限
sudo chmod 777 conky.desktop
5.重启电脑
6.问题
6.1 CPU温度不显示问题
sudo apt-get install lm-sensors
6.2 网络不显示问题
使用ip addr命令找到网卡名称,然后修改文件即可
7、补充:加入swap分区信息,以及修改计算机名称显示问题
要在上述配置中添加swap分区信息,你可以使用${swapperc}来获取swap分区的使用情况,并将其添加到相应位置。
以下是修改后的配置:
default_color white
double_buffer yes
no_buffers yes
update_interval 1.0
total_run_times 0
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_colour 000000
own_window_argb_visual yes
own_window_argb_value 0
double_buffer yes
draw_shades false
draw_outline no
draw_borders no
draw_graph_borders n0
minimum_size 300 1
maximum_width 406
default_color ffffff
default_shade_color 000000
default_outline_color 000000
alignment top_right
gap_x 6
gap_y 5
cpu_avg_samples 2
override_utf8_locale no
uppercase no # set to yes if you want all text to be in uppercase
use_spacer no
use_xft yes
xftfont WenQuanYi Zen Hei:pixelsize=12
override_utf8_locale yes
use_spacer no
minimum_size 300 1
TEXT
${font LCD:style=Bold:pixelsize=30}${alignc}${time %I:%M:%S}
${font LCD:style=Bold:pixelsize=16}${time %Y年%b%d日 星期%a}${alignc}
${font WenQuanYi Zen Hei:pixelsize=14}
${color #98c2c7}姓名: ${color}$alignr paloffice
${color #98c2c7}内核: ${color}$alignr$kernel
${color #98c2c7}已开机: ${color}$alignr$uptime
${color #98c2c7}CPU使用率: ${color}$cpu%
$cpubar
CPU1 温度: $alignr${exec sensors | grep 'Core 0' | cut -c17-25}
CPU2 温度: $alignr${exec sensors | grep 'Core 1' | cut -c17-25}
${color #98c2c7}CPU占用:${color}
${top name 1} ${alignr}${top cpu 1}
${top name 2} ${alignr}${top cpu 2}
${top name 3} ${alignr}${top cpu 3}
${top name 4} ${alignr}${top cpu 4}
${top name 5} ${alignr}${top cpu 5}
${top name 6} ${alignr}${top cpu 6}
${color #98c2c7}物理内存:${color}${alignr}$mem / $memmax
${membar}
${color #98c2c7}Swap分区: ${color}${alignr}${swap} / ${swapmax}
${swapbar}
${color #98c2c7}根分区: ${color}${alignr}${fs_free /} / ${fs_size /}
${fs_bar 4 /}
${color #98c2c7}Home分区: ${color}${alignr}${fs_free /home} / ${fs_size /home}
${fs_bar 4 /home}
${color #98c2c7}网络使用:${color}
${color #FFFFFF}网络:${color}$alignr${addr wlp3s0}
下载速度:$alignr${downspeed wlp3s0} k/s
上传速度:$alignr${upspeed wlp3s0} k/s
在以上配置中,${swap}和${swapbar}用于显示swap分区的使用情况,并将其放在${fs_bar}下方。请确保你的系统已经设置了swap分区并正确识别它。
网友评论