Switching to the awesome window manager

Vincent Bernat

I have hap­pily used FVWM as my win­dow man­ager for more than 10 years. How­ever, I re­cently got tired of man­u­ally ar­rang­ing win­dows and us­ing the mouse so much. A win­dow man­ager is one of the hand­ful of pieces of soft­ware get­ting in your way at ev­ery mo­ment which ex­plains why there are so many of them and why we might put so much time into it.

I de­cided to try a tiling win­dow man­ager. While i3 seemed pretty hot and pow­er­ful (watch the screen­cast!), I re­ally wanted some­thing con­fig­urable and ex­ten­si­ble with some lan­guage. So far, the com­mon choices are:

  • awe­some, writ­ten in C, con­fig­urable and ex­ten­si­ble in Lua;
  • StumpWM, writ­ten, con­fig­urable and ex­ten­si­ble in Com­mon Lisp; and
  • xmonad, writ­ten, con­fig­urable and ex­ten­si­ble in Haskell.

I chose awe­some, de­spite the fact that StumpWM’s vote for Lisp seemed a bet­ter fit (but it is more min­i­mal­ist). I hope there is some par­al­lel uni­verse where I en­joy StumpWM.

Vis­ually, here is what I got so far:

awesome dual screen setup
Dualhead setup with awesome

Awesome configuration#

With­out a con­fig­u­ra­tion file, awe­some does noth­ing. It does not come with any hard-coded be­hav­ior: ev­ery­thing needs to be con­fig­ured through its Lua con­fig­u­ra­tion file. A de­fault one is pro­vided but you can also start from scratch. If you like to con­trol your win­dow man­ager, this is some­what wonderful.

awe­some is well doc­u­mented. The wiki pro­vides a FAQ, a good in­tro­duc­tion and the API ref­er­ence is con­cise enough to be read from the top to the bot­tom. Know­ing Lua is not manda­tory since it is quite easy to dive into such a language.

I have posted my con­fig­u­ra­tion on GitHub. It should not be used as is but some snip­pets may be worth steal­ing and adapt­ing into your own con­fig­u­ra­tion. The fol­low­ing sec­tions shed light on some no­table points.

Keybindings#

Ten years ago was the epoch of scav­enger hunts to re­cover IBM Model M key­boards from waste con­tain­ers. They were great to type on and they did not fea­ture the in­fa­mous Win­dows keys. Nowa­days, it is harder to get such a key­board. All my key­boards now have Win­dows keys. This is a ma­jor change with re­spect to con­fig­ur­ing a win­dow man­ager: the left Win­dows key is mapped to Mod4 and is usu­ally un­used by most ap­pli­ca­tions and can there­fore be ded­i­cated to the win­dow manager.

The main prob­lem with the abil­ity to de­fine many key­bind­ings is to re­mem­ber the less fre­quently used ones. I have mon­key-patched the awful.​key mod­ule to be able to at­tach a doc­u­men­ta­tion string to a key­bind­ing. I have doc­u­mented the whole process on the awe­some wiki.

awesome online help
Contextual help for available keybindings

Quake console#

A Quake con­sole is a drop-down ter­mi­nal which can be tog­gled with some key. I was heav­ily re­ly­ing on it in FVWM. I think this is still a use­ful ad­di­tion to any awe­some con­fig­u­ra­tion. There are sev­eral pos­si­ble so­lu­tions doc­u­mented in the awe­some wiki. I have added my own1 which works great for me.

Quake console
Quake console at the top of the screen

XRandR#

XRandR is an ex­ten­sion which al­lows one to dy­nam­i­cally re­con­fig­ure out­puts: you plug an ex­ter­nal screen to your lap­top and you is­sue some com­mand to enable it:

$ xrandr --output VGA-1 --auto --left-of LVDS-1

awe­some de­tects the change and will restart au­to­mat­i­cally. Lap­tops usu­ally come with a spe­cial key to enable/disable an ex­ter­nal screen. Nowa­days, this key does noth­ing un­less con­fig­ured ap­pro­pri­ately. Out of the box, it is mapped to XF86Display sym­bol. I have as­so­ci­ated this key to a func­tion that will cy­cle through pos­si­ble con­fig­u­ra­tions de­pend­ing on the plugged screens. For ex­am­ple, if I plug an ex­ter­nal screen to my lap­top, I can cy­cle through the fol­low­ing con­fig­u­rations:

  • only the in­ter­nal screen
  • only the ex­ter­nal screen
  • in­ter­nal screen on the left, ex­ter­nal screen on the right
  • ex­ter­nal screen on the left, in­ter­nal screen on the right
  • no change

The pro­posed con­fig­u­ra­tion is dis­played us­ing naughty, the no­ti­fi­ca­tion sys­tem in­te­grated in awesome.

Notification of screen reconfiguration
Notification displaying the configuration to be applied through XRandR

