Top
Best
New

Posted by mmulet 3 days ago

Show HN: Term.everything – Run any GUI app in the terminal(github.com)
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.

1047 points | 142 comments
nick__m 2 days ago|
That's awesomely useless, it straddles the line between programming and art.

I am sure it was a great and fun learning experience.

Well done !

GTP 2 days ago||
Well, not 100% useless: I can see its use for applications running inside Docker containers. Yes, there are ways to have GUI applications rendered from the inside of a container, but maybe this is easier than getting the Dockerfile right.

EDIT: nevermind, doing this with Docker seems much easier than I expected [0]. I'll try it tomorrow, I'm curious to see if the proposed solution works on Windows as well.

[0] https://medium.com/@priyamsanodiya340/running-gui-applicatio...

nicce 2 days ago||
Windows had Wayland support before most distros! Rather surprising.
0points 2 days ago||
> Windows had Wayland support before most distros! Rather surprising.

WSL had non-accelerated wayland support at one point in time.

Was it before "most distros"?

I don't understand what you think that amounts to.

Wayland support in Linux-land typically means that the software supports running in your wayland compositor.

Windows famously is not a wayland compositor, no matter how much you try to bend reality.

actsasbuffoon 2 days ago|||
Yeah, I can’t explain why this project makes me so happy because I struggle to think of any time where I’d need this, but it puts a big, dumb grin on my face.
snozolli 2 days ago|||
It reminds me a bit of chindōgu, the Japanese art (?) of useless inventions. There's a particular delight to ingenious, but absurd or useless creations.
anthk 2 days ago|||
Emacs it's full of chindogus. Also, there's geekcode, xroach, megahal/hailo, xneko, aatv and mplayer rendering videos over aalib, aaquake, eforth running in the subleq virtual machine...
hiccuphippo 2 days ago|||
I remember watching the World Cup over telnet with one of those aalib libraries years ago. The signal arrived 5 seconds earlier than the TV :)
anthk 2 days ago||
With a small framebuffer font aatv was almost watchable over a distance, but OFC fbtv made it obsolete, and ditto with mplayer -vo aalib as movies worked in the framebuffer just as fine as X.

But I remember the BB demo and I still remember these catchy s3m modules...

https://aa-project.sourceforge.net/bb/

And, well, not AA, but I still play today tons of text adventures and roguelikes (and BSDgames and such), and my main X environment it's CLI/TUI based except for CWM (Window manager), MPV/MuPDF/NSxiv (images) and djview4 for DJVU files..

DiggyJohnson 2 days ago|||
I’m a fan of `xeyes`
watersb 2 days ago||
xeyes can be Actually Useful; two eyes always looking at the cursor...

your animal brain hardwired to discern the direction of gaze of the eyes facing you (citations appreciated)...

Helps me find the mouse cursor on a big screen if I lose track, even with small parallax angle.

On macOS, I just wiggle the mouse back and forth, and the cursor gets really big, it pops out at you.

I generally don't keep `xeyes` running. But it's a righteous, venerable hack.

hnlmorg 2 days ago||||
That’s a term I’ve not heard in literally decades.

Thanks for the reminder

robot-wrangler 2 days ago|||
[dead]
pawelduda 2 days ago||||
Well, you can run apps on any less capable device with ssh and proper terminal display. You can limit data usage by offloading video buffering to the host (however not sure if that's net positive saving). And put the host behind VPN to avoid getting region blocks.
blooalien 2 days ago|||
I actually used to tunnel Netscape Navigator via SSH to my Commodore Amiga desktop via an Xorg server way back in the 56K phone modem Internet days from my ISP's SSH user account login, since Amiga didn't have Netscape (and even if it did, the Amiga likely would have choked on it, massive and bloated as Netscape was), and the browser AmigaOS did have just wasn't up to the task of normal day-to-day usage of the Web as it existed back then. Fun times.

Sure am glad of the broadband Internet and modern "powerhouse" PCs we have so readily available today. Hell, even the computer most everyone carries in their pocket these days is infinitely more powerful than the average desktop machines of my childhood. :)

unleaded 2 days ago|||
Oops, we've invented X
msdz 2 days ago||||
It's like a more generalized browsh[1].

[1] https://www.brow.sh/

tombh 2 days ago||
I think one significant difference though is that Browsh renders actual text for text content, so you can copy and paste, etc.
mmulet 2 days ago||
You will be able to copy/paste with term.everything once I implement the Wayland copy/paste interface (wl_data_device_manager).
tombh 1 day ago||
OMG! That'd be AMAZING. But it still wouldn't render GUI text as terminal font text right?
mmulet 1 day ago||
That’s right, it will still be pixelfied text. We could run ocr on the images then convert to text, but that’s an entirely new can of worms. Make a feature request issue on GitHub if you’re interested,
mmulet 2 days ago|||
<3
k-warburton 2 days ago||
I came here to make the same comment. I want to try this myself just for the fun of it and the grin it will put on my face. Nice work!
mmulet 2 days ago||
You can have a <3 too!
dmayle 2 days ago||
Definitely not useless!

I run a ttyd server to get terminal over https, and I have used carbonyl over that to get work done. That's limited to a web browser (to get access to resources not exposed via the public internet), so having full GUI support is very useful

