[Top][All Lists]

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

Re: scripting screen windowlist?

From: Gerald Young
Subject: Re: scripting screen windowlist?
Date: Sun, 7 Jun 2009 07:03:41 -0700 (PDT)

Brian Kroth wrote:
> Is there a way to dump the
> output of "windowlist" to a file, or some other mechanism that I could
> get at this data?  I've tried with logging and hardcopy but they both
> dump the underlying window contents.

You could nest that screen session inside another screen session.
Let's call the session you already have "old" and the other "new".
You would first detach from "old" then do:
screen -e'^Ss' -mS new screen -r old

The useful thing about a nested screen session is that the ouput of
"old" session will be the input of "new", and therefore it will end up in
the display/scrollback buffer of it.

So if you bring the windowlist for "old" and do a "hardcopy" on "new",
it will capture the windowlist.

There's another problem though, if you try to do bring the windowlist
and then do a hardcopy from a single screen script the windowlist
wont appear quickly enough and hardcopy will capture the underlying
window instead.

There needs to be a wait between sending th command to bring up
the windowlist and doing "hardcopy". "sleep" doesnt work when
"source"ing screen scripts. So I split the script in two and used
"idle" instead:

So screen_script_1 would be:
stuff "^A\""
idle 1 source "/home/gerald/screenrc.d/screen_script_1"

And screen_script_2:
hardcopy "/home/gerald/screenrc.d/dumpwinlist"
idle 0
stuff "^["

Another way would be to do the commands from bash (using
screen -X), and use the "sleep" command it has instead.
View this message in context:
Sent from the Gnu - Screen mailing list archive at

reply via email to

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