zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: zftp xterm titlebar
@ 1999-12-10 16:06 Clint Adams
  1999-12-10 19:38 ` Alexandre Duret-Lutz
  1999-12-12 11:51 ` Andrej Borsenkow
  0 siblings, 2 replies; 9+ messages in thread
From: Clint Adams @ 1999-12-10 16:06 UTC (permalink / raw)
  To: zsh-workers

It would be nice if terminfo/termcap had support for titlebars,
but I can't find any.

--- Functions/Zftp/zftp_chpwd	1999/09/10 13:58:18	1.1.1.4
+++ Functions/Zftp/zftp_chpwd	1999/12/10 15:57:10
@@ -35,7 +35,7 @@
     case $TERM in
       sun-cmd) print -n -P "\033]l$str\033\\"
 	       ;;
-      xterm|aixterm) print -n -P "\033]2;$str\a"
+      *xterm*) print -n -P "\033]2;$str\a"
 	     ;;
     esac
   fi


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PATCH: zftp xterm titlebar
  1999-12-10 16:06 PATCH: zftp xterm titlebar Clint Adams
@ 1999-12-10 19:38 ` Alexandre Duret-Lutz
  1999-12-12 10:44   ` Andrej Borsenkow
  1999-12-23 11:50   ` Alexandre Duret-Lutz
  1999-12-12 11:51 ` Andrej Borsenkow
  1 sibling, 2 replies; 9+ messages in thread
From: Alexandre Duret-Lutz @ 1999-12-10 19:38 UTC (permalink / raw)
  To: zsh-workers


May I propose the following patch that also take `rxvt', `Eterm', 
and `dtterm' (from Sun CDE) into account ?  Are there other 
xterm-compatible terminals emulators around ?

(the following should be applied after Clint's 8993)

--- Functions/Zftp/zftp_chpwd~	Fri Dec 10 18:42:49 1999
+++ Functions/Zftp/zftp_chpwd	Fri Dec 10 18:48:10 1999
@@ -35,7 +35,7 @@
     case $TERM in
       sun-cmd) print -n -P "\033]l$str\033\\"
 	       ;;
-      *xterm*) print -n -P "\033]2;$str\a"
+      *xterm*|rxvt|dtterm|Eterm) print -n -P "\033]2;$str\a"
 	     ;;
     esac
   fi
--- Etc/FAQ.yo~	Fri Dec 10 18:35:03 1999
+++ Etc/FAQ.yo	Fri Dec 10 18:42:00 1999
@@ -1122,7 +1122,7 @@
   You should use the special function mytt(chpwd), which is called when
   the directory changes.  The following checks that standard output is
   a terminal, then puts the directory in the title bar if the terminal
-  is an tt(xterm) or a tt(sun-cmd).
+  is compatible with tt(xterm) or is a tt(sun-cmd).
   
   verb(
   chpwd() {
@@ -1130,7 +1130,7 @@
     case $TERM in
       sun-cmd+CHAR(41) print -Pn "\e]l%~\e\\"
         ;;
-      xterm+CHAR(41) print -Pn "\e]2;%~\a"
+      *xterm*|rxvt|dtterm|Eterm+CHAR(41) print -Pn "\e]2;%~\a"
         ;;
     esac
   }
--- Doc/Zsh/zftpsys.yo~	Sun Nov 28 17:42:27 1999
+++ Doc/Zsh/zftpsys.yo	Fri Dec 10 19:02:23 1999
@@ -97,10 +97,10 @@
 given as `tt(?)' it will be prompted for.  If var(host) is not present, use
 a previously stored set of parameters.
 
-If the command was successful, and the terminal is an tt(xterm), a summary
-will appear in the title bar, giving the local tt(host:directory) and the
-remote tt(host:directory); this is handled by the function tt(zftp_chpwd),
-described below.
+If the command was successful, and the terminal is compatible with
+tt(xterm) or is tt(sun-cmd), a summary will appear in the title bar,
+giving the local tt(host:directory) and the remote tt(host:directory);
+this is handled by the function tt(zftp_chpwd), described below.
 
 Normally, the var(host), var(user) and var(password) are internally
 recorded for later re-opening, either by a tt(zfopen) with no arguments, or
