Master Your Desktop Be a Window Wizard

Tutorials – WM Tiling

Article from Issue 197/2017
Author(s):

Regular window managers are so 2016 – install a tiling WM and work faster, smarter, and cooler.

Despite all of the vast gains seen in technology over the last few decades, user interfaces on desktop computers have remained pretty much the same. We have insanely fast CPUs and graphics cards to make our windows wobbly, and we have truckloads of RAM to run countless apps simultaneously. But we still tend to have the same kind of setup on our desktops: a program launcher, a taskbar or list of running programs, a "system tray" area, various windows scattered around, and so forth. Even the desktop environments that have bucked the trend in recent years, like Gnome 3 and Ubuntu's Unity, still keep most of the basics that we've been using since the Amiga Workbench days.

Now, you could argue that this is a good thing. User interface design has been refined over the decades, and we're all used to how WIMP (windows, icons, menus, and pointing device) setups work, so why change it? Why throw all of this away for something novel and "experimental" that requires learning a whole new workflow?

Well, sometimes that workflow can make you faster. A lot faster. Look at the command line, for instance: We Linux and Unix geeks know that it's not as pretty or welcoming as a flashy GUI, but it gets many things done much more quickly. Prodding the mouse, going through tabs in a dialog box, fiddling with sliders and radio buttons – who wants that when you can just type in a command and get your flippin' work done?

So Long, Rodent

Let's apply this thinking to desktop environments and window managers. Having lots of buttons, menus, and titlebars may look nice and helpful, but arguably they just eat up screen space. And, although many window managers have "smart" window placement modes and try to guess where you want a window to be, they usually do a pretty bad job of it. If you have a large screen (or even better, you're working with a multi-monitor setup), you've probably wasted enough time repositioning all of your favorite apps after every fresh boot of your distro.

This is where "tiling" window managers (WMs) are godsends. Tiling WMs do the job of positioning windows for you, placing them strategically and using up every spare pixel of screen space at the same time. You don't have bits of windows overlapping other ones; you don't have to drag them around and clumsily position them in a sort-of-about-right place – the tiling WM does all this for you. Of course, you still have manual control over your window placement, but with the right setup you rarely have to get involved. Oh, and to top it all off, tiling WMs are heavily keyboard driven, so you can switch between apps and rearrange your desktop layout right from the middle of your typing work – no need to reach for the mouse or trackpad.

One of the best tiling WMs doing the rounds is i3; it's especially popular in power-user distro circles (e.g., Arch Linux), but it can be installed in pretty much every other distro. And, although i3 takes a bit of getting used to, it's not especially hard to master and can save you huge amounts of time in the long run. In this article, we'll show you how it works, how to configure it, and how to get the most out of it.

i3 Basics

The first thing you'll need to do is install i3 from your distribution's package repositories. Have a look in your package manager – or on Debian and Ubuntu-based distros, you can install it with a simple:

sudo apt-get install i3

If you can't find it, grab the source code from i3's website [1] and build it yourself. If you have trouble compiling it, try posting a message on the i3 subreddit [2], which has plenty of users around to help.

Once you have i3 installed, log out of your current desktop environment and then choose i3 at your distro's login screen. Exactly how you do this will vary depending on your distro's login manager – usually there's a small icon showing your current desktop environment (Gnome, KDE, Xfce, etc.) that you can click to change it. So, click that and select i3.

Then log in, and you'll immediately see a "first configuration" box like in Figure 1. Here i3 is offering to generate and save a default config file for you – and that's definitely what you want at this stage, so hit Enter to proceed. Then you'll be posed another question: do you want to use your Windows key as the "default modifier," or the Alt key? This default modifier is the key you use in combination with other keys to manage and manipulate i3. We're going to choose Alt for this tutorial, but you can choose whatever suits your workflow best. (Of course, if you choose the Windows key, replace Alt with Windows in the instructions we give throughout this tutorial.)

Figure 1: When first launched, i3 will offer to set you up with a default config file.

