Being productive also means being able to navigate between open windows on your computer efficiently in your daily routine. The famous ALT + TAB for those who are used to it may not seem so bad, but it’s possible to greatly improve our efficiency when looking for that open window with our files or that Slack conversation where you received a notification.
On Linux we have several window managers that allow for various setups, and among them is what we’re going to talk about today, which is i3.
Important Distinctions
Before we talk about i3, it’s important to define some terms and where exactly i3 fits in the Linux world:
- Display servers: responsible for creating the graphical environment (Xorg, XFree86, X11);
- Login managers: responsible for allowing login to the local system (gdm, lightdgm, cdm);
- Window managers: controls the distribution and decoration of windows (i3, fluxbox, metacity)
- Desktop environment: suite of applications that share the same graphical interface (KDE, GNOME, XFCE)
What is i3
It’s a window manager that supports stacking, tabbed layout, and window tiling, which is what makes i3 so efficient. The tiling layout organizes windows so they don’t overlap, arranging them both vertically and horizontally.

It’s possible to organize your windows in different workspaces, configure shortcuts to open programs with specific sizes, floating windows, multi-monitor support, and much more.
The $mod Key
i3 makes use of a modifier key, which by default is ALT (Mod1), but which has been adopted by the community as the SUPER key (Windows key, Mod4). This modifier key is used in conjunction with other keys for shortcuts defined in the configuration file, such as:
# Open terminal
$mod+ENTER
# Close a window
$mod+SHIFT+Q
# Go to workspace 1
$mod+1Throughout this article, the default shortcut for some commands will be shown using $mod to exemplify some actions.
Workspaces
This is a very important feature when organizing your windows: it’s an easy way to group a set of windows in different places, work areas. For example, you choose your browser to always open in workspace 1, your communication apps in workspace 2, in workspace 3 you specify to always open on your second monitor with Spotify, and so on.
To switch from one workspace to another, simply press $mod + num where num is the number of the workspace you want to open.
To move a window to another workspace, simply press $mod + Shift + num where num is the number of the workspace you want to send the window to.
Configuring i3
To configure i3, simply edit your configuration file located at ~/.config/i3/config. When running i3 for the first time, you’ll be offered an option to generate a configuration file with some defaults, which is always a good idea to accept, in case you don’t already have a configured file.
This file will have some very interesting defaults to start using i3, such as some shortcuts, window rules, among others. It’s worth noting that variables can be defined in the configuration file:
# Define workspaces
set $console "1: term"
set $browse "2: browse"
set $code "3: code"
set $study "4: study"
# Using variables:
# Shortcut to access workspace $study
bindsym $mod+4 workspace $study
# Associates sublime text to always open in workspace $study
assign [class="^Sublime_text$"] $studyDefining Shortcuts
To define shortcuts for programs, simply use:
bindsym [--release] [<Group>+][<Modifiers>+]<keysym> command
bindcode [--release] [<Group>+][<Modifiers>+]<keycode> commandSome examples of shortcuts:
# Toggle fullscreen
bindsym $mod+f fullscreen toggle
# Restart i3
bindsym $mod+Shift+r restart
# Simulates pressing ctrl+v when pressing $mod+x
bindsym --release $mod+x exec --no-startup-id xdotool key --clearmodifiers ctrl+vDefining Rules for Windows
In i3, it’s possible to specify rules for different windows such as behavior, size, and where the window will open. To do this, you need to have one or more of the following window properties: title or class. To find out the title or class of a window, we can use the xprop tool which, when executed in the terminal, will change your cursor to a cross and you should click on the window you want to get information about. After that, the following output will be presented in the terminal, with window information.
**WM_CLASS(STRING) = "Alacritty", "Alacritty"**
XdndAware(ATOM) = BITMAP
_MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x2, 0x0, 0x1, 0x0, 0x0
_NET_WM_NAME(UTF8_STRING) = "Alacritty"
WM_NAME(STRING) = "Alacritty"
The bold text represents the class. In this case, we can create a rule for windows of the Alacritty class to behave in a floating manner and be moved to workspace 4 with the following configuration:
for_window [class="^Alacritty$"] floating enable, move container to workspace 4Some other examples:
# Adds 1 pixel border to all windows removing decoration
for_window [class=".*"] border pixel 1
# Disables floating for the window and makes it fullscreen
for_window [class="^deadcells$"] floating disable, fullscreen enable
# Specifies the size the window should open, enables float mode and centers it
for_window [class="^terminal"] resize set 900 600, floating enable float, move position centerDefining Shortcuts for Programs
To execute a program, the following syntax is used:
exec [--no-startup-id] <command>Examples:
# Shortcut to start google chrome
bindsym $mod+g exec google-chrome
# Opens i3 settings in sublime
bindsym $mod+i exec --no-startup-id subl ~/.config/i3/config
# Changes focus, splits container vertically and starts terminal
bindsym Control+Mod1+d focus child; split v; exec --no-startup-id i3-sensible-terminalAssociating Windows to Workspaces
A great feature is being able to associate windows to workspaces. Let’s say you create a mental map where your browser will always be in workspace 2, Slack in workspace 8, Spotify in workspace 7, and so on. It’s much easier to find what you’re looking for, right? To do this, simply add some rules in the same way we do for the for_window directive, but the syntax is a bit different:
assign <criteria> [→] [workspace] [number] <workspace>
assign <criteria> [→] output left|right|up|down|primary|<output>Examples:
# Associates google chrome to always open in workspace number 2
assign [class="Google-chrome" window_role="browser"] 2
# Associates PHPStorm to always open in workspace number 3
assign [class="jetbrains-phpstorm"] 3
# Associates google chrome to open on the monitor to the right of the current one
assign [class="Google-chrome"] output right
# Associates google chrome to open on the primary monitor
assign [class="Google-chrome"] output primaryThere are many more i3 configuration possibilities than those mentioned here. To see more, check out the documentation here.
Advanced: How i3 Works
In i3, all information about workspaces and windows is stored in a tree. The root node of this tree is the X11 root window (display server), followed by containers, workspaces, and finally the windows themselves.
Containers can have other containers or windows within themselves. Each container has an orientation (horizontal, vertical, or unspecified) and the orientation depends on the layout the container is in. Below is an example of a container with splith, two windows:

And an example of how it would be represented in the tree:

Above we have an example of when we start i3 with a single monitor, we have a single workspace and two terminal windows. The default layout for this workspace is called SPLITH. If you decide to change the layout to SPLIV (vertical) and open two terminals, you’ll end up with something like this:

To make it even more interesting, i3 allows splitting anything. Let’s say that in the previous example you want to open another terminal, but this time to the right of TERMINAL2. Simply put focus on the TERMINAL2 window and do SPLITH ($mod+H):

Example of what the tree would look like:

i3 Helps, But Doesn’t Work Miracles
With all this, we can already have an idea of the possibilities in managing and organizing the environment’s windows and how i3 works behind the scenes to ensure this flexibility in its operation.
Although i3 gives us the possibility to be more agile and productive in our daily lives, it’s our responsibility to take the time to configure it in the best way that meets our needs. This time can be costly, but the result is incredible: it allows you to do much more than the basics in an operating system than what we’re used to.
For a more complete view of everything offered by i3, I leave some useful links below for reference (worth checking out!):