Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 07 Feb 2010 11:25:10 +0100
From:      Dominic Fandrey <kamikaze@bsdforen.de>
To:        Erik Trulsson <ertr1013@student.uu.se>
Cc:        m.seaman@black-earth.co.uk, guru@unixarea.de, perryh@pluto.rain.com, freebsd-questions@freebsd.org
Subject:   Re: backup terminal title
Message-ID:  <4B6E9506.4030301@bsdforen.de>
In-Reply-To: <20100207100830.GA18513@falcon.midgard.homeip.net>
References:  <4B6D62B3.4070702@bsdforen.de> <20100206125554.GA2173@current.Sisis.de> <4B6D74EF.2090106@bsdforen.de> <4B6D80F3.7050707@black-earth.co.uk> <4B6D8377.1090005@bsdforen.de> <4B6D9B6B.40800@bsdforen.de> <4b6e2885.uAuY%2Ba00oT7AqSzy%perryh@pluto.rain.com> <4B6E6F24.3090609@bsdforen.de> <4B6E7EB2.7040408@bsdforen.de> <20100207100830.GA18513@falcon.midgard.homeip.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Erik Trulsson wrote:
> On Sun, Feb 07, 2010 at 09:49:54AM +0100, Dominic Fandrey wrote:
>> Dominic Fandrey wrote:
>>> perryh@pluto.rain.com wrote:
>>>>> I wish to use  the "\033]0;%s\007" sequence in a shell-script to
>>>>> set the title of a terminal. But only if I am able to undo it.
>>>>>
>>>>> My requirement is that this must be done without using anything
>>>>> outside the base system.
>>>> There is an escape sequence which will cause the terminal to echo
>>>> back its current title, but it's a bit tricky to use given only
>>>> base-system tools because the echo ends with, IIRC, \007 rather
>>>> than \n.  It may be possible in some shells to temporarily set the
>>>> line-end character to \007.  You probably also want to (somehow)
>>>> cover problematic cases like terminals that don't reply to the
>>>> inquiry even though TERMCAP implies that they should.
>>> That actually doesn't sound tricky at all, remember that the
>>> original sequence to change the title also ends with \007.
>>> Where can I find this magical sequence?
>>>
>>> I've been trying to read:
>>> http://www.xfree86.org/current/ctlseqs.html
>>>
>>> But the Syntax is really cryptic.
>> I finally got it:
>>
>> printf "\033[22;0t"
>> 	This stores the current icon and window titles on a stack.
>> printf "\033[23;0t"
>> 	This restores them from the stack.
>>
>> It works fine with xterm, has no effect on rxvt-unicode (which I
>> am using), though.
>>
>> That might well be a termcap problem. I've got to look into this.
> 
> Not a termcap problem. A terminal problem rather.  This "storing title
> on a stack" stuff is something very few terminals support.  Recent
> xterms does, but few if any others.

You're right my testing confirms that. I used the official termcap info
from urxvt (needed some reformatting to use it) and it didn't fix the
problem.

> Other terminals will at best have sequences for "set title" and "read
> current title".  

Unfortunately the sequence to return the title seems to be implemented
(it returns the surrounding sequence as described in
http://invisible-island.net/xterm/ctlseqs/ctlseqs.html), but the string
in there is empty.

I contacted the main developer of rxvt-unicode with my problem.
I figure the stack solution is the most traditional and convenient
approch in my opinion. Maybe he'll agree.

-- 
A: Because it fouls the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail? 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4B6E9506.4030301>