Last active
January 1, 2024 23:00
-
-
Save mid-kid/c4eae19b20d251d2b55008e42998180f to your computer and use it in GitHub Desktop.
Check for the presence of an Xembed tray on linux X11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <X11/Xlib.h> | |
// Simple program to check for the presence of an Xembed tray | |
// Exits with status 0 if the tray exists | |
int main() | |
{ | |
Display *d = XOpenDisplay(NULL); | |
if (!d) { fprintf(stderr, "XOpenDisplay failed\n"); return EXIT_FAILURE; } | |
Atom a = XInternAtom(d, "_NET_SYSTEM_TRAY_S0", False); | |
if (a == None) { fprintf(stderr, "XInternAtom failed\n"); return EXIT_FAILURE; } | |
Window w = XGetSelectionOwner(d, a); | |
if (w == None) { fprintf(stderr, "XGetSelectionOwner failed\n"); return EXIT_FAILURE; } | |
return EXIT_SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment