XSetClassHint()XSetClassHint()NameXSetClassHint – set the XA_WM_CLASS property of a window.
Synopsis
XSetClassHint(display, w, class_hints)
Display *display;
Window w;
XClassHint *class_hints;
Arguments
display Specifies a connection to an X server; returned from
XOpenDisplay().
w Specifies the ID of the window for which the class hint is to
be set.
class_hints
Specifies the XClassHint structure that is to be used.
DescriptionXSetClassHint() sets the XA_WM_CLASS property for the specified window.
The window manager may (or may not) read this property, and use it to
get resource defaults that apply to the window manager's handling of
this application. If the strings in class_hints are not in the Host
Portable Character Encoding, the result is implementation-dependent.
The XClassHint structure set contains res_class and res_name fields.
The res_name field contains the application name, and the res_class
field contains the application class. Note that the name set in this
property may differ from the name set as WM_NAME. That is, WM_NAME
specifies what should be displayed in the title bar and, therefore, can
contain temporal information (for example, the name of a file currently
in an editor's buffer). On the other hand, the name specified as part
of WM_CLASS is the formal name of the application that should be used
when retrieving the application's resources from the resource database.
There are several more powerful functions that set XA_WM_CLASS. They
include XSetWMProperties(), and (in R5) XmbSetWMProperties(). These
functions read the RESOURCE_NAME environment variable if res_name is
NULL, and they use argv[0] stripped of any directory prefixes if
RESOURCE_NAME is not set. XSetClassHint() only uses the explicit value
of res_name.
For more information, see Volume One, Chapter 12, Interclient Communi‐
cation.
Errors
BadAlloc
BadWindow
Structures
typedef struct {
char *res_name;
char *res_class;
} XClassHint;
See AlsoXAllocClassHint(), XFetchName(), XGetClassHint(), XGetIconName(),
XGetIconSizes(), XGetNormalHints(), XGetSizeHints(), XGetTransient‐
ForHint(), XGetWMHints(), XGetZoomHints(), XSetCommand(), XSetIcon‐
Name(), XSetIconSizes(), XSetNormalHints(), XSetSizeHints(), XSetTran‐
sientForHint(), XSetWMHints(), XSetZoomHints(), XStoreName(), XSetWM‐
Properties().
Xlib - Window Manager Hints XSetClassHint()