screen-users
[Top][All Lists]
Advanced

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

Re: shelltitle, window titling


From: Phil!Gregory
Subject: Re: shelltitle, window titling
Date: Thu, 25 Aug 2005 19:33:53 -0400
User-agent: Mutt/1.5.9i

* Dan Mahoney, System Admin <address@hidden> [2005-08-25 13:25 -0400]:
> Is there any way to have command options included for certain commands?
> 
> i.e. to have some sort of script or regex look allow me to have 
> ssh:address@hidden, or irc:irc.freenode.net

screen does not support this; its automatic titling stuff is relatively
simple.  Since you're running tcsh, you could use the postcmd alias to
achieve what you want.  (postcmd is tcsh's analog to zsh's preexec.)

I see form my notes that the tcsh invocation to get the name of the
current command into the shelltitle is

  alias postcmd 'echo -ne "^[k\!#:0^[\\"'

so this should do roughly what you want:

  alias postcmd 'echo -ne "^[k\!#:0 \!#:$^[\\"'

Now, for zsh, I might do something like this:

  preexec () {
      if [[ "$TERM" == "screen" ]]; then
          local CMD="${1[(wr)^(<*|*=*|sudo|exec|-*)]} 
${1[(wrn:2:)^(<*|*=*|sudo|exec|-*)]}"
          echo -n "\ek$CMD\e\\"
      fi
  }

which pulls out the first and second non-variable, non-input redirection,
non-option elements of the command line.  (It's not terribly happy if
there isn't a second (or first, for that matter) such element.)

-- 
...computer contrarian of the first order... / http://aperiodic.net/phil/
PGP: 026A27F2  print: D200 5BDB FC4B B24A 9248  9F7A 4322 2D22 026A 27F2
--- --
I got stuck on a roadtrip with nothing but _3001_ to read.  Ugh.  That was
even worse than the time I got stuck in the San Jose airport with nothing
at all to read.
                       -- Todd Larason
---- --- --




reply via email to

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