Moving to a tiling window manager

Over two blog posts, I have described my journey towards minimalism – from Windows to Ubuntu at the beginning of the decade, then to Xubuntu over two years back, and onward to Arch Linux a year ago. While moving to Arch Linux, I abandoned desktop environments in favour of a relatively minimalist window manager (Openbox). I chose Openbox because I wanted something minimalist, but was not ready for a tiling window manager.

A couple of months back, I decided to explore tiling window managers which give much greater control over the placement of windows and are also more keyboard friendly. Many years ago, when I was dissatisfied with how often stacking window managers place new windows at arbitrary locations and size them inappropriately, I had discovered wmctrl which is a command line tool to activate, close, move, resize, maximize and minimize windows. By assigning hotkeys to suitable wmctrl commands, I could very quickly move windows to desired locations and sizes (for example, full height, flush left and filling two-thirds of the screen). Most often, I operated with a couple of windows that fully covered the screen. Slowly, I realized that I was using wmctrl to turn a stacking window manager into a tiling manager, and so it might make more sense to use a tiling manager.

I began my exploration of tiling window managers with awesome, but its out-of-the-box behaviour did not suit me at all, and so I decided to try i3. Trying these two in quick succession turned out to be a good idea because awesome and i3 have very different philosophies and default behaviours. By experiencing both of them, I could get a good sense of how to configure a tiling window manager to suit my needs. The decision to go back to awesome was driven by the perception that it could be customized more thoroughly by writing appropriate lua code.

My customization of awesome included the following:

  • Install the tyrannical tag managment engine to simplify the placement of windows in different tags.

  • Use a simple black wallpaper to replace the default images.

  • Get rid of most of the fancy layouts offered by awesome and use just two:

    local layouts =
    {
      awful.layout.suit.tile,
      awful.layout.suit.max,
    }
    
  • Set default layout: master window occupying the left two-thirds of the screen.
    tyrannical.settings.default_layout =  awful.layout.suit.tile
    tyrannical.settings.mwfact = 0.66
    
  • Get rid of window title (local titlebars_enabled = false) and instead use thick borders (border_width = beautiful.border_width * 2)

  • Put my emacs in an exclusive tag where it runs maximized. I usually run emacs split horizontally into two windows, and so there is no space for anything else on that screen. All other applications go into another tag.

    tyrannical.tags = {
    {
        name        = "Emacs",                
        init        = true,                   -- Load the tag on startup
        exclusive   = true,                   -- Refuse any other type of clients (by classes)
        selected    = true,
        class       = { "Emacs" }
    } ,
    {
        name        = "Main",                 
        fallback    = true,                   -- default tag for all windows
    } ,
    }
    
  • Set up key bindings for different ways to navigate and layout windows:
    • Cycle different applications into the master window while keeping the focus on the master window using c = client.focus c:swap(awful.client.getmaster())
    • Navigate windows by direction using awful.client.focus.bydirection
    • Navigate windows in order using awful.client.focus.byidx
    • Cycle where a window is shown (focus remains in the window as it moves) using awful.client.swap.byidx
    • Alternate between last two windows using awful.client.focus.history.previous()
    • Toggle between tiling and max layouts
    • Toggle floating
    • Widen and narrow master window
  • Set up key bindings for various actions on focused window: fullscreen, maximized, floating. Also a key binding to kill window.

  • Set up key bindings to list all windows (across all tags) and focus chosen window using rofi: awful.util.pread("rofi -show window") awful.client.restore()

  • Set up key bindings for commonly used applications: browser, file manager, oblogout, gmrun

  • Disable focusing of window when mouse hovers it (without clicking) by commenting the sloppy focus code:

    -- Enable sloppy focus
    -- c:connect_signal("mouse::enter", function(c)
    --     if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
    --         and awful.client.focus.filter(c) then
    --         client.focus = c
    --     end
    -- end)
    
  • Set up to run autostart programs only once, not when awesome is restarted
    local xresources_name = "awesome.started"
    local xresources = awful.util.pread("xrdb -query")
    if not xresources:match(xresources_name) then
        -- Autostarts have not been run, so run them now
        awful.util.spawn_with_shell("xset -b") -- set bell off
        awful.util.spawn_with_shell("numlockx on") -- set numlock on
        awful.util.spawn_with_shell("nm-applet&") -- networking icon
        awful.util.spawn_with_shell("xscreensaver -no-splash &") -- launch screensaver silently
        -- we have set xscreensaver to lock=false. Use light-locker to lock
        awful.util.spawn_with_shell("light-locker  --lock-on-suspend &")
    end
    awful.util.spawn_with_shell("xrdb -merge <<< " .. "'" .. xresources_name .. ": true'")
    

The biggest problem that I encountered was that keepass2 crashes whenever the Super (Windows) key is pressed. This bug in Windows.Forms (mono), has nothing to do with awesome or any other window manager; but a window manager that uses this key extensively makes this bug apparent. The solution was to add the option --verify-all to the mono command while running keepass2. I created a file with the line export MONO_ENV_OPTIONS=--verify-all in /etc/profile.d/.

I have been using awesome for nearly two months now and am quite happy with it. As they say, once you start using a tiling window manager, you will never go back.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s