-   Linux - Software (
-   -   How to get the Title of a Putty Window (Emulating an XTerm) (

NateTut 09-03-2009 02:34 PM

How to get the Title of a Putty Window (Emulating an XTerm)
I have a Perl script that changes the terminal window title and I would like to be polite and reset it to the original value when I am done. We are using Putty which emulates xterm. We are not running X-Windows so I can't use something like xprop (can I?). I'm using XTerm control codes to change the title and I have found a code that returns the window title ESC[21t; It seems to work except it doesn't go to STDOUT or STDERR. I can see the title, but I need to capture it

Putty has an option: "Response to remote title query (SECURITY)" I would like to know how to make such a query. I understand the security implications, but this is behind a firewall and Putty will not be used on sites in the wild.:cool:

carltm 09-05-2009 05:12 AM

I use this line to change the window title from my .profile:

PROMPT_COMMAND='echo -ne "\033]0;$USER@${HOSTNAME}: ${PWD}\007"'
Try running echo $PROMPT_COMMAND before running your perl script. If that
variable contains something, run PROMPT_COMMAND_OLD="$PROMPT_COMMAND" before
you run the script and then PROMPT_COMMAND="$PROMPT_COMMAND_OLD" afterwards.

All times are GMT -5. The time now is 03:08 AM.