How to set a windows's title in Linux
Solution 1
One way of doing it is to use xdotool, e.g., from the commandline:
xdotool search --name "Old name" set_window --name "New name"
This searches open windows that contain the name "Old name" and changes its name to "New name". You also search by Window class, PID and a variety of other things. See the xdotool man page.
There are probably other ways of setting the same automatically when the program starts depending on the program, and whether it uses Qt, or GTK, or what.
Solution 2
If the window in question is an xterm, you can use a magic escape sequence:
echo "^[]0;New name^G"
where ^[
is the escape character and ^G
is control-G.
If the window is the Gnome Terminal, you can use the menu item "Terminal|Set Title".
Another way to write it is
echo "\033]0;New name\007"
Related videos on Youtube
user_unknown
Updated on September 17, 2022Comments
-
user_unknown almost 2 years
Is there a way to set a custom windows title in Linux?
-
phil294 about 6 yearsheres how to do it with xprop. askubuntu.com/a/626524/378854
-
-
Ivan Xiao about 11 yearsVery interesting!
-
tripleee over 5 yearsThe octal escape codes work in Bash but might not be portable to other shells or
echo
implementations. -
Adrian Lopez almost 4 yearsThe problem comes if you have two windows with the same name. Terminals for example are usually named like "user:host"
-
Flint over 3 yearsuse
xprop
then andxdotool search --any --pid $pid --name $name
-
nikc over 2 yearsThe
-e
is needed for someecho -e "\033]0;New name\007"