Change konsole tab title from command line and make it persistent?

Shuman picture Shuman · Nov 11, 2013 · Viewed 20.5k times · Source

How can I change the konsole tab title? By default, it's set to %u : %n, so it always changes automatically.

I can set it with:

qdbus org.kde.konsole $KONSOLE_DBUS_SESSION setTitle 1 "My Title"

But as soon as you run something in the console, it changes back to %u : %n. Of course. I can set it to %w to tell it to set the title to "Window Title set by shell", but later (if I don't explicitly set it), it will be empty. (Every new tab will be empty, unless I set it.)

The question is how to make it persistent (or how to switch profile via command line)? I can make another profile in which the title format is set to %w, and before I set my custom title, switch to that profile.

enter image description here

enter image description here

edit: I think I have found the answer

qdbus org.kde.konsole $KONSOLE_DBUS_SESSION setTabTitleFormat 0 "" qdbus org.kde.konsole $KONSOLE_DBUS_SESSION setTitle 0 "My Title"

Answer

Tim picture Tim · Aug 7, 2014

You may need to use this variant:

echo -ne "\033]30;test change title\007"

$ konsole -v
Qt: 4.8.6
KDE Development Platform: 4.13.3
Konsole: 2.13.2