Conky

在 Conky 中添加文本周圍的間距?

  • October 5, 2013

我在 Conky 中為我的台式機創建了一個非常棒的佈局。

恰當的例子

不幸的是,我很難嘗試在右側的文本中添加填充以將文本的右側與右邊框分開。

這是我的配置:

background yes
use_xft yes
xftfont 123:size=8
xftalpha 0.1
update_interval 0.5
total_run_times 0
own_window yes
own_window_type panel
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 270 1080
#maximum_width 450
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color white
default_shade_color red
default_outline_color black 
alignment top_left
gap_x 0
gap_y 0 
no_buffers yes
uppercase no
cpu_avg_samples 2
net_avg_samples 1
use_spacer left
override_utf8_locale yes

lua_load ~/.config/conky/scripts/conky_lua_scripts.lua

TEXT
${image .conky/mightymoose-sidebar-background.png}${image .conky/mightymoose-logo.png -p 10,10 -s 255x100}${voffset 110}
${offset 10}${font Monospace:bold:size=8}PROCESSORS ${hr 2}
${font Monospace:size=8}${cpugraph cpu0 30,255 333333 FFFFFF}
${offset 10}${cpubar cpu1 6,135}$alignr ${execi 1 get-i7z-value freq -c 0}  ${execi 1 get-i7z-value temp -c 0} ${lua_parse format %3.0f ${cpu cpu1}}%
${offset 10}${cpubar cpu2 6,135}$alignr ${lua_parse format %3.0f ${cpu cpu2}}%
${offset 10}${voffset -5}${hr 0.1}
${offset 10}${cpubar cpu3 6,135}$alignr ${execi 1 get-i7z-value freq -c 1}  ${execi 1 get-i7z-value temp -c 1} ${lua_parse format %3.0f ${cpu cpu3}}%
${offset 10}${cpubar cpu4 6,135}$alignr ${lua_parse format %3.0f ${cpu cpu4}}%
${offset 10}${voffset -5}${hr 0.1}
${offset 10}${cpubar cpu5 6,135}$alignr ${execi 1 get-i7z-value freq -c 2}  ${execi 1 get-i7z-value temp -c 2} ${lua_parse format %3.0f ${cpu cpu5}}%
${offset 10}${cpubar cpu6 6,135}$alignr ${lua_parse format %3.0f ${cpu cpu6}}%
${offset 10}${voffset -5}${hr 0.1}
${offset 10}${cpubar cpu7 6,135}$alignr ${execi 1 get-i7z-value freq -c 3}  ${execi 1get-i7z-value temp -c 3} ${lua_parse format %3.0f ${cpu cpu7}}%
${offset 10}${cpubar cpu8 6,135}$alignr ${lua_parse format %3.0f ${cpu cpu8}}%

${offset 10}${font Monospace:bold:size=8}MEMORY ${hr 2}
${offset 10}${font Monospace:size=8}${membar}
${offset 10}$alignc${mem} of ${memmax}: ${lua_parse format %3.0f $memperc}%

${offset 10}${font Monospace:bold:size=8}GPU ${hr 2}
${offset 10}${font Monospace:size=8}Temperature:$alignr${nvidia temp}°C
${offset 10}GPU Frequency:$alignr${nvidia gpufreq} MHz
${offset 10}Memory Frequency:$alignr${nvidia memfreq} MHz

${offset 10}${font Monospace:bold:size=8}NETWORK ${hr 2}
${offset 10}${font Monospace:size=8}eth0:  ${addr eth0}$alignr${font :size=8}↑${font Monospace:size=6}${upspeedf eth0}${font :size=8}↓${font Monospace:size=6}${downspeedf eth0}${font :size=8}
${offset 10}${font Monospace:size=8}wlan0: ${addr eth2}$alignr${font :size=8}↑${font Monospace:size=6}${upspeedf eth2}${font :size=8}↓${font Monospace:size=6}${downspeedf eth2}${font :size=8}
${offset 10}${font :size=20}↓${downspeedgraph eth2 25,105 333333 FFFFFF -l}↑${upspeedgraph eth2 25,105 333333 FFFFFF -l}

必須在每行上指定偏移量以將所有內容向右移動 10px 似乎很愚蠢,但如果這是唯一的解決方案,那沒關係。

這裡的主要目標是在右側添加 10px 的間距以將文本拉離右邊框。有沒有辦法做到這一點?

Conky 有一系列非常全面的設置來顯示您的系統資訊。

在這種情況下最感興趣的兩個是:

  • 邊界內邊距
  • 邊界外邊距

在您描述的情況下,我建議前者:

以像素為單位的內邊框邊距(邊框和文本之間的邊距)。

引用自:https://unix.stackexchange.com/questions/93632