@@ -466,9 +466,10 @@
 item(tt(zftp_chpwd))(
 This function is called every time a connection is opened, or closed, or
 the remote directory changes.  This version alters the title bar of an
-tt(xterm) or tt(sun-cmd) terminal emulator to reflect the local and remote
-hostnames and current directories.  It works best when combined with the
-function tt(chpwd).  In particular, a function of the form
+tt(xterm) compatible or tt(sun-cmd) terminal emulator to reflect the 
+local and remote hostnames and current directories.  It works best when
+combined with the function tt(chpwd).  In particular, a function of 
+the form
 
 example(chpwd() {
   if [[ -n $ZFTP_USER ]]; then

-- 
Alexandre Duret-Lutz


^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: PATCH: zftp xterm titlebar
  1999-12-10 19:38 ` Alexandre Duret-Lutz
@ 1999-12-12 10:44   ` Andrej Borsenkow
  1999-12-13 10:13     ` Alexandre Duret-Lutz
  1999-12-23 11:50   ` Alexandre Duret-Lutz
  1 sibling, 1 reply; 9+ messages in thread
From: Andrej Borsenkow @ 1999-12-12 10:44 UTC (permalink / raw)
  To: Alexandre Duret-Lutz, zsh-workers

>
> May I propose the following patch that also take `rxvt', `Eterm',
> and `dtterm' (from Sun CDE) into account ?

This works here but I could not find anything about it in dterm reference
(TriTeal TED 4.2)

How portable is it? Do all dtterm's from all vendors suport it?

BTW is it possible to get the current window title?

/andrej


^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: PATCH: zftp xterm titlebar
  1999-12-10 16:06 PATCH: zftp xterm titlebar Clint Adams
  1999-12-10 19:38 ` Alexandre Duret-Lutz
@ 1999-12-12 11:51 ` Andrej Borsenkow
  1999-12-12 23:02   ` Bart Schaefer
  1 sibling, 1 reply; 9+ messages in thread
From: Andrej Borsenkow @ 1999-12-12 11:51 UTC (permalink / raw)
  To: Clint Adams, zsh-workers

>
> It would be nice if terminfo/termcap had support for titlebars,
> but I can't find any.
>

I am not convinced, this is a nice idea. I nromally have host@$PWD as part of my
title bar (set in chpwd()). In this case zftp would reset it without ever
restoring back. This should at least be configurable (preferably, with zstyle
:-). Actually, users may have preexec() function that sets title bar to current
command being executed and precmd() that resets it back to some defaults after
command has completed. In this case your change will simply be a noop.

/andrej


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PATCH: zftp xterm titlebar
  1999-12-12 11:51 ` Andrej Borsenkow
@ 1999-12-12 23:02   ` Bart Schaefer
  0 siblings, 0 replies; 9+ messages in thread
From: Bart Schaefer @ 1999-12-12 23:02 UTC (permalink / raw)
  To: zsh-workers

On Dec 12,  1:44pm, Andrej Borsenkow wrote:
}
} BTW is it possible to get the current window title?

I do not believe so.

On Dec 12,  2:51pm, Andrej Borsenkow wrote:
}
} I am not convinced, this is a nice idea. [...] This should at least be
} configurable (preferably, with zstyle :-).

Yes, that would be a good thing.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PATCH: zftp xterm titlebar
  1999-12-12 10:44   ` Andrej Borsenkow
@ 1999-12-13 10:13     ` Alexandre Duret-Lutz
  1999-12-13 12:08       ` Andrej Borsenkow
  0 siblings, 1 reply; 9+ messages in thread
From: Alexandre Duret-Lutz @ 1999-12-13 10:13 UTC (permalink / raw)
  To: zsh-workers; +Cc: Andrej Borsenkow

>>> "AB" == Andrej Borsenkow <Andrej.Borsenkow@mow.siemens.ru> writes:

 >> May I propose the following patch that also take `rxvt', `Eterm',
 >> and `dtterm' (from Sun CDE) into account ?

 AB> This works here but I could not find anything about it in dterm reference
 AB> (TriTeal TED 4.2)

 AB> How portable is it? Do all dtterm's from all vendors suport it?

I don't know.   My dtterm(5) man page reads :

SunOS 5.7           Last change: 25 Apr 1994                   15

Headers, Environments, and Macros                       dtterm(5)

[...]

         Esc ] p1 ;  p2 <control>-G
                Set text parameters.  This escape sequence allows
                various  terminal emulator text values to be set.
                Valid supported values of p1 are:

                   0     Change the icon name and window title to
                         the string p2.

                   1     Change the icon name to the string p2.

                   2     Change the window title  to  the  string
                         p2.

                   3     Set the current working directory to the
                         string  p2.  The terminal emulator tries
                         to restart in this directory when it  is
                         restarted in a new session.

[...]

        Esc ] l text Esc Backslash
                Set the window title to text.

[...]

The second is the same as the `sun-cmd' case in zsh.

 AB> BTW is it possible to get the current window title?

I could print it with : 

$ echo '^[[21t'

But does someone know how to catch this in a shell script ?  Is there
a better way than using script(1) ?


This is an excerpt of what dtterm(5) says about '^[[21t' :

        Esc [ p1 ; p2 ; p3 t
                Window manipulation.  Valid values  for  p1  (and
                any additional parameters) are:

[...]

                   21    Report  the  dtterm(1)  window's  title.
                         The  terminal emulator returns ``Esc ] l
                         title Esc Backslash''.


