diff options
-rwxr-xr-x | panel.py | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -457,12 +457,18 @@ class ModNetIf(ModInterval): class ModCPU(ModInterval): def refresh(self): percent = psutil.cpu_percent() - self.out = Fmt.labelled('CPU', f'{percent:.0f}%%') + buf = f'{percent:.0f}%%' + if percent > 75: + buf = Fmt.fg('#ff4000', buf) + self.out = Fmt.labelled('CPU', buf) class ModMem(ModInterval): def refresh(self): percent = psutil.virtual_memory().percent - self.out = Fmt.labelled('MEM', f'{percent:.0f}%%') + buf = f'{percent:.0f}%%' + if percent > 75: + buf = Fmt.fg('#ff4000', buf) + self.out = Fmt.labelled('MEM', buf) class ModPWVol(ModInterval): def __init__(self, sink='@DEFAULT_AUDIO_SINK@', step='0.05', limit=None, |