I run irssi in screen and I want screen to automatically blank the terminal (scrollback) after detach. I found out that screen has a command called "blanker" that can clear the screen, but I don't see a way to do it automatically after detach (whether remote or via C-a d).
When you run
screen, it sends (among other things) the strings defined in the terminal description for starting/stopping full-screen operation. These are
te (in termcap),
rmcup (in terminfo).
- When you start screen, or attach to a session, it sends
- When you stop screen, or detail from a session, it sends
Depending on the terminal description, they may be used to switch xterm (and similar terminals) to/from the alternate screen. For most terminals, switching back to the normal screen from the alternate screen makes it seem as if the full-screen application had been cleared from the screen. (With xterm, you can switch back and forth using menus: the data is still there until it is cleared).
You could force
screen to always use the alternate screen by
- specifying a particular value for the
- using the termcap/terminfo tweaks to modify the
Either way has drawbacks (because you might run
screen on a different terminal type), but the latter is more likely to work since it does not interfere with the ability to use special keys (cursor- and function-keys).
If you prefer
screen to use the alternate screen of the xterm-like terminal, you could add to your
termcapinfo xterm*|rxvt* te=\E[?1049l:ti=\E[?1049h:
If you would rather not use the alternate screen, you could redefine
te to clear the screen:
termcapinfo xterm*|rxvt* te=\E[H\E[2J:ti=\E[H\E[2J:
Had the same problem with urxvt. Found the fix here: