feat: HD rendering mode and rendering defaults from config file - #23
Open
jonathandip wants to merge 3 commits into
Open
feat: HD rendering mode and rendering defaults from config file#23jonathandip wants to merge 3 commits into
jonathandip wants to merge 3 commits into
Conversation
- Move call_after_refresh(_paint_kitty) from _invalidate_cache into _rebuild_kitty so the callback fires after the new pixel buffer is ready, eliminating the one-keypress display lag in Kitty/FullHD mode. - Draw atom number labels directly onto the pixel buffer in Kitty mode using PIL ImageDraw with a small (9 px) font, matching the #Nums toggle that already worked in braille mode.
- Fix APC payload chunking (4096-byte limit with m=1/m=0 continuation) - Query actual cell pixel dimensions via CSI 16t before app startup; drain leftover bytes to avoid polluting Textual's input buffer - Guard all /dev/tty paths on Windows - Widen atom-number font fallback to DejaVu (Linux) and load_default() - Narrow bare except to RuntimeError around call_after_refresh teardown - Replace auto-activation on mount with opt-in --hd CLI flag and H keybinding - Rename pixel_mode → hd_mode, action_toggle_pixel_mode → action_toggle_hd_mode
Author
Adds optional user config at ~/.config/moltui/config.toml with a [rendering] section covering ambient, diffuse, specular, shininess, atom_scale, bond_radius, and hd. Missing keys fall back to built-in defaults; out-of-range values are silently clamped. The --hd CLI flag overrides config.hd when set. Note: the hd setting depends on the Kitty HD mode introduced in kszenes#23. Config loading requires tomllib (Python 3.11+) or tomli; silently skipped if neither is available.
Owner
|
Hi @jonathandip, thanks for the contribution. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Inspired by ProteinView's approach to exposing rendering settings, this PR adds a high-definition rendering mode and an optional config file to persist rendering defaults across sessions.
Added
--hdflag: start the viewer in HD mode from the command line (moltui file.xyz --hd)Hkeybinding: toggle HD mode on/off at runtime~/.config/moltui/config.tomlto set rendering defaults[rendering]section with configurableambient,diffuse,specular,shininess,atom_scale, andbond_radiushd = trueto start in HD mode by default--hdCLI flag overrideshdin the config when settomllib(Python 3.11+) ortomli; silently skipped if neither is availableExample config