dwmblocks/xgetrootname.c
Ashish Kumar Yadav b0747006c6 Did some cleanup
2020-07-07 01:58:41 +05:30

22 lines
502 B
C

#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;
}
if (XFetchName(dpy, DefaultRootWindow(dpy), &name) && name[0])
printf("%s\n", name);
else
puts("No name has been set for the root window.");
XFree(name);
XCloseDisplay(dpy);
return 0;
}