Repository navigation
list-fonts TUI picker similar to list-themes #14609
Unanswered
davidsanchez222
asked this question in
Feature Requests, Ideas
Replies: 1 comment 1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
the current
ghostty +list-fontsjust printing out the fonts to stdout could use an enhancement. it would be nice to have a way to see each font in a picker instead of having to toggle each one in the config file, reload the config and then repeat.i (with the help of Claude Sonnet 5.5) implemented a TUI picker for list-fonts that is mostly the same as
list_themes.zig. I reviewed it, tested it on macOS, and can explain how it works.Diff: davidsanchez222@09bd8e5
Demo:
list-fonts-poc.mp4
there was 2 approaches for this since each cell can only be rendered in the configured font:
the existing
list_fonts.zigdecides whether to launch the pickerlist_fonts_picker.zigchecks that the terminal supports Kitty graphics and reports its size in pixels. Otherwise you still get the searchable list, with a text note in place of the preview.it pulls from the users configured theme so its not just a white/black screen picker like list-themes is.
pressing
cwill copy the line needed to add to the config. so in the demo above the user would receivefont-family = "MesloLGL Nerd Font Mono"in their clipboard.i did some rudemtary performance analysis and saw a 20MB increase in memory usage. about 25 ms per font selection change, and about 50 MB peak memory compared to 33 MB for the plain listing.
only tested on macOS so far
i think it would also be useful to add some icons/ligatures to the preview text in another commit. ligatures would need the shaper, so i'd look into that separately
thoughts?
All reactions