LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   xterm and titlebar (https://www.linuxquestions.org/questions/linux-software-2/xterm-and-titlebar-51963/)

King V 03-27-2003 01:08 AM

xterm and titlebar
 
All,

Ok, I'm using Mandrake 9.0 . . and have taken care of that xterm vs xterm.real issue that would prevent my .Xdefaults settings for xterm from working properly.

Anyway, most other systems I'd worked with, the titlebar for the Xterm program simply said "xterm" up top.

When I start an Xterm however, I note that the titlebar shows that for only the briefest split second, then instead it shows a string that is in the form

username@full-domain-name: current-directory

and it will change dynamically when I change directories.

The thing is that the properties of that window don't show xterm being in the window class or title at all.

CORRECTION: that last statement about the properties of the window isn't true . . it does show Class as being Xterm and resource as being xterm . . my mistake.

Thus in my .fvwm2rc file, the Style settings I have for xterm aren't recognized.

So how do I prevent the xterm title from showing that whole thing? Or, at the very least, can I start it with the word "xterm" then let the whole other string be displayed afterward?

I'm not sure what in the system sets the behavior to be as it currently is. It seems to be that way by default.

jpbarto 03-27-2003 09:32 AM

I'm assuming that you are launching Xterm from a menu... have you checked to see how the WM is invoking the xterm? What happens if you launch xterm from the command prompt yourself?

King V 03-27-2003 11:29 AM

Actually, the menu only does an "exec xterm" . . but I usually don't use the menus, I ususally launch it from the command prompt simply by typing xterm then hitting ENTER

Both have the same effect.

jpbarto 03-27-2003 12:42 PM

perhaps the title is compiled into the xterm executable (I don't know if thats possible). It could be that the default title can be specified at compile time... in other words, download the xterm source and compile it from source... but b4 you do that I would check the xterm configuration files, but I figured you've pro'lly done that already.

NSKL 03-27-2003 12:46 PM

This behaviour of xterm can be achieved by using special character sequence in your bash PS1 variable. You need to remove that sequence from the script that sets that variable. I added this feature to my xterms on purpose. I made a script and put it into /etc/profile.d/shell.sh. Here it is:

if [ "$TERM" = "linux" ]
then


if
[ "$UID" = "0" ];
then
# I am root
GREEN="\[\e[0;33m\]"
CYAN="\[\e[0;31m\]"
fi
PS1="$YELLOW|:-$GREEN($CYAN\u$GREEN@$CYAN\h$GREEN:\w>$GREEN$CYAN\$$NONE "


else


if
[ "$UID" = "0" ];
then
# I am root
GREEN="\[\e[0;33m\]"
CYAN="\[\e[0;31m\]"
fi
PS1="\[\e]2;\w\a\]$YELLOW|:-$GREEN($CYAN\u$GREEN@$CYAN\h$GREEN:\w>$GREEN$CYAN\
$$NONE "
fi

The sequence i'm talking about should be \[\e]2;\w\a\], for more info read the bash prompt how to.
Of course, in your case it might be due to something else, did you try exporting the PS1 variable to something like > and then starting a new xterm?
-NSKL

King V 03-27-2003 06:08 PM

jpbarto,
Actually, I have NOT checked the xterm configuration files..... which files are they and where are they usually kept?

NSKL,
I checked. My PS1 variable is an oddball string which makes the prompt somewhat similar, but doesn't seem to have those particular characters that cause the xterm titlebar to change.

Actually, double-checked, and the word xterm definitely shows up in the titlebar for a brief moment when I start up an xterm.

Xterm titlebar format is:
user@fully-qualified-domain-name: full-pathname-of-current-directory

whereas the prompt is:
user@hostname current-directory-name

Thus if I was in /root/tmp/mystuff the former would show the whole thing, the latter would show simply mystuff

Anyway, I hope I don't have to get another version of, or recompile, the xterm. It's not too much trouble or anything, but it's just an annoyance.

joesbox 03-27-2003 07:57 PM

have you ever tried using the command:
xterm -title string

King V 03-27-2003 08:09 PM

Just tried it . . . . the "string" shows up for that brief moment the way "xterm" does if I type that without the arguments, then quickly gets replaced by the username@fully-qualified-domain: current-full-directory-path

So something is overriding it AFTER the invocation of the xterm I guess. But what? And how?

jpbarto 03-28-2003 09:29 AM

There should be two configuration files in (according to xterms man page) /usr/lib/X11/app-defaults called XTerm and XTerm-color. Briefly looking through the XTerm file on my pc it doesn't look like there's anything specifying title, but it might be worth looking at. Also some distros can be a little odd.. for example when you install Slackware vi is a symlink to some editor named Elvis... (in other words not really vi or vim). Check your xterm and make sure that what you're executing is not a symbolic link. (Just throwin out ideas now).

bahamat 03-28-2003 10:46 AM

The xterm title can be set with an ENV variable.

You have something like this in your.bashrc:
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'

You can make it echo whatever you want. This overrides the -title switch.


All times are GMT -5. The time now is 04:41 AM.