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
> [email protected]
> https://lists.gnu.org/mailman/listinfo/screen-users
>
_______________________________________________
screen-users mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/screen-users