LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices

Reply
 
Search this Thread
Old 05-09-2012, 01:50 AM   #1
WraithBand
LQ Newbie
 
Registered: May 2012
Posts: 4

Rep: Reputation: Disabled
Can't change the title of a xterm


Hello!
I need to launch a xterm with a specific title. I used:
xterm -T "MyTitle" -n "MyIconTitle"
but the title changes for a split second (when xterm is launched), and it reverts back to my login name.

I have Ubuntu 11.10.
 
Old 05-09-2012, 02:34 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,541
Blog Entries: 28

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
It is probably being set by your PS1. What is the output from echo "$PS1" ?
 
Old 05-09-2012, 02:51 AM   #3
WraithBand
LQ Newbie
 
Registered: May 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
The output from echo "$PS1" is:

\[\e]0;\u@\h: \w\a]${debian_chroot:+($debian_chroot)}\u@\h:\w\$
 
Old 05-09-2012, 05:19 AM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,541
Blog Entries: 28

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
The first part of that sets the xterm title. More information here.
 
Old 05-09-2012, 07:39 AM   #5
WraithBand
LQ Newbie
 
Registered: May 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
I read the page of the link you gave me but I didn't understand how to solve my problem. Is there a function like his prom1 in my .bashrc that I need to remove? Or is what I want to do just impossible?

EDITED

I found some lines in my .bashrc that defines PS1 (" case $XTERM ") and i jsut commented those lines. Now I can set the title with: xterm -T "MyTitle"

Thanks everybody!

Last edited by WraithBand; 05-09-2012 at 08:14 AM.
 
Old 05-09-2012, 12:14 PM   #6
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
As catkin said, bash allows you to optionally set the xterm title directly from the PS1 prompt string.

The part at the front between "\e]0;" and "\a" is the title setting section, and "\[" and "\]" have also been placed around it because it contains non-printing characters. Everything after that is the setting for the prompt itself.

So just remove that front part from your PS1 prompt setting and new shells shouldn't have their titles affected.
 
Old 05-10-2012, 02:08 AM   #7
WraithBand
LQ Newbie
 
Registered: May 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
Ok thank you. I will make some adjustments following your advice.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Terminal xterm Title is too dynamic (title doesn't change manually) ZeroDaHero Slackware 4 11-04-2012 12:16 PM
[bash] xterm title with ~ shortcut hashbang#! Programming 2 02-10-2012 06:54 AM
Get the title of xterm/gnome-terminal redleafong Linux - Software 6 01-10-2011 06:38 PM
Change title of xterm - Fedora 2.6 sohnir Linux - General 3 12-13-2005 11:40 AM
custom xterm title when already defined in .bashrc brian0918 Linux - Software 1 06-01-2004 11:17 AM


All times are GMT -5. The time now is 12:32 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration