Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

pudge (1)

pudge
  (email not shown publicly)
http://pudge.net/
AOL IM: Crimethnk (Add Buddy, Send Message)

I run this joint, see?

Journal of pudge (1)

Tuesday November 18, 2003
10:02 PM

Terminal.app and Window Names

[ #15853 ]

Right now, the name of my frontmost window in Terminal.app is "pudge@slashdot-nfs-1:/usr/local/src ssh". How does Terminal.app know I am logged into that machine, and am in that directory? I do know "pudge@slashdot-nfs-1:/usr/local/src" is called the "custom title" portion of the name, but I do not know how it is being set automatically.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Xterm? (Score:2, Interesting)

    I believe (and may be way off on this) that it's a feature of the xterm protocol. If not, I too would love to know how this occurs.
  • if [ ${TERM} = "xterm" ]; then
        /usr/bin/printf "\033]1;$* \007"
        /usr/bin/printf "\033]2;$* \007"
    fi

    (but, your shell is probably doing this already, possibly in a pre-command hook.)
    • Aha! It was doing:
      PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\007"'
      Neat little trick. Thanks, that rules.
      • Yes, the Terminal in Panther uses xterm title escapes. I noticed it a few weeks ago while a friend was logged into a work machine (which all have the appropriate trickery in a bash config file somewhere), and was wondering how long it would take for folks to notice it.

        I'm not sure if you can override it using the Terminal window inspector to set a custom title, as I don't have Panther yet. I'd hope so. (Otherwise, I suppose you could edit the config files wherever you needed to, but that's a bit tedious.)
  • There is also an easy GUI way of changing the Terminal title bar.

    1. Go to Window Settings... in the Terminal menu, it's right below Preferences.
    2. Pick the Window item in the menu at the top of the Terminal Inspector window which appears.
    3. Play with the nifty options.

    I have it set to display the active process name, the window size (104x57 characters is half of my screen, and is a handy size for reading man pages), and the shortcut command key for that window. You can also enable the tty name, the .term s