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) <noreply@anthropic.com>
This commit is contained in:
lukasz@orzechowski.eu
2026-03-25 17:22:50 +01:00
parent 7b4b02c267
commit e5723cb4e2
2 changed files with 46 additions and 13 deletions

View File

@@ -1,3 +1,3 @@
"""entropymon - Terminal system monitor by Electric Entropy Lab."""
__version__ = "2.1.1"
__version__ = "2.2.0"

View File

@@ -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"):