Navigating & Using i3 Window Manager15 January 2019
Photo: Andy Crouch
Last week I shared the fact that I have migrated over to i3wm (i3) from a full desktop environment. i3 is a tiling window manager which is much lighter on resources than an environment such as Gnome. It also uses extensive keyboard shortcuts for navigation.
Depending on how you install i3 you may need to set up some basic configuration. If you use a distro like Manjaro i3 then when you log in you will have a working environment. If you install i3 via your existing distro then when you log in you will see a setup wizard. It will offer you the ability to use default options or start with an empty config. I recommend you use defaults. I will follow up the post next week with details on i3 and my configuration.
Now you have a working environment, how do you do anything? Where is the menu? Where are the icons?
The first thing to know is that all the keyboard shortcuts involve the $mod key. You will use the $mod key to open applications, move windows and change workspaces. Most distros tend to use the Windows key as the $mod key. The wizard mentioned above suggests either the Windows key or the left Alt key. The key can be configured in the i3 configuration file using:
set $mod Mod4
(The i3 configuration file is usually found at ~/.i3/config)
As an aside if you want to find a list of alternative mod key mappings to use then run the following in your terminal:
Now we have the $mod key configured how do we use it? The equivalent of a “Hello World” example for i3 is to execute the $mod+Enter command. This will open a terminal.
If you repeat the $mod+Enter command you will get a second terminal open to the right of the first terminal.
This is the “tiling” idea that is core to i3. You can divide up your workspace by tiling horizontally or vertically. By default in a workspace when you open a new application window it will open horizontally tiled. If you want to tile your next application under a current one then you need to use $mod+v to change the behaviour. You can use $mod+h to switch back to horizontal split mode.
You can change the focus of the open applications by using $mod+ one of the arrow keys. You can also move between windows using keys from the home row (like Vim). $mod+j moves to the left and $mod+; moves to the right. $mod+k moves up and $mod+l moves down. You can mix in the shift key to the arrows of home row keys to actually move the application window within the tiling layout of the current workspace. So if you have a browser and the terminal open split horizontally and hit $mod+shift+j then you will have the terminal and the browser instead.
When you launch a new i3 session you will start on workspace 1. There are 8 workspaces you can access using $mod+1 through to 8. Most configurations will only show the workspace indicator in i3 bar if you have an application open within it. If you open an application on workspace one and decide you want to move it to workspace 2 then you can use $mod+shift+ workspace number.
Obviously, tiling is very useful but there are times you need to full screen a window. To do that you can use $mod+f and to exit full screen you also use $mod+f. In order to close an application window, you use $mod+shift+q.
OK, so we can open terminals and move between them and move them to over workspaces. How do we open our applications? You use d-menu. d-menu is a dynamic menu system for X and is almost always used by default within i3. To open the menu you use $mod+d and then type the application name you want to open. To dismiss the menu you can use the Esc key.
The last main key combinations to know about are how to handle switching layout mode. i3 supports three layouts. Tiling is what we have been using up until now. It also supports stacked and tabbed layouts. You still move between the stacked application windows or tabs with the $mod+ arrow keys (or home row). You move to stacked layout using $mod+s. You move to tabbed layout using $mod+w or you revert to tiled layout using $mod+e. $mod+e will also change the tiling mode from horizontal and vertical.
So that sums up opening applications, navigation, moving between applications and workspaces and closing the applications down. To exit i3 you need to hit $mod+shift+e which will bring up the i3 nagbar and ask if you really want to exit. Ironically you have to click “yes” with you mouse! That will return you to your login manager.
I will leave you with some references for further reading on i3 and using it which I found useful:
- The Official Documentation.
- Fedora Magazines Getting Started With The i3 Window Manager.
- i3 Cheat Sheet.