X
Tech

How to customise your Linux desktop: More experiments with i3

Another set of adventures with this tiling window manager.
Written by J.A. Watson, Contributor

In my previous post I gave a basic introduction to the i3 Window Manager, with some simple examples of opening and managing windows and using a few basic utilities.

Now I would like to expand on that, looking at more advanced window and workspace management, and how to use i3 efficiently and effectively with various Linux applications. But I would like to start out by clarifying a couple of important points.

First, if you are serious about learning and using i3, you have to read the i3 User's Guide. What I am presenting in these two or three blog posts barely scratches the surface of what i3 is, what it can do, and how it can be configured. If I pique enough interest in i3 that you want to try it out, then please, please, please read the User's Guide. It's not terribly long, you can get through it in an hour or so (plus whatever time you spend investigating and testing things on your own as you read them). I know, I know, I'm an old dinosaur and I have been going around growling RTFM for longer than many of you have been alive. But in this case the payoff is enormous so please, just do it.

Second, everything I am writing in these posts about i3 is based on the Manjaro Linux 15.12 i3 distribution. That is very important to knowfor two reasons. First, i3 is extremely configurable, so what it looks like is heavily dependent on the person/people who installed and configured it. Second, as I have said many times now, i3 is only a window manager, it includes very few other utilities and no applications at all. So everything from the File Manager to the Office suite may be different from one distribution to the next - or may very well not be included at all!

If you want to try i3 yourself, there is a Distributions and Downloads page, have a good time!

Ok, with those preliminaries out of the way, let's get to work. In the first i3 post I showed how to open a terminal window (Mod-Enter) and how to start a couple of other simple utilities (ranger and gpixview) by using the 'dmenu' context-search launcher. Now I would like to expand on that by starting and managing some more common Linux programs.

Let's go straight for the throat and try to run Firefox, by hitting Mod-d and then typing 'Firefox' in the search box. After just a few keystrokes it becomes obvious that Firefox is not there, so I am going to have to install it.

The package management utility you can use will depend on what distribution you are using (duh), in my case with Manjaro I will be using pacman. So I have to go to a terminal window and run "sudo pacman -S firefox".

2016-01-08-1347101366x768scrot.png

Once I get Firefox installed, if I stay on the screen (workspace) with the terminal that I just used, and I start Firefox (via dmenu, as described above) then i3 will split the screen and create a new window for Firefox, as shown here. This might be good, if you really are going to use the terminal and Firefox at the same time. That is not generally the case, though, so I'm going look at a couple of alternatives.

First we get to learn another new i3 command - to close the current window, press Mod-Shift-q. I think of this as being the equivalent of clicking the "close" button on other window managers. If the application running in the window has a menu option or other command for close/exit, it's probably better to use that, but if not, or if you are lazy, this does the trick.

2016-01-08-1347541366x768scrot.png

In the first post I mentioned that it is common to use i3 workspaces to group tasks. This is a very good example of that - having one workspace specifically for web browsing, or for Internet browsing/mail/miscellaneous programs. To do this, open a new workspace (Mod-2) then start Firefox again. This time Firefox gets the full screen. Much better.

Note that you can see that there are now two numbered blocks at the bottom left corner of the screen, for the two workspaces. You can then switch between the two desktops by pressing Mod-1 and Mod-2, or by clicking on these number blocks.

Let's go back one step and look at a different possibility. Going back to the screen where we had two windows with a terminal and Firefox, rather than going through the sequence of close Firefox / change workspace / open Firefox, you can simply hit Mod-Shift-2, which will send the existing firefox window directly to workspace 2. Nice. The result is exactly the same as it was for the previous step.

2016-01-08-1402441366x768scrot.png

There is another alternative, if you don't want Firefox to share a split screen but you also don't want it to be on a different workspace (picky, aren't you?). Press Mod-Shift-Space and the Firefox window will "float" above the other windows on its workspace. You can also see here that since the Firefox window is not part of the tiled group any more, the terminal window has expanded again to fill the entire screen space.

The float command (Mod-Shift-Space) works as a toggle, so when you are focused on a floating window like this, you can hit that command again and the window will be tiled into the desktop again.

2016-01-08-1516201366x768scrot.png

There is one more useful way of manipulating windows that I would like to look at before moving on. Similar to floating a window, you can hit Mod-f to display the current window in full-screen mode. The window will take over the entire display, exactly the same as if it were the only thing running. This is also a toggle command, so hit Mod-f again to return to the tiled display.

I have said from the very beginning that i3 is a tiling window manager, and that is true at least in principle. But in fact i3 can also stack windows, in which case only the currently active window is visible and a title bar is added at the top for each window in the stack. A variation of this is tabbed windows, where again only the active window is visible, but only one title bar is added and then split into "tabs" for each window in the stack.

The commands for these modes are Mod-s (stacked), Mod-w (tabbed) and Mod-e (tiled). I will leave it as an exercise for the reader to try these modes out - they are pretty trivial compared to what we have been through already, and it is kind of fun (and instructive) to watch the windows jump around into different layouts as you try them.

In fact, Mod-e has yet another interesting function; if the screen is already tiled and you press Mod-e it will switch the direction of tiling of the current group - if the windows were stacked vertically they will switch to a row horizontally, and vice versa.

2016-01-12-1437581366x768scrot.png

One last topic in window management - resizing windows. As I am sure most people have realized by now, continually splitting the screen space in equal parts is not always what you want to do. You can enter resize mode by pressing Mod-r, and then resize the current window either by using the arrow keys, which change the size in fixed steps, or by using the mouse to drag the window border. When you are finished, hit Esc to exit resize mode.

When you try this you will see that as you change the size of the active window, the adjacent window(s) will also change size. This is the basic characteristic of tiling, that the available screen space is always filled. Here is a simple example, where I have a terminal window that has just a little space at the top of the screen, and a browser which has the rest of the available space.

These concepts of screen management can be extended to include various other common Linux programs. Things like LibreOffice and GIMP fit in nicely; you could easily have a desktop dedicated to Office applications, and another to GIMP and graphical applications.

Oh, here's a small tip about running GIMP with i3. Because GIMP starts with three windows, and i3 doesn't have any idea how to arrange or manage them, they will initially be all crammed together on the screen. If you allow them to float (Mod-Shift-Space) they will sort themselves out, and you can then rearrange and resize them to a pleasing and useful tiled arrangement. In the next post I will be discussing how to configure i3 so that specific applications like this are handled properly on startup.

This is supposed to be a series about "customizing Linux desktops", and so far I have justified this post by thinking that we are customizing by changing the window manager. But I want to get back to the original purpose of the series, which was customizing the look and feel of some window managers.

So for the next post, I am going to combine these two things, and I will try to install the i3 window manager on a Raspberry Pi, and then I will configure and customize it so that it looks good and works well. It should be interesting, and might be exciting.

Read more on Linux and open source:

Editorial standards