v2.1.1: Fix curs_set() ERR on xterm-color and limited terminals

- Wrap all curs_set(0) calls in try/except for terminals that don't support cursor hiding
- Safe guard init_colors() for terminals with <8 colors

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
lukasz@orzechowski.eu
2026-03-25 17:00:05 +01:00
parent 3dd65e9d7d
commit 7b4b02c267
2 changed files with 21 additions and 7 deletions

View File

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

View File

@@ -218,8 +218,13 @@ C_WHITE_BOLD = 20
def init_colors():
curses.start_color()
curses.use_default_colors()
try:
curses.start_color()
curses.use_default_colors()
except curses.error:
pass
if curses.COLORS < 8:
return
curses.init_pair(C_TITLE, curses.COLOR_CYAN, -1)
curses.init_pair(C_LOW, curses.COLOR_GREEN, -1)
curses.init_pair(C_MED, curses.COLOR_YELLOW, -1)
@@ -1971,7 +1976,7 @@ class Renderer:
# ─── Intro ──────────────────────────────────────────────────────────
VERSION = "2.1.0"
VERSION = "2.1.1"
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",
@@ -2002,7 +2007,10 @@ BOOT_LINES = [
def intro_splash(stdscr):
"""Animated boot splash inspired by Spectre/Pulse."""
curses.curs_set(0)
try:
curses.curs_set(0)
except curses.error:
pass
stdscr.nodelay(False)
stdscr.timeout(20)
init_colors()
@@ -2235,7 +2243,10 @@ show_intro = True
def _mini_splash(stdscr):
"""Quick 1-second mini splash when full intro is disabled."""
curses.curs_set(0)
try:
curses.curs_set(0)
except curses.error:
pass
init_colors()
h, w = stdscr.getmaxyx()
stdscr.erase()
@@ -2269,7 +2280,10 @@ def _curses_main(stdscr):
else:
_mini_splash(stdscr)
curses.curs_set(0)
try:
curses.curs_set(0)
except curses.error:
pass
stdscr.nodelay(True)
init_colors()