How to set a windows's title in Linux

13,256

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"
Share:
13,256

Related videos on Youtube

user_unknown
Author by

user_unknown

Updated on September 17, 2022

Comments

  • user_unknown
    user_unknown almost 2 years

    Is there a way to set a custom windows title in Linux?

  • Ivan Xiao
    Ivan Xiao about 11 years
    Very interesting!
  • tripleee
    tripleee over 5 years
    The octal escape codes work in Bash but might not be portable to other shells or echo implementations.
  • Adrian Lopez
    Adrian Lopez almost 4 years
    The problem comes if you have two windows with the same name. Terminals for example are usually named like "user:host"
  • Flint
    Flint over 3 years
    use xprop then and xdotool search --any --pid $pid --name $name
  • nikc
    nikc over 2 years
    The -e is needed for some echo -e "\033]0;New name\007"