Show HN: Chawan TUI web browser
239 shiomiru 37 6/16/2025, 8:48:43 PM chawan.net ↗
A terminal-based web browser in Nim.[1] Has acceptable (YMMV) CSS
rendering, some JS support, and inline images (sixel/kitty). It can
also use various protocols other than http(s) such as (s)ftp, gopher,
gemini, ...
Chawan started out as a w3m clone, and the UI still resembles it. However, the architecture has turned out quite different, with pages loaded in separate processes, and protocol/file type handling separated out into external binaries. An interesting result is that you can even register decoders for custom inline image formats, although practical use cases of this are rather minimal.
There is a gallery showcasing some websites being rendered here: https://chawan.net/gallery/index.html
[1]: https://nim-lang.org
What's the best resource (paid or free) in your opinion for learning about these TTY related concepts?
I'm aware of https://www.linusakesson.net/programming/tty/index.php for example, but that doesn't go into termcap/terminfo/curses.
one of the comments mentions http://www.amazon.com/termcap-terminfo-OReilly-Nutshell-Lind... though (online https://www.scribd.com/document/831486848/Termcap-and-Termin...)
As it hasn't been brought up yet, a really great hack (esp. for us without sixel) is this terminal port of chromium: https://github.com/fathyb/carbonyl .. but the original creator hasn't had time to get back to it. So it is very bare bones & lacks a lot of features, like keyboard shortcuts, file saving.. but obviously it brings full web compatibility and is just very cool. Wishing for someone with rust skills to pick it up again, last time I looked (couple of months ago) none of the forks had any momentum.
Slightly off topic but I’d love to see a list of mainly text sites.
My two favourites are https://plaintextsports.com/ and https://lite.cnn.com/
Having support for some CSS makes it a bit more difficult, as spacing between elements is now an issue, where previously links would ignore margins and padding all together which were used to display cleaner inline list elements (for menus and such).
When I do `cha example.com` I can't figure out how to use any of the commands (hjkl, etc). The only keys I've found that have any effect are typing numbers which show up in the bottom left. Haven't figured out how to do anything with those. Am I missing something obvious about how to use this or could this be a bug?
I built from source on MacOS Sequoia 15.5 Apple Silicon using Nim 2.24. Pages load correctly, I just can't get the commands to work. Thanks!
Could you please pull the macos-input branch from https://git.sr.ht/~bptato/chawan and report back on what the `a` file includes after opening a site and typing some commands? (Should be created in the current working directory.)
``` handleCommandInput 1, buffer "" c 'j' handleCommandInput 2, buffer "" c 'j' after handleCommandInput, buffer 0x104c5b780"j" c 'j' handleCommandInput 1, buffer "" c 'k' handleCommandInput 2, buffer "" c 'k' after handleCommandInput, buffer 0x104ca8b70"k" c 'k' handleCommandInput 1, buffer "" c 'l' handleCommandInput 2, buffer "" c 'l' after handleCommandInput, buffer 0x104c5bab0"l" c 'l' handleCommandInput 1, buffer "" c 'k' handleCommandInput 2, buffer "" c 'k' after handleCommandInput, buffer 0x104ca8d20"k" c 'k' handleCommandInput 1, buffer "" c 'j' handleCommandInput 2, buffer "" c 'j' after handleCommandInput, buffer 0x104c5b480"j" c 'j' handleCommandInput 1, buffer "" c 'h' handleCommandInput 2, buffer "" c 'h' after handleCommandInput, buffer 0x104ca89c0"h" c 'h' handleCommandInput 1, buffer "" c 'g' handleCommandInput 2, buffer "" c 'g' after handleCommandInput, buffer 0x104cae780"g" c 'g' handleCommandInput 1, buffer "" c '1' after handleCommandInput, buffer "" c '1' handleCommandInput 1, buffer "" c '2' after handleCommandInput, buffer "" c '2' handleCommandInput 1, buffer "" c '3' after handleCommandInput, buffer "" c '3' handleCommandInput 1, buffer "" c '1' after handleCommandInput, buffer "" c '1' handleCommandInput 1, buffer "" c '2' after handleCommandInput, buffer "" c '2' handleCommandInput 1, buffer "" c '2' after handleCommandInput, buffer "" c '2' handleCommandInput 1, buffer "" c '3' after handleCommandInput, buffer "" c '3' handleCommandInput 1, buffer "" c '\3' handleCommandInput 2, buffer "" c '\3' after handleCommandInput, buffer 0x104cae690"\3" c '\3' handleCommandInput 1, buffer "" c '\3' handleCommandInput 2, buffer "" c '\3' after handleCommandInput, buffer 0x104adaed0"\3" c '\3' handleCommandInput 1, buffer "" c '\3' handleCommandInput 2, buffer "" c '\3' after handleCommandInput, buffer 0x104ca8720"\3" c '\3' handleCommandInput 1, buffer "" c '\4' handleCommandInput 2, buffer "" c '\4' after handleCommandInput, buffer 0x104bf8d80"\4" c '\4' handleCommandInput 1, buffer "" c '\3' handleCommandInput 2, buffer "" c '\3' after handleCommandInput, buffer 0x104caaa80"\3" c '\3' handleCommandInput 1, buffer "" c '\4' handleCommandInput 2, buffer "" c '\4' after handleCommandInput, buffer 0x104ca8e40"\4" c '\4' ```
OK, let's try something else. On master, is anything written to the status line if you press `p` when started with
I see you don't use termcap/ncurses anymore. Do you perform terminal handling yourself directly?
Thanks again!
I started with termcap because I was already familiar with it through w3m. But termcap is an obsolete interface, and cannot describe the only useful attribute for modern terminals (true color). Its only benefit was "maybe it accidentally works on a hardware terminal from the 80s", which is cool but not really worth the extra failure mode.
So instead of migrating to terminfo, I ditched it completely in favor of terminal queries (which were already necessary for other reasons). There is still a built-in terminal database, to detect known TERM values with XTerm incompatibilities. But a terminal that correctly responds to queries will work out of the box, even if its TERM value is unknown.
Is that your design choice not having "Open URL"(Address bar) feature?
For navigation in particular you'd use capital D to discard the current buffer and return to the previous page. There's also , (comma, back) and . (period, forward), which non-destructively cycle through the stack.
(Well, it's really a tree, but the UI mostly treats it as a stack.)
If you're interested, I posted a user style for HN here: https://lists.sr.ht/~bptato/chawan-devel/%3CD9S40OS2QWHL.PXQ...
Mainly just to fix the vote arrows, because for now background-image only renders placeholders.
Nim is wonderful language and I am glad to see it used for this.