sane-sysload: add an "{all}" formatter, and show that by default
This commit is contained in:
@@ -22,6 +22,7 @@ variables available for formatting:
|
|||||||
- {mem_icon}
|
- {mem_icon}
|
||||||
- {mem_pct}
|
- {mem_pct}
|
||||||
and some presets, encapsulating the above:
|
and some presets, encapsulating the above:
|
||||||
|
- {all}
|
||||||
- {bat}
|
- {bat}
|
||||||
- {cpu}
|
- {cpu}
|
||||||
- {mem}
|
- {mem}
|
||||||
@@ -382,6 +383,9 @@ class AllInfo:
|
|||||||
|
|
||||||
# user-facing format shorthands
|
# user-facing format shorthands
|
||||||
@property
|
@property
|
||||||
|
def all(self) -> str:
|
||||||
|
return f"{self.bat_pct} {self.bat} {self.mem} {self.cpu}"
|
||||||
|
@property
|
||||||
def bat(self) -> str:
|
def bat(self) -> str:
|
||||||
return f"{self.bat_icon}{self.bat_time}"
|
return f"{self.bat_icon}{self.bat_time}"
|
||||||
@property
|
@property
|
||||||
@@ -476,7 +480,7 @@ def main() -> None:
|
|||||||
parser.add_argument("--hour-suffix", default=SUFFIX_HR)
|
parser.add_argument("--hour-suffix", default=SUFFIX_HR)
|
||||||
parser.add_argument("--minute-suffix", default=SUFFIX_MIN)
|
parser.add_argument("--minute-suffix", default=SUFFIX_MIN)
|
||||||
parser.add_argument("--percent-suffix", default=SUFFIX_PERCENT)
|
parser.add_argument("--percent-suffix", default=SUFFIX_PERCENT)
|
||||||
parser.add_argument("formatstr", nargs="+")
|
parser.add_argument("formatstr", nargs="*", default=["{all}"])
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
if args.debug:
|
if args.debug:
|
||||||
@@ -491,6 +495,7 @@ def main() -> None:
|
|||||||
info = AllInfo(f)
|
info = AllInfo(f)
|
||||||
formatstr = " ".join(args.formatstr)
|
formatstr = " ".join(args.formatstr)
|
||||||
print(formatstr.format(
|
print(formatstr.format(
|
||||||
|
all=LazyFormatter(info, "all"),
|
||||||
bat=LazyFormatter(info, "bat"),
|
bat=LazyFormatter(info, "bat"),
|
||||||
bat_icon=LazyFormatter(info, "bat_icon"),
|
bat_icon=LazyFormatter(info, "bat_icon"),
|
||||||
bat_pct=LazyFormatter(info, "bat_pct"),
|
bat_pct=LazyFormatter(info, "bat_pct"),
|
||||||
|
Reference in New Issue
Block a user