Movwin: My (Unpublished) TUI Framework
Frustrated by the fleeting nature of UI frameworks and performance issues, a developer built Movwin, a custom Python TUI on ncurses, prioritizing long-term stability and control. This deep dive showcases its unique features, like DOS-inspired windows and Unicode handling, through practical applications. Intriguingly, the author explicitly states they won't publish the code, citing concerns over AI companies exploiting open-source contributions.
The Lowdown
Movwin is a personal, unpublished Terminal User Interface (TUI) framework developed by the author out of frustration with the instability and performance of existing UI libraries. Conceived after the 2025 Advent of Code, the project aims to create a robust and lasting framework that the author can rely on for years, without needing to constantly adapt to upstream changes or face slow initialization times. Built in Python, it leverages ncurses for terminal compatibility, treating it as an intelligent framebuffer rather than using its subwindows.
Here are the core aspects and features of Movwin:
- Foundation and Philosophy: Movwin (movq's windows and widgets) is a Python library built atop
ncurses, prioritizing stability and performance over chasing trends. It relies onwcwidthfor acceptable Unicode support, ensuring text and emojis display correctly without layout issues, though perfect terminal-specific rendering is acknowledged as impossible. - Performance and Design Choices: A key goal is fast startup times (under 300ms on older hardware), leading to sacrifices like avoiding Python's
dataclassesdue to their import overhead. It adopts aWindowandWindowManagerconcept, reminiscent of old DOS TUIs. - Limited Mouse Support: While some mouse functionality exists (e.g., moving windows), it's currently limited due to inconsistencies across UNIX terminals and may be removed, leaning into a keyboard-driven approach.
- Applications Showcase: The post demonstrates Movwin through several applications:
tracktivity: A tool for tracking activities from CSV files, showcasing dynamic UI form generation and window resizing/moving capabilities.bine: A fast hex editor utilizingmmap()for large files, featuring info panels, multi-window support with tiling, and undo/redo functionality.watwar: A simple time-tracking program, integrating with an Arduino-based 7-segment display for real-time hour monitoring.
- Advanced Features: Movwin includes two built-in themes ("bluegray" and "amber" for DOS nostalgia) with seasonal auto-selection and customizability. It also boasts a well-thought-out menu system with discoverability, keyboard accelerators (e.g.,
Alt+f, q), and self-documenting hotkeys. - Unicode in Edit Boxes: Edit boxes intelligently handle Unicode, supporting horizontal scrolling without display glitches, even for multi-cell characters.
The author expresses satisfaction with Movwin's current state, confident in its long-term viability given the stability of ncurses and Python. Future plans include implementing a proper list view, tree view, and file selection dialog. However, the author explicitly states the code will not be published, citing concerns about AI companies appropriating open-source contributions without regard for licensing.