logoalt Hacker News

JdeBP06/04/20251 replyview on HN

That would be one way to do it, certainly. It's boring, though. (-:

There is another. In NetBSD one can, at least according to the manual, open the wsdisplay of the relevant terminal and read out the display contents, with the WSDISPLAYIO_GETWSCHAR I/O control. sysinst is just a full-screen TUI program.

* https://man.netbsd.org/wsdisplay.4

(The manual says that character values are "ASCII", but the data structure uses a 16-bit unsigned integer for them. So I wonder whether this is UCS-2 or NetBSD has been saddled with some 512-entry character set mess from back in the 1990s.)

Presumably there is a third one if the virtual terminal's wsdisplay is in graphics mode and one can access its frame buffer.

There was also a fourth for the serial console screenshots, although they were clearly done the boring way by screenshotting a GUI window, as its scrollbars are visible in the images. Presumably the terminal emulator at the other end of the connection had some sort of direct screen shotting functionality. That was definitely something that serial device DTE emulator programs in the days of yore used to have.

That's an interesting thought, actually. I wonder whether one could do that at all with many Unix/Linux tools, like GNU screen in its serial terminal mode. One could with (some of) the terminal emulators that used to be available for MS/PC/DR-DOS. There would be some "dump screen to file" menu option, or in extremis a TSR program that could do that. (-:


Replies

actionfromafar06/04/2025

Did not have "being jelaous of NetBSD wscons framework" on my bingo card.

How does one make a "screenshot" of a TUI program? The classic terminal APIs don't have a "framebuffer" (or "textbufffer" I guess) from what I can tell.

I could use such a mechanism to create automated screenshots of a TUI program (using Terminal.GUI in this case) for documentation generation.

show 2 replies