And then… Well, there's nothing. Or almost nothing. Your screen will go completely blank – or at least show the wallpaper from your login manager – with nothing obvious going on. Look down at the bottom of your screen, though, and you'll see a thin black bar containing various bits of information. This is the i3bar, and it's running a tool called i3status inside of it. Have a look at the data it displays: You'll see that there's information about your network connection, free hard drive space, IP address, CPU load, along with the date and time. All rather handy and taking up very little space.

Now try clicking the bits of data on the i3bar though – notice how nothing happens? As mentioned, i3 is very much keyboard-centric, so the mouse does very little out of the box. i3 encourages you to keep your hands firmly on the keyboard, with pretty much every feature available via keyboard shortcuts. Indeed, you can't even launch a program via the mouse; if you've been searching around for a Start-like menu, you won't have had any luck.

To open a terminal, hit Alt+Enter. You'll see straight away that the terminal fills up the entire screen. This is where we start to see the basics of tiling: i3 sees the whole empty desktop as one big "tile" in which it can place a newly launched application. i3 automatically makes use of all available space – you don't need to maximize your windows manually.

Managing Windows

Now, with that single terminal window open, hit Alt+Enter again to open another terminal. i3 immediately splits the screen into two tiles: one on the left, and one on the right, leaving you with two terminals open side-by-side, like in Figure 2. There's no empty space on the screen here. The currently focused window is the one on the right-hand side, so what if you want to switch to the other one?

Figure 2: Here's our first exposure to tiling, with two windows being automatically placed side-by-side.

You could move the mouse over (i3 operates under the "focus follows mouse" model, so you don't have to click on a window to make it active), but that's not ideal when we want to keep our hands on the keyboard. Instead, use Alt along with your arrow keys; you can tell which window is focused by the color of the title bar and the thin frame around it (in the default configuration, focused windows are dark blue while unfocused ones are black).

Now, you can keep hitting Alt+Enter to pop up terminals so that they're all shown side-by-side, but sometimes you'll want to make one window appear below the current one. Make sure you have two terminals open like in Figure 2, with the right-hand one active. Tap Alt+V to prepare i3 for a vertical split, and then hit Alt+Enter again – and you should now have three terminals visible, with one taking up the left-hand part of the screen and the other two on the right-hand part, stacked on top of each other (Figure 3).

Figure 3: We can split the screen horizontally or vertically, and indeed do combinations of those splits.

If you hit Alt+Enter again, another terminal will appear in that right-hand section. Press Alt+H to return to horizontal splits and hit Alt+Enter – this time the new terminal window appears to the right of the current one. It might sound rather odd and unintuitive, but try playing around with different combinations: Open and close terminals, using Alt+V and Alt+H to switch between different layouts as you do so. Along with Alt and the cursor keys to navigate between windows, you can use the JKL; keys for left, down, up and right, respectively.

If you want to move a window into a different tile, use Alt+Shift together with the cursor keys (or JKL;). Resizing tiles is possible using the keyboard: press Alt+R to switch to resize mode (you'll see the word "resize" in the left-hand part of the status bar), and then use the arrow keys to change the size. When you're done, hit Esc. If you find this approach a bit unintuitive with certain layouts, you can still resort to the mouse – just click and drag the separators between windows (or the titlebars in vertical layouts).

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • A taste of tiling with X-Tile
  • Free Software Projects

    This month, we explore open source science projects. The young TileMill project is a powerful mapping tool for cartographers, HUBzero provides a platform for scientific collaboration, and the NASA-sponsored Virtual Microscope magnifies specimens without breaking any glass slides.

  • Desktopia: Wmii

    If you’d rather rule the desktop from your keyboard, try the powerful Wmii window manager.

  • Desktopia: Whaw

    If you’re weary of sorting through overlapping windows, Whaw will help you get organized.

  • DeskTOPia: hsetroot & Esetroot

    Users who work long hours on a

    desktop computer will appreciate

    something eye-catching to relieve

    the monotony. The hsetroot and

    Esetroot tools offer you more than

    an ordinary desktop.

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95

News