Live data from Hacker News

Mwm – The smallest usable X11 window manager

github.com

21–30 of 96 posts

Re: Mwm – The smallest usable X11 window manager

#21
post #7
post #4

This is the entire source: #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; XSelect…

Beware! That's the DSL trap. It works here so well because it's limited to 20 lines and each macro does exactly what it needs to for the problem at hand. Take that DSL and use it over a year to write a bunch of code to do normal things as your app grows into its problem domain and spills over into a few more, and it melts. New developers will show up to onboard to your and be like "WTF is this 'on()' thing I'm lookin…

there really isn't a fundamental difference between DSLs and libraries for the points that you brought up. where it really starts to get sketchy is when you do really funny things with the base syntax (looking at you lisp and rust). if not well thought out they can be fragile, confusing, and a real burden for new contributors.

I guess here's a question - do you consider regex libraries to be DSLs?

Re: Mwm – The smallest usable X11 window manager

#23
While this leaves a lot to be desired as a window manager, it illustrates one of my main gripes about the Wayland ecosystem: By effectively bundling the window manager and X server, it makes it much harder for more niche/experimental window managers to come about and stay alive. Even with things like wlroots, you have to invest a lot more work to get even the basics working that X11 will give you for free.

Re: Mwm – The smallest usable X11 window manager

#24
post #8
post #5

Earlier quoted context omitted.

Is it really that much better than this: #include #include int GetKeyCode(Display* d, char* s) { return XKeysymToKeycode(d, XStringToKeysym(s)); } int main() { Display* d = XOpenDisplay(0); Window r = DefaultRootWindow(d); XSelectInput(d, r, SubstructureRedirectMask); XGrabKey(d, GetKeyCode(d, "n"), Mod4Mask, r, 1, 1, 1); XGrabKey(d, GetKeyCode(d, "q"), Mod4Mask, r, 1, 1, 1); XGrabKey(d, GetKeyCode(d, "e"), Mod4Mask,…

I think this is more readable than with macros, but it might be a preference.

[deleted]

Re: Mwm – The smallest usable X11 window manager

#25
> No title bars, no status bars, no buttons, no borders, no menus, etc.

> All windows are full-screen, just one is visible at any given time.

Oh, it's like cage ( https://github.com/cage-kiosk/cage ) for X11. I was wondering ex. how you'd even move windows around in that little code; the answer is "you don't":)

Re: Mwm – The smallest usable X11 window manager

#27
post #23

While this leaves a lot to be desired as a window manager, it illustrates one of my main gripes about the Wayland ecosystem: By effectively bundling the window manager and X server, it makes it much harder for more niche/experimental window managers to come about and stay alive. Even with things like wlroots, you have to invest a lot more work to get even the basics working that X11 will give you for free.

True; but a counterargument is that the _display protocol_ is not the right abstraction layer for decoupling window management from the display server. There is nothing stopping someone from writing a batteries-included wlroots-like library where the only piece you need to write is the window management and input handling, or even an entire Wayland compositor that farms these pieces out to an embedded scripting runtime.

But even then, I think we have rose-tinted glasses on when it comes to writing an X11 WM that actually works, because X11 does not actually give much for free. ICCCM is the glue that makes window management work, and it is a complete inversion of "mechanism, not policy" that defines the X11 protocol. It also comes in at 60-odd pages in PDF form: https://www.x.org/docs/ICCCM/icccm.pdf

For an example, X11 does not specify how copy-and-paste should work between applications; that's all ICCCM.

Re: Mwm – The smallest usable X11 window manager

#29
post #23

While this leaves a lot to be desired as a window manager, it illustrates one of my main gripes about the Wayland ecosystem: By effectively bundling the window manager and X server, it makes it much harder for more niche/experimental window managers to come about and stay alive. Even with things like wlroots, you have to invest a lot more work to get even the basics working that X11 will give you for free.

YAGN more experimental/niche window managers. Windows and macOS get by fine on one apiece, in fact their desktop story is better because their WM and toolkit is standardized.

The developers of Wayland (who are identical to the developers of Xorg) aspire to more of a Windows/Mac-like ecosystem for Linux, in which standardization, performance, and support for modern graphics hardware without hacks or workarounds are prioritized over proliferation of niche window managers and toolkits

Post reply on HN