Set name of Konsole window
Solution 1
you can add a bash function at the end of your ~/.bashrc
title() {
echo $'\033]30;'$*$'\007'
}
(after saving .bashrc remember to type in the console: . ~/.bashrc
to add the function to your shell, or else you can open a new terminal)
You can use the new function like this:
title this is my console
Solution 2
It seems, at least in recent versions of Konsole, the title cannot be changed. You can change the tab, though, for example by the following ANSI sequence:
echo $'\033]30;NewName\007'
Update:
For inspiration, I tried another approach. I created a file ~/konsole-name.sh
:
function kname {
name=$(grep $WINDOWID .knamerc)
name=${name#*$'\t'}
if [[ $name ]] ; then
qdbus org.kde.konsole $KONSOLE_DBUS_SESSION \
org.kde.konsole.Session.setTitle 1 $name > /dev/null
fi
}
function kname-set {
sed -i "/^$WINDOWID\t/d" .knamerc
echo $WINDOWID$'\t'"$1" >> .knamerc
kname
}
And I added the following to my .bashrc:
. ~/konsole-name.sh && kname
Then, when a new konsole is started, I can just type kname-set THE-ONE-TRUE-KONSOLE
in the first window. All newly created tabs will be named the same. You can give any konsole its "name" by calling the function in its first tab.
You might need to clobber the file .knamerc
on logout.
The rest is left as an exercise to the reader :-)
Related videos on Youtube
dotancohen
Updated on September 18, 2022Comments
-
dotancohen over 1 year
How can one set the name of a Konsole window in KDE? I know that we can change the names of the tabs, and the Konsole window title is preconfigured to use the name of the current tab, but this is not what I would like to do.
I have one Konsole window with three tabs that I always keep open (
vimwiki
,cmus
, and a custom Python script) which I would like to be easy to find among my sea of other Konsole windows, each with its own set of tags.As a workaround name all tabs to the name that I would like for the window, but that has many drawbacks. A simple way to rename the entire window would be best. I could also use a different terminal emulator for this 'special' window, but I really like Konsole.
-
choroba over 10 years
-
dotancohen over 10 years@choroba: Thank you, but that only sets the name of the first tab in a newly-opened Konsole window. It has no functionality advantage over setting the tab name in all the extant window tabs, which as I mentioned has drawbacks.
-
choroba over 10 yearsIs stackoverflow.com/q/19897787/1030675 any better?
-
-
terdon over 10 yearsRelevant: bugs.kde.org/show_bug.cgi?id=179142
-
dotancohen over 10 yearsThank you choroba, but as I mention in the OP, setting all the tabs' titles is not practical and has too many drawbacks.
-
choroba over 10 years@dotancohen: Check the update.
-
Uyghur Lives Matter over 8 yearsGnome terminal has since removed this functionality unfortunately.
-
dotancohen over 3 yearsThank you Lucio!
-
Cymatical over 2 yearsIs this valid in 2021 for KDE Plasma 5+?
-
Cymatical over 2 yearsIs this valid in 2021 for KDE Plasma 5+?
-
Cymatical over 2 yearsIs this valid in 2021 for KDE Plasma 5+?
-
choroba over 2 years@Cymatical: I have no idea. I moved to LXDE.
-
Simon1901 over 2 yearsNot sure, dont remember what the command does. 7+years ago