With the advent of the Unity shell in Ubuntu 11.04 (Natty) and the Gnome 3 shell in 11.10 (Oneiric), I and, I believe, many other Ubuntu users, started to look around for a window manager replacement that we could use to continue doing development work properly and without feeling that our productivity was compromised.

This is how I came to know the Awesome Window Manager. I really thank Ubuntu for shipping that painfully slow version of Unity in April 2011. The adoption of Awesome has been the most productive change in my developer work-flow since I discovered Emacs org-mode back in 2007.

./awesome.png

What is Awesome WM

Awesome falls into the category of tiling window managers. The project was started in 2007 by Julien Danjou, who according to Wikipedia, started it as a fork of dwm, another tiling window manager. For hard-core Emacs users, Awesome is probably one of the best choices of window manager out there. Simply because the window manager keyboard shortcuts do not interfere with those from Emacs and actually seem like a natural fit for people like me that like to have complete control from the keyboard with a minimal use of the mouse.

Pros/Cons

This is a very personal summary of what things I like and dislike about Awesome WM.

Pros:

  1. Very minimal, no clutter, tiny top panel that stays our of your way and maximises screen real state.
  2. Large number of workspaces (a.k.a ‘tags’ in Awesome WM speak). The default is 9.
  3. Very stable. Almost two years of daily use, and I don’t remember it crashing on me or having to restart it. One of the advantages or being minimalistic.
  4. High performance (this WM is really minimal), switching between workspaces/windows with 0 lag; the desktop loads immediately after the login screen (because there’s not a lot to load really). No silly 3D effects. It is perfect for running on virtual machines.
  5. Default keyboard shortcuts do not interfere with (my) Emacs key bindings thanks to Awesome using the Windows key as trigger.
  6. Everything can be done from the keyboard. Jumping between workspaces, selecting windows (a.k.a ‘clients’ in Awesome WM speak), transferring windows to other workspaces (a.k.a. ‘tags’ in Awesome WM speak), switching between tile layouts, changing window positions and sizes, starting terminals and programs, closing windows, putting windows on top, maximising, minimising, etc.
  7. No hassle installation in Debian derivatives with sudo apt-get install awesome.
  8. Minimal/no configuration out of the box that gets things working from minute 0. Multiple screens work out of the box at least in Ubuntu.

Cons

  1. Additional configuration/personalisation requires tinkering with Lua scripts, which I don’t mind since I don’t care about the looks of the desktop.
  2. You need to memorise a basic subset of keyboard combinations from day 1. Not a problem if you are an avid Emacs user like me.
  3. No volume widget. Keyboard multimedia keys do not work out of the box (more on that later).

Keyboard shortcuts

This is the subset of the window manager shortcuts that I use most frequently, and that I believe are minimal to be productive in this type of environment (NOTE: Mod4 is the Windows key on a normal PC keyboard).

 
Starting/closing things Function Comment
Mod4 + Return Spawn terminal This is so intuitive you will want to do it in other window managers
Mod4 + r Run command A tiny command prompt appears at the top panel near the left corner
Mod4 + Shift + c Close focused window Need to be careful as sometimes it is difficult to discern which one is the focused window
 
Maximixing/Minimizing Function Comment
Mod4 + m Maximize/restore windows Ditto
Mod4 + n Minimize windows Ditto
Mod4 + Ctrl + n Restore a minimized window This one takes a bit of time to remember as it is not so intuitive
Mod4 + f Set window full screen The window is all over the screen, the top level panel disappears
Mod4 + t Set window on top Ditto
 
Workspaces Function Comment
Mod4 + j (k) Focus next (previous) window Ditto
Mod4 + Left (Right) Switch to left (right) workspace Ditto
Mod4 + 1-9 Switch to workspace 1-9 Ditto
Mod4 + Shift + 1-9 Move focused window to workspace 1-9 Ditto
 
Layouts Function Comment
Mod4 + Space Switch to next layout Ditto
Mod4 + Shift + Space Switch to previous layout Ditto
 
Multiple screens Function Comment
Mod4 + Ctrl + j (k) Focus next (previous) screen Really handy in a multi-monitor setup
Mod4 + o Send window to next screen Ditto

Multiple screens

In Awesome, by the default the second monitor acts as an independent screen with its own set of workspaces (tags). So with two monitors, you effectively get 18 independent workspaces. This is interesting because you can switch workspaces independently in each monitor, which is probably not the behaviour most people would expect. In my case, this feature is actually very desirable, but other people might find this a bit disconcerting.

Customising

I never cared very much about the looks of the Linux desktop, so I’m not really into customizing Awesome. But sometimes it is necessary to adjust a few things.

Awesome WM can be customised by modifying a Lua script named rc.lua that is read at startup. The file is expected to be located at one of the following directories, in this order:

  • $XDG_CONFIG_HOME/awesome/rc.lua
  • $HOME/.config/awesome/rc.lua
  • XDG_CONFIG_DIRS/awesome/rc.lua

In my system, I could find an example rc.lua in this location:

/usr/share/awesome/lib/shifty/example.rc.lua

Getting the multimedia keys to work

I’m used to changing volume using the multimedia keys of my keyboard. There is no default configuration in Awesome to do this so it is necessary to add a bit code in Awesome’s rc.lua script to make it work. The following is an example on how to bind the multimedia keys to do this type of things:

awful.key({}, "XF86AudioRaiseVolume", function () awful.util.spawn("pactl -- set-sink-volume 1 +10%") end),
awful.key({}, "XF86AudioLowerVolume", function () awful.util.spawn("pactl -- set-sink-volume 1 -10%") end),
awful.key({}, "XF86AudioMute", function () awful.util.spawn("/home/joni/work/tools/bin/pa-vol.sh mute") end),
awful.key({}, "XF86Mail", function () awful.util.spawn("thunderbird") end),
awful.key({}, "XF86HomePage", function () awful.util.spawn("nautilus /home/joni") end),
awful.key({}, "XF86Messenger", function () awful.util.spawn("skype") end),
awful.key({}, "XF86Document", function () awful.util.spawn("libreoffice") end),
awful.key({}, "XF86Favorites", function () awful.util.spawn("firefox") end),
  • Increasing/decreasing the volume is done with Pulseaudio’s pactl command line utility, that allows the control of a running Pulseaudio server.
  • Muting with Pulseaudio is a bit more complicated, but I found a handy script that makes use of the same ~pactl~ utility in combination with padump to achieve the effect of muting and unmuting a specific Pulseaudio sink from the command line. Just needed to make sure that the script would use the right Pulseaduio sink for my system. pacmd list-sinks is one tool that can be used to list Pulseaudio sinks available in a system.
  • I dont’ use other keys like play, stop, next or previous, but other people bind them to control MPD as a backend player.

Start up programs

Finally, there are those programs that you need to start every time you log in your system. So I decided to add those to the Awesome’s config to auto-start them on every session.

awful.util.spawn_with_shell("/usr/bin/radiotray")
awful.util.spawn_with_shell("/usr/bin/hp-systray")
awful.util.spawn_with_shell("/usr/bin/quicksynergy")
awful.util.spawn_with_shell("/home/joni/bin/emacsorg")
awful.util.spawn_with_shell("/home/joni/bin/emacstiz")
awful.util.spawn(terminal)
awful.util.spawn(terminal)
awful.util.spawn("/usr/bin/nautilus")
awful.util.spawn("/usr/bin/firefox")

Other tiling window managers

Currently Awesome is ticking all the boxes for me but I’ve also heard good things about xmonad. Some people have blogged comparisons between these two, but so far my impression is that that there is no clear winner, so this might be an interesting test to do in the future.