7 ms·
I spent a good chunk of time last week looking for a solid cross-platform GUI toolkit. I came to the conclusion that the terminal is the most portable GUI platf
by anderspitman 4y ago
I spent a good chunk of time last week looking for a solid cross-platform GUI toolkit. I came to the conclusion that the terminal is the most portable GUI platform available. You can create an app that has windows, buttons, mouse support, etc, statically compile it for Windows, Linux, and Mac, and run it over SSH. The closest you can get to that with real graphics is using a toolkit built on OpenGL, and you'll be forced to dynamically link to X11 or Wayland on Linux.
The achilles heel of terminal UIs is that they can't display images.
- Hamcha 4y agoThis is so sad. Every time I boot up Plan9 for fun I'm reminded their remoting solution (drawterm) does graphics just fine (since everything is just files, and graphics is done by writing to a software framebuffer device file). Sure, it's something you can do with SSH via X11 forwarding since forever, but it seems the ecosystem never quite stuck the landing, and now we're here trying to figure out how to make CLI more like GUI for our own sanity. Maybe we should give it another shot? It seems Windows is trying to do something similar with WSLg to achieve seamless integration of Linux apps within Windows 11 (using RDP under the hood), what is everyone else doing?
- oddlama 4y agoI'm actually kind of glad that X11 forwarding didn't stick. TUIs are generally efficiently navigatable using just the keyboard, a property I very much enjoy and frequently miss in "real GUI" apps.
- digisign 4y agoThey can display images, though the resolution is not very high, even with sixels.
- qbasic_forever 4y agoI'd look at Qt or Electron if you need to do cross-platform desktop apps, if for no other reason than accessibility. Sure you can make wacky midnight commander like GUIs in the console, but no screen reader is going to be able to make heads or tails of them and you'll shut out users.
- cmroanirgo 4y agoLess modern systems have been running cross platform forever. Eg Free Pascal/lazarus. TUI/GUI (qt,gtk,cocoa,...) & even has pas2js
- shakna 4y agoCurses is screen reader compatible! JAWS might have dumped all their TUI accessibility features now that they think blind users should only use the GUI, but BRLTTY is based around the console. Orca does assume Gnome and/or a web browser, but it's no worse than usual with a console. (That is to say - I hate Orca, no matter where I'm using it.) If you're making your own TUIs, there's a few things that curses sneaks in to make things a nicer experience. It uses the start of heading, start of text, file/group/record/unit separators from the invisible portion at the start of the ASCII table, which your sighted users can't see, but things like BRLTTY announce. (Note: I don't use BRLTTY with an actual Braille display. I use it with espeak.)
- aidenn0 4y agoTk is my goto for cross-platform desktop apps; it's unreasonably good for them. However non-desktop support was essentially nonexistent last time I checked.
- ghosty141 4y agoDisagree, there are a ton of differences, especially when it comes to fancier stuff like ncurses provides for example. QT and Electron are the most capable cross platform tools for building UIs in my opinion. Both have their drawbacks of course, QT is a pain to work with and electron is famous for being not responsive enough for some users
- throwawayboise 4y agoAlmost every language has an ncurses library or module. Isn't ncurses fairly cross-platform?
- akkartik 4y agoLately I'm all in on LÖVE (https://love2d.org https://love2d.org). No dynamic linking required, cross-platform, less bloat than mainstream toolkits. Anything it can't do I just accept as a constraint I can't change.
- t0astbread 4y agoGame engines (at least the lightweight ones) seem good for cross-platform graphical apps in general but the idea of redrawing a static GUI at 30 FPS just sounds too inefficient to me.
- akkartik 4y agoYou're absolutely right. So I do without 30 FPS. We're all up this tree where we want all the features we're used to and we're willing to put up with software bloat and insecure software and sprawling supply chains to get it. I'm not. So I start with something minimalist and do what I can within it. One of my inspirations is http://akkartik.name/illich.pdf http://akkartik.name/illich.pdf
- fyve 4y agoDoes this mean that you're rendering at 1fps, 10fps or something? Is it an artificial limit you put on rendering? Do you have button animations at 30 FPS?
- runald 4y agoYou can lower the frame rate when the window is not focused, or entirely avoid drawing if it's not visible.
- akkartik 4y agoAll I meant is, if drawing too many things overloads the system so it can't render at 30fps, that's fine, I build things that don't look bad if the rate drops. I can't do action games, high-speed video, a few other things. That's fine, I can still do lots of things.
- DrStartup 4y agoAre you sure? https://hpjansson.org/chafa/ https://hpjansson.org/chafa/
- kaba0 4y agoJust why? At that point just get a plain old framebuffer and plot individual pixels to it in serial code. How is it better to hack a use-case terminals were not meant to handle? They will have all the other complexities of GUIs still to solve, you just now has a hacky render path to worry about as well.
- anderspitman 4y agoIt's cool stuff but unfortunately I need icons.
- michaelsbradley 4y agoHow about Notcurses? https://github.com/dankamongmen/notcurses#readme https://github.com/dankamongmen/notcurses#readme demo: https://www.youtube.com/watch?v=dcjkezf1ARY https://www.youtube.com/watch?v=dcjkezf1ARY
- anderspitman 4y agoThat's really impressive, but does it run on Windows, Mac, and Linux including image support? Do you have a link to any examples of more traditional application UI as opposed to demo flavored?
- nelsondev 4y agoDid you consider Web Browsers + Javascript?
- IggleSniggle 4y agoRequires installing a web browser and having access to the computer’s renderer on some level
- lazyier 4y agoSo does any other GUI program.... He was looking for a cross-platform GUI toolkit.
- blooalien 4y agoThe cross-platform GUI toolkit I personally prefer is Qt. Bein' I'ma "Python guy" I tend to interact with Qt mainly via PyQt/PySide, but there's handy bindings for a ton of other cross-platform programming languages as well. I've also recently(ish) discovered and been thoroughly impressed by Will McGugan's "Rich" library and the "Textual" TUI library he built for it. Been sprucing up all my terminal output to be more modern using those two lately. > "The achilles heel of terminal UIs is that they can't display images." That statement is not entirely 100% accurate these days, thanks to some really creative hacks over the years. I'll list a few links where some fun examples live. ;) [1] https://github.com/atanunq/viu https://github.com/atanunq/viu [2] https://github.com/stefanhaustein/TerminalImageViewer https://github.com/stefanhaustein/TerminalImageViewer [3] https://askubuntu.com/questions/97542/how-do-i-make-my-terminal-display-graphical-pictures https://askubuntu.com/questions/97542/how-do-i-make-my-termi... [4] https://unix.stackexchange.com/questions/35333/what-is-the-fastest-way-to-view-images-from-the-terminal https://unix.stackexchange.com/questions/35333/what-is-the-f...
- anderspitman 4y agoQt is solid, no doubt. But it's rather high level and bloated. Plus the company appears to be actively be trying to pull away from open source.
- russellendicott 4y agoI'm working on this https://github.com/rendicott/uggly-client https://github.com/rendicott/uggly-client
- t0astbread 4y agoSomething else that doesn't seem to get a lot of attention in terminal UI is screen reader accessibility. I'm not a regular screen reader user but I've tried a few TUI programs in GNOME Terminal with Orca and it was a mixed bag. Some simple programs were actually usable, more complex layouts not so much. It seems GNOME Terminal outputs the line where the cursor is when it changes so it also depends on if the program puts the cursor somewhere relevant when it finishes updating the screen.
- lazyier 4y agoThe cross-platform GUI is WWW.
- lilyball 4y agoSome terminals have custom protocols for displaying images. The real achilles heel is they're not accessible. There is no terminal protocol for denoting actual objects being drawn in the window such that they can be exposed to accessibility APIs. Standard CLI tools are usable, but TUIs are not. I have previously seen someone state that for this reason, every TUI program should have an optional CLI mode. Also, if every UI is a TUI then the OS task switcher becomes useless, terminal programs don't have access to the full set of key modifiers, mouse support is spotty, etc.
- ungamedplayer 4y agoI feel like I've seen TUI's from a completely different angle, including full use of modifier keys , full mouse support, etc. Its amazing how one persons perspective can completely disagree with anothers. What did you mean by the "OS task switcher becomes useless" ?
- lilyball 4y agoTUIs cannot have full use of modifier keys as the full set of modifiers is not sent to processes running in a terminal. As for the OS task switcher, if everything is a TUI then you only have one app, which is your terminal, and so your OS task switcher cannot help you switch between apps anymore. You have to switch between windows belonging to the same process. It’s the same problem that you run into by doing everything inside a browser.
- ungamedplayer 4y ago> TUIs cannot have full use of modifier keys as the full set of modifiers is not sent to processes running in a terminal. I have hyper meta super and ctrl work, sent through to my curses app. Are you referring to something like gnome or something else intercepting the keys ?
- lilyball 4y agoCommand on macOS doesn't work, ctrl+shift doesn't work, ctrl alone doesn't work with most non-letters, etc. Terminals typically let you add explicit key mappings but that's really tedious and you have to map each individual key, and then ensure that the programs you want to use understand the mapped values. And not all terminals allow for freeform key mapping either. I do see on https://invisible-island.net/xterm/ctlseqs/ctlseqs.html https://invisible-island.net/xterm/ctlseqs/ctlseqs.html that xterm has a resource modifyOtherKeys that is documented to turn keys like like alt-tab turn into CSI 2 7 ; 3 ; 9 ~, but this doesn't appear to work on Terminal.app, iTerm.app, or Kitty. Similarly there's a documented sequence that's supposed to make xterm set the 8th bit for meta instead of prefixing with ESC, but that also doesn't work on these three terminal emulators. I am not set up right now to try xterm itself (I don't have an X11 server). Ultimately, the ways keys are sent to terminal processes by default disallow many modifier combinations (and may also have multiple key chords that send the same input). Some terminals may allow for customizing this on a key-by-key basis but most CLI apps won't understand the resulting input, and won't have a way to declare whether or not the terminal should do this. xterm documents a way to do this for most keys, but that isn't supported on the terminals I have access to on macOS.
- aa-jv 4y agoI've settled in the last few years on using JUCE for all my apps. It has everything I need, and provides more than ample features for adding new GUI elements. I strongly encourage anyone looking for a cross-platform GUI solution to consider JUCE very carefully - it says "for Audio plugins" on the box, but in fact it is perfectly cromulant way of doing 'normal apps' too .. http://juce.com/ http://juce.com/