Re: backup terminal title

2010-02-07 Thread Dominic Fandrey
Dominic Fandrey wrote:
 per...@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.

-- 
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? 
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: backup terminal title

2010-02-07 Thread Erik Trulsson
On Sun, Feb 07, 2010 at 09:49:54AM +0100, Dominic Fandrey wrote:
 Dominic Fandrey wrote:
  per...@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.

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


-- 
Insert your favourite quote here.
Erik Trulsson
ertr1...@student.uu.se
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: backup terminal title

2010-02-07 Thread Dominic Fandrey
Erik Trulsson wrote:
 On Sun, Feb 07, 2010 at 09:49:54AM +0100, Dominic Fandrey wrote:
 Dominic Fandrey wrote:
 per...@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? 
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: backup terminal title

2010-02-07 Thread Thomas Dickey
On Sat, Feb 06, 2010 at 10:04:49PM -0800, per...@pluto.rain.com wrote:
 Warren Block wbl...@wonkity.com wrote:
  What's the sequence for reading the terminal title?
 
 If I remembered it I'd have included it :)
 
 The first 3 results from Googling xterm escape sequences are

This is where to start (the other ones are older versions):

http://invisible-island.net/xterm/ctlseqs/ctlseqs.html

By the way, it's the first hit when I ask google the same question.

   rtfm.etla.org/xterm/ctlseq.html
 
   www.faqs.org/docs/Linux-mini/Xterm-Title.html
 
   www.kitebird.com/csh-tcsh-book/ctlseqs.pdf
 
 I'd expect it to be in at least one of them.

That's a nice assumption.  However...

-- 
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net


pgp34PRPxLogu.pgp
Description: PGP signature


Re: backup terminal title

2010-02-07 Thread Thomas Dickey
On Sun, Feb 07, 2010 at 09:49:54AM +0100, Dominic Fandrey wrote:
 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.

I wouldn't expect it to work with the other terminals - it takes usually
a year or more before features from xterm get copied into other programs.

-- 
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net


pgp9O40FX1T1V.pgp
Description: PGP signature


Re: backup terminal title

2010-02-07 Thread Thomas Dickey
On Sun, Feb 07, 2010 at 09:49:54AM +0100, Dominic Fandrey wrote:
 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.

I wouldn't expect it to work with the other terminals - it takes usually
a year or more before features from xterm get copied into other programs.

-- 
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net


pgpxj4XVJjr07.pgp
Description: PGP signature


backup terminal title

2010-02-06 Thread Dominic Fandrey
I just started to wonder how portmaster changes the window title
of my terminal and why it doesn't change it back when it
terminates.

Some digging in the portmaster code showed up an escape sequence:
printf \033]0;%s\007 YOUR TEXT GOES HERE

Unfortunately I am entirely clueless as to how one could backup
the old title string to restore it upon termination. It seems
to me this ought to be a precondition to using this kind of
feature.

-- 
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? 
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: backup terminal title

2010-02-06 Thread Matthias Apitz
El día Saturday, February 06, 2010 a las 01:38:11PM +0100, Dominic Fandrey 
escribió:

 I just started to wonder how portmaster changes the window title
 of my terminal and why it doesn't change it back when it
 terminates.
 
 Some digging in the portmaster code showed up an escape sequence:
 printf \033]0;%s\007 YOUR TEXT GOES HERE
 
 Unfortunately I am entirely clueless as to how one could backup
 the old title string to restore it upon termination. It seems
 to me this ought to be a precondition to using this kind of
 feature.

Play around with xwininfo(1), like:

$ xwininfo -tree -root | fgrep xterm

which prints the titles for all your XTerm windows.

HIH

matthias

-- 
Matthias Apitz
t +49-89-61308 351 - f +49-89-61308 399 - m +49-170-4527211
e g...@unixarea.de - w http://www.unixarea.de/
Vote NO to EU The Lisbon Treaty: http://www.no-means-no.eu
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: backup terminal title

2010-02-06 Thread Thomas Dickey
On Sat, Feb 06, 2010 at 01:38:11PM +0100, Dominic Fandrey wrote:
 I just started to wonder how portmaster changes the window title
 of my terminal and why it doesn't change it back when it
 terminates.
 
 Some digging in the portmaster code showed up an escape sequence:
 printf \033]0;%s\007 YOUR TEXT GOES HERE
 
 Unfortunately I am entirely clueless as to how one could backup
 the old title string to restore it upon termination. It seems
 to me this ought to be a precondition to using this kind of
 feature.

It can, depending - some people object to the control sequence which
can retrieve the previous value.  I added a push/pop stack for xterm last
year which can work around that (transparently).  I used that in vile
(vi like emacs), and I made a fix for 'screen' which uses it.

see
http://invisible-island.net/xterm/xterm.log.html#xterm_251

For other terminals - some have disabled the objectionable feature,
some have not.  (Some will eventually copy the push/pop feature ;-)

-- 
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net


pgpdNZr7YsZSr.pgp
Description: PGP signature


Re: backup terminal title

