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:
@@ -1,3 +1,3 @@
|
|||||||
"""entropymon - Terminal system monitor by Electric Entropy Lab."""
|
"""entropymon - Terminal system monitor by Electric Entropy Lab."""
|
||||||
|
|
||||||
__version__ = "2.1.1"
|
__version__ = "2.2.0"
|
||||||
|
|||||||
@@ -1594,16 +1594,30 @@ class Renderer:
|
|||||||
cx = x + 1 + col * col_w
|
cx = x + 1 + col * col_w
|
||||||
if cy >= y + box_h - 1:
|
if cy >= y + box_h - 1:
|
||||||
break
|
break
|
||||||
col_attr = C_LOW
|
# Color based on absolute temperature thresholds
|
||||||
if current > high * 0.8:
|
if high and high > 0:
|
||||||
col_attr = C_MED
|
# Use sensor-provided thresholds
|
||||||
if current > high:
|
if current >= (critical or high + 10):
|
||||||
col_attr = C_HIGH
|
|
||||||
if critical and current > critical:
|
|
||||||
col_attr = C_CRIT
|
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
|
# Mini-bar scaled to max 100°C for visibility
|
||||||
temp_pct = min(current / (critical or 110) * 100, 100)
|
temp_pct = min(current / 100 * 100, 100)
|
||||||
mini_bar_w = max(col_w - 22, 3)
|
mini_bar_w = max(col_w - 22, 3)
|
||||||
text = f"{label[:10]:10s} {current:5.1f}\u00b0C "
|
text = f"{label[:10]:10s} {current:5.1f}\u00b0C "
|
||||||
safe_addstr(self.scr, cy, cx, text, curses.color_pair(col_attr))
|
safe_addstr(self.scr, cy, cx, text, curses.color_pair(col_attr))
|
||||||
@@ -1976,7 +1990,7 @@ class Renderer:
|
|||||||
|
|
||||||
# ─── Intro ──────────────────────────────────────────────────────────
|
# ─── Intro ──────────────────────────────────────────────────────────
|
||||||
|
|
||||||
VERSION = "2.1.1"
|
VERSION = "2.2.0"
|
||||||
|
|
||||||
LOGO_ART = [
|
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",
|
" \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,9 +2340,18 @@ def _curses_main(stdscr):
|
|||||||
pm.filter_mode = False
|
pm.filter_mode = False
|
||||||
pm.filter_text = ""
|
pm.filter_text = ""
|
||||||
pm.selected_idx = 0
|
pm.selected_idx = 0
|
||||||
|
pm.selected_pid = None
|
||||||
elif key == 10 or key == 13:
|
elif key == 10 or key == 13:
|
||||||
pm.filter_mode = False
|
pm.filter_mode = False
|
||||||
pm.selected_idx = 0
|
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):
|
elif key in (curses.KEY_BACKSPACE, 127, 8):
|
||||||
pm.filter_text = pm.filter_text[:-1]
|
pm.filter_text = pm.filter_text[:-1]
|
||||||
pm.selected_idx = 0
|
pm.selected_idx = 0
|
||||||
@@ -2336,6 +2359,10 @@ def _curses_main(stdscr):
|
|||||||
pm.filter_text += chr(key)
|
pm.filter_text += chr(key)
|
||||||
pm.selected_idx = 0
|
pm.selected_idx = 0
|
||||||
continue
|
continue
|
||||||
|
else:
|
||||||
|
continue
|
||||||
|
if pm.filter_mode:
|
||||||
|
continue
|
||||||
|
|
||||||
# Nice dialog
|
# Nice dialog
|
||||||
if pm.show_nice_dialog:
|
if pm.show_nice_dialog:
|
||||||
@@ -2381,7 +2408,13 @@ def _curses_main(stdscr):
|
|||||||
if key == ord("q") or key == ord("Q"):
|
if key == ord("q") or key == ord("Q"):
|
||||||
break
|
break
|
||||||
elif key == 27:
|
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):
|
elif key in (ord("h"), ord("?"), curses.KEY_F1):
|
||||||
renderer.show_help = True
|
renderer.show_help = True
|
||||||
elif key == ord("L"):
|
elif key == ord("L"):
|
||||||
|
|||||||
Reference in New Issue
Block a user