set Cygwin terminal title

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

set Cygwin terminal title

Maninmoon
Ho can I set Cygwin termnal title?

I have tried echoing every escape sequence I have found on web.

None seem to work.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply | Threaded
Open this post in threaded view
|

Re: set Cygwin terminal title

Adam Dinwoodie-2
On Tue, Apr 08, 2014 at 03:24:29PM +0100, xmoon 2000 wrote:
> Ho can I set Cygwin termnal title?
>
> I have tried echoing every escape sequence I have found on web.
>
> None seem to work.

It's reasonably likely your `$PS1` includes a line to set the terminal
title; I think the default Cygwin Bash profile files do that.  If that's
the case, an escape sequence command to set the terminal title will
work, but will then be immediately reset by the Bash prompt being
displayed.

To check, run `echo "$PS1"` and see if that includes a bunch of escape
sequences.  If it does, to change that behaviour you'll need to work out
which file is setting `$PS1` and fix it.  It'll probably be one of
`~/.bashrc`, `~/.profile` or `~/.bash_profile`.

If that doesn't get you anywhere, read through the below, including the
link on how to ask smart questions.  You've really not given us much to
go on to help you.

> Problem reports:       http://cygwin.com/problems.html

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply | Threaded
Open this post in threaded view
|

RE: set Cygwin terminal title

Nellis, Kenneth-3
In reply to this post by Maninmoon
From: xmoon 2000
> Ho can I set Cygwin termnal title?
>
> I have tried echoing every escape sequence I have found on web.
>
> None seem to work.

This works with mintty and bash:

printf "\e]2;%s\a" "your message here"

--Ken Nellis


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply | Threaded
Open this post in threaded view
|

Re: set Cygwin terminal title

Duncan Roe-2
In reply to this post by Adam Dinwoodie-2
On Tue, Apr 08, 2014 at 03:55:02PM +0100, Adam Dinwoodie wrote:

> On Tue, Apr 08, 2014 at 03:24:29PM +0100, xmoon 2000 wrote:
> > Ho can I set Cygwin termnal title?
> >
> > I have tried echoing every escape sequence I have found on web.
> >
> > None seem to work.
>
> It's reasonably likely your `$PS1` includes a line to set the terminal
> title; I think the default Cygwin Bash profile files do that.  If that's
> the case, an escape sequence command to set the terminal title will
> work, but will then be immediately reset by the Bash prompt being
> displayed.
>
> To check, run `echo "$PS1"` and see if that includes a bunch of escape
> sequences.  If it does, to change that behaviour you'll need to work out
> which file is setting `$PS1` and fix it.  It'll probably be one of
> `~/.bashrc`, `~/.profile` or `~/.bash_profile`.
>
> If that doesn't get you anywhere, read through the below, including the
> link on how to ask smart questions.  You've really not given us much to
> go on to help you.
>
I have this in my .bashrc

PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}:${PWD/#$HOME/~}\007"'

A bit extravegant to issue after every command I suppose, but it works,

Cheers ... Duncan.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply | Threaded
Open this post in threaded view
|

Re: set Cygwin terminal title

Csaba Ráduly
In reply to this post by Adam Dinwoodie-2
On Tue, Apr 8, 2014 at 4:55 PM, Adam Dinwoodie  wrote:

> On Tue, Apr 08, 2014 at 03:24:29PM +0100, xmoon 2000 wrote:
>> Ho can I set Cygwin termnal title?
>>
>> I have tried echoing every escape sequence I have found on web.
>>
>> None seem to work.
>
> It's reasonably likely your `$PS1` includes a line to set the terminal
> title; I think the default Cygwin Bash profile files do that.  If that's
> the case, an escape sequence command to set the terminal title will
> work, but will then be immediately reset by the Bash prompt being
> displayed.

xmoon, if you are experimenting with setting the terminal title and
indeed PS1 is resetting it, try putting a sleep command after the
title-setting echo:

echo -ne "\033]2;I am ${USER}@${HOSTNAME} at ${PWD}\007"; sleep 3

Now you can admire the new title for three seconds.

Csaba, whose echo $PS1 says
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[00;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\n\$
--
GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
The Tao of math: The numbers you can count are not the real numbers.
Life is complex, with real and imaginary parts.
"Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds
"People disagree with me. I just ignore them." -- Linus Torvalds

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply | Threaded
Open this post in threaded view
|

Re: set Cygwin terminal title

Maninmoon
@Csaba   Yes - that works.

Actually that's a big help - because within my looping bash script
that is keeping the window title up/changing until scripts stops .
Which is perfect.

thanks you

On 9 April 2014 08:37, Csaba Raduly <[hidden email]> wrote:

> On Tue, Apr 8, 2014 at 4:55 PM, Adam Dinwoodie  wrote:
>> On Tue, Apr 08, 2014 at 03:24:29PM +0100, xmoon 2000 wrote:
>>> Ho can I set Cygwin termnal title?
>>>
>>> I have tried echoing every escape sequence I have found on web.
>>>
>>> None seem to work.
>>
>> It's reasonably likely your `$PS1` includes a line to set the terminal
>> title; I think the default Cygwin Bash profile files do that.  If that's
>> the case, an escape sequence command to set the terminal title will
>> work, but will then be immediately reset by the Bash prompt being
>> displayed.
>
> xmoon, if you are experimenting with setting the terminal title and
> indeed PS1 is resetting it, try putting a sleep command after the
> title-setting echo:
>
> echo -ne "\033]2;I am ${USER}@${HOSTNAME} at ${PWD}\007"; sleep 3
>
> Now you can admire the new title for three seconds.
>
> Csaba, whose echo $PS1 says
> \[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[00;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\n\$
> --
> GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
> The Tao of math: The numbers you can count are not the real numbers.
> Life is complex, with real and imaginary parts.
> "Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds
> "People disagree with me. I just ignore them." -- Linus Torvalds
>
> --
> Problem reports:       http://cygwin.com/problems.html
> FAQ:                   http://cygwin.com/faq/
> Documentation:         http://cygwin.com/docs.html
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
>

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply | Threaded
Open this post in threaded view
|

Re: set Cygwin terminal title

Csaba Ráduly
Hi xmoon,

Please don't top-post (http://cygwin.com/acronyms/#TOFU)

On Wed, Apr 9, 2014 at 10:25 AM, xmoon 2000  wrote:
> @Csaba   Yes - that works.
>
> Actually that's a big help - because within my looping bash script
> that is keeping the window title up/changing until scripts stops .
> Which is perfect.

When you have a long-running script, you don't need to call sleep; you
can set the title and then run the script. When the script ends, the
title will be reset by PS1.

A more permanent solution could be this script:
http://www.twistedmatrix.com/users/glyph/preexec.bash.txt

It will change the terminal title to the running command without you
having to explicitly set it.

Csaba
--
GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
The Tao of math: The numbers you can count are not the real numbers.
Life is complex, with real and imaginary parts.
"Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds
"People disagree with me. I just ignore them." -- Linus Torvalds

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple