v2.2.1: Clear screen on exit

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
lukasz@orzechowski.eu
2026-03-25 22:45:09 +01:00
parent e5723cb4e2
commit f0ab27f279
2 changed files with 4 additions and 10 deletions

View File

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

View File

@@ -1990,7 +1990,7 @@ class Renderer:
# ─── Intro ──────────────────────────────────────────────────────────
VERSION = "2.2.0"
VERSION = "2.2.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",
@@ -2667,15 +2667,9 @@ def main():
# Reset terminal state before entering curses
os.system("stty sane 2>/dev/null")
# Save terminal content before curses takes over
sys.stdout.write("\033[?1049h") # switch to alternate screen
sys.stdout.flush()
try:
curses.wrapper(_curses_main)
except curses.error as e:
sys.stdout.write("\033[?1049l") # restore main screen
sys.stdout.flush()
os.system("stty sane 2>/dev/null")
term = os.environ.get("TERM", "?")
print(f"\nTerminal error: {e}")
@@ -2688,9 +2682,9 @@ def main():
except KeyboardInterrupt:
pass
finally:
sys.stdout.write("\033[?1049l") # restore main screen
sys.stdout.flush()
os.system("stty sane 2>/dev/null")
sys.stdout.write("\033[2J\033[H") # clear screen + cursor home
sys.stdout.flush()
if __name__ == "__main__":