I’m embodying an archetype here, but I can’t resist.
The use of QTermWidget makes this almost entirely an exercise in building a hello-world Qt app and very little about building a terminal. That is all very well if you are looking to learn Qt—which is by no means an unworthy aim—but I wouldn’t use the adjective “minimal” to describe any Qt app, no matter how short its main().
If you are actually looking for a minimal terminal, whose source code is intelligible and readily customizable, look no further than https://st.suckless.org/
Yeah, I too was hoping for something substantital, e.g. a description of how to allocate and manage a pseudo-terminal (especially since I'll be needing that for a project of mine quite soon). I'll probably be looking at the st(1) source code, then.
I'm not at all an experienced Unix programmer though so take it with a grain of salt. Would be happy to hear about any defects or possible improvements.
Good suggestion! I found st a joy to read. Only a couple of C files, few frills and a straightforward coding style. I can see what the suckless folks are getting at.
Slightly OT here but I was thinking about what a suckless UI system would be like - one without excessive layering and as few moving parts as possible. I'm fairly sure it should be possible by avoiding truetype fonts and using the framebuffer directly. That would preclude ubiquitous animation but smooth scrolling and dragging is perfectly doable even with a single buffer.
What would be the win in avoiding TrueType? Seems like we could easily convert any TTF files to PostScript Type 1 if there were an advantage to be gained.
This might be a misconception but I was under the impression that truetype fonts are a complexity and security minefield. In particular I noticed an st developer complaining (on the mailing list, probably) about the lack of a suckless font library when I concluded that it might be better to just do without them.
There is libdrw in suckless now, which still uses xft and fontconfig. Fontconfig and xft are ugly and require too much internal knowledge to be useful. The next logical layer in Linux evolved as pango and cairo. Both of course added HTML formatting and vector drawing. This is not needed to simply draw some text somewhere. And this is what a suckless font rendering library should do: Give it a font string and render at some position the given font without having to care about font specifics.
It's Qt. The author writes it both ways, but lowercase 't' is correct. It's a tad bit weird to see it all uppercase. It's kinda like "Build your own WebApp using NODE".
This has nothing to do with building terminal code. This is just a Qt tutorial that has just 1 widget and does nothing special besides the general init stuff for the widget.
I thought this would be about building the minimal input parser and line printer, instead you just _import_ the terminal from Qt and be done with it. This is not minimal by any stretch of imagination.
Does anyone else wish to use Ctrl+C to copy selected text from their terminal? And, Ctrl+V to paste?
I miss the Command key. Here is a work-around:
# setxkbmap -option ctrl:swap_lalt_lctl
I map all of the Alt keys using AutoKey when in the Terminal so that they type the equivilent Ctrl key, and all of the Ctrl keys mapped so that they do what I expect. For example Ctrl+C types Ctrl+Shift+C which in the Terminal I am using will copy selected text to the clipboard.
When I was using `xmonad`, I built a VTK terminal into the WindowManager. The whole implementation was just several lines in Haskell, using its wrapper for VTK.
31 comments
[ 2.3 ms ] story [ 83.5 ms ] threadThe use of QTermWidget makes this almost entirely an exercise in building a hello-world Qt app and very little about building a terminal. That is all very well if you are looking to learn Qt—which is by no means an unworthy aim—but I wouldn’t use the adjective “minimal” to describe any Qt app, no matter how short its main().
If you are actually looking for a minimal terminal, whose source code is intelligible and readily customizable, look no further than https://st.suckless.org/
https://github.com/sjmulder/trickle/blob/master/tritty.c
I'm not at all an experienced Unix programmer though so take it with a grain of salt. Would be happy to hear about any defects or possible improvements.
Slightly OT here but I was thinking about what a suckless UI system would be like - one without excessive layering and as few moving parts as possible. I'm fairly sure it should be possible by avoiding truetype fonts and using the framebuffer directly. That would preclude ubiquitous animation but smooth scrolling and dragging is perfectly doable even with a single buffer.
Suckless font rendering library
There is libdrw in suckless now, which still uses xft and fontconfig. Fontconfig and xft are ugly and require too much internal knowledge to be useful. The next logical layer in Linux evolved as pango and cairo. Both of course added HTML formatting and vector drawing. This is not needed to simply draw some text somewhere. And this is what a suckless font rendering library should do: Give it a font string and render at some position the given font without having to care about font specifics.
They are both capable of providing bitmap fonts as well, but those are less commonly used.
What about IMGUI? https://github.com/ocornut/imgui
https://dwm.suckless.org/
That would be its best feature.
Suckless looks great tho. Thanks for the link!
I miss the Command key. Here is a work-around:
I map all of the Alt keys using AutoKey when in the Terminal so that they type the equivilent Ctrl key, and all of the Ctrl keys mapped so that they do what I expect. For example Ctrl+C types Ctrl+Shift+C which in the Terminal I am using will copy selected text to the clipboard.> we’ll be installing qtermwidget
I'm guessing the author meant visually minimal, rather than minimal footprint.