2020-07-03 21:04:11 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
|
|
|
|
int
|
|
|
|
main()
|
|
|
|
{
|
|
|
|
char *name;
|
2020-12-04 21:54:41 +00:00
|
|
|
Display *dpy;
|
2020-07-03 21:04:11 +00:00
|
|
|
|
|
|
|
if (!(dpy = XOpenDisplay(NULL))) {
|
|
|
|
fputs("Error: could not open display.\n", stderr);
|
|
|
|
return 1;
|
|
|
|
}
|
2020-07-06 20:28:41 +00:00
|
|
|
if (XFetchName(dpy, DefaultRootWindow(dpy), &name) && name[0])
|
2020-07-03 21:04:11 +00:00
|
|
|
printf("%s\n", name);
|
|
|
|
else
|
2020-12-04 21:54:41 +00:00
|
|
|
fputs("No name has been set for the root window.\n", stderr);
|
2020-07-03 21:04:11 +00:00
|
|
|
XFree(name);
|
|
|
|
XCloseDisplay(dpy);
|
|
|
|
return 0;
|
|
|
|
}
|