Conky

Conky 緩衝區太小?

  • April 16, 2019

例如:我的範例 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

但是 noooooOO,因為 conky 將此輸出提供給桌面:

在此處輸入圖像描述

為什麼?為什麼停在16點?一些緩衝區小嗎?或者 conky 不能編寫腳本輸出更長的 16 行或什麼?:O

計算字元數,conky 顯示 257 個字元,這看起來很可疑,就像 conky 中單行 TEXT 的任意限制。在內部添加一些隱藏的引號到 conky 和 ​​shell 擴展中,並且您會失去“times”字元。Conky 曾經將其顯示的內容限制為前 128 個字元——他們可能已經將其翻了一番。

(15(+1 換行)=每行 16 個字元 x 16 行 = 256 個字元。

發現這個Google搜尋:

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 足夠長,您可能需要進一步提高此限制,或者將您的腳本分成幾個命令。

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