screen-users
[Top][All Lists]
Advanced

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

Re: open new shell on attach


From: Phil!Gregory
Subject: Re: open new shell on attach
Date: Tue, 15 Jun 2004 13:00:44 -0400
User-agent: Mutt/1.5.5.1+cvs20040105i

* Andrew Leiserson <address@hidden> [2004-05-19 17:40 -0400]:
> I would like to have screen open a new shell when I attach (from a newly
> opened xterm).

This is a question a friend of mine had recently, too, so I went poking at
things.  I found one way to do this, provided you can come up with unique
names for your screen windows.

First off, you cannot create a new window and attach to screen in a single
command, since screen's -X option trumps -r and -x.  (In fact, it changes
the meaning of -r and just ignores -x.)  So you need to write a short
script to create the window and then attach.

<background; feel free to skip>
By default, when you attach to screen, you get either the window that was
visible the last time you detached or, if you haven't detached before,
the first window available.  (Steve, this is in FindNiceWindow() in
process.c, called from FinishAttach() in socket.c.)
</background>

You can, however, use the -p option to preselect a window.  -p takes
either a number (which you can't always know) or a name.  So the trick is
to create a unique name for your new window.  My /bin/sh (which is bash)
provides $RANDOM, so I'd use

  #/bin/sh
  WINDOWNAME="newwin-$RANDOM"
  screen -X screen -t $WINDOWNAME
  screen -r -p $WINDOWNAME

I don't know how POSIX $RANDOM is, so it might not exist everywhere.

> Please CC me on replies, as I am not on the list.

Aside for Andy:

I see that you use mutt.  You can simplify this request for many people by
telling mutt to set a Mail-Followup-To header.  Just add these lines to
your .muttrc:

  set followup_to=yes
  lists address@hidden

(followup_to defaults to "yes", actually, so you probably don't even need
that line.)  If you send mail to a list that mutt knows about, either via
'lists' or 'subscribe', mutt withh create a Mail-Followup-To header.  If
you used 'lists', the header will point to your address and indicate that
you want CCs.  Is you used 'subscribe', the header will point to the list
address and indicate that you do _not_ want CCs.

-- 
...computer contrarian of the first order... / http://aperiodic.net/phil/
PGP: 026A27F2  print: D200 5BDB FC4B B24A 9248  9F7A 4322 2D22 026A 27F2
--- --
I don't care how many levels of reality you posit; as soon as you posit
even one it's turtles all the way down.
                       -- Nova Spivak
---- --- --




reply via email to

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