Skip to content

feat: TUIs through ex_ratatui - #34

Open
mcass19 wants to merge 30 commits into
protolux-electronics:mainfrom
mcass19:ex-ratatui
Open

feat: TUIs through ex_ratatui#34
mcass19 wants to merge 30 commits into
protolux-electronics:mainfrom
mcass19:ex-ratatui

Conversation

@mcass19

@mcass19 mcass19 commented May 11, 2026

Copy link
Copy Markdown

Hi @gworkman, hope you're doing well!

What

ex_ratatui recently got a CellSession transport that exposes ratatui's cell grid as a stream of {row, col, char, fg, bg, modifiers} events instead of writing escape codes to a TTY. That makes it possible to bridge ex_ratatui to anything that can paint cells. Including this badge, so I went for it.

There's a generic Screen.ExRatatui adapter that hosts any use ExRatatui.App module as a screen, a small 6×8 bitmap font included in NameBadge.ExRatatui.Font, and a rasteriser in NameBadge.ExRatatui.Raster that walks the cells, draws each glyph into a 400×300 buffer, and inverts pixels for bg: :black or :reversed.

There's more in the README in the folder, including how easy is to add a new screen.

Demo

Three demos are wired into the carousel:

  • Counter — minimal end-to-end demo, two-button up/down counter.
  • Goathi — pixel-art front-view goat face that winks while flashing "HI!" every other tick, all canvas shapes.
  • Stats — five-pane BEAM infographic with a memory-by-category bar chart, processes/atoms gauges, three rolling sparklines (memory, work-rate, run-queue), and a top-12 process panel.

Here's me showing the three screens running on the real hardware:

badge_demo_compressed.mp4

Bonus

While I was at it I also registered a nerves_ssh subsystem pointing at a system monitor TUI. Same library, much wider rendering surface. Plain ssh nerves@wisteria.local (no -s) still drops into the usual IEx prompt.

ssh -t nerves@wisteria.local -s Elixir.NameBadge.ExRatatui.SystemMonitorTui
badge_system_monitor

Next steps

Try it and let me know if useful :).

This is a BIG PR, it has a lot of commits with some back&forth. Each one a step along the way to making it work as clean as possible. Happy to split it however's most useful. One concrete option would be to extract NameBadge.ExRatatui.Raster (plus the font) into its own small library so also the Nerves Starter Kit or any project with a framebuffer-ish display can host TUIs. Open to whatever direction you'd like to take if any. Very happy to collaborate.

mcass19 added 30 commits May 10, 2026 12:47
@gworkman

Copy link
Copy Markdown
Contributor

Hi @mcass19, this is absolutely incredible!! Super cool to see what you've done here, and I'm especially impressed as the rendering performance seems to be great. This is definitely something that I think we can integrate into the upcoming Nerves Starter Kit.

That being said, I'm currently spending most of my time getting the NSK ready. One of the areas I'm working on in that regard is creating a framework for designing screens, which will be a standalone library that will be pushed to hex. The goal is to enable people to make libraries of reusable screens or components. As a part of this, I already know that there's interest in supporting various rendering engines, and so I'm working on designing the library to have an adapter pattern for renderers. I think ex_ratatui would fit very nicely in this abstraction. I'd love to work together to make this one of the officially supported rendering engines :)

In terms of timelines - I'm really pushing on the starter kit right now, and I hope that I can clean up and make public an early version of the rendering library later this month (at which point we can start on implementing an ex_ratatui renderer). For this repo in general, it is somewhat in low-maintenance mode until I get the rendering framework more ready. At that point, I'd like to come back and update this entire repo to use the new framework. It will require a bit of a refactor, but at that point I'd love to merge in your screens!

I'm reachable on the Nerves Discord if you want to discuss specifics on the library and architecture. There's a #starter-kit channel there if you wanted to share the video of the screens you made!

@mcass19

mcass19 commented May 12, 2026

Copy link
Copy Markdown
Author

Thanks @gworkman!!!

Of course, no need to do anything with these changes. I wanted to go end-to-end and demonstrate it working on the hardware I have, and share it with you all. Looking forward to the starter kit (already on the waiting list 🙂).

Excited about the upcoming rendering framework, and happy to collaborate on making TUIs through ex_ratatui a first-class option once we have it. I'll share in Discord #starter-kit channel shortly. Thank you again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants