conky 中的 execbar 似乎无法正常工作。
因此,如果我使用 bash 脚本(名为 myscript.sh)
# moc or mocp is Music on Console
totalsec=$(mocp --info | grep "TotalSec" | cut -d: -f2 | sed 's/^ //g' | sed 's/ $//g')
cursec=$(mocp --info | grep "CurrentSec" | cut -d: -f2 | sed 's/^ //g' | sed 's/ $//g')
progress=$(echo "(${cursec}*100/${totalsec})" | bc)
echo "\${execbar echo ${progress}}"
echo "${progress}" # This works and shows be the value of the integer variable.
然后使用 conky 调用 bash 脚本
conky.text = [[${execpi 3 ./myscript.sh}]];
然后不显示进度条。只有一个白色的矩形。
但是,如果将相同的 bash 脚本更改为
progress=23
echo "\${execbar echo ${progress}}"
然后它工作并显示一个恒定的23
. 不知道为什么传递整数变量不起作用。任何解决此问题的帮助将不胜感激。