i3: Tiling Window Management

Forget about touchscreens for a moment, put the mouse down and control the desktop with your keyboard.

Why do this?

  • Work more efficiently.
  • Keep carpal tunnel syndrome at bay.
  • Get value for money from your high-resolution monitor.

If you’ve always used a stacking window manager (one in which windows overlap each other – most window managers are stacking), then the concept of a tiling window manager may seem a little strange. Using a tiling WM, you don’t have much control over window placement, and there’s usually no taskbar for minimised windows. Instead the whole thing is driven by keyboard commands. At first, this can seem archaic. When you first use a tiling window manager, you’ll probably find that it doesn’t make good use of screen space, but this is just because you haven’t learned to use it well yet.

Once you’ve got used to the system, you should find that you can do all your window management tasks without your fingers ever leaving the keyboard. This is much faster than flicking back and forward to the mouse. Don’t worry though, you won’t have to abandon your computer’s rodent – you’ll still be able to use it for graphical applications. Now, let’s get stuck in so you can see what it’s like for yourself.

Getting started

Image

You can install multiple window managers on a single distro, so you can try i3 without losing your current setup. All you have to do is grab the package through your package manager (usually called i3). It’s available in all major distros. If you’re using Debian or Ubuntu (or a derivative of these), you can adjust your repositories to get the latest version of i3 by following the guide at https://i3wm.org/docs/repositories.html; however, this isn’t necessary if you just want to try it out.

Once you’ve got everything installed, you just need to switch desktops. Log out of your current session and you should be able to select i3 as an option on the login screen. This will take you into i3. You should see a desktop wallpaper with a black bar along the bottom. There’s no graphical menu (or anything else you might click with your mouse) as i3 is primarily keyboard-driven. If you’re used to doing most of your work with the mouse, it may take a little while to get used to this, but many people find that they end up preferring a keyboard-driven interface.

Windows and containers

Image

Most of i3 is driven through a modifier key. This can be either Alt or the Windows key depending on the setup (you may have been asked to choose when starting i3). The first thing we’ll do is open a terminal. This is done with Mod+Enter. Try with both Alt and Windows to see which way you have it set up.

You’ll find that the terminal takes up the whole screen, and that there are no window decorations for resizing, moving or closing it. That’s because i3 is a tiling window manager, and it handles all the placement and sizing.

To get an idea of how this works, press Mod+Enter again. You should find that i3 opens another terminal either next to, or below the previous terminal. Whenever you open a new window in i3 it splits the space of the current one to fit the new one in. If you press Mod+H before creating the new window, it will split the window horizontally, if you press Mod+V before, it will split vertically. This is the basic way of organising your windows on the screen.

Select the active window

Image

With multiple windows open on the screen, you can use the mouse to select the one you want to use. However, this isn’t very efficient. It’s usually much better to move around using the keyboard. You can move between the different panes (known as containers), either by using Mod+arrow key or by using Mod+J, K, L or ; for left, down, up and right (the same as in the Vi text editor).

Once you’re in a container, you can use Mod+F to make it full-screen, or Mod+Shift+<num> (where <num> is a number) to send it to another workspace. You can then go to the workspace by pressing Mod+<num>. If you do find yourself using the mouse, you can switch between workspaces by clicking on the numbers in the bottom left-hand corner of the screen. One final use of the mouse is that you can use it to resize containers by clicking and dragging the border between them.

Other applications

Image

So far, we’ve only been playing with terminals. This is useful to get a feel of how the desktop works, but it’s not very good for general use (unless, of course, you’re a true Unix ninja). You can, of course, just start programs from terminals, but this means you have to have terminals spewing out the output of the graphical programs.

Although i3 doesn’t have a graphical applications menu, it does have a menu. To open it, press Mod+D, then start typing the name of the program you want to start. This works a little like tab completion in the command line. Unlike a desktop environment (such as Gnome or KDE), i3 doesn’t come with any specific applications. All Linux software should work with i3, but it’s worth thinking about which applications fit in best with the keyboard-driven way of working. For example, the Ranger terminal-based file manager can be easier than a graphical tool like Nautilus or Dolphin.

More controls

Image

What we’ve covered so far needs to become second nature to you, so now’s a good time to start practising. Once you know all these key bindings automatically, you should be able to use i3 for most work. However, there are still some more advanced features that can come in handy.

Rather than tile a group of containers, you can have them stacked or tabbed to give more screen real-estate to the currently active container. You can switch between the various options with Mod+S, W or E (for stacking, tabbed or default respectively).

You can also resize containers by using Mod+R to enter resize mode. Once you’ve pressed that, you should see Resize Mode appear in the bottom-left corner. You can then use the arrow keys or J, K, L and ; (without Mod) to resize the current container. Once you’ve finished, press Escape to exit resize mode.

Configuration

Image

Since i3 is mostly aimed at advanced computer users, it’s highly customiseable. This is done through modifying the config file ~/.i3/config or ~/.config/i3/config. In it, you should see that all the keybindings can be changed to whatever you want them to be. .

As well as configuring i3, you can also get extra software to help you. I3pystatus (https://github.com/enkore/i3pystatus) is a replacement for the status bar that’s extensible in Python. There’s also QuickSwitch (https://github.com/proxypoke/quickswitch-for-i3) which is a utility to help you find and control windows in i3.

If you get stuck, i3 has good documentation at http://i3wm.org/docs/. There’s also a stackoverflow-style FAQ at https://faq.i3wm.org/questions which is a good place to find solutions since most problems you face will have happened to someone before.