KWIN_RUNNING X11 Atom No Longer Valid?

Hi, I wrote a library which uses Zenity for GTK+ dialogs whenever KWin is not the current Window Manager. When KWin is the current Window Manager, it switches to use KDialog for KDE/Qt dialogs instead to attempt matching the rest of the current desktop. I used to achieve checking whether KWin was the current Window Manager by checking for the existence of the KWIN_RUNNING X11 Atom, and while this works in older versions of KDE, such as the version of KDE provided by Kubuntu 22.04 LTS, trying it with newer versions of KDE shipped with other distributions such as the latest version KDE neon, at the time of writing, it will no longer work and will still try to use Zenity as if the KWIN_RUNNING X11 Atom no longer exists. Note as long as xwayland is installed, it shouldn’t matter whether using a wayland or x11 session. The result is the same; it will work on Kubuntu 22.04 LTS and not work in KDE neon.

Here’s an example C code:

Atom aKWinRunning = XInternAtom(display, “KWIN_RUNNING”, True);
Bool bKWinRunning = (aKWinRunning != None);

… where as bKWinRunning is whether KWin is running / is the current WM.
What is the new way of doing this? is there a way to do it which will work universally in both older and newer versions of KDE?

I guess I could check if the basename of kwin_x11 or kwin_wayland belongs to a currently running process in the user session, but that can sometimes leave misleading results, all one has to do is rename a running executable to one of those basenames. I wanted it to work regardless of where the executable is running from, to support more OS’s (Linux, FreeBSD, and DragonFly BSD for example), so this is unreliable. Older Linux kernels contains the kwin executable in /usr/bin. Newer versions of the Linux kernel will make /usr/bin a symlink to /bin instead of the other way around, and FreeBSD / DragonFly BSD have the kwin executable under /usr/local/bin. Even if checking the absolute path it isn’t the best way in my opinion. The KWIN_RUNNING Atom was the most accurate and reliable solution, at least, until in randomly stopped working with a certain KDE version update.

Any help is appreciated!

The atom was removed.

As for what to do instead, take a look at the XDG_CURRENT_DESKTOP environment variable, which is meant for such checks