Live data from Hacker News

Mwm – The smallest usable X11 window manager

github.com

11–20 of 96 posts

Re: Mwm – The smallest usable X11 window manager

#13
post #3

> Most software today is crappy. Do you really need all the bells and whistles? Probably not. I agree that most software today is bloated , but I wouldn't say crappy. There are legitimate reasons to choose bloat, for example using SDL or Electron to speed up development and have easier portability. But for some reason I do strongly enjoy writing and using minimalist software. That's why I removed C++, SDL and other l…

The best apps I've used have implementations for every OS and UI separately. Usually, everyone uses the easier route, but it will only be good enough, not the best. But again, now your app works only on Windows.

Yeah those apps were my inspiration: use the native UI and share logic as a lib.

I don't even have a Mac yet, so no point in shipping for that if I can't debug it.

If sales are good, I'd be glad to buy a cheap macbook off ebay and port it.

Re: Mwm – The smallest usable X11 window manager

#14
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…

Yeah exactly, this is why I stopped liking DSLs about 15 years ago, shortly after using Ruby extensively (probably not a coincidence) and converting to Clojure, where there was a large movement away from macros despite it being lisp. They're good in very isolated situations, and only when designed very carefully. This wm is quite possibly one of them; if you need more complexity than the macros here allow, and adding/changing macros only makes it worse, just use another wm.

Re: Mwm – The smallest usable X11 window manager

#15
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.

It's also 50 bytes longer than the original. More LOC only because my Vim formats on save.

Whenever somebody comes up with some big brain idea with macros, ORMs, DSLs, 180 IQ templates, language extensions that even Haskell nerds would say are too much, there's a good chance that the grugbrained version is just as readable, just as concise without going against the language.

I'm this close to go completely nuts with this industry and commit to full butlerian jihad against anybody who goes higher in abstraction than ANSI C.

Re: Mwm – The smallest usable X11 window manager

#18
post #3

> Most software today is crappy. Do you really need all the bells and whistles? Probably not. I agree that most software today is bloated , but I wouldn't say crappy. There are legitimate reasons to choose bloat, for example using SDL or Electron to speed up development and have easier portability. But for some reason I do strongly enjoy writing and using minimalist software. That's why I removed C++, SDL and other l…

It's a shame no one has figured out how we can get the flexibility of html/css/js in a way that is fast.

Re: Mwm – The smallest usable X11 window manager

#19
post #18
post #3

> Most software today is crappy. Do you really need all the bells and whistles? Probably not. I agree that most software today is bloated , but I wouldn't say crappy. There are legitimate reasons to choose bloat, for example using SDL or Electron to speed up development and have easier portability. But for some reason I do strongly enjoy writing and using minimalist software. That's why I removed C++, SDL and other l…

It's a shame no one has figured out how we can get the flexibility of html/css/js in a way that is fast.

Python?

Re: Mwm – The smallest usable X11 window manager

#20
post #18
post #3

> Most software today is crappy. Do you really need all the bells and whistles? Probably not. I agree that most software today is bloated , but I wouldn't say crappy. There are legitimate reasons to choose bloat, for example using SDL or Electron to speed up development and have easier portability. But for some reason I do strongly enjoy writing and using minimalist software. That's why I removed C++, SDL and other l…

It's a shame no one has figured out how we can get the flexibility of html/css/js in a way that is fast.

if you can elaborate a bit on a) flexibility b) fast

like the fellow commenter said, python might qualify as flexible, fast to code, and 'fast enough'

Post reply on HN