6 ms·
Ftxui: C++ Functional Terminal User Interface
- synergy20 5y agoGreat project. One of its user git-tui looks well comparing to another git-cli (tig). Wish we have some nice cross-platform GUI with modern c++ works across linux/windows/macos too, the only choice used to be Qt. Nowadays imgui seems a good alternative.
- gooderist 5y agoJuce is pretty nice. https://juce.com/ https://juce.com/
- PaulDavisThe1st 5y agogtkmm works across all those 3 platforms, and had modern C++ before Qt did (e.g. actually using templates and libstdc++ instead of preprocessors and custom "standard" classes).
- synergy20 5y agohttps://www.msys2.org/docs/what-is-msys2/ https://www.msys2.org/docs/what-is-msys2/ Looks like a nice alternative indeed. it uses MSYS2 for windows native build.
- dominicl 5y agoThere is also still wxWidgets https://www.wxwidgets.org/ https://www.wxwidgets.org/ Not modern c++ last time I checked but active development for sure.
- HKCM852 5y agoWow this look great. Does anyone have a good recommendation for the equivalent in Python?
- dangrie158 5y agorich[0] has some nice Lay-out functionality [1] [0]: https://github.com/willmcgugan/rich https://github.com/willmcgugan/rich [1]: https://www.willmcgugan.com/blog/tech/post/building-rich-terminal-dashboards/ https://www.willmcgugan.com/blog/tech/post/building-rich-ter...
- antattack 5y agoFor a polished gui as FTXUI is I am surprised that horizontal bar movement is rather jerky, as it appears to move two steps forward, one step back. https://arthursonzogni.com/FTXUI/examples/?file=./component/homescreen.js https://arthursonzogni.com/FTXUI/examples/?file=./component/...
- kzrdude 5y agoCompiling all the demos to wasm and showing on the site is what would have been such an impressive feature before and now seems common.
- arthur_sonzogni 5y agoYes. Indeed. Initially, mouse support wasn't part of FTXUI. Everything was designed to be controlled only by the keyboard. Mouse support was introduced only 30 days ago: https://github.com/ArthurSonzogni/FTXUI/pull/85 https://github.com/ArthurSonzogni/FTXUI/pull/85 The combinaison of: - The "frame" element - allowing you to draw inside a virtual area potentially larger than the real one. - The "select"/"focus" element - to scroll the content of the "frame" toward the selected element. - The "Menu" component. isn't currently working satisfyingly. I should work on this.
- amelius 5y agoIt looks incredibly nice, but ... I still think a text UI that looks like a GUI is combining the worst of two worlds.
- colesantiago 5y agoso you're enjoying typing in commands on the terminal repetitively can you still can't see what you're doing?
- xixixao 5y agoExcept if you need to run the app on remote server. VS Code shows how utterly difficult it is to get a GUI working well in that scenario.
- aninteger 5y agoWhat scenario are you talking about, or what does VS Code have to do with anything? Did you mean running VS Code on a remote server and forwarding it to the local machine? X11 based forwarding?
- zxzax 5y agoYou probably just want to use the Remote SSH extension in VS Code. That should work a lot better than X11 forwarding, and it should be a lot easier than rewriting the whole GUI to use the terminal.
- pjmlp 5y agoRDP, XWindows and VNC have worked for quite a few decades now. My first experience with remote XWindows was using IBM X Windows terminals in 1994.
- kevin_thibedeau 5y agoIt's nice to be able to configure a kernel without a GUI available. TUIs have their place.
- creamytaco 5y agoC++ ensures this will never be used widely.
- vitaut 5y agoAnd yet C++ is one of the most popular languages in the world and widely used in the industry including most (all?) tech giants.
- pjmlp 5y agoTo reinforce that, even those giants that are slowly adopting Rust, do have employees seated at ISO C++ table and are major contributors to its compilers and IDEs.
- pipologist 5y agoYes like you didn’t use a browser written in C++ to write that comment
- layoutIfNeeded 5y agoLol, sure! The amount of software written in C++ is minuscule compared to Rust, right?
- mofosyne 5y agoI be curious to see if there is a Terminal User Interface that can also have a GUI mode as well if opened directly rather than in a terminal.
- tyingq 5y agoThose existed for a while when both DOS and Windows were popular at the same time. Foxpro was one example.
- SuperNinKenDo 5y agoThat's how Emacs works, although it uses (your choice of a set of) GUI toolkits. Not sure if you mean one single toolkit that covers both and looks identical. I guess Emacs would still mostly qualify.
- agumonkey 5y agoMaybe we're about to see react like semantics driving multiple backends, cli, local gui, html5 webapps..
- vbsteven 5y agoThat is basically what Flutter is. Renders to desktop, mobile and web, only tui is missing there.
- notorandit 5y agoUnderestimating the power of TUIs annoying it is.
- mraza007 5y agoLooks incredibly good. I love the animated spinners and the graphs.
- einpoklum 5y agoI am worried by the sentence: > Cross platform (mostly). Linux (main target), Windows (experimental), Mac. So, it is not targeting _terminals_ (like traditional libraries do, including ncurses), it is targeting entire operating systems. That suggests it might be relying on things it shouldn't be relying on, and possibly making a bunch of simplifying assumptions. Given that it also says: > No dependencies I'm even more worried.
- jcelerier 5y ago> That suggests it might be relying on things it shouldn't be relying on, why ? If I have a choice between using a software that works on mac / win / linux, and one that works on those three + a ton of obscure architectures / old systems I'd definitely choose the first one - every additional platform supported invariably means that : - you have to give up some features or reimplement them yourself (because you want that feature anyways) thus more possibilities of bugs, e.g. the amount of times I've seen people reimplementing badly some POSIX functions or stuff like clock_gettime on windows - you have to duplicate code, say DLL / so loading if you have some plugin system (plus a mess of #ifdefs because of shit like macOS having a non-functional pthread_cancel, etc...) - in some cases this may mean that the program author needs to add some run-time indirections, e.g. to call platform functions, which may have a performance cost. - most likely the build system will be some terrible autotools mess which has not been updated in 15 years and does need 50 changes before working on a modern linux distro (had that merely a week ago) + a batch script for windows - maybe some performance / technical improvements / simplifications would not be available because they would break compatibility with whatever EBCDIC IBM platform with two users, thus making the software worse, condemning us to the "state of the art" of the oldest supported platform etc etc...
- einpoklum 5y ago> If I have a choice between using a software that works on mac / win / linux, and one that works on those three + a ton of obscure architectures / old systems I'd definitely choose the first one The first option probably means they are assuming the terminal behavior of the common terminal apps desktop users on one of the two/three main platforms are using. But if they're making that assumption, they might as well assume they can use a proper GUI and go with that. The whole point of terminal programming is that you live within the abstraction which is the terminal. The fact that you're thinking about _systems_ rather than _terminals_ is the problem. It's perfectly ok to have your app refuse to run on a terminal which lacks certain capabilities (annoying, but ok): You check for whatever you need from the terminal using Terminfo(https://en.wikipedia.org/wiki/Terminfo https://en.wikipedia.org/wiki/Terminfo), and die gracefully if necessary. What's not ok is saying "Oh, I'm running on Windows, so XYZ must be true about the terminal I'm in, I'll just go ahead and assume that's the case". Also - what you consider "obscure and esoteric systems", for many other people is just "systems".
- p1131 5y agoLooking at the source, I think it "renders" and reprints the whole "frame" everytime... In which case it might be bad...
- kragen 5y agoThat's a reasonable thing to do nowadays; I wrote a terminal text editor on a Sharp Zaurus in 02003 that worked that way, and it was fine. ssh -C removes most of the bandwidth cost if you're doing this remotely. You do have to be a little careful about flicker, and probably on mobile devices (like the Zaurus!) it costs you battery life.
- arthur_sonzogni 5y ago(Author of FTXUI here) Yes, that's correct. The whole frame is printed. As said above, as long as you are careful about flickering, this is fine. This runs very smoothly. So I would say "premature optimization is the root of all evil" for now. Note that in case of many events sent in a row, we don't render a new frame after every events. We first empty the list of pending events and only render once when it is empty. This ensure there are no lags. If there is a need, this can be added easily. We just need to ensure this doesn't regress performance. Sending a single chunk representing the whole frame can sometimes be cheaper than sending several diffs at various locations of the screen. Also, FTXUI support not only rendering to the alternate buffer (fullscreen mode), but it can also render inline. In case of terminal window resize, printing the whole frame avoids garbages to remain, which is nice.
- winrid 5y agoThrow nimlang on top and you could have a really productive environment.
- ncmncm 5y agoCan I just say that the Ftxui source code is beautifully laid out, and is much more readable than I am used to seeing in Free Software projects? This library has absolutely exemplary presentation. [Edit: I see it uses clang-format. More projects should use that.] Overuse of shared_ptr (what we call "Java Disease") is probably forgiveable in a UI toolkit. Even protected data members, often frowned upon in O-O circles, are probably OK, here. A note to the author (and, you know, everybody): the "#ifndef xxxx/#define xxxx" two-step is no longer necessary or useful; "#pragma once" is supported everywhere now.
- saurik 5y agoI am terrified by #pragma once due to issues with relative include paths sometimes being mixed with absolute ones in various situations (none of which I personally cause). I recommend reading this post on StackOverflow by a GCC/autoconf maintainer on why he believes it is actually impossible to make it work correctly. I imagine it is thereby not in the standard, despite being widely implemented, "for good reason". https://stackoverflow.com/a/34884735 https://stackoverflow.com/a/34884735 > (Historical note: The only reason I didn't rip #pragma once and #import out of GCC when I had the authority to do so, ~12 years ago, was Apple's system headers relying on them. In retrospect, that shouldn't have stopped me.)
- ncmncm 5y agoI read that SO page. I find the argument unpersuasive for the same reasons commenters there did. The case for C++ is stronger because the set of current C++ compilers (which nowadays have integrated pre-processor) is much smaller than of C compilers that could be encountered in the wild. Doing complicated things with header files and paths is inherently fragile, pragma or no pragma. So, don't do them. Absent fragile header file or include-path games, there is no problem. In the foreseeable future, #include will begin to fade from C++ code, and with it #pragma once, include guards, and any sort of worries about them. (Then we might start to worry about module name collisions, instead.)