spe*_*cle 3 if-statement conky
由于我的可搜索关键字的广泛含义,我很难用谷歌搜索并搜索我正在尝试做的事情.
我正在尝试修改我的.conkyrc文件以根据温度更改字体颜色,这需要我写下这样的内容:
if [ $test >="50" and $test <="60"];
Run Code Online (Sandbox Code Playgroud)
我不希望上述内容完全起作用,我知道语法都是错误的,但这是我描述我想要完成的内容的最简单方法
下面是我配置中的一个实际部分,我试图在没有"和"或"或"的情况下进行,但当然,它不能像我希望的那样工作.
${goto 45}${if_match "${platform coretemp.0 temp 2}" >= "115"}${color4}${endif}${if_match "${platform coretemp.0 temp 2}" >= "125"}${color5}${endif}${if_match "${platform coretemp.0 temp 2}" >= "145"}${color6}${endif}${if_match "${platform coretemp.0 temp 2}" >= "155"}${color7}${endif}${if_match "${platform coretemp.0 temp 2}" >= "170"}${color8}${endif}${platform coretemp.0 temp 2}°F
Run Code Online (Sandbox Code Playgroud)
另外,我可以使用带有conky的elseif吗?
${if_match "$test" >="113"}${color4}${elseif "$test1" <="120"}${color5}${endif}
Run Code Online (Sandbox Code Playgroud)
或类似的东西?
Til*_*ilt 10
要模拟AND,您可以使用两个嵌套的IF,这样:
${if_match ${battery_percent BAT0} <= 60}${if_match ${battery_percent BAT0} >=50} my battery is between 50 and 60 ${endif}${endif}
Run Code Online (Sandbox Code Playgroud)
(照顾双$ {endif}:如果你打开两个IF,你应该关闭两个IF)
您还可以模拟嵌套两个IF的elseif:
${if_match "$test" >="113"}${color4}\
${else}${if_match "$test" <="120"}${color5}${endif}\
${endif}
Run Code Online (Sandbox Code Playgroud)
(反斜杠以提高可读性)
| 归档时间: |
|
| 查看次数: |
12576 次 |
| 最近记录: |