Subject: FVWM: Xterm titles

From: Andy Arbon <[email-masked]>
Date: Fri, 13 Sep 2002 15:08:49 +0100

Hello,

Firstly, I'm not 100% sure this is really on topic on the FVWM list for
which I apologise, but it's definitely a related query.

I am looking for a way to make it easier to tell the many xterms I
always end up running apart in the window lists. What I am currently
thinking of doing is changing the title of each xterm to something like
"xterm (<username>) - <last issued command>"

Using the environment variable PROMPT_COMMAND I can give bash a command
to execute before it draws each prompt, which would seem to be the right
time to do the change. What I don't know is how to change the xterm
title from within bash - is it possible, and if so, how?

Many thanks,

Andy

PS. If anyone else has any other ideas on how to solve the problem of
making the xterms easier to tell apart I'd be interested to hear them.

- --

Real Men don't make backups. They upload it via ftp and let the world
mirror it. -- Linus Torvalds

--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Dominik Vogt <[email-masked]>
Date: Fri, 13 Sep 2002 16:29:11 +0200

On Fri, Sep 13, 2002 at 03:08:49PM +0100, Andy Arbon wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hello,
> 

There are some special escape sequences that chenge the window
title.  Use this command:

  printf "\e]2;"blabla"\a"

And replace "blabla" with the desired text.  In zsh, the syntax is

  print -Pn "\e]2;blabla\a"

> making the xterms easier to tell apart I'd be interested to hear them.

In the 2.5.x branch (unstable development versions at the moment),
Windows with the same title can be numbered with

  Style * IndexedWindowName

So instead of

  xterm
  xterm
  ...

you get

  xterm
  xterm (2)
  xterm (3)
  ...

Bye

Dominik ^_^  ^_^

 --
Dominik Vogt, mail: [email-masked], phone: 0721/91374-382
Schlund + Partner AG, Erbprinzenstr. 4-12, D-76133 Karlsruhe
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Dan Espen <[email-masked]>
Date: Fri, 13 Sep 2002 10:31:48 -0400

> title from within bash - is it possible, and if so, how?

There is an escape sequence that changes the title.
This creates the "shdr" function to change the title:

  function shdr	{		# changes screen title
    # This would make Rumba hang, so only do for some TERMs:
    if [ "$TERM" = "xterm" -o "$TERM" = "rxvt" ] ; then
      print -n '\033]2;'$*'\07'
    fi
  }

> making the xterms easier to tell apart I'd be interested to hear them.

I find that doing most of my work in XEmacs removes the need for
a host of xterms.

-- 
Dan Espen                           E-mail: [email-masked]
444 Hoes Lane  Room RRC 1C-214      Phone: (732) 699-5570
Piscataway, NJ 08854
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: David Koo <[email-masked]>
Date: Fri, 13 Sep 2002 20:14:00 +0530

> What I don't know is how to change the xterm title from within bash
> - is it possible, and if so, how?

    Here's what I do:

    In a shell script that is sourced at startup:

---
# set prompt for xterm vs. non-xterm
setprompt()
{
      local TITLEBAR=""
      local prompt="[\w]"

      case $TERM in
        xterm*|screen)
            TITLEBAR="\[\033[^[]0;\h: \w\007\]"
            ;;
      esac

      prompt="${TITLEBAR}[\$(basename \$(dirname \w))/\$(basename \w)]"
      PS1="$prompt"
}
---

    At some later point in time, call the setprompt function. The
function will (among other things) set the titlebar to a string of the
form, "hostname: /full/path/of/current/dir" e.g. "koo: /home/koo". You
don't need to use the PROMPT_COMMAND variable ;).

    If all you want is the escape code, its there in the "TITLEBAR"
variable above. I got that from "man console_codes" (mandrake 8.2).

    HTH.

--
Koo

---

From: Ionel Mugurel Ciobica <[email-masked]>
Date: Fri, 13 Sep 2002 16:49:18 +0200

> "xterm (<username>) - <last issued command>"

The way I do it is that I open each xterm for a purpose. If it is a
local terminal then I call it xterm@localhost and the rest I call it
with the names of the computers I log into. One xterm is for the e-mail.
I have mutt rename it with this lines in .muttrc:

 set xterm_set_titles=yes
 set xterm_title="Mail"

So I have no need to make changes in the xterm name. If you have few
xterms oppened for the same computer it can be tricky, I never had more
than 2-3, except for the localhost. In that case I have special defined
few xterms (different colors and names) and it never happend to have
more than those oppened.

You can try the function which change the title for xterm, but what if
the last command on all xterm is 'ls -ltr'?

Ionel

---

From: Richard Lister <[email-masked]>
Date: Mon, 16 Sep 2002 14:59:16 -0400 (EDT)

From: Andy Arbon <[email-masked]>
Subject: FVWM: Xterm titles
Date: Fri, 13 Sep 2002 15:08:49 +0100

> title from within bash - is it possible, and if so, how?

Hi Andy

Check out

  http://cns.georgetown.edu/~ric/howto/Xterm-Title/

Cheers
Ric

Richard J Lister
Dept of Neuroscience
Georgetown University Medical Center
http://cns.georgetown.edu/~ric/
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].