Conky - 字符串格式化

now*_*wy1 9 bash c awk conky lua

我有记录:

${color lightblue} Down: ${downspeed wlan0} Up: ${upspeed wlan0}
Run Code Online (Sandbox Code Playgroud)

Conky 打印链接速度,但文本移动:

Down: OB  Up: OB 
Down: 60B  Up: 60B
Down: 148B  Up: 148B
Down: 1KiB  Up: 1KiB
Down: 1.8KiB  Up: 1.8KiB
Down: 1.08KiB  Up: 1.08KiB
Down: 31.8KiB  Up: 31.8KiB
Run Code Online (Sandbox Code Playgroud)

基于此主题创建具有零填充的 Conky 文本变量?我尝试格式化输出,但文本仍在移动。

${color lightblue} Down: ${lua_parse format %7s ${downspeed wlan0}} Up: ${lua_parse format %7s ${upspeed wlan0}}
Run Code Online (Sandbox Code Playgroud)

我想要打印输出 conky:

Down:      0B  Up:      0B
Down:     60B  Up:     60B
Down:    148B  Up:    148B
Down:    1KiB  Up:    1KiB
Down:  1.8KiB  Up:  1.8KiB
Down: 1.08KiB  Up: 1.08KiB
Down: 31.8KiB  Up: 31.8KiB
Run Code Online (Sandbox Code Playgroud)

小智 4

您是否尝试过使用goto此处引用的内容:http ://conky.sourceforge.net/variables.html

你可以这样做:

${color lightblue} Down: ${lua_parse format %7s ${downspeed wlan0}}${goto 100} Up: ${lua_parse format %7s ${upspeed wlan0}}
Run Code Online (Sandbox Code Playgroud)

只需将 更改${goto 100}为更符合您的格式的数字即可。