Skip to content

Instantly share code, notes, and snippets.

@tur11ng
Created May 29, 2023 16:34
Show Gist options
  • Save tur11ng/2f946b30f0c2e96c57619af5d03ccbaf to your computer and use it in GitHub Desktop.
Save tur11ng/2f946b30f0c2e96c57619af5d03ccbaf to your computer and use it in GitHub Desktop.
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <stdio.h>
#include <stdlib.h>
int main() {
Display *d = NULL;
d = XOpenDisplay(NULL);
Window w;
XEvent e;
Atom atom;
int screen;
if (d == NULL) {
printf("Error opening display\n");
exit(1);
}
screen = DefaultScreen(d);
static char net_wm_cm[] = "_NET_WM_CM_Sxx";
snprintf (net_wm_cm, sizeof (net_wm_cm), "_NET_WM_CM_S%d", screen);
atom = XInternAtom (d, net_wm_cm, False);
w = XGetSelectionOwner(d, atom);
if (w == None) {
printf("Compositor isn't registered.");
} else {
printf("Compositor is registered.");
}
XCloseDisplay(d);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment