---
name: "XSetWMProperties"
section: "3x"
platform: "linux"
package: "libx11-dev"
version: "4.3.0.dfsg.1-14sarge7"
release: "Debian 3.1 (Sarge)"
platforms: ["linux"]
url: "https://new.carta.tech/XSetWMProperties/3x"
---

# XSetWMProperties(3x)

set standard window properties

## NAME

XSetWMProperties, XmbSetWMProperties, Xutf8SetWMProperties - set standard window properties

## SYNTAX

void XSetWMProperties(Display \**display*, Window *w*, XTextProperty \**window\_name*, XTextProperty \**icon\_name*, char \*\**argv*, int *argc*, XSizeHints \**normal\_hints*, XWMHints \**wm\_hints*, XClassHint \**class\_hints*);

void XmbSetWMProperties(Display \**display*, Window *w*, char \**window\_name*, char \**icon\_name*, char \**argv*\[\], int *argc*, XSizeHints \**normal\_hints*, XWMHints \**wm\_hints*, XClassHint \**class\_hints*);

void Xutf8SetWMProperties(Display \**display*, Window *w*, char \**window\_name*, char \**icon\_name*, char \**argv*\[\], int *argc*, XSizeHints \**normal\_hints*, XWMHints \**wm\_hints*, XClassHint \**class\_hints*);

## ARGUMENTS

- *argc*

  Specifies the number of arguments.

- *argv*

  Specifies the application's argument list.

- *class\_hints*

  Specifies the *XClassHint* structure to be used.

- *display*

  Specifies the connection to the X server.

- *icon\_name*

  Specifies the icon name, which should be a null-terminated string.

- *normal\_hints*

  Specifies the size hints for the window in its normal state.

- *w*

  Specifies the window.

- *window\_name*

  Specifies the window name, which should be a null-terminated string.

- *wm\_hints*

  Specifies the *XWMHints* structure to be used.

## DESCRIPTION

The  *XSetWMProperties* convenience function provides a single programming interface  for setting those essential window properties that are used  for communicating with other clients (particularly window and session managers).

If the window\_name argument is non-NULL,  *XSetWMProperties* calls *XSetWMName*, which in turn, sets the WM\_NAME property (see section 14.1.4). If the icon\_name argument is non-NULL, *XSetWMProperties* calls *XSetWMIconName*, which sets the WM\_ICON\_NAME property (see section 14.1.5). If the argv argument is non-NULL,  *XSetWMProperties* calls *XSetCommand*, which sets the WM\_COMMAND property (see section 14.2.1). Note that an argc of zero is allowed to indicate a zero-length command. Note also that the hostname of this machine is stored using *XSetWMClientMachine* (see section 14.2.2).

If the normal\_hints argument is non-NULL,  *XSetWMProperties* calls *XSetWMNormalHints*, which sets the WM\_NORMAL\_HINTS property (see section 14.1.7). If the wm\_hints argument is non-NULL,  *XSetWMProperties* calls *XSetWMHints*, which sets the WM\_HINTS property (see section 14.1.6).

If the class\_hints argument is non-NULL,  *XSetWMProperties* calls *XSetClassHint*, which sets the WM\_CLASS property (see section 14.1.8). If the res\_name member in the *XClassHint* structure is set to the NULL pointer and the RESOURCE\_NAME environment  variable is set,  then the value of the environment variable is substituted for res\_name. If the res\_name member is NULL,  the environment variable is not set,  and argv and argv\[0\] are set,  then the value of argv\[0\], stripped of any directory prefixes, is substituted for res\_name.

The *XmbSetWMProperties* and *Xutf8SetWMProperties* convenience functions provide a simple programming interface  for setting those essential window properties that are used  for communicating with other clients (particularly window and session managers).

