How can I output the output of a command to the console title bar?

Thanks to the clever use of some escape characters, I used the output of arbitrary commands (like "dirs") in my xterm header line. Can I do the same in the console? If so, how?

+6
linux kde konsole
source share
2 answers

It's a little tricky to do what you want, but you can change the Konsole title bar. Switch to:

Settings > Edit current profile > Tabs > Tab title format

and change it to %w , which means the window title set by the shell. I think you need to close Konsole and reopen it for the changes to take effect.

In any case, go to the prompt and execute the exec command:

 OUTPUT=`whoami`; echo -ne "\033]2;$OUTPUT\007" 

and so!

In this example, the window title is temporarily set to whatever is displayed by whoami.

+6
source share

You can also do this with dbus:

 qdbus $KONSOLE_DBUS_SERVICE $KONSOLE_DBUS_SESSION setTitle 1 $(dirs) 

for KDE 3 using dcop:

 dcop $KONSOLE_DCOP_SESSION renameSession $(dirs) 
+4
source share

All Articles