How can one put the output of a command into a konsole title bar?
Asked Answered
I

2

6

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?

Inaptitude answered 21/3, 2011 at 2:30 Comment(0)
H
6

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.

Hix answered 21/3, 2011 at 3:40 Comment(0)
L
4

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)
Ladle answered 22/3, 2011 at 18:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.