If the window\_name argument is non-NULL, they set the WM\_NAME property. If the icon\_name argument is non-NULL, they set the WM\_ICON\_NAME property. The window\_name and icon\_name arguments are null-terminated strings, for *XmbSetWMProperties* in the encoding of the current locale, for *Xutf8SetWMProperties* in UTF-8 encoding. If the arguments can be fully converted to the STRING encoding, the properties are created with type \`\`STRING'';  otherwise, the arguments are converted to Compound Text,  and the properties are created with type \`\`COMPOUND\_TEXT''.

If the normal\_hints argument is non-NULL, *XmbSetWMProperties* and *Xutf8SetWMProperties* call *XSetWMNormalHints*, which sets the WM\_NORMAL\_HINTS property (see section 14.1.7). If the wm\_hints argument is non-NULL,  *XmbSetWMProperties* and *Xutf8SetWMProperties* call *XSetWMHints*, which sets the WM\_HINTS property (see section 14.1.6).

If the argv argument is non-NULL, *XmbSetWMProperties* and *Xutf8SetWMProperties* set the WM\_COMMAND property from argv and argc. An argc of zero indicates a zero-length command.

The hostname of the machine is stored using  *XSetWMClientMachine* (see section 14.2.2).

If the class\_hints argument is non-NULL, *XmbSetWMProperties* and *Xutf8SetWMProperties* set the WM\_CLASS property. If the res\_name member in the  *XClassHint* structure is set to the NULL pointer and the RESOURCE\_NAME environment variable is set, the value of the environment variable is substituted for res\_name. If the res\_name member is NULL, the environment variable is not set, and argv and argv\[0\] are set, then the value of argv\[0\], stripped of any directory prefixes, is substituted for res\_name.

It is assumed that the supplied class\_hints.res\_name and argv, the RESOURCE\_NAME environment variable, and the hostname of the machine are in the encoding of the current locale. The corresponding WM\_CLASS, WM\_COMMAND, and WM\_CLIENT\_MACHINE properties are typed according to the local host locale announcer. No encoding conversion is performed for these strings prior to storage in the properties.

For clients that need to process the property text in a locale, *XmbSetWMProperties* and *Xutf8SetWMProperties* set the WM\_LOCALE\_NAME property to be the name of the current locale. The name is assumed to be in the Host Portable Character Encoding and is converted to STRING for storage in the property.

*XSetWMProperties*, *XmbSetWMProperties* and *Xutf8SetWMProperties* can generate *BadAlloc* and *BadWindow* errors.

The function *Xutf8SetWMProperties* is an XFree86 extension introduced in XFree86 4.0.2. Its presence is indicated by the macro *X\_HAVE\_UTF8\_STRING*.

## PROPERTIES

- WM\_CLASS

  Set by application programs to allow window and session managers to obtain the application's resources from the resource database.

- WM\_CLIENT\_MACHINE

  The string name of the machine on which the client application is running.

- WM\_COMMAND

  The command and arguments, null-separated, used to invoke the application.

- WM\_HINTS

  Additional hints set by the client for use by the window manager. The C type of this property is  *XWMHints*.

- WM\_ICON\_NAME

  The name to be used in an icon.

- WM\_NAME

  The name of the application.

- WM\_NORMAL\_HINTS

  Size hints for a window in its normal state. The C type of this property is *XSizeHints*.

## DIAGNOSTICS

- *BadAlloc*

  The server failed to allocate the requested resource or server memory.

- *BadWindow*

  A value for a Window argument does not name a defined Window.

## SEE ALSO

XAllocClassHint(3X11), XAllocIconSize(3X11), XAllocSizeHints(3X11), XAllocWMHints(3X11), XParseGeometry(3X11), XSetCommand(3X11), XSetTransientForHint(3X11), XSetTextProperty(3X11), XSetWMClientMachine(3X11), XSetWMColormapWindows(3X11), XSetWMIconName(3X11), XSetWMName(3X11), XSetWMProtocols(3X11), XStringListToTextProperty(3X11), XTextListToTextProperty(3X11)\
 *Xlib - C Language X Interface*