Widgets#

I was pre­vi­ously us­ing Conky to dis­play var­i­ous sys­tem-re­lated in­for­ma­tion, like free space, CPU us­age and net­work us­age. awe­some comes with wid­gets that can fit the same use. I am re­ly­ing on vi­cious, a con­trib­uted wid­get man­ager, to man­age most of them. It al­lows one to at­tach a func­tion whose task is to fetch val­ues to be dis­played. This is quite powerful.

Here is an ex­am­ple with a vol­ume widget:

local volwidget = widget({ type = "textbox" })
vicious.register(volwidget, vicious.widgets.volume,
         '<span font="Terminus 8">$2 $1%</span>',
        2, "Master")
volwidget:buttons(awful.util.table.join(
             awful.button({ }, 1, volume.mixer),
             awful.button({ }, 3, volume.toggle),
             awful.button({ }, 4, volume.increase),
             awful.button({ }, 5, volume.decrease)))

You can also use a func­tion to for­mat the text as you wish. For ex­am­ple, you can dis­play a value in red if it is too low. Have a look at my bat­tery wid­get for an example.

Various widgets
Various widgets: disk usage, CPU and memory usage, tags and layout, network usage, date and system tray, volume and date

Miscellaneous#

While I was work­ing on my awe­some con­fig­u­ra­tion, I also changed some other desk­top-re­lated bits.

Keyboard configuration#

I hap­pen to set up all my key­boards to use the QWERTY lay­out. I use a com­pose key to in­put spe­cial char­ac­ters like “é.” I have also re­cently used Caps Lock as a Con­trol key. All this has been per­fectly sup­ported for ages by X11. I am also map­ping the Pause key to XF86ScreenSaver key sym­bol which will in turn be bound to a func­tion that will trig­ger xautolock to lock the screen.

Thanks to a great ar­ti­cle about ex­tend­ing the X key­board map with xkb, I dis­cov­ered that X was able to switch from one lay­out to an­other us­ing groups.2 I fi­nally opted for this sim­ple con­fig­uration:

$ setxkbmap us,fr '' compose:rwin ctrl:nocaps grp:rctrl_rshift_toggle
$ xmodmap -e 'keysym Pause = XF86ScreenSaver'

I switch from us to fr by press­ing both left Con­trol and left Shift keys.

Getting rid of most GNOME stuff#

Less than one year ago, to take a step for­ward to the fu­ture, I started to heav­ily rely on some GNOME com­po­nents like GNOME Dis­play Man­ager, GNOME Power Man­ager, the screen saver, gnome-session, gnome-settings-daemon and oth­ers. I had nu­mer­ous prob­lems when I tried to set up ev­ery­thing with­out pulling the whole GNOME stack. At each GNOME up­date, some­thing was bro­ken: the screen­saver did not start au­to­mat­i­cally any­more un­til a full ses­sion restart or some key­bind­ings were ran­domly hi­jacked by gnome-settings-daemon.

There­fore, I have de­cided to get rid of most of these com­po­nents. I have re­placed GNOME Power Man­ager with sys­tem-level tools like sleepd and the PM util­i­ties. I re­placed the GNOME screen­saver with i3lock and xau­tolock. GDM has been re­placed by SLiM which now fea­tures ConsoleKit sup­port.3 I use ~/.​gtkrc-2.0 and ~/.​config/​gtk-3.0/​settings.​ini to con­fig­ure GTK+.

The fu­ture will wait.

Terminal color scheme#

I am us­ing rxvt-uni­code as my ter­mi­nal with a black back­ground (and some light trans­parency). The de­fault color scheme is sub­op­ti­mal on the read­abil­ity front.

Shar­ing ter­mi­nal color schemes seems a pop­u­lar ac­tiv­ity. I fi­nally opted for the “derp” color scheme which brings a ma­jor im­prove­ment over the de­fault con­fig­uration.

Comparison of terminal color schemes
Comparison of the default color scheme (bottom) with the new one (top)

I have also switched to Xft for font ren­der­ing us­ing DejaVu Sans Mono as my de­fault font (in­stead of fixed) with the fol­low­ing con­fig­u­ra­tion in ~/.​Xresources:

Xft.antialias: true
Xft.hinting: true
Xft.hintstyle: hintlight
Xft.rgba: rgb
URxvt.font: xft:DejaVu Sans Mono-8
URxvt.letterSpace: -1

The re­sult is less crisp but seems a bit more read­able. I may switch back in the future.

Comparison of terminal fonts
Comparison of the fixed font (left) with DejaVu Sans Mono (right)

Next steps#

My re­liance on the mouse has been greatly re­duced. How­ever, I still need it for ca­sual brows­ing. I am look­ing at lu­akit, a WebKit-based browser ex­ten­si­ble with Lua for this purpose.