screen-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: I need `undo' in gnu screen


From: Kevin Van Workum
Subject: Re: I need `undo' in gnu screen
Date: Mon, 5 Sep 2011 07:21:20 -0400



On Wed, Jul 27, 2011 at 1:26 AM, chen bin <address@hidden> 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
address@hidden
https://lists.gnu.org/mailman/listinfo/screen-users


reply via email to

[Prev in Thread] Current Thread [Next in Thread]