Changing xterm title.

Changing xterm title.

Post by Ken Stee » Fri, 04 Jul 2003 13:17:53



I have an ncurses based application that changes the xterm title to the
current working directory.  I was using printf statements and escape
characters to change the title but if the program is running inside of
the screen program that will not work.  I changed the program to use Xlib
calls but I am not sure if I am doing it correctly or not.

This works but I am wondering if there is a better way.

void
change_term_title(char * new_title)
{
        Display *dsp = NULL;
        Window win = 0;
        XTextProperty prop;

        XStringListToTextProperty(&new_title, 1, &prop);
        dsp = XOpenDisplay(NULL);
        win = atol(getenv("WINDOWID");

        XSetWMName(dsp, win, &prop);
        XFlush(dsp);
        XFree(prop.value);
        XCloseDisplay(dsp);

Quote:}

I have never done any Xlib programming and I don't know how portable this
code is.  I realize that the code needs some error checking, but I am
wondering if I am on the right track or if there is a better way of doing
this.

Thanks,
Ken

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----

 
 
 

Changing xterm title.

Post by Stephane CHAZELA » Fri, 04 Jul 2003 17:11:50



> I have an ncurses based application that changes the xterm title to the
> current working directory.  I was using printf statements and escape
> characters to change the title but if the program is running inside of
> the screen program that will not work.

[...]

You can put this in your ~/.screenrc:

termcapinfo xterm 'hs:ts=\E]2;:fs=\007:ds=\E]0;xterm\007'

--
Stphane

 
 
 

1. dynamically changing xterm title

Hello!
        Does any one know o a fairly simpl way to change the xterm
title to the current hostname and then change when telnet/rlogin to
a different host and change back when exiting?
        Thanks.
Cal Wooten

2. Mozilla user interface?

3. Prompt string to change xterm title?

4. Apache 2.0 advantages?

5. Changing Xterm title with new job

6. Matrox Mystiqe & X

7. changing xterm titles on the fly

8. Networking

9. changing xterm title.

10. Change xterm title/icon name?

11. How to change xterm title bar string?

12. Change xterm title bar?

13. change xterm title from unix prompt