Efficient window management with i3!

Among the various things I like about using Linux as a basis for my development environment is the possibility for me to choose the window manager fitting my needs and requirements.

Plenty of them are available, from really sophisticated ones with lots of graphical effects, to some extremely simple ones with the bare minimal amount of features. i3 would probably fall in that second category in comparison with other popular solutions like Gnome, KDE, or XFCE for example. The main strength of i3 is that it’s a tiling window manager, which means that windows aren’t floatting containers, like they usually are in most of the window managers, but rather containers which are organized as tiles, placed one after the others. Because of that, it’s extremely easy to work with multiple windows opened at the same time, and you don’t have to think about organizing those windows anymore: i3 is doing it all for you. By allowing tiling, tabbing, or stacking of windows, i3 lets you define exactly how you’d like your desktop to look!

The next thing I love about i3 is that absolutely everything can be done from the keyboard only. Moving a window next to another one? Sending a window to another virtual desktop? Resizing a window? Easy and customizable keyboard shortcuts are there for you to perform all the actions you need! This allows you to focus on what you’re doing, like coding, debugging something, or testing software, by switching between windows quickly and easily without even needing your mouse!

How to use i3?

First of all, you obviously need to install it, and run it. That all depends on your Linux distribution so I’ll let you have a look at i3’s website) for instructions.

Once installed, you’ll have to pick i3 as your window manager. This time, it’ll all depend on your login manager, some graphical ones allow you to pick the window manager you want from a small menu before logging in, while some other login manager require to modify a configuration file to specify which window manager you want to use. Again, I’ll let you have a look at your documentation to see how to select it depending on your configuration.

Let’s come to the interesting part: everything in i3 is configured through one configuration file, ~/.i3/config.

Everything is nicely documented on their website, and you’ll find all the configuration possibilities you may think about, but let’s go trough a few examples for you to see how easily it is:

Defining variables

You can define variables in your configuration file for factorizing what you do. It’s as easy as:

set $mod Mod4

set $pink #f02093
set $yellow #fdf215
set $green #abd543
set $blue #03adf1
set $purple #a23095

Defining shortcuts

All shortcuts can be completely customized by using this simple syntax:

# focus management
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right

# move windows
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right

By the way, these shortcuts allow to illustrate that everything you do with i3 is actually a simple i3 command. For example, the line bindsym $mod+Left focus left means that while pressing the mod key + the left key, I’ll execute i3 focus left command.

Of course, this means you can interact extremely easily with your window manager from scripts or other programs!

Using scratchpad

i3 also has some nice little features like scratchpad for example! With this little configuration:

# make window a scratchpad
bindsym $mod+Shift+b move scratchpad

# show scratchpad window
bindsym $mod+b scratchpad show

It allows you to put a window in a small scratchpad that you can hide and show whenever and wherever you need! Which is extremely useful while taking some notes for example.

Managing workspaces

As most of window managers on Linux, i3 also comes with some workspaces management. Again with some easy shortcuts capabilities:

# workspace direct switch
bindsym $mod+ampersand workspace $WS1
bindsym $mod+eacute workspace $WS2

# move window to workspace
bindsym $mod+Shift+ampersand move container to workspace $WS1
bindsym $mod+Shift+eacute move container to workspace $WS2

Working with workspaces becomes very intuitive and easy thanks to easy shortcuts.

Launching programs easily

Modes are a feature from i3 allowing to kind of isolate some shortcuts depending on the mode they’re executed in. For example, you could have a mode allowing you to easily execute programs from a simple shortcut:

set $launcher_mode "launcher"

bindsym $mod+Return mode $launcher_mode

mode $launcher_mode {
  bindsym c exec code, mode "default"
  bindsym f exec firefox, mode "default"
  bindsym Return exec termite, mode "default"

  bindsym Escape mode "default"
}

Which you can of course customize for whatever you need.

Assigning applications to workspaces

Finally, a last feature I’d like to highlight is the possibility with i3 to automatically attach an application in a particular workspace, allowing you to easily remember where to find the applications you’re using:

# WS1: Terminals
assign [class="Terminator"] $WS1
assign [class="Termite"] $WS1

# WS2: Text Editors
assign [class="Atom"] $WS2
assign [class="Code"] $WS2

Thanks to this kind of configuration, it allows you to nicely and easily organize your applications!


You got it, I really enjoy using i3 as my window manager, and I definitely recommend it for a development environment. In my opinion, that really is a nice productivity enhancer and it helps focusing on what you’re actually doing.

If you’d like to go further with it, you can find my complete i3 configuration file directly from my dotfiles repository.

Thank you very much for your time and attention, and have a great day!