Re: FVWM: Xterm titles

From: David Koo <koo_at_postmark.net>
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
--
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 majordomo_at_fvwm.org.
To report problems, send mail to fvwm-owner_at_fvwm.org.
Received on Fri Sep 13 2002 - 09:42:50 BST

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:37:53 BST