3 ms·
Tinywm, a window manager in 50 lines of C
- jff 17y agoIs this link working for anyone else? I'm getting a 503.
- mattyb 17y agoWorks for me.
- mahmud 17y agoYou know, succinctness is not something I look for in C code. Unless you're artificially going for obfuscation; I think 50 lines is barely enough to check arguments, open descriptors, test results, setup signal handlers and sit tightly on a loop. You will need at least another 50-500 just to implement ICCC.
- silentbicycle 17y agoAgreed, but speaking as someone who has only done patchy X programming, it's still nice to have a stub of a window manager with notes about the absolute basics. I've used a fork of dwm for a while, but a typical comment from its source is, "To understand everything else, start reading main()." That's not terribly helpful when you're just starting out. Look at how many windowmanagers are based on aewm, too.
- mahmud 17y agoStumpwm is in CL and you can read it. And while googling a second ago, I found this http://tronche.com/gui/x/gwm/html-manual/ http://tronche.com/gui/x/gwm/html-manual/ Lispy window manager; gonna chase down the author's page and see if this gave birth to any research papers.
- silentbicycle 17y agoI've read through parts of Ratpoison, aewm, Awesome, XMonad, Blackbox, and other WMs over the years. Short source like this can be very helpful in other ways, though - seeing a very simple Scheme interpreter or minimal webserver in Python (or whatever) can make previously "hard" things more approachable. The "hey, you can do this too" energy or big picture insight from overly-simple-but-still-functional code can be just as helpful as deep references sometimes. As WMs go, I've had an itch for a while to write a skeleton WM in C with hooks to script it in Lua. dwm continues to work just well enough for me, though, and I've already got too many projects. One of these days... (And no, Awesome and XMonad don't do it for me.) Also, for anybody doing any kind of exploratory X WM programming, it's incredibly helpful to use a nested X server such as Xnest (http://www.xfree86.org/4.0/Xnest.1.html http://www.xfree86.org/4.0/Xnest.1.html) for debugging. Something like this should work: #!/bin/sh # -ac allows connections Xnest -ac :1 & Then you can say e.g. "xeyes -display :1" to run things inside it.