-   Slackware (
-   -   Terminal xterm Title is too dynamic (title doesn't change manually) (

ZeroDaHero 08-21-2010 01:53 PM

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.


My bashrc is a modified version (just slimmed down--mostly aliases removed) of this example one: Mine is commented out like crazy, so I don't think you really want to read it.

catkin 08-21-2010 02:09 PM

You could define a function in .bashrc that effectively does xtitle some_file.txt; nano some_file.txt for you. Something like (not tested)

function nano {
echo "\033]0;$*\007"
/usr/bin/nano "$@"

ZeroDaHero 08-22-2010 08:04 AM

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()"


alias nano="nano_title"

Poof! Everything I've ever wanted and more! Thank you so much!

catkin 08-23-2010 07:54 AM

Glad it worked for you :-)

The Thread Tools menu can be used to mark threads as SOLVED.

ZeroDaHero 11-04-2012 12:16 PM

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:


echo -ne ...
so the full function is


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:

All times are GMT -5. The time now is 04:52 PM.