Master Your Desktop Be a Window Wizard

Launching and Closing Apps

So far we've only been opening terminal windows, which is fine if you do most of your work at the command line, but obviously isn't great for general desktop usage. Fortunately, there's a dedicated program launcher for i3 called dmenu that is – as you've probably guessed by now – keyboard-centric. To activate it, press Alt+D and look at the top of the screen: You should see a bar with a gap on the left and various programs listed on the right. (If you don't see this, make sure dmenu is installed – have a search for it in your distro's package manager.)

Now, with dmenu open, start typing something – for example, f. You'll see that dmenu narrows down the list of displayed apps to those beginning with f. Type "fire" and (unless you have other apps installed beginning with fire), it should narrow down to "firefox", so hit Enter to launch it. As you're seeing, dmenu is a useful way to quickly launch applications without having to type in the full executable names – at least, most of the time!

To close an window, press Alt+Shift+Q. This tells i3 to send a regular "close window" command to the application, that is, shutting it down gracefully. So if you're running an editor and haven't saved your work, the app will prompt you. Try it out with, say, LibreOffice – start a word processor document, tap in some text, and then press Alt+Shift+Q. LibreOffice's Save Document? dialog will pop up, and you'll also notice that i3 lets it appear in the middle of the screen, as usual (see the "Using Workspaces" box for more info).

Using Workspaces

Like most desktop environments and window managers, i3 supports workspaces – separate virtual "screens" where you can open additional applications. You can see the number of the currently active workspace in the far-left of the status bar at the bottom (it should show "1" at this stage). To switch to another workspace, use Alt along with a number (e.g., Alt+2 to switch to workspace 2). These are created on the fly, so you don't have to worry about creating or managing them.

In many cases, you'll want to move windows between different workspaces; this is achieved by using Alt+Shift along with a number. So, if you're in workspace 1 with two windows open side-by-side and press Alt+Shift+2, the currently selected window will be moved into the second workspace. And, if that workspace was empty before the move, the window will take up the whole screen, like when we first started i3.

So i3 isn't overly zealous about tiling; it tries to give each window and application its own dedicated space on the screen, making sure no pixels are wasted, but it's also clever enough to respect "floating" windows that are temporary and don't need to be assigned their own tiles. You can see this in Figure 4.

Figure 4: i3 doesn't try to tile absolutely everything, though and respects the wishes of floating dialogs.

You're now ready to start using i3 for your daily work – it may take some time to get used to, but after a while you'll find it much more elegant to work with than regular point-and-click window managers (Figure 5).

Figure 5: A great example of i3 at its best: editing a config file in one tile while viewing its manual page in another.

But one final thing we'll look at is the default configuration file that i3 created when you first launched it. This is called config, and you'll find it in the .config/i3/ subdirectory of your home directory.

Apart from the font option, which lets you customize the font used in window titles and the i3bar, most of the other options are preceded by bindsym and configure the keybindings for the various window management options. For instance, look at this:

bindsym $mod+Shift+q kill

Here, $mod is the modifier key (Alt or Windows) that we selected during the first run of i3 – and it's also defined at the top of the configuration file. So, this line of code says "bind the key combination $mod+Shift+q to the kill command" with kill meaning close the window.

Look through the file to explore the available keybindings – there are a few lesser-used ones that we haven't talked about in this guide, but that you may find useful as time goes on. If there's a particular default keybinding that you find awkward to use, you can simply change it here, save the file, and press Alt+Shift+C to reload the configuration file without having to restart i3 completely. (To exit i3, use Alt+Shift+E and notice the confirmation bar at the top of the screen.)

One last thing: When you're getting to grips with i3, we recommend loading up the i3 Reference Card [3] and making a printout of it for your wall. For the complete i3 documentation, describing many different ways to divide up your screen, see the User's Guide [4]. Also, check out the "Other Tiling WMs" box for alternatives to i3.

Other Tiling WMs

i3 is the most popular tiling window manager, and for good reason: Its default configuration is sensible, it's insanely fast and light, and it has very few dependencies (so it doesn't pull in loads of libraries or graphical toolkits when you run it). But there are plenty of others worth exploring as well if you really get into the tiling groove.

Awesome [5] works well out of the box, but is designed as a "framework" window manager that can be extended using the Lua programming language. It implements many standards, so it fits in well with add-on tools like docks, program launchers, and system trays.

Dwm [6], meanwhile, is an extremely minimalist tiling window manager – indeed, the developers have set its source code a hard limit of 2,000 lines! And it's even possible to do tiling inside a terminal window, thanks to Tmux – see our guide on page 92 of Linux Magazine issue 193 for all the juicy details.

Buy this article as PDF

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

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More