Thursday, September 15, 2011

wmii tilling manager

After I wrote In search of a perfect Window Manager, I received comment from cyb3rpunk, who suggested me to try scrotwm and wmii.

I'll be brief about scrotwm, which I gave second chance - I don't like it. I don't like how it handles tiled windows, I don't like 1px borders, which are hard to see.

In this article I will write about wmii.

What is wmii?

wmii is wonderful tiling window manager. It's so wonderful, because it can be easily scripted.
To configure wmii you need to write some script (unless you are pervert enough to code wmii config in some low level language such as C)
This script will handle events, that wmii generates and then it will manipulate wmii state.

Example wmii config in sh

Example wmii config is written in Bourne Shell (sh), and is pretty good place to start learning wmii.
However I soon discovered few flaws if you use sh to configure wmii.
When you write config in sh, you'll need to fork some parts of your script in background. The problem is that when you kill wmii, your forked code will be around, unless you implement some process handling in sh.
I didn't want like that, so I started writing custom config in Ruby 1.9.

There are also example ruby and python configurations.

Writing my ruby config

I decided not to reuse example wmii ruby config, because it was using Ruami 3.x ruby library (not sure how 4.x is better, but whatever).
Besides it was nice ruby practice, for me, as I just started learning Ruby.

While writing my wmii config from scratch I did make some peeks at example ruby configuration, to get some ideas how Rumai/wmii works.
It also gave me idea to use yaml, for most of config.

After few days of coding, I was sick of many crashes and thought, wtf am I doing.... however I didn't gave up, and in about week since I started coding, I got my config very stable.
Best of all, that this config, has features and ideas from my fvwm and xmonad configurations (such as desk workdir, switching to tag and back, with single key combination, switching to previous used tag and others).

I also think (but that's subjective) that my configuration is little more flexible than example ruby configuration. Also it looks that with mine config, ruby use less CPU.

Currently I prefer wmii over xmonad and fvwm

wmii screenshot (big)
What I love about wmii

wmii handles floating windows very well, much better than any other tilling window manager that I tried.

Compared to xmonad, it's much easier to create new columns with windows in wmii. Maybe I didn't say that 100% correctly, but the fact is, that in wmii window arrangement is way more flexible than in xmonad.

Xmonad has master area and slave area. You can modify how many windows are placed in master area. This is nice, but not flexible enough.

In wmii, you don't have master area as such. Instead you have columns with windows. When you open new tag (view in wmii terminology) and open terminal, it will fill entire workspace. Now when you open another terminal, it will cover old terminal (simply put: stacking). Now you have 2 terminals, but only see one of them, and you see (depending on your config) title of other terminal. If you move current terminal right or left, wmii will create new column, and you will have 2 columns. New windows will be placed in current column. This makes wmii very flexible for coding.

Another feature I like in wmii is window grouping. You can group windows and move this group to separate view (for example), or do something else. Grouping also makes special view @ where you can see all windows, that you grouped. AFAIK, there can be only 1 group.

wmii bar, is pretty flexible, you can add buttons to it and assign event handlers, when you click on it. You can go as far as making it act as notification area, or even use it as dialog instead of xmessage / gxmessage.
For example I plan to implement similar functionality to KILL_GELI.sh from wmscritps in wmii bar. Imagine, I press Mod4+Del and notification appears, asking: "Are you sure you want to nuke your drives?", with 2 buttons "YES" in red color and "NO" in green. That would look awesome. This idea was inspired by Uplink, where you can nuke your gateway, if FBI is going to break in your gateway room. :)

I also like how wmii fills gaps between terminal and screen borders, by extending border :)

Since I'm using ruby to handle wmii configuration, I'm only limited to my imagination.

wmii problems

Currently I've faced only one problem: when someone starts chat with me, pidgin creates new urgent window, but wmii doesn't throw UrgentTag event, and I never notice this important event.
There is workaround for this, I could throw UrgentTag event, when I get Urgent event, however right now I'm bit lazy to write the code.

I reported this issue, and it looks like it was fixed in less than 24h. I haven't tried wmii from mercurial repository yet (I'm lazy and tired ATM)

mplayer tip

In article In search of a perfect Window Manager, I complained that in some window managers, mplayer would start fullscreen. I discovered how to fix this.

in your ~/.mplayer/config you need to add

fs=no
ontop=no


You need to do this for wmii, wmfs, i3 (and probably others), if you won't want mplayer to start full screen.
SIDENOTE: however for xmonad I prefer to set both settings to yes. mplayer won't start fullscreen in xmonad, but this helps movie aspect ratio, if your mplayer isn't floating

In the end

I really recommend everyone to try wmii. It takes a while to configure, but it's worth it.

In case anyone is interested here's my wmii config

4 comments:

  1. Man, I've been reading your ruby configuration of wmii and you made one of the best lines to have a "killer" wmii. I'm using scrotwm since a couple of months ago because it's very simple to handle it, and it does just the basic stuff I need, but wmii with ruby configuration is definitely a pending job I have since I use it like a year ago.

    Thanks for writing this excellent post and thanks for sharing the lines.

    BTW, totally agree in your last post, all the browsers sucks, the thing is "which one is sucking less?" (Opera to me).

    Greetings from Mexico.

    ReplyDelete
  2. Thanks :)

    Without previous experience with xmonad and fvwm, my wmii config wouldn't be as near as good as it is now.

    Best of all it's very, very stable (haven't had panic for a very long time)

    ReplyDelete
  3. If you only saw the Ruby configuration example that ships with wmii 3.9.2, then please know that it's a very old snapshot of my own Ruby wmiirc:

    https://github.com/sunaku/wmiirc

    Please upgrade to wmii-hg (build wmii directly from its hg source repository) and also try my updated Ruby wmiirc directly from its Git repository (see link above).

    Cheers.

    ReplyDelete
  4. I really, really don't want to do that (just yet).

    ReplyDelete