←back to thread

1080 points mmulet | 4 comments | | HN request time: 0s | source

I made a built-from scratch Wayland Compositor to display any GUI app* in the terminal! I think there is a lot of unexplored potential in custom Wayland compositors, a lot of really cool things you can embed existing applications into! So, I started with embedding apps into the terminal because that is the easiest input/output (output is just utf-8 and I use the great `chafa` library for that, and I just read from stdin for the input).

If you have any other ideas for cool Wayland compositors, let me know. I purposedly wrote 80% the app in Typescript to appeal to the most developers and attract cool contributions (I do all drawing with the familiar Canvas2D api, so if there is interest, I can also fork this out into a cool Terminal canvas, let me know!)

I have a blog post here about how I did it, but it’s pretty high level and non technical, so please ask if you have any questions.

[How I Did It](<https://github.com/mmulet/term.everything/blob/main/resource...>)

*technically only Wayland apps and x11 apps with Xwayland. But on Linux that’s mostly everything.

Show context
IshKebab ◴[] No.45204435[source]
I started working on this with the Kitty image protocol, but unfortunately that protocol is really unsuited to this sort of thing. Performance will be awful.

The protocol is sort of:

1. I'd like you to display this PNG. Here's the data: ...

2. Ok I've got the data.

3. Ok now display it at this position.

4. Ok now remove it from the screen.

We're talking motion-PNG here. Just think about how awful that is.

I wish someone would add some kind of AV1-over-terminal protocol. That would be actually useful.

The other thing I was going to try was a custom GUI that used normal terminal text for the text of widgets, but Kitty images for the rest. It's quite a hard problem though.

replies(2): >>45204606 #>>45207248 #
ranger_danger ◴[] No.45204606[source]
https://www.youtube.com/watch?v=dcjkezf1ARY
replies(1): >>45210624 #
1. IshKebab ◴[] No.45210624[source]
Probably not running over a network. Also I'm not seeing anything GUI-like.
replies(1): >>45214436 #
2. ranger_danger ◴[] No.45214436[source]
How about this then: https://github.com/saitoha/libsixel
replies(1): >>45216533 #
3. IshKebab ◴[] No.45216533[source]
Sixels are hilariously inefficient. Think "motion xpm".
replies(1): >>45217140 #
4. ranger_danger ◴[] No.45217140{3}[source]
But it's running over a network. I'm not sure what you're asking for otherwise.