2010-02-06 Thread Thomas Dickey
On Sat, Feb 06, 2010 at 01:55:55PM +0100, Matthias Apitz wrote:
 El día Saturday, February 06, 2010 a las 01:38:11PM +0100, Dominic Fandrey 
 escribió:
 
  I just started to wonder how portmaster changes the window title
  of my terminal and why it doesn't change it back when it
  terminates.
  
  Some digging in the portmaster code showed up an escape sequence:
  printf \033]0;%s\007 YOUR TEXT GOES HERE
  
  Unfortunately I am entirely clueless as to how one could backup
  the old title string to restore it upon termination. It seems
  to me this ought to be a precondition to using this kind of
  feature.
 
 Play around with xwininfo(1), like:
 
 $ xwininfo -tree -root | fgrep xterm
 
 which prints the titles for all your XTerm windows.

iirc, vim does something like this, but it has the potential for being
very slow (ymmv).

-- 
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net


pgprUhQe4zlss.pgp
Description: PGP signature


Re: backup terminal title

2010-02-06 Thread Dominic Fandrey
Matthias Apitz wrote:
 El día Saturday, February 06, 2010 a las 01:38:11PM +0100, Dominic Fandrey 
 escribió:
 
 I just started to wonder how portmaster changes the window title
 of my terminal and why it doesn't change it back when it
 terminates.

 Some digging in the portmaster code showed up an escape sequence:
 printf \033]0;%s\007 YOUR TEXT GOES HERE

 Unfortunately I am entirely clueless as to how one could backup
 the old title string to restore it upon termination. It seems
 to me this ought to be a precondition to using this kind of
 feature.
 
 Play around with xwininfo(1), like:
 
 $ xwininfo -tree -root | fgrep xterm
 
 which prints the titles for all your XTerm windows.

Nice, but I need something that works with base system
components. Like an escape sequence that causes the terminal
to reset its title.

Regards

-- 
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? 
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: backup terminal title

2010-02-06 Thread Matthew Seaman
On 06/02/2010 13:55, Dominic Fandrey wrote:

 Nice, but I need something that works with base system
 components. Like an escape sequence that causes the terminal
 to reset its title.

Something like this for tcsh:

set prompt = '%{\033]0;%...@%m:%/\007%}%B%m%b:%c03:%# '

Sets the window title to 'u...@hostname:/current/directory'.  Porting
this escape sequence to other shells left as an exercise for the student.

Cheers,

Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.  7 Priory Courtyard, Flat 3
Black Earth Consulting   Ramsgate
 Kent, CT11 9PW
Free and Open Source Solutions   Tel: +44 (0)1843 580647



signature.asc
Description: OpenPGP digital signature


Re: backup terminal title

2010-02-06 Thread Dominic Fandrey
Matthew Seaman wrote:
 On 06/02/2010 13:55, Dominic Fandrey wrote:
 
 Nice, but I need something that works with base system
 components. Like an escape sequence that causes the terminal
 to reset its title.
 
 Something like this for tcsh:
 
 set prompt = '%{\033]0;%...@%m:%/\007%}%B%m%b:%c03:%# '
 
 Sets the window title to 'u...@hostname:/current/directory'.  Porting
 this escape sequence to other shells left as an exercise for the student.

Already experimented with that, but it makes tcsh believe the prompt
is longer than it really is. So it will blow up when you move your
cursor around in long commands.

Also this doesn't really relate to the question, does it?

-- 
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? 
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: backup terminal title

2010-02-06 Thread Dominic Fandrey
Dominic Fandrey wrote:
 Matthew Seaman wrote:
 On 06/02/2010 13:55, Dominic Fandrey wrote:

 Nice, but I need something that works with base system
 components. Like an escape sequence that causes the terminal
 to reset its title.
 Something like this for tcsh:

 set prompt = '%{\033]0;%...@%m:%/\007%}%B%m%b:%c03:%# '

 Sets the window title to 'u...@hostname:/current/directory'.  Porting
 this escape sequence to other shells left as an exercise for the student.
 
 Also this doesn't really relate to the question, does it?

I realize my wording should be clearer.

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.

-- 
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? 
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: backup terminal title

2010-02-06 Thread perryh
 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.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: backup terminal title

2010-02-06 Thread Warren Block

On Sat, 6 Feb 2010, per...@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.


% printf \033]0;Title Here\007

What's the sequence for reading the terminal title?

-Warren Block * Rapid City, South Dakota USA
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: backup terminal title

2010-02-06 Thread perryh
Warren Block wbl...@wonkity.com wrote:
 What's the sequence for reading the terminal title?

If I remembered it I'd have included it :)

The first 3 results from Googling xterm escape sequences are

  rtfm.etla.org/xterm/ctlseq.html

  www.faqs.org/docs/Linux-mini/Xterm-Title.html

  www.kitebird.com/csh-tcsh-book/ctlseqs.pdf

I'd expect it to be in at least one of them.

(#4 may be a miss, but the next 5 also look promising.)
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: backup terminal title

2010-02-06 Thread Warren Block

On Sat, 6 Feb 2010, per...@pluto.rain.com wrote:


Warren Block wbl...@wonkity.com wrote:

What's the sequence for reading the terminal title?


If I remembered it I'd have included it :)


I did some unsuccessful searching for query xterm title earlier today.


The first 3 results from Googling xterm escape sequences are

 rtfm.etla.org/xterm/ctlseq.html


That one has it:

printf \033];badexample\007

This sets the title in both xterm and Terminal.

printf \033[21;t\n

That brings back the title in Terminal, with a leading l... and in the 
keyboard buffer.  Doesn't work in xterm, possibly because xterm is 
pickier about the exact sequence.


-Warren Block * Rapid City, South Dakota USA
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: backup terminal title

2010-02-06 Thread Dominic Fandrey
per...@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.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org