> Implement automatic ncurses detection to automatically start a “visual” program in a terminal, even when it’s not known in advance. Is it even possible?
There are a couple of techniques:
1) Check for use of certain escape sequences in the output.
2) Check PTY terminal modes using tcgetattr, especially for raw mode
I think combining (1) and (2) you could come up with some heuristics that would work 99% of the time, without hardcoding names of fullscreen apps or anything else like that.
(Really this isn't "ncurses detection" per se, you can have a full-screen terminal app without using any curses library.)
There are a couple of techniques:
1) Check for use of certain escape sequences in the output.
2) Check PTY terminal modes using tcgetattr, especially for raw mode
I think combining (1) and (2) you could come up with some heuristics that would work 99% of the time, without hardcoding names of fullscreen apps or anything else like that.
(Really this isn't "ncurses detection" per se, you can have a full-screen terminal app without using any curses library.)