4

I generally see the syntax for setting the terminal title as (something like):

echo -e '\e]0;Some Title\a'

But I noticed this answer used 2 instead of 0, which prompted me to do a little more digging. According to this document you can actually set both the "icon name" and the "window title" with this syntax:

·  ESC]0;stringBEL -- Set icon name and window title to string

·  ESC]1;stringBEL -- Set icon name to string

·  ESC]2;stringBEL -- Set window title to string

   where ESC is the escape character (\033), and BEL is the bell
   character (\007).

Printing one of these sequences within the xterm will cause the window
or icon title to be changed.

But it doesn't go on to explain what exactly it means by "icon title" or "icon name". When I try it out I don't see any difference between 0 and 2, and 1 doesn't appear to do anything.

So what is the "icon title", and what is supposed to happen when 0 or 1 is called?

2

This is X11 code perhaps ignored or unimplemented by modern Window Managers. Luckily, I don't run a modern Window Manger, so with FVWM on OpenBSD, I can set the icon name to blah, then minimize that xterm:

lo a screenshot

Which produces an icon with that name.

| improve this answer | |
1

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.