LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
LinkBack Search this Thread
Old 08-21-2010, 01:53 PM   #1
ZeroDaHero
LQ Newbie
 
Registered: Jun 2007
Distribution: Slackware 13.1, Slackware64 13.1
Posts: 26

Rep: Reputation: Disabled
Terminal xterm Title is too dynamic (title doesn't change manually)


So when I upgraded to Slack64 13.1 on my asus MB homebrewed desktop and Slack 13.1 on my compaq presario a900 laptop, I started having issues with the xterm title (in Terminal--not Konsole) being too dynamic. By "too dynamic" I mean that I can't actually change the title. The dynamic title (from my .bashrc) is basically just pwd. Whenever I try to set the title (via terminal->set title (menu)), I changes it for a split second, and then reverts back to the dynamic title.

This is merely a petty annoyance, so to get around it, I added an xtitle function that I grabed somewhere online (just echos "\033]0;$*\007"). So for nano-ing some file, I'd type:

xtitle some_file.txt; nano some_file.txt

That works just fine (kind of annoying to type though). running xtitle alone won't actually change the name either though (I'm pretty sure it's the same command as what terminal does anyway). That is, running:

xtitle some_file.txt

changes the title for a split second, and the reverts back to my old pwd.

What I really want is to have it dynamically name it "some_file.txt" whenever I use nano, but that appears to be a functionality of zsh (with the preexec() fxn).

I'm wondering if anyone else has had this problem, and if you have a fix for it.

Thanks!

My bashrc is a modified version (just slimmed down--mostly aliases removed) of this example one: http://tldp.org/LDP/abs/html/sample-bashrc.html. Mine is commented out like crazy, so I don't think you really want to read it.
 
Old 08-21-2010, 02:09 PM   #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,512
Blog Entries: 27

Rep: Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174
You could define a function in .bashrc that effectively does xtitle some_file.txt; nano some_file.txt for you. Something like (not tested)
Code:
function nano {
echo "\033]0;$*\007"
/usr/bin/nano "$@"
}
 
Old 08-22-2010, 08:04 AM   #3
ZeroDaHero
LQ Newbie
 
Registered: Jun 2007
Distribution: Slackware 13.1, Slackware64 13.1
Posts: 26

Original Poster
Rep: Reputation: Disabled
Awesome! That is an awesome idea! Here's what I did in full:

added the nano function (just like above, I added the usual case for xterm, though...despite the fact that I only use xterm...but whatever) to my bashrc as "nano_title()"

then:

alias nano="nano_title"

Poof! Everything I've ever wanted and more! Thank you so much!
 
Old 08-23-2010, 07:54 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,512
Blog Entries: 27

Rep: Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174
Glad it worked for you :-)

The Thread Tools menu can be used to mark threads as SOLVED.
 
Old 11-04-2012, 12:16 PM   #5
ZeroDaHero
LQ Newbie
 
Registered: Jun 2007
Distribution: Slackware 13.1, Slackware64 13.1
Posts: 26

Original Poster
Rep: Reputation: Disabled
I keep coming back to this everytime I setup a new machine. There are some fancier ways of doing this out there, but since I use nano for just about all of my editing purposes, I tend to have several tabs of nano open, so this is particularly useful for that.

An update for the times:

makes sure that the line is:

Code:
echo -ne ...
so the full function is

Code:
function nano_title {
echo -ne "\033]0;$*\007"
/usr/bin/nano "$@"
}
alias nano="nano_title"
I hope this helps everyone else!
Also, check out this thread, too for a beefier way of doing this:

http://unix.stackexchange.com/questi...terminal-title
 
  


Reply

Tags
bashrc, terminal, title, xterm


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Get the title of xterm/gnome-terminal redleafong Linux - Software 6 01-10-2011 06:38 PM
howto change gnome-terminal title bar imraven Linux - Desktop 2 10-04-2008 03:25 AM
How to change terminal title obnascar Linux - General 1 01-12-2006 02:41 PM
Change title of xterm - Fedora 2.6 sohnir Linux - General 3 12-13-2005 11:40 AM
change window title in terminal sandman Linux - General 4 12-15-2002 03:55 AM


All times are GMT -5. The time now is 01:55 AM.

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