My new window manager is Awesome
I wrote a few posts in the past about my window manager - I was using StumpWM, which is a WM written in Common Lisp. It's great, and I used it for a long time, but had to switch. Unfortunately, I got a 4k laptop from work, and Stump couldn't handle that - at least not without a lot of work. The fact that Stump draws everything with X APIs (XCB) doesn't make it any easier, too.
So, reluctantly, I was forced to switch to GNOME. It's a surprisingly solid environment, as long as you install a few add-ons and disable most "user friendly" features (I wonder who ever thought the "reversed scroll direction" is "natural"!!)
I started looking for a solution. I wanted a reasonably stable, maintained window manager with a (or even built around) REPL - a simple requirement, but it filtered out 99% of the candidates, leaving just three:
Sawfish is scriptable with "a Lisp variant", described as a "mix of Emacs Lisp and Scheme", though I'm not sure how exactly that's supposed to look like. Unfortunately, it looked the least maintained of the bunch, so I decided to pass on it.
XMonad uses Haskell for scripting, which is an interesting choice. I don't know Haskell - I just skimmed a few books on it and played in the REPL, but that's not the level of "knowing" a language - but I could learn. After taking note of this, I went to examine the third option.
As already said in the title, I ultimately chose Awesome WM. My main reason (besides the name) was that it is built around a library of lightweight widgets, which render using Cairo lib, not the antiquated X widgets (like in StumpWM). Furthermore, it was scripted in Lua, a language which I know, and which is also a target for the transpiler I happened to be interested in. The reasonably complete documentation helped, though you can see a few lacking areas.
I will write the rest - how I set up Awesome, explored its library (called "awful"...), re-learned Lua from the ground up, or how I ended up forking the mentioned language, you know, the uninteresting details - in the follow-up posts, so now I just want to share a minor success of coding a complete widget by myself!
3x3 virtual desktop grid
Right, its about virtual desktops. All modern OSes offer the functionality where you can switch to another "desktop" with its own set of windows, then switch back. In some cases changing the desktop is accompanied with an animation (eg. sliding vertically or horizontally), and there's often a "zoomed out" mode for viewing windows from all desktops at once. In most popular implementations, the desktops are chained in a straight line, even without a wraparound.
Awesome's of course has virtual desktops, though it calls them tags: switching to a desktop number 3 makes only the windows tagged with "3" to become visible. The default configuration has ten tags configured, users can change it however they wish. With the larger number of desktops, though, comes another problem: how do you remember what window is on which desktop?
My solution to that problem was, since my early Linux experiences with Enlightenment 0.16, arranging the desktops in a grid. I'm not sure what it is, but there's something about path-finding and spacial metaphor that our brains seem to like a lot... Anyway, Awesome sadly lacked the ability to display a grid of my desktops - the "taglist" is a single row of labels (often numerical), like here:
So the first thing I want to share is that, after a long while, I managed to display a three by three, free floating taglist in Awesome! It was much more troublesome than I expected, due to the dual (schizophrenic) nature of the widget system (X / Cairo) and lack of good docs on Awesome architecture. Well, after a lot of tinkering, I made it! See the screenshot below (on the right).
Well, it was almost perfect, but unfortunately, no matter where I placed it or how I played with opacity, there was always a moment where it displayed over some important details, requiring manual intervention. I understood that, to be fully ideal, it would need to hide and show itself at just the correct moments: show after desktop change (or after key shortcut, or mouse-over), then hide a few seconds later or immediately if clicked on.
This time it was a bit easier, mostly because I already learned most of the API, but also thanks to Lua coroutines. Awesome has no direct support for animations, doesn't use them for anything (that I'm aware of) and apparently is not very interested in them. Fortunately, Awesome implements a timer: a piece of code which can call the callback function after some time, then repeat (or not). That is enough to allow users to implement their own stepping logic. Thanks to Lua coroutines, you can describe your animations as simple functions, wrap them with coroutine and plug straight into a timer. Here's the result of my efforts in action:
The code for this is in the repo on Github (as usual), but if you'd like to use it, ping me first - it's my personal config and I didn't bother with too much cleanup, but I can do it if it's going to be useful to someone.Comments