The Xterm Title HOW-TO is simplified. From XTerm Control Sequences
OSC Ps ; Pt ST
OSC Ps ; Pt BEL
Ps = 0 -> Change Icon Name and Window Title to Pt.
Ps = 1 -> Change Icon Name to Pt.
Ps = 2 -> Change Window Title to Pt.
(OSC
could be escape], or 0x9d).
Some applications (such as screen
) know about the three possibilities (0=both, 1=icon, 2=title), though it took a while to get to that point (see fix).
According to the XStoreName manual page
The XStoreName()
function assigns the name passed to window_name to the specified window. A window manager can display the window name in some prominent place, such as the title bar, to allow users to identify windows easily. Some window managers may display a window's name in the window's icon, although they are encouraged to use the window's icon name if one is provided by the application. If the string is not in the Host Portable Character Encoding, the result is implementation dependent.
The call sets a window manager property. Many window manager properties are optional, allowing for different implementations. The ICCM documents WM_ICON_NAME as
The WM_ICON_NAME
property is an uninterpreted string that the client wants to be displayed in association with the window when it is iconified (for example, in an icon label). In other respects, including the type, it is similar to WM_NAME
. For obvious geometric reasons, fewer characters will normally be visible in WM_ICON_NAME
than WM_NAME
.
Clients should not attempt to display this string in their icon pixmaps or windows; rather, they should rely on the window manager to do so.
The encoding mentioned for XStoreName
is a clue. It is not UTF-8. After several years (around the early 2000s), of introducing Unicode strings into applications designed for ISO-8859-1 (Latin-1), e.g., this gem, some window manager developers came up with Extended Window Manager Hints to rectify the situation and provide for extensions. It uses different window properties, e.g., _NET_WM_ICON_NAME
The Client SHOULD set this to the title of the icon for this window in UTF-8 encoding. If set, the Window Manager should use this in preference to WM_ICON_NAME
.
Again, this is optional. Desktop developers may have different ideas about how to show icons, and graphic images seem to have gotten more attention, usually at the expense of accessibility. However, it is still part of the standard, used by a few window managers such as fvwm, twm, ctwm. If someone were to make an accessible version of KDE or GNOME, they might use this property.
PS1
variable is causing things to revert back. You can test this by adding; sleep 10s
to the end of whichever command you're using to change a title/name. If you do that, you'll see the new title/name for 10 seconds, then it will revert back to the old. (I can't remember where I picked that up.) If that's the problem, try something like the solution at https://unix.stackexchange.com/a/566383/291375.