如何格式化字符串输出

时间:2019-09-13 06:33:13

标签: xmobar

如何使cpu百分比指标具有固定宽度或在100以下时插入0。

我的CPU配置

commands = [

        Run Cpu [
        "--template", "cpu: <total>%",
        "-L", "3",
        "-H", "50",
        "--normal", "green",
        "--high", "red"] 10
]

1 个答案:

答案 0 :(得分:1)

您可以使用选项-m设置最小宽度

commands = [

        Run Cpu [
        "--template", "cpu: <total>%",
        "-L", "3",
        "-H", "50",
        "-m", "3",
        "--normal", "green",
        "--high", "red"] 10
]