Is there a library and header to use to access EWMH/NetWM functions?

764 Views Asked by At

I need to get similar information on the current windows and virtual desktops as that provided by the command-line app wmctrl. I s there some (C/C++) API header & lib-files that I can use?

2

There are 2 best solutions below

4
On BEST ANSWER

Download the source code of wmctrl and study it. If you are making some free software with the same or compatible GPLv2 license you could take some code from it.

There is only one source file main.c and it seems to do ordinary Xlib calls, notably XGetWindowProperty calls wrapped in get_property

I'm very surprised you asked the question here. With free software, it is so much simpler and quicker to download the source code and study it.

1
On

If it must be in C/C++, i think libxcb-wm is the most prominent one: very mature, still actively developed, and from Freedesktop, the same organization that created the EWMH spec.

On Debian/Ubuntu you have the binary packages libxcb-ewmh2 (run-time library) and libxcb-ewmh-dev (development headers), both from source package xcb-util-wm:

sudo apt install libxcb-ewmh-dev  # also pulls libxcb-ewmh2, as usual

And official Documentation and Tutorial from Xorg