JASCO

Sixels and changing terminal emulators

Published: Sun, 15 Dec 2024 01:02:40 -0800

I want to rewrite my tui rss feed reader

I wrote Feedie a couple years ago with the one goal of having a terminal rss feed reader with thumbnail support. I got it to a functioning state, but it has a number of issues and is poorly designed. I've been meaning to rewrite it for more than a year, even making a pretty good start back in March, but have been to busy with school and life (read too lazy) to actually make real progress. With the semester having ended this week, I'm making it a goal to work on the Feedie rewrite over the winter break.

For the original Feedie, I used Ueberzug for image drawing to the terminal. Ueberzug is pretty good, but after the original creator nuked the repo out of frustration, proper documentation is kinda hard to come by, and it generally seems like the utility is being used to a lesser extent. For these reasons, I wanted to look for something else. After some research, I found Sixels, short for "six pixels". It almost sounded too good to be true, a terminal and display server agnostic method to print images to the terminal? Well, there is one catch. Most popular terminals do not support it. However after scrolling through https://www.arewesixelyet.com, I found that there are a good number of them that do. Alacritty, the terminal emulator I was using, did not.

Oddly enough, XTerm does, if you run it in VT340 compatibility mode. I opened it up with the absolute eye cancer that came from the default configuration. It didn't matter what it looked like for now, I just wanted to see this sixel format for myself. I downloaded one of the various sixel reference images and gave it a shot.

Note: not on XTerm, hence the reasonable color scheme

Honestly this is better than I could have hoped for. The image quality is pretty good, there's some pixelation, but in an odd way it's sorta fitting, in a way better than having the full fidelity image. It looks more at home on the terminal than a regular image. It reminds me of graphics used in textbooks from the early 2000s, probably because they were also using dot-matrix printers and sixels were invented for dot-matrix printers. They also behave in a more cohesive way than Ueberzug and other terminal image-drawers. Instead of having a separate program being called and drawing the image over the terminal where the image is supposed to be, the sixel image takes up space where characters can't be drawn on, and is rendered by the terminal. I foresee this being useful, as Feedie currently just gives the whole top right quadrant of the window to draw the image, because it was unpredictable to get the exact size the image would take up. I kept accidentally covering other elements of the screen when I tried having the description go immediately bellow the image. This problem should not exist with sixels.

Changing terminal emulators

On the list of sixel supporting terminals, I noticed that ST, suckless terminal, had support through one of its patches. Having had some experience and general satisfaction with other suckless projects like dwm and dmenu, I gave it a shot. Then I remembered why I stopped using those tools, suckless's patching system is a pain. The first patch I tried installing failed, so I had to copy over each line from the diff by hand. This wasn't actually all that bad the first time around, just being a single copy and paste job, but when trying to add the required patches for mouse scrolling, the patch also failed. This one was less trivial, with two dozen different segments I needed to insert. I stared at the procession of interchanging red and green highlighting of the diff, sighed, and decided to look for another option.

I scrolled through the list again and saw one that a vaguely remember hearing about before, Wezterm. It had native support for sixels, was gpu accelerated, and in the Void repos, so I figured I'd give it a shot. After installing, I was initially unimpressed. The default theme looked pretty tacky, made worse with the ever present tab-bar. I was half-certain about looking for a different option again, when I decided to look through the documentation just to see how hard it was to make it useable. I was quite pleasantly surprised to see how fleshed out and straightforward the configuration was. Over the course of a couple hours I got it to be pretty much one-to-one with my Alacritty configuration and swapped out as my default. So far so good! Albeit, it's been less than a day using it.

Give Sixel images a try, Wezterm is a good way to view them

Contact Me

I regularly check my email, If I don't respond quickly, send me a poke:
jasco.website@pm.me