How to set a windows's title in Linux

2

0

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

user_unknown

Posted 2011-01-01T15:27:38.827

Reputation: 325

heres how to do it with xprop. https://askubuntu.com/a/626524/378854

– phil294 – 2018-05-31T18:20:19.447

It might help to know if there's a particular program or set of programs that interest you. – frabjous – 2011-01-01T16:04:27.340

Answers

4

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.

frabjous

Posted 2011-01-01T15:27:38.827

Reputation: 9 044

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"

Shannon Nelson

Posted 2011-01-01T15:27:38.827

Reputation: 1 287

The octal escape codes work in Bash but might not be portable to other shells or echo implementations. – tripleee – 2019-03-22T10:42:25.833

Very interesting! – Ivan Z. G. Xiao – 2013-06-04T17:29:54.220