Define custom properties for x11 windows in order to associate additional data with them

Viewed 158

I'm trying to work out how to define my own window properties in xcb/x11, in order to be able to associate additional data with a window.

I can set and retrieve the pre-defined properties, such as XCB_ATOM_WM_NAME, using xcb_change_property() and xcb_get_property(), just fine, but can't figure out how to define new properties of my own.

A number of tutorials allude to this being possible, and indeed integral to the design, but nowhere can I find any guidance on how to go about it.

1 Answers

I don't know about xcb but in X you can create an Atom (Property) with

XInternAtom

The XInternAtom function returns the atom identifier associated with the specified atom_name string. If only_if_exists is False, the atom is created if it does not exist.

and modify/retrieve it by

XChangeProperty
XGetWindowProperty

xcb should provide something similar.

Related