XSetCommand(3)
β¨ NAME β¨
XSetCommand, XGetCommand β set or read a window's WM_COMMAND property. This is the XSetCommand(3) page from the XLIB FUNCTIONS manual, and yes bestie, we are getting into window command metadata today π
π οΈ SYNTAX π οΈ
Exact signatures, no cap:
int XSetCommand(Display *display, Window w, char **argv, int argc);
Status XGetCommand(Display *display, Window w, char ***argv_return, int *argc_return);
π«Ά ARGUMENTS π«Ά
argcβ the number of arguments. Just the count, bestie π’argc_returnβ returns the number of arguments returned. This is where that returned count comes back to you.argvβ the application's argument list. This is the list you're handing over.argv_returnβ returns the application's argument list. This is where the returned list comes back to you.displayβ the connection to the X server. Your little server link π‘wβ the window. Which window? This one πͺ
π DESCRIPTION π
Okay so XSetCommand sets the command and arguments used to invoke the application. (Typically, argv is the argv array of your main program β iykyk.) If the strings are not in the Host Portable Character Encoding, the result is implementation-dependent, so that's the vibe check you have to pass. XSetCommand can generate BadAlloc and BadWindow errors.
XGetCommand reads the WM_COMMAND property from the specified window and returns a string list. If the WM_COMMAND property exists, it is of type STRING and format 8 β noted π If sufficient memory can be allocated to contain the string list, XGetCommand fills in the argv_return and argc_return arguments and returns a nonzero status. Otherwise, or if any other error is encountered, it returns a zero status. If the data returned by the server is in the Latin Portable Character Encoding, then the returned strings are in the Host Portable Character Encoding. Otherwise, the result is implementation-dependent. To free the memory allocated to the string list, use XFreeStringList β free it, bestie, don't leak it π«Ά
π·οΈ PROPERTIES π·οΈ
WM_COMMANDβ the command and arguments, null-separated, used to invoke the application. Null-separated lineup, very demure π
π¨ DIAGNOSTICS π¨
BadAllocβ the server failed to allocate the requested resource or server memory. Rude, but it happens πBadWindowβ a value for aWindowargument does not name a definedWindow. Basically that window is not a real one, bestie π
π SEE ALSO π
Go be nosy, bestie β these are the related pages:
XAllocClassHint(3)XAllocIconSize(3)XAllocSizeHints(3)XAllocWMHints(3)XSetTransientForHint(3)XSetTextProperty(3)XSetWMClientMachine(3)XSetWMColormapWindows(3)XSetWMIconName(3)XSetWMName(3)XSetWMProperties(3)XSetWMProtocols(3)XStringListToTextProperty(3)Xlib - C Language X Interface
Final footer energy: X Version 11, libX11 1.8.14, and the XSetCommand(3) page β that's the source/version tea, and the date isn't even in the footer, so we're not inventing one π
mwah, bye bestie ππ
π¦ where this page comes from
- alpine 3.24: libx11-doc 1.8.14-r0 Β· X11
- arch rolling: libx11 1.8.14-1 Β· MIT AND X11
- nixos 26.05: libx11 1.8.14
- nixpkgs unstable: libx11 1.8.14
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms