News for hackers. Stuff that matters.
Re:Build your own Terminal using Qt by davidad_ on Wednesday October 25, 2017 @03:38AM (#15548235)
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/

Re:Build your own Terminal using Qt by sjmulder on Wednesday October 25, 2017 @04:12AM (#15548331)
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.

Re:Build your own Terminal using Qt by laumars on Wednesday October 25, 2017 @06:55AM (#15549010)
They already have one:

https://dwm.suckless.org/

Re:Build your own Terminal using Qt by sjmulder on Wednesday October 25, 2017 @11:47AM (#15551092)
That's a window manager. I was thinking more along the lines of a lightweight X replacement.
Re:Build your own Terminal using Qt by laumars on Wednesday October 25, 2017 @12:38PM (#15551635)
The problem with running a nonstandard display server is you either need to support Xorg (or Wayland) else face near zero application support.
Re:Build your own Terminal using Qt by noir_lord on Wednesday October 25, 2017 @12:29PM (#15551546)
pure framebuffer UI's exist in embedded systems, they look horrible but constraints are constraints.
Re:Build your own Terminal using Qt by speps on Wednesday October 25, 2017 @06:06AM (#15548825)
> suckless UI system

What about IMGUI? https://github.com/ocornut/imgui

Re:Build your own Terminal using Qt by koenigdavidmj on Wednesday October 25, 2017 @12:25PM (#15551507)
C++ would be a non-starter for them.
Re:Build your own Terminal using Qt by racer-v on Wednesday October 25, 2017 @04:29AM (#15548398)
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.
Re:Build your own Terminal using Qt by sjmulder on Wednesday October 25, 2017 @05:02AM (#15548543)
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.
Re:Build your own Terminal using Qt by racer-v on Wednesday October 25, 2017 @02:06PM (#15552505)
Sounds like a noble endeavor. From https://suckless.org/project_ideas

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.

Re:Build your own Terminal using Qt by cat199 on Wednesday October 25, 2017 @10:49AM (#15550585)
not 100% but pretty sure the suckless folks are in the static bitmapped font camp - TTF and PS are raster formats.
Re:Build your own Terminal using Qt by aardvark291 on Wednesday October 25, 2017 @11:20AM (#15550841)
aren't "bitmapped" and "raster" pretty much synonymous?
Re:Build your own Terminal using Qt by Stratoscope on Wednesday October 25, 2017 @12:41PM (#15551660)
They are. cat199 no doubt meant to say that TrueType and PostScript generally use vector (outline) fonts, not raster (bitmap).

They are both capable of providing bitmap fonts as well, but those are less commonly used.

Re:Build your own Terminal using Qt by jasonkostempski on Wednesday October 25, 2017 @09:39AM (#15549970)
"That would preclude ubiquitous animation"

That would be its best feature.

Re:Build your own Terminal using Qt by majewsky on Wednesday October 25, 2017 @04:10AM (#15548326)
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.
Re:Build your own Terminal using Qt by sjmulder on Wednesday October 25, 2017 @04:15AM (#15548342)
I was experimenting with pty's just the other day. I needed only I/O and window size updates, so it turned out fairly succinct:

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.

Re:Build your own Terminal using Qt by freedomben on Wednesday October 25, 2017 @05:22AM (#15548629)
I came out of it feeling like it was a great foundation, and ready for me to hack and customize without having to start the project from scratch.

Suckless looks great tho. Thanks for the link!

Re:Build your own Terminal using Qt by dang on Wednesday October 25, 2017 @12:17PM (#15551439)
Ok, we swapped "minimal" for "QT" in the title above.
Re:Build your own Terminal using Qt by slavik81 on Wednesday October 25, 2017 @01:00PM (#15551825)
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".
Re:Build your own Terminal using Qt by dang on Wednesday October 25, 2017 @01:33PM (#15552145)
Ok, fixed. Shows you what I know about Qt.
Re:Build your own Terminal using Qt by heidar on Wednesday October 25, 2017 @09:48AM (#15550054)
> Build Your Own Minimal Terminal

> we’ll be installing qtermwidget

I'm guessing the author meant visually minimal, rather than minimal footprint.

Re:Build your own Terminal using Qt by eptcyka on Wednesday October 25, 2017 @05:09AM (#15548579)
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.
Re:Build your own Terminal using Qt by basdp on Wednesday October 25, 2017 @04:03AM (#15548296)
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.
Re:Build your own Terminal using Qt by mmphosis on Wednesday October 25, 2017 @05:38AM (#15548703)
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.
Re:Build your own Terminal using Qt by heuiop on Wednesday October 25, 2017 @09:10AM (#15549758)
What about Ctrl+Alt+c and Ctrl+Alt+v? These work on rxvt.
Re:Build your own Terminal using Qt by mmphosis on Wednesday October 25, 2017 @03:47PM (#15553465)
I would probably map Ctrl+C to Ctrl+Alt+c and Ctrl+V to Ctrl+Alt+v, if I was using rxvt.
Re:Build your own Terminal using Qt by drwu on Wednesday October 25, 2017 @08:22AM (#15549427)
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.
Re:Build your own Terminal using Qt by santaclaus on Wednesday October 25, 2017 @12:20PM (#15551467)
It is Qt, not QT!
Re:Build your own Terminal using Qt by Svenstaro on Thursday October 26, 2017 @01:18PM (#15560966)
It's also Arch Linux, not Archlinux. I guess it's hard to keep track of all the names in software nowadays.
Re:Build your own Terminal using Qt by mromanuk on Wednesday October 25, 2017 @09:19AM (#15549816)
Love to see Qt in a tutorial in HN; fond memories.