Re: xterm ttle patch v898 v2

* Tribhuvan <loka rcn com> [Tue, 07 Jan 2003]:
> This is a modification of a patch Tomas Stylbo sent me 
> a couple of days ago.

I really think it's too error prone and that we rather should not
try to restore the title. The xterm title feature is by default
disabled so we can inform the user in the manual how to work
around it in the shell.

> 4) added option for displaying user host in title bar
>   I still have to add explicit support for NATIVE_WIN32
>   (ie: correct environment variables for USER and HOSTNAME)

It would be better not to count on presence of these variables.

If the USER variable is not set then the username should be
obtained from the passwd structure (getpwuid(getuid()).

You should also try the USERNAME variable.

If the HOSTNAME variable is not set then the hostname should be
obtained by calling the gethostname() function. But it's not
present on all platforms probably.

Also I'd prefer a generic solution to this problem. The user
should have the possibility to define the format of the title. I
already created some code that uses a new XTERM_TITLE variable for
this purpose. I plan to release it sometimes together with a
specification defining how the content of this variable should be
interpreted. The specification is not written yet, though.

Anyway, the small library routine together with a small test
program is attached to this message. It allows the user to define
format of the title using the env variable, like this:

    XTERM_TITLE="%a: %r"    => "mc: /home/trip"

    XTERM_TITLE="(%r) - %U"  => "(/home/trip) - MC"
    XTERM_TITLE="%a: %r (%u %h) [%p]" =>

        "mc: /home/trip (trip host) [1234]"
                                     ^^^^ => pid

It would be nice if you could look at this code, make it compile
on solaris and use it as a base for the enhanced title
implementation. That way the title can be consistently implemented
in various terminal applications. The code is complete, tested,
but lacks the very important documentation yet.
> 1) the problem on remote host is still not resolved
>   (ie: store and restore - the title function works fine
>    on remote machines, but _restoring_ old title does not.
>    The delay on initialization of the store_xterm_title
>    is fine (though it could be reduced to a fraction of a second)

I really don't know where's the problem then, sorry. I thought
that the failure to restore the title was caused by too short
delay when we are trying to read the title from the terminal.

> I think it should be introduced in _restore_ when
> mc is exiting/cleaning up. 

That's impossible, we must read the original title before we
change it in any way. That means it must be done at the start.

> 2)  I'd like to create a dialog box for these extra features, so
>    that while they are compiled in by default - they can be
>    switched on and off on-the-fly for buggy/cheap terminal
>    environments.
> Question for Thomas Stylbo: what platform are you testing on?

I am using Linux and FreeBSD, XFree 4.2.0.

> Will report back full testing results a little later....

Please try just this. Login to the remote system and run this in
the shell:

    echo -e "\e[21t"

Does it print the title ?

Does it work on your local system ?

Tomas Styblo <tripie cpan org>

Attachment: xterm-title.tar.gz
Description: GNU Zip compressed data

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]