This C function can be used to disable or enable windows decorations in many window managers. If 'mode' is 'd' the window will hide the decorations, otherwise if the 'mode' is 'D' the window will show them.
void window_tune_decorations(Display *disp, Window win, char mode) {
long hints[5] = { 2, 0, 0, 0, 0};
Atom motif_hints = XInternAtom(disp, "_MOTIF_WM_HINTS", False);
switch (mode) {
case 'D':
hints[2] = 1;
/* fall through */
case 'd':
XChangeProperty(disp, win, motif_hints, motif_hints, 32, PropModeReplace, (unsigned char *)hints, 5);
break;
default:
fputs("Invalid mode.\n", stderr);
}
}
I would like to implement a ``toggle mode''. So my question is, there a way to detect if a windows has the decorations? I tried using XGetWindowProperty with _MOTIF_WM_HINTS, but I am not sure how to interpret the output.