[Top][All Lists]

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

Re: action upon re-attach

From: John Davidorff Pell
Subject: Re: action upon re-attach
Date: Sun, 19 Sep 2004 19:19:28 -0700

Using my mad hacker skills (that's a joke), i've come up with the following commands: screen -S "`screen -ls | grep tached | awk '{print $1}' | head -n1`" -X screen screen -S "`screen -ls | grep tached | awk '{print $1}' | head -n1`" -xRR

This ensures that if I have multiple screens available, the command is sent to the right one (first one, which may not be the right one...) and then I re-attach to that same one. Problem: if the screen is already attached to, then the previously attached screen switches to the newly created window. The newly attached screen, starts up in the previously active window... not the newly created one...

What would it take to implement a "re-attach and open new window" flag? Could someone point me to the right function/file (and maybe a few tips on the archaic code?). I think I'm capable enough to come up with a patch (that won't meet sven's standards) that would work, but last time I started looking through screen's code I got a headache... I'm thinking that I'd allow for -X /and/ -r... but that already means something... perhaps different meaning for -r/-R when used with -X?


On 19 Sep 2004, at 07:37, Phil!Gregory wrote:

* John Davidorff Pell <address@hidden> [2004-09-19 00:31 -0700]:
What I would like to do is create a new window, with a new shell in it,
every time I re-attach.

You can accomplish this with a script that runs the two commands:

  screen -X screen
  screen -r

The problem is that the reattach will not go to the newly created window
on its own; it'll display the screen you last detached from, unless you
use -p to preselect a window.  This might work:

  screen -X screen -t $WINDOW
  screen -r -p $WINDOW

but only if you don't have your shell changing window titles for you.
(Mine does.)

-- contrarian of the first order... / PGP: 026A27F2 print: D200 5BDB FC4B B24A 9248 9F7A 4322 2D22 026A 27F2
--- --
Education is a better safeguard of liberty than a standing army.
                       -- Edward Everett
---- --- --

screen-users mailing list

"NOTICE: This E-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged. If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution or copying of this communication is strictly prohibited, Please reply to the sender that you have received the message in error, then delete it. Thank you."

reply via email to

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