我正在将垂直 conky 更改为横穿屏幕顶部的水平 conky 条。
对于Name and CPU %
,如何设置最大宽度列?我需要设置一个固定宽度,Name CPU%
以便我将下一列带出偏移量。现在它会自动扩展到终端边缘的末端。
conky.text = [[
${alignc} Darin's Computer <<<Gentoo>>> on $machine
$stippled_hr
${alignc}${color}Uptime:${color} $uptime ${color}
${voffset 10}${color }${color}CPU Temperature: ${color white}${exec sensors | grep Tctl | cut -c16-17} c
${color yellow}${cpugraph cpu0 40,500ffff00 ffffff}
${voffset -67} ${offset 545}${color }RAM Usage:${color white} $memperc
${offset 550}${color}${color yellow}${membar 8,500 /}
${offset 550}${color}File Systems:${color white} ${fs_used_perc /}
${offset 550}${color yellow}${fs_bar 8,500 /}
$color$stippled_hr
${voffset -105}${offset 1130}${color}Name ${alignr}CPU o/o #HERE IS WHERE I NEED TO SET A HARD WIDTH
${offset 1130}${color white} ${top name 1} ${alignr}${top cpu 1}
${offset 1130}${color yellow} ${top name 2} ${alignr}${top cpu 2}
${offset 1130}${color yellow} ${top name 3} ${alignr}${top cpu 3}
${offset 1130}${color yellow} ${top name 4} ${alignr}${top cpu 4}
${color}$stippled_hr
${offset 1300}${color}Networking:
Down:${color white} ${downspeed enp2s0} k/s${color white}
${color yellow}${downspeedgraph enp2s0 10,150 ffffff}
${color}${offset 5}Up:${color white} ${upspeed enp2s0} k/s
${color yellow}${upspeedgraph enp2s0 10,150 ffffff}
${color}Port(s) and Connections
$color Inbound: ${color white}${tcp_portmon 1 32767 count} ${color} Outbound: ${color white}${tcp_portmon 32768 61000 count} ${color}ALL: ${color white}${tcp_portmon 1 65535 count}
${color}Inbound Con. ${alignr} Port${color white}
${tcp_portmon 1 32767 rhost 0} ${alignr} ${tcp_portmon 1 32767 lservice 0}
答案1
一种方法是使用tab
对象来定位右侧标题并使用偏移来定位右侧列top
对象。
${offset 15}${color orange}Name${tab 160 15}CPU o/o
${offset 15}${color white}${top name 1}${offset 25}${top cpu 1}
${offset 15}${color yellow}${top name 2}${offset 25}${top cpu 2}
${offset 15}${color yellow}${top name 3}${offset 25}${top cpu 3}
${offset 15}${color yellow}${top name 4}${offset 25}${top cpu 4}