How to set/change the title bar of a Terminal console in Linux?
| DiptenduDas | |||
| Hi, How Can I change the title bar of the Terminal console in Linux? In windows this can be done by the help of title command. Is there anything equivalent to that? Thanking U in Advance, Diptendu | |||
| jsmith | |||
| Put this line in an executable shell script file: echo -ne "\033]0;${1}\007" (Mine is called setxtitle) Then setxtitle "Hello World" sets the title of the console/terminal/xterm I ran it from to "Hello World". | |||
| DiptenduDas | |||
| Smith Thnx for your suggestion. But how can I use the same from c++, using system() call? I need the same in Linux OS. For WINDOWS I am done but 4 LINUX .... :-(
Thanking U in Advance... Diptendu | |||
| jsmith | |||
| |||
| DiptenduDas | |||
| Hi Smith, Sorry But the above snippet of code didn't worked for me.. :-( I have done the below in code.
I am using Red Hat Linux 2.4.20-8smp. Please let me know If I am doing something wrong. | |||
| jsmith | |||
| Sorry 'bout that. konsole seems a bit different. By default, my konsole's title bar displays "/home/jsmith - Shell - Konsole". Using my setxtitle trick, I can change it to "Foobar - Shell - Konsole". And by going to View ... Rename session I can change it to "Foobar - TurtleShell - Konsole". (I'm running FC2 / 2.6.5). So it seems that it only partially works. It's probably doable using some X function, but I don't know anything about X programming. (Admittedly, I don't even know why the above trick works; I just saw some script do it years ago and copied the line of code). | |||
| Zaita | |||
wouldn't it be the equal of
exec("echo -ne \"\033]0;${1}\007\" ");But with the proper 0x0X put in. That should call that command through the console and change the title. cout << "" would only display it on screen. I don't have time atm to write the full code out sorry. But you should get the idea. | |||
| Duoas | |||
| http://www.faqs.org/docs/Linux-mini/Xterm-Title.html | |||
Registered users can reply in this forum.
