From e5723cb4e222e7dc1c67227c1058313924ba70a3 Mon Sep 17 00:00:00 2001 From: "lukasz@orzechowski.eu" Date: Wed, 25 Mar 2026 17:22:50 +0100 Subject: [PATCH] v2.2.0: ESC behavior, filter nav, temp colors fix - ESC no longer quits - clears filter or tree view instead (q to quit) - Arrow keys in filter mode exit filter and navigate immediately - Fix temperature colors: proper thresholds with/without sensor limits - Mini-bars scaled to 100C for better visibility at normal temps Co-Authored-By: Claude Opus 4.6 (1M context) --- entropymon/__init__.py | 2 +- entropymon/monitor.py | 57 +++++++++++++++++++++++++++++++++--------- 2 files changed, 46 insertions(+), 13 deletions(-) diff --git a/entropymon/__init__.py b/entropymon/__init__.py index abcaf61..de28ce5 100644 --- a/entropymon/__init__.py +++ b/entropymon/__init__.py @@ -1,3 +1,3 @@ """entropymon - Terminal system monitor by Electric Entropy Lab.""" -__version__ = "2.1.1" +__version__ = "2.2.0" diff --git a/entropymon/monitor.py b/entropymon/monitor.py index d42433b..39b657c 100755 --- a/entropymon/monitor.py +++ b/entropymon/monitor.py @@ -1594,16 +1594,30 @@ class Renderer: cx = x + 1 + col * col_w if cy >= y + box_h - 1: break - col_attr = C_LOW - if current > high * 0.8: - col_attr = C_MED - if current > high: - col_attr = C_HIGH - if critical and current > critical: - col_attr = C_CRIT + # Color based on absolute temperature thresholds + if high and high > 0: + # Use sensor-provided thresholds + if current >= (critical or high + 10): + col_attr = C_CRIT + elif current >= high: + col_attr = C_HIGH + elif current >= high * 0.75: + col_attr = C_MED + else: + col_attr = C_LOW + else: + # Sensible defaults when no thresholds available + if current >= 95: + col_attr = C_CRIT + elif current >= 80: + col_attr = C_HIGH + elif current >= 60: + col_attr = C_MED + else: + col_attr = C_LOW - # Temperature with mini-bar - temp_pct = min(current / (critical or 110) * 100, 100) + # Mini-bar scaled to max 100°C for visibility + temp_pct = min(current / 100 * 100, 100) mini_bar_w = max(col_w - 22, 3) text = f"{label[:10]:10s} {current:5.1f}\u00b0C " safe_addstr(self.scr, cy, cx, text, curses.color_pair(col_attr)) @@ -1976,7 +1990,7 @@ class Renderer: # ─── Intro ────────────────────────────────────────────────────────── -VERSION = "2.1.1" +VERSION = "2.2.0" LOGO_ART = [ " \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2557", @@ -2326,16 +2340,29 @@ def _curses_main(stdscr): pm.filter_mode = False pm.filter_text = "" pm.selected_idx = 0 + pm.selected_pid = None elif key == 10 or key == 13: pm.filter_mode = False pm.selected_idx = 0 + pm.selected_pid = None + elif key in (curses.KEY_DOWN, curses.KEY_UP, curses.KEY_NPAGE, + curses.KEY_PPAGE, curses.KEY_HOME, curses.KEY_END, + ord("j"), ord("k")): + # Arrow keys exit filter mode and navigate immediately + pm.filter_mode = False + pm.selected_pid = None + # Don't continue - fall through to normal key handling elif key in (curses.KEY_BACKSPACE, 127, 8): pm.filter_text = pm.filter_text[:-1] pm.selected_idx = 0 elif 32 <= key <= 126: pm.filter_text += chr(key) pm.selected_idx = 0 - continue + continue + else: + continue + if pm.filter_mode: + continue # Nice dialog if pm.show_nice_dialog: @@ -2381,7 +2408,13 @@ def _curses_main(stdscr): if key == ord("q") or key == ord("Q"): break elif key == 27: - break + # ESC clears filter/state, does NOT quit + if pm.filter_text: + pm.filter_text = "" + pm.selected_idx = 0 + pm.selected_pid = None + elif pm.tree_mode: + pm.tree_mode = False elif key in (ord("h"), ord("?"), curses.KEY_F1): renderer.show_help = True elif key == ord("L"):