ASHISH031192 / mintty

Automatically exported from code.google.com/p/mintty
0 stars 0 forks source link

Allow more information in window title (hostname etc) #231

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
In mintty window title, only the current working directory is displayed, it 
should be possible to also display more information about the current session, 
such as hostname and current user.

This is quite necessary especially when a long running command is executing 
with long output, in such case it's inconvenient to distinguish among several 
mintty window.

Original issue reported on code.google.com by roge...@gmail.com on 2 Nov 2010 at 8:48

GoogleCodeExporter commented 8 years ago
As far as mintty is concerned, any string can be displayed in the window title. 
This can be set either with the --title command line option or the relevant 
xterm control sequence.

In the default Cygwin configuration, the working directory is put into the 
title by bash's prompt setting, i.e. the PS1 variable:

$ echo $PS1
\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$

The title setting bit is this: '\e]0;\w\a'. Bash expands the '\w' to the 
current working directory. The sequence is enclosed by '\[' and '\]' to tell 
bash that it shouldn't be counted towards the length of the prompt, otherwise 
it gets confused about long lines.

See also:
http://www.davidpashley.com/articles/bash-prompts.html
http://www.davidpashley.com/articles/xterm-titles-with-bash.html

Original comment by andy.koppe on 2 Nov 2010 at 12:17