This seems to be true for xterm too (which I find strange since xterm
does not accept the resulting '^[]ltitle^[\' sequence).

 AB> /andrej

-- 
Alexandre Duret-Lutz


^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: PATCH: zftp xterm titlebar
  1999-12-13 10:13     ` Alexandre Duret-Lutz
@ 1999-12-13 12:08       ` Andrej Borsenkow
  1999-12-14 11:15         ` Oliver Kiddle
  0 siblings, 1 reply; 9+ messages in thread
From: Andrej Borsenkow @ 1999-12-13 12:08 UTC (permalink / raw)
  To: Alexandre Duret-Lutz, zsh-workers

>  AB> BTW is it possible to get the current window title?
>
> I could print it with :
>
> $ echo '^[[21t'
>
> But does someone know how to catch this in a shell script ?  Is there
> a better way than using script(1) ?
>

Quick'n'dirty

bor@itsrm2% ./rt.zsh
Title is: bor@itsrm2:~/test/zsh

bor@itsrm2% cat rt.zsh
#!/tools/bin/zsh

typeset  name
stty -icanon -echo < /dev/fd/0
print -n "\033[21t"
    read -u0 -k 1 c
    ((#c == 27)) || exit
    read -u0 -k 1 c
    ((#c == 93)) || exit
    read -u0 -k 1 c
    ((#c == ##l)) || exit
    read -u0 -k 1 c
    while ((#c != 27)) {
        name[$#name+1]=$c
        read -u0 -k 1 c
    }
    read -u0 -k 1 c
    ((#c == ##\\)) || name=()

print Title is: $name

(For some reasons, neiter ##] nor ##\] worked)

The problem is, output of dtterm appears as input to zsh. When you start new
script (as in this case) tty mode is reset to it's default, that is line
buffered and echoing input. The stty above is needed to turn off line buffer
(else you would need to press CR) and to turn off echo.

The stty seems to be needed even if you call the above from inside of your login
shell. I have "frozen" tty; in general case you may need to save/restore tty
settings.

Hmm ... as stty is highly system-dependent, may be stty module would be very
nice.

/andrej


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PATCH: zftp xterm titlebar
  1999-12-13 12:08       ` Andrej Borsenkow
@ 1999-12-14 11:15         ` Oliver Kiddle
  0 siblings, 0 replies; 9+ messages in thread
From: Oliver Kiddle @ 1999-12-14 11:15 UTC (permalink / raw)
  To: Zsh workers

>  AB> BTW is it possible to get the current window title?
>
> I could print it with :
>
> $ echo '^[[21t'
>
> But does someone know how to catch this in a shell script ?  Is there
> a better way than using script(1) ?

Try getting the setterm program at
http://www.moria.de/~michael/setterm/. It lets you read back responses
from the terminal easily. It would be easy to add handling for dtterm
and the escape code you mentioned above for getting the window title. I
did a similar thing with it to read the colour settings for an SGI xwsh.

Oliver Kiddle


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PATCH: zftp xterm titlebar
  1999-12-10 19:38 ` Alexandre Duret-Lutz
  1999-12-12 10:44   ` Andrej Borsenkow
@ 1999-12-23 11:50   ` Alexandre Duret-Lutz
  1 sibling, 0 replies; 9+ messages in thread
From: Alexandre Duret-Lutz @ 1999-12-23 11:50 UTC (permalink / raw)
  To: zsh-workers

>>> "AD" == Alexandre Duret-Lutz <alexandre.duret@greyc.ismra.fr> writes:

[...]

 AD> Are there other xterm-compatible terminals emulators around ?

Yes, kterm :

--- Functions/Zftp/zftp_chpwd~	Thu Dec 23 11:42:24 1999
+++ Functions/Zftp/zftp_chpwd	Thu Dec 23 11:43:23 1999
@@ -32,9 +32,9 @@
     local str=$zfconfig[lastloc_$ZFTP_SESSION]
     [[ ${#str} -lt 70 ]] && str="%m: %~  $str"
     case $TERM in
-      sun-cmd) print -n -P "\033]l$str\033\\"
+      sun-cmd) print -Pn "\033]l$str\033\\"
 	       ;;
-      *xterm*|rxvt|dtterm|Eterm) print -n -P "\033]2;$str\a"
+      *xterm*|rxvt|dtterm|Eterm|kterm) print -Pn "\033]2;$str\a"
 	     ;;
     esac
   fi
--- Etc/FAQ.yo~	Thu Dec 23 11:46:07 1999
+++ Etc/FAQ.yo	Thu Dec 23 11:43:55 1999
@@ -1130,7 +1130,7 @@
     case $TERM in
       sun-cmd+CHAR(41) print -Pn "\e]l%~\e\\"
         ;;
-      *xterm*|rxvt|dtterm|Eterm+CHAR(41) print -Pn "\e]2;%~\a"
+      *xterm*|rxvt|dtterm|Eterm|kterm+CHAR(41) print -Pn "\e]2;%~\a"
         ;;
     esac
   }


-- 
Alexandre Duret-Lutz



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~1999-12-23 10:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-12-10 16:06 PATCH: zftp xterm titlebar Clint Adams
1999-12-10 19:38 ` Alexandre Duret-Lutz
1999-12-12 10:44   ` Andrej Borsenkow
1999-12-13 10:13     ` Alexandre Duret-Lutz
1999-12-13 12:08       ` Andrej Borsenkow
1999-12-14 11:15         ` Oliver Kiddle
1999-12-23 11:50   ` Alexandre Duret-Lutz
1999-12-12 11:51 ` Andrej Borsenkow
1999-12-12 23:02   ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).