From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11798 invoked by alias); 12 Apr 2014 00:49:59 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 11782 invoked by uid 89); 12 Apr 2014 00:49:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-HELO: mail105.syd.optusnet.com.au Received: from mail105.syd.optusnet.com.au (HELO mail105.syd.optusnet.com.au) (211.29.132.249) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 12 Apr 2014 00:49:56 +0000 Received: from dimstar.local.net (c122-107-168-99.eburwd5.vic.optusnet.com.au [122.107.168.99]) by mail105.syd.optusnet.com.au (Postfix) with ESMTP id 118A71043DBF for ; Sat, 12 Apr 2014 10:49:53 +1000 (EST) Received: (qmail 11026 invoked by uid 501); 12 Apr 2014 00:49:47 -0000 Date: Sat, 12 Apr 2014 00:49:00 -0000 From: Duncan Roe To: cygwin@cygwin.com Subject: Re: setting cygwin terminal (mintty) title from a very remote system Message-ID: <20140412004947.GF23945@dimstar.local.net> Mail-Followup-To: cygwin@cygwin.com References: <53483EC3.6010707@biostat.ucsf.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <53483EC3.6010707@biostat.ucsf.edu> User-Agent: Mutt/1.5.22 (2013-10-16) X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=eojmkOZX c=1 sm=1 tr=0 a=+cDhJlqnNvz9E7c5l3ERGg==:117 a=+cDhJlqnNvz9E7c5l3ERGg==:17 a=y26AOypDAAAA:8 a=PO7r1zJSAAAA:8 a=M1kyBYkWWGkA:10 a=_KQaLYPUiGMA:10 a=kj9zAlcOel0A:10 a=iaFubHWvAAAA:8 a=1XWaLZrsAAAA:8 a=tXNp_sQbAAAA:8 a=BZ2fTdvATZge5o8qcIgA:9 a=CjuIK1q_8ugA:10 X-IsSubscribed: yes X-SW-Source: 2014-04/txt/msg00311.txt.bz2 On Fri, Apr 11, 2014 at 12:13:07PM -0700, Ross Boylan wrote: > I typically connect to systems through several hops; this note is about how > I managed to set the title of the cygwin terminal to match the remote > system. Usually it just shows the name on the first hop only. I would > love to learn there is a better way to get the same results. > > Various internet sources advise things like > > echo -ne '\e]0;Title\a' > > to set the window title while noting that the default cygwin prompt sets > this automatically. This did not work for me initially, but I found a way > to get it to work. > > On the remote system the prompt does not contain any window titling > commands. > > Concretely, my connection sequence looks like this. > > From System A, running Windows 7, launch a cygwin bash shell. > In that shell, ssh to system B. B's name will appear in the title bar. > From B ssh to C. Neither this nor later operations change the title bar. > From C ssh to D. > On D, run screen. > In screen, run emacs. > In emacs start a (bash) shell. > > I want the name of system D to appear in my title bar. > Systems B-D are running various versions of Debian GNU/Linux. > The echo command from within the bash prompt is ineffective. > > If I start a new shell from within screen (Ctl-a c), the echo command works > from there. > > I suppose if I built the window setting command into the remote prompt > things would just work, since I launch emacs from such a prompt. But I'm > not sure what that would do if I were not connecting via cygwin. > > Ross Boylan > > Someone put in a request for a feature to support manually setting the > title; this was rejected on the grounds that echoing an appropriate sequence > would do the same thing > (http://code.google.com/p/mintty/issues/detail?id=241). Unfortunately, that > does not seem to be true after connecting to a remote system, or at least it > is not true after the sequence of steps described above. http://superuser.com/questions/362227/how-to-change-the-title-of-the-mintty-window > has a comment that the echo has no effect when issued from within screen. > It is simply inappropriate to try to set the window title from the bash prompt. Remove any and all attempts to do that from PS1 and instead put them in PROMPT_COMMAND which bash will obey at every prompt. This may look like overkill, but will reset the window name should any command you run have changed it. E.g. I have PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}:${PWD/#$HOME/~}\007"' Try it, 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