You are not logged in.

#1 2015-10-27 17:32:12

SlickBlackCadillac
Member
Registered: 2015-09-10
Posts: 15

Detach from screen - remnants from screen on terminal

I connect to my arch box using puTTY. If I attach to a screen, do some work, and then detach using ctrl + a then d, my original putty terminal is cleared placing my cursor at the top, first line, but everything from the screen session sticks around and just gets in the way until I run the "clear" command.

My old arch install did not exhibit this behavior. Everything was cleared upon a detach. No need to run clear again.

Here is my .screenrc

#
# Example of a user's .screenrc file
#

# This is how one can set a reattach password:
# password ODSJQf.4IJN7E    # "1234"


# no annoying audible bell, please
vbell on

# detach on hangup
autodetach on

# don't display the copyright page
startup_message off

# emulate .logout message
pow_detach_msg "Screen session of \$LOGNAME \$:cr:\$:nl:ended."

# advertise hardstatus support to $TERMCAP
# termcapinfo  * '' 'hs:ts=\E_:fs=\E\\:ds=\E_\E\\'

# make the shell in every window a login shell
#shell -$SHELL

# autoaka testing
# shellaka '> |tcsh'
# shellaka '$ |sh'

# set every new windows hardstatus line to somenthing descriptive
# defhstatus "screen: ^En (^Et)"

defscrollback 1000

# don't kill window after the process died
# zombie "^["

# enable support for the "alternate screen" capability in all windows
# altscreen on

################

There is a topic here similar to this https://bbs.archlinux.org/viewtopic.php?id=84600
I do not have .Xdefaults so I could not try this.

Thanks

Edit: clarified that my problem is similar to one already found in these forums

Last edited by SlickBlackCadillac (2015-10-27 17:58:58)

Offline

#2 2015-10-27 21:52:38

nixpunk
Member
Registered: 2009-11-23
Posts: 271

Re: Detach from screen - remnants from screen on terminal

Maybe I'm just not understanding the problem correctly, but wouldn't something simple like the following work?

$ screen -r && clear

Of course, I'm assuming a reattach in this case but you get the general idea.

Last edited by nixpunk (2015-10-27 21:53:57)

Offline

#3 2015-10-28 13:55:54

SlickBlackCadillac
Member
Registered: 2015-09-10
Posts: 15

Re: Detach from screen - remnants from screen on terminal

Using screen -r && clear does ellicit my desired (and correct) behavior. The difference being that I am typing clear before rather than after. A clear command is being run somewhere between attaching and detaching since I am all-the-way scrolled up after a detach, but all the crud on the previous screen is just hanging there graphically. So a clear at the point clears all the crud, or the clear run on the && clear does that for me.

Is there any way I can alias so that everytime I run screen it will throw an && clear at the end?

Offline

#4 2015-10-28 15:00:58

nixpunk
Member
Registered: 2009-11-23
Posts: 271

Re: Detach from screen - remnants from screen on terminal

Sure.  Just add

alias screen='screen && clear'

to your ~/.bashrc.

[edit 1] Keep in mind this is really just a workaround for your issue and not necessarily the best solution.  By clearing the garbage this way, you will also clear out the messages from screen when exiting/detaching (e.g. '[screen is terminating]', etc.).  This seems pretty harmless, but I just wanted to point it out.

[edit 2] Not a good solution for reattaching, since it won't handle args.  See my post below.

Last edited by nixpunk (2015-10-28 18:30:23)

Offline

#5 2015-10-28 16:02:47

SlickBlackCadillac
Member
Registered: 2015-09-10
Posts: 15

Re: Detach from screen - remnants from screen on terminal

Thanks for the reply and edit. I just tried that and discovered that as well. Another thing that is happening is I am spawning a new screen everytime I try to reattach to a screen. I am not even sure that I am attaching to the same screen or to the one that I am just spawning!

Offline

#6 2015-10-28 16:41:09

nixpunk
Member
Registered: 2009-11-23
Posts: 271

Re: Detach from screen - remnants from screen on terminal

Oh, that actually makes sense.  You want to pass args to the alias (e.g. 'screen -r'), so a function in ~/.bashrc would be necessary.  Something like:

function screen_w_clear {
    screen "$@" && clear
}

Then just call it using:

screen_w_clear -r

Offline

#7 2015-10-28 16:48:46

SlickBlackCadillac
Member
Registered: 2015-09-10
Posts: 15

Re: Detach from screen - remnants from screen on terminal

Thank you!!! I knew there had to be a way to include the args first and you showed me how.

Thanks for teaching me a new skill and workaround

Offline

Board footer

Powered by FluxBB