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.
Posting my own solution to this old question, because
org.kde.konsole
echo
require a permanent change to konsole settingsAfter reading the Scripting Konsole chapter in the konsole documentation I wrote these bash functions which can be added to $HOME/.bashrc
:
set-konsole-tab-title-type ()
{
local _title=$1
local _type=${2:-0}
[[ -z "${_title}" ]] && return 1
[[ -z "${KONSOLE_DBUS_SERVICE}" ]] && return 1
[[ -z "${KONSOLE_DBUS_SESSION}" ]] && return 1
qdbus >/dev/null "${KONSOLE_DBUS_SERVICE}" "${KONSOLE_DBUS_SESSION}" setTabTitleFormat "${_type}" "${_title}"
}
set-konsole-tab-title ()
{
set-konsole-tab-title-type $1 && set-konsole-tab-title-type $1 1
}
Example 1: set both local & remote tab formats
$ set-konsole-tab-title test
Example 2: leave remote tab format unchanged
$ set-konsole-tab-title-type test
Example 3: leave local tab format unchanged
$ set-konsole-tab-title-type test 1
You can also use this function to set the tab title dynamically to %w
for the echo
solutions.