3

How can I make terminal applications immune to terminal emulator close, but still able to use all virtual terminal features?

\begin{UPDATE}

I want my terminal application remain alive and accessible if I accidentally close terminal emulator. This functionality is provided by screen and tmux, but they have issues with colors and they flush screen. Yes, I can run the shell inside screen, but I do not want the shell remain alive unless there is some other program running.

\end{UPDATE}

I see this must be something like screen, but without VT100 terminal emulation, something which will just apply whatever application does with "terminal proxy"'s terminal (like outputting something to stdout/stderr or using stty to set terminal options) to the terminal this proxy runs in.

// I know about screen and altscreen on, but it makes either this (screen with TERM=screen):

screen with TERM=screen

or this (screen with TERM=rxvt-unicode):

screen with TERM=rxvt-unicode

while I want this (rxvt-unicode without screen):

rxvt-unicode

I have figured out that everything looks fine if I compile rxvt-unicode with USE=-xterm-color (in fact vim looks like on the second picture even without screen if I add this USE flag) and set TERM=screen-256color, but I do not like this workaround because it actually changes colors and I can't be sure that it will always change them only this way:

screen with TERM=screen-256color

Gareth
  • 19,080
ZyX
  • 263

4 Answers4

4

There is also a program called "dtach" that does just that, without superimposing its own screen buffer. (I know the answer is quite late but I post it nonetheless for those who google and stumble upon the page)

tzervo
  • 56
0

Yes, I can run the shell inside screen, but I do not want the shell remain alive unless there is some other program running.

One solution would be to run the shell from screen (as you said you didn't want to), but then add a Cron job to run every 10 minutes to check if there are screen sessions to close.

If all screen sessions are detached and no programs besides shells are running from them then you can close them down.

Jarvin
  • 7,386
0

Use sakura. It prompts you if you try to close a vterm down with a running program.

brice
  • 2,387
0

You can use screen to directly launch your application so when your app exits screen will exit:

screen <yourprog>

See the 5th paragraph of the screen manpage for more details.

pjz
  • 470