Is KDE too much for you? GNOME tries to do too much? Xfce still a bit too fancy? Do you need something smaller? Even more minimalist? What about a mere 20 lines of code which provide the absolute barest possible minimum of window management functionality?
You need mwm.
This is the smallest, actually usable window manager I know about. Even TinyWM is twice as large. However, it doesn’t let you launch programs, or assign key bindings.
↫ Mwm’s GitHub pagemwm
does.
It will open a window, and let you switch between windows, that are always fullscreen. No titlebars, no virtual desktops, no menus, no nothing. This is the true minimalist’s experience.
I love the concept. This would be ideal for kiosk setups or to squeeze the max performance out of retro hardware.
Came here to say this. I’ve been considering dwm or i3wm for a small handheld Linux computer thingy I’ve been working on, but I think this will be even better since the device is intended for “one application at a time” distraction-free use. And hell, 20 lines of code? Even a troglodyte like me might be able to figure out how to modify it to suit my needs. I did that with dwm years ago and learned a little bit about C programming as a result.
The Motif Window Manager is not 20 lines of code.
(acronyms, let’s just reuse that one ok?)
Kind of amazing that MWM got 36 years before there was a name collision. Especially since 2 of the 3 letters were pretty much baked in to the naming convention back in the day.
Compiling with tcc and use of the WTFPL really tell you where the author is coming from.
The “20 lines” is achieved by clever use of #define and a little semi-colon abuse. The ability to “launch applications” is just system(). If you unroll the #define statements, you get a pretty clean look at what a minimal X11 event loop looks like. Quite interesting. It almost makes you want to create an X11 window manager. The code is short enough that I kind of think it should have been posted in Thom’s article.
`#include
#include
#define stk(s) XKeysymToKeycode(d, XStringToKeysym(s))
#define on(_, x) if (e.type == _) { x; }
#define map(k, x) if (e.xkey.keycode == stk(k)) { x; }
#define grab(…) const char *l[] = { __VA_ARGS__, 0 }; \
for (int i = 0; l[i]; i++) XGrabKey(d, stk(l[i]), Mod4Mask, r, 1, 1, 1);
int main() {
Display *d = XOpenDisplay(0); Window r = DefaultRootWindow(d); XEvent e;
XSelectInput(d, r, SubstructureRedirectMask);
grab(“n”, “q”, “e”);
while (!XNextEvent (d, &e)) {
on(ConfigureRequest, XMoveResizeWindow(d, e.xconfigure.window, 0, 0, e.xconfigure.width, e.xconfigure.height));
on(MapRequest, XMapWindow(d, e.xmaprequest.window);
XSetInputFocus(d, e.xmaprequest.window, 2, 0));
on(KeyPress, map(“n”, XCirculateSubwindowsUp(d, r); XSetInputFocus(d, e.xkey.window, 2, 0))
map(“q”, XKillClient(d, e.xkey.subwindow))
map(“e”, system(“dmenu_run &”)));
}
}`