dwmblocks/xgetrootname.c

22 lines
502 B
C
Raw Normal View History

2020-07-03 21:04:11 +00:00
#include <stdio.h>
#include <X11/Xlib.h>
int
main()
{
Display *dpy;
char *name;
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
puts("No name has been set for the root window.");
XFree(name);
XCloseDisplay(dpy);
return 0;
}