本人树莓派纯小白~ 欢迎大神批评指正。
硬件: 树莓派4B
系统:raspiOS-bullseye-arm64
参考文章:一劳永逸配置树莓派 - 知乎 (zhihu.com)https://zhuanlan.zhihu.com/p/63275945Conky配置(中文备注) - hellofriland - 博客园 (cnblogs.com)
https://www.cnblogs.com/hellofriland/p/16029445.html
一、安装conky
登录树莓系统,在terminal命令行输入以下命令
sudo apt-get install conky
注意!!!大多文章会执行以下命令,尝试过无效。
因为这个网址已经过于久远了,版本跟不上!!!
wget -O /home/pi/.conkyrc https://raw.githubusercontent.com/novaspirit/rpi_conky/master/rpi3_conkyrc
二、配置conky.conf 文件
执行第一步命令后,系统默认配置文件安装在 /etc/conky/ 目录下,含有conky.conf 和 conky_no_x11.conf文件。我们对conky.conf文件进行操作。
执行以下命令进入目标文件所在位置,并将文件内容进行替换。
#进入目录
cd /etc/conky
#对原文件进行备份
sudo cp conky.conf beifen.txt
#编辑文件
sudo nano conky.conf
将原文件内容删除并替换成以下内容:
--[[
Conky, a system monitor, based on torsmo
Any original torsmo code is licensed under the BSD license
All code written since the fork of torsmo is licensed under the GPL
Please see COPYING for details
Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
Copyright (c) 2005-2019 Brenden Matthews, Philip Kovacs, et. al. (see AUTHORS)
All rights reserved.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
]]
conky.config = {
alignment = 'top_right',
background = false,
border_width = 1,
cpu_avg_samples = 2,
default_color = 'grey',
default_outline_color = 'green',
default_shade_color = 'red',
double_buffer = true,
draw_borders = false,
draw_graph_borders = true,
draw_outline = false,
draw_shades = false,
extra_newline = false,
font = 'DejaVu Sans Mono:size=12',
gap_x = 60,
gap_y = 60,
minimum_height = 5,
minimum_width = 5,
net_avg_samples = 2,
no_buffers = true,
out_to_console = false,
out_to_ncurses = false,
out_to_stderr = false,
out_to_x = true,
own_window = true,
own_window_transparent = true,
own_window_class = 'Conky',
own_window_type = 'normal',
show_graph_range = false,
show_graph_scale = false,
stippled_borders = 0,
update_interval = 0.5,
uppercase = false,
use_spacer = 'none',
use_xft = true,
}
conky.text = [[${font Arial:size=20}${color Tan1}RPI${color Ivory}LINUX
${voffset -90}
${color DimGray}
${font}
${font Arial:bold:size=10}${color Tan1}SYSTEM ${color DarkSlateGray} ${hr 2}
$font${color DimGray}$sysname $kernel $alignr $machine
Frequency $alignr${freq_g cpu0}Ghz
Uptime $alignr${uptime}
File System $alignr${fs_type}
${font Arial:bold:size=10}${color Tan1}CPU ${color DarkSlateGray}${hr 2}
$font${color DimGray}Temp: $alignr ${exec /opt/vc/bin/vcgencmd measure_temp | cut -c6-9} C
$font${color DimGray}CPU1 ${cpu cpu1}% ${cpubar cpu1}
CPU2 ${cpu cpu2}% ${cpubar cpu2}
CPU3 ${cpu cpu3}% ${cpubar cpu3}
CPU4 ${cpu cpu4}% ${cpubar cpu4}
${cpugraph DimGray DarkSlateGray} $color
${font Arial:bold:size=10}${color Tan1}MEMORY ${color DarkSlateGray}${hr 2}
$font${color DimGray}MEM $alignc $mem / $memmax $alignr $memperc%
$membar
$font${color DimGray}SWAP $alignc $swap / $swapmax $alignr $swapperc%
$swapbar
${font Arial:bold:size=10}${color Tan1}HDD ${color DarkSlateGray}${hr 2}
$font${color DimGray}/home $alignc ${fs_used /home} / ${fs_size /home} $alignr ${fs_free_perc /home}%
${fs_bar /home}
${font Arial:bold:size=10}${color Tan1}TOP PROCESSES ${color DarkSlateGray}${hr 2}
${color DimGray}$font${top_mem name 2}${alignr}${top mem 2} %
$font${top_mem name 3}${alignr}${top mem 3} %
$font${top_mem name 4}${alignr}${top mem 4} %
$font${top_mem name 5}${alignr}${top mem 5} %
${font Arial:bold:size=10}${color Tan2}NETWORK ${color DarkSlateGray}${hr 2}
$font${color DimGray}IP on wlan0 $alignr ${addr wlan0}
Down $alignr ${downspeed wlan0} kb/s
Up $alignr ${upspeed wlan0} kb/s
Downloaded: $alignr ${totaldown wlan0}
Uploaded: $alignr ${totalup wlan0}
]]
按ctrl+x键,依据提示保存退出。
conky
执行后就可以出现以下界面:
三、设置开机自启动
在/home/xiyi/.config目录下新建一个autosatrt文件夹,用于存放自启动文件。
创建conky.desktop文件并进行编辑
sudo nano /home/xiyi/.config/autostart/conky.desktop
[Desktop Entry]
Encoding = UTF-8
Name=conky
Type=Application
Exec=/usr/bin/conky
按ctrl+x键,依据提示保存退出。重新启动树莓派仍然可看到此界面。over~