红联Linux门户
Linux帮助

Conky--linux自定义桌面监控

发布时间:2017-06-28 12:06:30来源:linux网站作者:hudongloop
Conky可以对Linux硬件设备进行实时监控,并且显示在桌面上。
 
首先,先贴图:
Conky--linux自定义桌面监控
右边就是conky显示的,可以显示进程,内存,显卡温度等等。下载安装在github(https://github.com/aikunzhe/conky_colors),这个是支持中文的,而且里面有简单的conky语法说明,具体的conky语法在https://sourceforge.net/projects/conky/有说明。
 
我的cinkyrc文件如下:
######################
# - Conky settings - #
######################
update_interval 1
total_run_times 0
net_avg_samples 1
cpu_avg_samples 1
if_up_strictness link
imlib_cache_size 0
double_buffer yes
no_buffers yes
format_human_readable
#####################
# - Text settings - #
#####################
use_xft yes
xftfont WenQuanYi Micro Hei:size=8
override_utf8_locale yes
text_buffer_size 2048
#############################
# - Window specifications - #
#############################
own_window_class Conky
own_window yes
own_window_type normal
own_window_transparent yes
own_window_argb_visual yes
own_window_argb_value 200
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
alignment top_left
gap_x 25
gap_y 40
minimum_size 182 900
maximum_width 182
default_bar_size 60 8
#########################
# - Graphics settings - #
#########################
draw_shades no
default_color cccccc
color0 cyan
color1 green
color2 orange
color3 204A87
TEXT
${font Liberation Sans:style=Bold:size=8}SYSTEM $stippled_hr${font}
##############
# - SYSTEM - #
##############
${color0}${voffset 8}${offset 4}${font ConkyColorsLogos:size=9}l${font}${color}${voffset -16}
${color0}${font ConkyColors:size=16}b${font}${color}
${goto 32}${voffset -29}Kernel: ${alignr}${color2}${kernel}${color}
${goto 32}Uptime: ${alignr}${color2}${uptime}${color}
# |--CPU
${voffset 4}${color0}${font ConkyColors:size=16}c${font}${offset -20}${voffset 6}${cpubar cpu0 4,17}${color}${voffset -16}${goto 32}CPU1: ${font Liberation Sans:style=Bold:size=8}${color1}${cpu cpu1}%${color}${font} ${alignr}${color2}${cpubar cpu1 8,60 3465A4 204A87}${color}
${goto 32}CPU2: ${font Liberation Sans:style=Bold:size=8}${color1}${cpu cpu2}%${color}${font} ${alignr}${color2}${cpubar cpu2 8,60 3465A4 204A87}${color}
${goto 32}CPU3: ${font Liberation Sans:style=Bold:size=8}${color1}${cpu cpu3}%${color}${font} ${alignr}${color2}${cpubar cpu3 8,60 3465A4 204A87}${color}
${goto 32}CPU4: ${font Liberation Sans:style=Bold:size=8}${color1}${cpu cpu4}%${color}${font} ${alignr}${color2}${cpubar cpu4 8,60 3465A4 204A87}${color}
# |--MEM
${voffset 2}${color0}${font ConkyColors:size=15}g${font}${color}${goto 32}${voffset -7}RAM: ${font Liberation Sans:style=Bold:size=8}${color1}$memperc%${color}${font}
${offset 1}${goto 32}F: ${font Liberation Sans:style=Bold:size=8}${color2}${memeasyfree}${color}${font} ${goto 120}${voffset -3}T: ${font Liberation Sans:style=Bold:size=8}${color2}${memmax}${color}${font}
# |--SWAP
${voffset 2}${color0}${font ConkyColors:size=15}z${font}${color}${voffset -8}${goto 32}SWAP: ${font Liberation Sans:style=Bold:size=8}${color1}${swapperc}%${color}${font}
${voffset 2}${offset 1}${color}${voffset -2}${goto 32}F: ${font Liberation Sans:style=Bold:size=8}${color2}$swapmax${color}${font} ${goto 120}${voffset -3}T: ${font Liberation Sans:style=Bold:size=8}${color2}$swapmax${color}${font}
# |--PROC
${voffset 4}${color0}${font ConkyColors:size=16}C${font}${color}${goto 32}${voffset -10}Processes: ${color2}${alignr 26}PID${alignr 10}CPU${alignr}RAM${color}
${voffset -1}${goto 32}${color2}${top_mem name 1}${color}${font Liberation Sans:style=Bold:size=8}${color1} ${goto 95}${top_mem pid 1}${goto 126}${top_mem cpu 1}${alignr }${top_mem mem 1}${color}${font}
${voffset -1}${goto 32}${color2}${top_mem name 2}${color}${font Liberation Sans:style=Bold:size=8}${color1} ${goto 95}${top_mem pid 2}${goto 126}${top_mem cpu 2}${alignr }${top_mem mem 2}${color}${font}
${voffset -1}${goto 32}${color2}${top_mem name 3}${color}${font Liberation Sans:style=Bold:size=8}${color1} ${goto 95}${top_mem pid 3}${goto 126}${top_mem cpu 3}${alignr }${top_mem mem 3}${color}${font}
#############
# - CLOCK - #
#############
${voffset 4}${font Liberation Sans:style=Bold:size=8}DATE $stippled_hr${font}
${voffset -2}${color2}${font Liberation Sans:style=Bold:size=30}${time %H:%M}${font}${color} ${voffset -20}${alignr }${font WenQuanYi Micro Hei:size=18}${time %A}${font}
${color #8AE234}$hr${color}
${alignc 20}${time %d %B %Y}${font WenQuanYi Micro Hei:size=8}${alignr }${execpi 300 ~/.conkycolors/bin/lunar}${font}
##############
# - NVIDIA - #
##############
${voffset 4}${font Liberation Sans:style=Bold:size=8}NVIDIA $stippled_hr${font}
${color0}${voffset 2}${font ConkyColorsLogos:size=16}n${font}${color}${goto 32}${voffset -8}GPU Temp:${alignr}${font Liberation Sans:style=Bold:size=8}${color1} ${exec nvidia-settings -q [gpu:0]/GPUCoreTemp | grep Attribute | cut -d ' ' -f 6 | cut -c 1-2}${font}${color}°C
#${goto 32}GPU Clock:${alignr}${font Liberation Sans:style=Bold:size=8}${color1} ${exec nvidia-settings -q [gpu:0]/GPU2DClockFreqs -t}${font}${color}MHz
${goto 32}Video RAM:${alignr}${font Liberation Sans:style=Bold:size=8}${color1} ${exec nvidia-settings -q [gpu:0]/VideoRam -t}${font}${color}KiB
${goto 32}Driver Version:${alignr}${font Liberation Sans:style=Bold:size=8}${color1} ${exec nvidia-settings -q [gpu:0]/NvidiaDriverVersion -t}${font}${color}
##########
# - HD - #
##########
${voffset -4}${font Liberation Sans:style=Bold:size=8}HD $stippled_hr${font}
${execpi 30 /usr/local/share/conkycolors/bin/conkyHD1}
###############
# - NETWORK - #
###############
${voffset -20}${font Liberation Sans:style=Bold:size=8}NETWORK $stippled_hr${font}
# |--WLAN0
${if_up wlan0}
${voffset -5}${color0}${font ConkyColors:size=15}s${font}${color}${goto 32}${voffset -12}Up: ${font Liberation Sans:style=Bold:size=8}${color1}${upspeed wlan0}${color}${font} ${alignr}${color2}${upspeedgraph wlan0 8,60 3465A4 204A87}${color}
${goto 32}Total: ${font Liberation Sans:style=Bold:size=8}${color2}${totalup wlan0}${color}${font}
${voffset 2}${color0}${font ConkyColors:size=15}t${font}${color}${goto 32}${voffset -12}Down: ${font Liberation Sans:style=Bold:size=8}${color1}${downspeed wlan0}${color}${font} ${alignr}${color2}${downspeedgraph wlan0 8,60 3465A4 204A87}${color}
${goto 32}Total: ${font Liberation Sans:style=Bold:size=8}${color2}${totaldown wlan0}${color}${font}
${color0}${font ConkyColors:size=15}j${font}${color}${voffset -6}${goto 32}Signal: ${font Liberation Sans:style=Bold:size=8}${color1}${wireless_link_qual_perc wlan0}%${color}${font} ${alignr}${color2}${wireless_link_bar 8,60 wlan0}${color}
${voffset 2}${color0}${font ConkyColors:size=15}B${font}${color}${goto 32}${voffset -6}Local IP: ${alignr}${color2}${addr wlan0}${color}
# |--ETH0
${else}${if_up eno1}
${voffset -5}${color0}${font ConkyColors:size=15}s${font}${color}${goto 32}${voffset -12}Up: ${font Liberation Sans:style=Bold:size=8}${color1}${upspeed eno1}${color}${font} ${alignr}${color2}${upspeedgraph eno1 8,60 3465A4 204A87}${color}
${goto 32}Total: ${font Liberation Sans:style=Bold:size=8}${color2}${totalup eno1}${color}${font}
${voffset 4}${color0}${font ConkyColors:size=15}t${font}${color}${goto 32}${voffset -12}Down: ${font Liberation Sans:style=Bold:size=8}${color1}${downspeed eno1}${color}${font} ${alignr}${color2}${downspeedgraph eno1 8,60 3465A4 204A87}${color}
${goto 32}Total: ${font Liberation Sans:style=Bold:size=8}${color2}${totaldown eno1}${color}${font}
${voffset 2}${color0}${font ConkyColors:size=15}B${font}${color}${goto 32}${voffset -6}Local IP: ${alignr}${color2}${addr eno1}${color}
# |--ENP4S0
${else}${if_up enp4s0}
${voffset -5}${color0}${font ConkyColors:size=15}s${font}${color}${goto 32}${voffset -12}Up: ${font Liberation Sans:style=Bold:size=8}${color1}${upspeed enp4s0}${color}${font} ${alignr}${color2}${upspeedgraph enp4s0 8,60 3465A4 204A87}${color}
${goto 32}Total: ${font Liberation Sans:style=Bold:size=8}${color2}${totalup enp4s0}${color}${font}
${voffset 2}${color0}${font ConkyColors:size=15}t${font}${color}${goto 32}${voffset -12}Down: ${font Liberation Sans:style=Bold:size=8}${color1}${downspeed enp4s0}${color}${font} ${alignr}${color2}${downspeedgraph enp4s0 8,60 3465A4 204A87}${color}
${goto 32}Total: ${font Liberation Sans:style=Bold:size=8}${color2}${totaldown enp4s0}${color}${font}
${voffset 4}${color0}${font ConkyColors:size=15}B${font}${color}${goto 32}${voffset -6}Local IP: ${alignr}${color2}${addr enp4s0}${color}
# |--PPP0
${else}${if_up ppp0}
${voffset -5}${color0}${font ConkyColors:size=15}s${font}${color}${goto 32}${voffset -12}Up: ${font Liberation Sans:style=Bold:size=8}${color1}${upspeed ppp0}${color}${font} ${alignr}${color2}${upspeedgraph ppp0 8,60 3465A4 204A87}${color}
${goto 32}Total: ${font Liberation Sans:style=Bold:size=8}${color2}${totalup ppp0}${color}${font}
${voffset 2}${color0}${font ConkyColors:size=15}t${font}${color}${goto 32}${voffset -12}Down: ${font Liberation Sans:style=Bold:size=8}${color1}${downspeed ppp0}${color}${font} ${alignr}${color2}${downspeedgraph ppp0 8,60 3465A4 204A87}${color}
${goto 32}Total: ${font Liberation Sans:style=Bold:size=8}${color2}${totaldown ppp0}${color}${font}
${voffset 2}${color0}${font ConkyColors:size=15}B${font}${color}${goto 32}${voffset -6}Local IP: ${alignr}${color2}${addr ppp0}${color}
${else}${voffset 4}${color0}${font ConkyColors:size=15}q${font}${color}${voffset -6}${goto 32}Network Unavailable${voffset 14}${endif}${endif}${endif}${endif}
#############
# - PHOTO - #
#############
${voffset -8}${font Liberation sans:style=Bold:size=8}PHOTO $stippled_hr${font}
${execi 60 ~/.conkycolors/bin/conkyPhotoRandom}${image /tmp/conkyPhoto.png -s 193x121 -p -2,735}
 
最后注意,开机启动运行/usr/local/share/conkycolors/bin/conkyStart下的文件。命令运行时会“故意”sleep等待25秒钟,让桌面自动完成后再启动conky。就2行命令:
#!/bin/bash
sleep 25 && conky -c ~/.conkycolors/conkyre;
 
本文永久更新地址:http://www.linuxdiyf.com/linux/31774.html