Re: I need `undo' in gnu screen

Kevin Van Workum <[email protected]>
Newsgroups gmane.comp.gnu.screen.user
Message-ID <CAHom8ytoeADyBOeXsUMfhMnrG772xQQRKQe7Cer44jvpuL8YFw@mail.gmail.com>
On Wed, Jul 27, 2011 at 1:26 AM, chen bin <[email protected]> wrote:

> typical user case,
>
> I use command `only` (C-a Q) to maximize the window to observer some
> log,  then I want to restore the previous layout to do other things.
>

Great ideal, I think I'd use that too. The following will make C-a Q toggle
between the maximized window and the previous layout.

First, add these lines to your .screenrc:

layout autosave on
layout save 0
layout new ONLY
layout select 0
bind Q exec screen-ONLY

Then put this script somewhere in your PATH and call it screen-ONLY:

#!/bin/bash


screen -X msgwait 0

# get the current layout name
screen -X layout show
layout=$(screen -Q lastmsg | sed 's/.*\([0-9]\+\)\*\s\+\(\S\+\).*/\2/')
if [ "$layout" == "ONLY" ]; then
    screen -X layout prev
    exit
fi

# if layout != ONLY
# put the current window into the "ONLY" layout
window=$(screen -Q windows | sed 's/.*\([0-9]\+\)\*\s\+\(\S\+\).*/\1/')
screen -X layout select ONLY
screen -X select $window

# Return msgwait to something useful
screen -X msgwait 3


> --
> help me, help you.
>
> _______________________________________________
> screen-users mailing list
> screen-users-mXXj517/[email protected]
> https://lists.gnu.org/mailman/listinfo/screen-users
>

_______________________________________________
screen-users mailing list
screen-users-mXXj517/[email protected]
https://lists.gnu.org/mailman/listinfo/screen-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.