config.h:
#define ACTIONKEY_NEXT_WINDOW XK_Tab
#define ACTIONKEY_HIDE_ALL_WINDOWS XK_F11
keyboard.c:
case ACTIONKEY_NEXT_WINDOW:
stack_shuffle_next_window(display, screen);
break;
case ACTIONKEY_HIDE_ALL_WINDOWS:
stack_hide_all_windows(display, screen, state);
break;
desktop.c:
void stack_shuffle_next_window(Display *d, int screen) {
// circulate up through windows
XCirculateSubwindowsUp(d, RootWindow(d, screen));
XFlush(d);
}
void stack_hide_all_windows(Display *d, int s, State *s) {
Window target=RootWindow(d, s);
Window root, parent;
Window *child;
unsigned int i, count, bot_of_screen=DisplayHeight(d,s) ;
// get all windows currently owned by root window
if (XQueryTree(d, target, &root, &parent, &child, &count)) {
// loop through all windows
for (i=0; i
if (state->is_hidden) {
// move window to normal position
XMoveWindow(d, *child, 0, 0); // move window to 0x0
} else {
// move window out of screen bounds
XMoveWindow(d, *child, 0, bot_of_screen+1); // hide window
}
child++; // goto next window
}
state->is_hidden = !(state->is_hidden);
XFlush(d);
}
}
The code should be fairly easy to read; I am moving the windows off the screen when Mod+F11 is pressed for the first time, when it is pressed again they are moved back to 0x0 (all windows are always positioned at 0x0 and are streched the entire size of the screen).
Cycling through windows is as simple as calling one of the circulate-window functions in xlib!
Now we have something that is almost useable! Although I am seeing big problems with Thunar (the sub-windows seem to be being considered as their own standalone window).. so don’t try Thunar just yet!