This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Issue with the titlebar


> I have quite a disturbing task my colleque gave to me. 
> He uses CygWin and has up to 10 Windows opened, now he's getting tired of looking through every single Window when he searches for a specific one. To be exact, he uses ssh to connect to our servers and wants the titlebar to show which server that specific window is logged on to. 
> Is that even possible? I've gone through the web and found nothing helpful. I know that you can let the titlebar show a process name, the full path and i guess even the Hostname, because it is a variable, but everything i tried did not show the Hostname of the server he logs on to. 

Three possibilities:

One, tell your disturbing-and-demanding colleague (DDC for short) to set
PS1='\[\033]0;\]\h\[\007\]$ '.  This is hard to read, but the Bash
prompt HOWTO describes the available \-sequences for setting different
colors and information in the prompt, and for putting information into the
window titlebar.

I do this a little more clearly in the code at bottom, from my .bashrc
file.

Two, DDC could consider using screen(1) to manage all of his many sessions
in a single console window.  In my .screenrc file I have

# caption bar at bottom:
caption always '%-Lw%{.kG} %n%f %t %{-}%+Lw'

and this gives a tab-like bottom row with the names of all of the windows
in the screen session, and the current window highlighted.  Again this is
hard to read, but it's all fully explained in the screen info.

Three, tell DDC to go read up on PS1 and screen, and then solve his own
damn problems.

Good luck,
Andrew.

prompt_host=${SSH_CONNECTION:+[\\h] }
prompt_color='\[\033[1;36m\]'   # color of prompt ; cyan
text_color='\[\033[0m\]'        # color of text ; grey
start_window_title='\[\033]0;\]'
end_window_title='\[\007\]'

case $TERM in
        # text colors and window titles:
        xterm*|cygwin|screen|screen.linux)
                ;;
        # text colors, no window titles:
        linux)
                start_window_title='\n'
                end_window_title=
                ;;
        # no colors, no window titles:
        *)
                start_window_title='\n'
                end_window_title=
                prompt_color=
                text_color=
                ;;
esac
PS1="${start_window_title}${prompt_host}\w${end_window_title}\n${prompt_color}\$${text_color}"

--
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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]