reactordev 2 days ago||
This is one of those things that pushes the boundaries to nowhere, yet everywhere at the same time whilst being incredibly awesome and something you can show off ad infinitum. Outstanding! Not sure how we’ll implement vdi now! Gives ghost in the shell a whole new meaning.

But can it run doom?

mmulet 2 days ago||
Ask and ye shall receive: Running doom: https://github.com/mmulet/term.everything/blob/main/resource...

I had the change a couple of line to make it work because term.everything takes input only from stdin (this way it works of ssh and is pretty broadly compatible across terminals).

1. I had to remap another key to the control key (which is usually used to send signals like sigterm)

2. Then I had to change the timeout in which keys are pressed. When using stdin, you get a keydown event, but you don't get a key up event (ever). So I have to guess when you want to key up. Most of the time, I can send key up right away. But, it looks like doom has some sort of key debounce, so I had to wait 50-100 ms for keyup. Then there is the problem of if you want to walk forward in games you usually hold down up arrow, but now you have to rapidly press it! Not ideal, but it does work, and it it playable.

reactordev 2 days ago||
Phenomenal!!!

I used to write telnet games so I know all about keypress up never coming through. Even with immediate mode (so repeated keys will send repeated key codes while held down) it never tells you when it stops. You have to read the buffer ascii byte by byte. Still, awesome to see. Great work!!!

anthk 2 days ago||
aaquake ran under ASCII terminals before this ever existed.
reactordev 2 days ago||
But that isn’t this, answered above.
shonku 2 days ago||
Absolutely love the energy here. You really terminally outdid yourself here. Consider me officially shell-shocked.
pbhjpbhj 2 days ago|
Terrible puns. But at least you gave it a bash.
psd1 1 day ago||
Very prompt. This thread has Bourne fruit. I'm uTTYerly impressed.
marcodiego 2 days ago||
This is interesting, but there was something that was even more impressive many years ago: a GTK theme that rendered all decoration and widgets using text chars and a GDK backend that rendered to text. Combine both and you could run any GTK app on a terminal with legible text and a beautiful TUI.

http://zemljanka.sourceforge.net/cursed/screenshots/

GranPC 2 days ago||
Link is dead. Archive: https://web.archive.org/web/20080924152845/http://zemljanka....
pndy 2 days ago|||
Damn I have a vague memories of seeing this thing in Fedora Core
colecut 2 days ago||
why did this go away?
saghm 1 day ago||
Maybe linking to this reminded the owner that they had a sourceforge account they had forgotten about, and they took the opportunity to delete it.
tri2820 3 days ago||
This is such a cool project. Personally, I think there are so many interesting use cases that can be built on top of Wayland, like https://github.com/udevbe/greenfield and this
wdavidw 1 day ago||
A few years back, I was deploying, operating and debugging a Hadoop cluster with Kerberos enabled behind a firewall with only the SSH port being opened. Without a web browser would have been a much more complicated task. I ended up installing the X11 client on my local macOS and the all Gnome + Firefox on one of the cluster's node. Something that is not doable with Wayland. This project work like a charm, here is a quick example on how to test it inside an Incus container (I had to install 2 additional dependencies).

  # Work with Gnome terminal but resolution is much better in something supporting images
  apt install -y kitty
  kitty
  # Create an incus container
  incus --project default launch images:ubuntu/24.04 term
  incus --project default shell term
  # Install dependencies
  apt install -y curl firefox libharfbuzz0b libfontconfig1
  curl -L -o term https://github.com/mmulet/term.everything/releases/download/0.5.1/term.everything.mmulet.com-dont_forget_to_chmod_+x_this_file
  mv term.everything.mmulet.com-dont_forget_to_chmod_+x_this_file term
  chmod u+x term
  echo '<h1>Hello</h1>' > test.html
  # Start firefox, wait for a few seconds
  ./term firefox test.html
warwren 2 days ago||
I remember the carbonyl project to run chromium in the terminal that got me really excited (https://github.com/fathyb/carbonyl) but it eventually became unmaintained.

This is pretty much that but supercharged. Definitely really cool to see. Good work!

serbuvlad 2 days ago||
We got Wayland over vt100 escape codes over ssh over tcp before we got a headless Wayland VNC/RDP solution.
roughly 2 days ago||
This is the exact kind of unhinged that belongs on HN. Naturally, it's written in typescript.
codethief 1 day ago|
Reminds me of https://m.youtube.com/watch?v=0mCsluv5FXA
taviso 1 day ago|
It's fun, but reminds me of a trick using Xvfb.

For example...

    $ Xvfb :7 &
    [1] 21688
    $ xeyes -display :7 &
    [2] 21697
    $ xwd -display :7 -name xeyes -out /dev/stdout | convert xwd:- sixel:-

It looks like this: https://imgur.com/a/Eq2ToVO

Obviously no input though, you would have to use xdotool! The main benefit is that you probably already have all these tools installed :)

FortuneIIIPick 1 day ago|
Looks like you're on Windows? You can run X apps with XMing, I used to do it years ago. You can run the actual X app and use it, not just get a screenshot.
taviso 1 day ago||
The point is to view it in a terminal (e.g. XTerm, Konsole, etc), of course you can just run it in an X server.
More comments...