![Conky缓冲区太小?](https://linux22.com/image/2336/Conky%E7%BC%93%E5%86%B2%E5%8C%BA%E5%A4%AA%E5%B0%8F%EF%BC%9F.png)
例如:我的示例 conkyrc (最后一行是唯一重要的部分!):
background yes
use_xft yes
xftfont Terminus:size=8
xftalpha 0.8
update_interval 5.0
total_run_times 0
double_buffer yes
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
minimum_size 0 0
draw_shades yes
draw_outline no
draw_borders no
stippled_borders 8
border_margin 0
border_width 0
default_color ffffff
default_shade_color black
default_outline_color ffffff
alignment top_left
# gap_x - 1280x800 = 1105; 1024x768 = 820
gap_x 1200
gap_y 0
no_buffers yes
uppercase no
cpu_avg_samples 2
net_avg_samples 2
override_utf8_locale yes
use_spacer yes
TEXT
${execpi 15 sleep $[ ($RANDOM % 3 ) ]; sh conkyscripts.sh}
和
cat conkyscripts.sh
#!/bin/bash
for i in {1..40}; do echo "Welcome $i times"; done
所以这应该给出与执行“sh conkyscript.sh”时相同的输出
Welcome 1 times
Welcome 2 times
Welcome 3 times
Welcome 4 times
Welcome 5 times
Welcome 6 times
Welcome 7 times
Welcome 8 times
Welcome 9 times
Welcome 10 times
Welcome 11 times
Welcome 12 times
Welcome 13 times
Welcome 14 times
Welcome 15 times
Welcome 16 times
Welcome 17 times
Welcome 18 times
Welcome 19 times
Welcome 20 times
Welcome 21 times
Welcome 22 times
Welcome 23 times
Welcome 24 times
Welcome 25 times
Welcome 26 times
Welcome 27 times
Welcome 28 times
Welcome 29 times
Welcome 30 times
Welcome 31 times
Welcome 32 times
Welcome 33 times
Welcome 34 times
Welcome 35 times
Welcome 36 times
Welcome 37 times
Welcome 38 times
Welcome 39 times
Welcome 40 times
但是不行,因为 conky 向桌面提供了以下输出:
为什么?为什么到16就停止了?某些缓冲区是否太小?或者 conky 无法编写输出超过 16 行的脚本还是什么? :哦
答案1
计算字符数,conky 显示了 257 个字符,这看起来很像 conky 中单行 TEXT 的任意限制。在 conky 和 shell 扩展内部添加一些隐藏的引号,您就失去了“times”字符。 Conky 过去将其显示内容限制为前 128 个字符 - 他们可能将其加倍。
(15(+1 换行符)=每行 16 个字符 x 16 行 = 256 个字符。
谷歌搜索发现了这个:
http://lifehacker.com/5067341/customize-conky-for-ambient-linux-productivity
If your to-do file or any other section is getting cut off too soon, that's because Conky has an unseen default text limit for any object. You can tweak it by adding a text_buffer_size 512 to the top section of your .conkyrc, changing that number to fit your needs.
如果您的 TEXT 足够长,您可能需要进一步提高此限制,或者将脚本分成多个命令。