How can one put the output of a command into a konsole title bar?
Through the clever use of some escape characters, I used to put the output of arbitrary commands (e.g. "dirs") into my xterm title bar. Can I do the same thing in konsole? If so, how开发者_运维技巧?
It's a little tricky to do what you want, but you can change Konsole's title bar. Go to:
Settings > Edit current profile > Tabs > Tab title format
and change it to %w
which means Window Title Set by Shell. I think you need to close Konsole and reopen it for the changes to take effect.
Anyway, go to the prompt and exec:
OUTPUT=`whoami`; echo -ne "\033]2;$OUTPUT\007"
and behold!
This example sets the title of the window temporarily to whatever is outputted by whoami.
You can also do it using dbus:
qdbus $KONSOLE_DBUS_SERVICE $KONSOLE_DBUS_SESSION setTitle 1 $(dirs)
for KDE 3, using dcop:
dcop $KONSOLE_DCOP_SESSION renameSession $(dirs)
精彩评论