summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xpanel.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/panel.py b/panel.py
index 0dcfade..fdee772 100755
--- a/panel.py
+++ b/panel.py
@@ -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,