Install and Use i3 Window Manager on Ubuntu

Install i3wm on Ubuntu Linux

i3wm is easily the most popular tiling window manager available right now. It’s lightweight, easy to learn, and easy to configure.

i3 provides the benefits of using a tiling window manager without the hassles of having to write long and sometimes confusing scripts for configuration. i3wm uses a plain text configuration file.

i3 is also very well documented. Documentation is key when using a tiling window manager since you’re responsible for setting up and customizing everything. With i3wm you can usually find the answers to any questions you run across quickly.

What Is a Tiling Window Manager?

It’s time to take a step back. What is a tiling window manager anyway?

A tiling window manager(TWM) is not a full desktop environment. Instead, it just provides enough functionality to control the windows on your screen.

Tiling window managers also lay out their windows in logical subdivisions, breaking down the screen space in a logical pattern. For example, the first two windows that you open on your screen will each take up half of the screen and sit directly next to each other.

Also read: How to Install and Configure bspwm in Linux

Windows do not float around and can’t be dragged from place to place or sit on top of each other unless specified by a user. By default, a tiling window manager will waste absolutely no screen space.

While tiling window managers might not be for everyone, they do provide people who want maximum efficiency and control out of their computer an option to get just that.

Installing i3wm

Note: We will be using Ubuntu as an example in this article. The instructions and usage will be the same for any other distros.

i3wm is available from Ubuntu’s main repositories. You can use Apt to install it.

sudo apt update
sudo apt install i3

You can also install via the Software Center. For other distros you should also be able to find “i3-wm” in your package manager or repository.

Also read: 5 Useful Patches to Improve Your dwm Experience

Using i3wm

After i3’s been installed, you can log out of your current session on Ubuntu to bring yourself back to the login screen. Click the little icon next to the password box. It’ll show you the desktop options. Select i3 and log in as you normally would.

The First Time

What you’re going to find on the other side will be surprising if you haven’t worked with just a window manager before. It’s minimal and it’s ugly. That’s the way it’s supposed to be.

Wx0eNaGzAZU maxresdefault

i3wm doesn’t have a lot of default configuration because it assumes that you want to customize it, and you can, a lot.

Running i3 For the first time on Ubuntu

On your first run you’re going to see a window asking you to create a configuration file. Accept. Then you’ll get another asking which key you want to use as the “Mod” key. It can either be the “Windows” key or “Alt.”

Since i3 is mostly controlled by the keyboard, the mod key serves to differentiate regular typing from commands to i3.

Navigating

Almost everything in i3wm is handled with hotkeys. There are plenty of predefined ones, but you can also change those and make your own. Before you do anything, though, you need to familiarize yourself with the basic ones.

You’re probably going to be working with terminals a lot. Go ahead and open one with “Mod key + Enter.” If you keep pressing “Mod key + Enter,” you’ll see the default pattern that i3 uses for dividing up your screen.

Open terminals in i3

It’s not all that useful when you have a bunch of them. Try re-positioning them. By default, you can navigate using “Mod key + j” to move left, “Mod key + k” to move down, “Mod key + l” to move up, and “Mod key + ;” to move right. This should be sort of familiar to Vim users but slightly off. You can change it to the actual Vim bindings.

If you want to move the windows, you can add “Shift” to any of the directional hotkeys, and the window will move in that direction. So to move a window down, use “Mod key + Shift + k.”

To open new windows split the way you want, you can target the window you want to split and use “Mod key + h” to split the window horizontally and “Mod key + v” to split it vertically.

When you want to close a window, there’s a hotkey for that too – “Mod key + Shift + q.”

Workspaces

i3wm comes with ten workspaces. Each workspace acts as a different virtual screen that you can arrange how you would like with different windows.

To access a workspace, type the mod key combined with the workspace number. So, “Mod key + 3” takes you to workspace 3.

You can move a window to a new workspace by focusing on it and entering “Mod key + Shift + 3” with the number being the workspace that you want to move it to.

Manipulating Windows

i3wm does allow you to use floating windows. Some windows, like the GIMP toolbars, will automatically open floating, but you can make any window float. “Mod key + Shift + Space” will move back and forth between floating and tiled mode for the selected window.

You can also force a window to go full screen with “Mod key + f.” Pressing it again will return it.

Opening Programs

Use a launcher to open programs in i3wm. The default launcher is dmenu, but you can substitute others like rofi in its place.

i3-dmenu

These launchers act like a search for your programs. Punch in the program that you want and hit Enter. The program will launch. The launcher will keep track of your most commonly used programs and display them in a list when it’s opened. You can select them there without typing.

The launcher hotkey is “Mod key + d.”

Basic Configuration

There’s an absolutely insane amount of configuration that you can do with i3wm, so it’s only possible to cover the basics here. These are some of the more common things that you’d want to do.

After creating the default configuration on your first run, it was placed in the “/etc/” directory. You have to copy it to your home to customize it.

mkdir ~/.i3
sudo cp /etc/i3/config ~/.i3/config
sudo chown user:group ~/.i3/config

Don’t forget to change the ownership of the file to your user. The user and group name should both match your username.

Colors

Changing the colors is easy. i3wm uses hex values for colors like CSS. There are a couple of different classes that each have a border, background, text, and indicator value. You can lay them out in a table and plug in the color values that you want.

class                  border    backgr.   text    indicator
 client.focused          #1e1e1e   #1e1e1e   #151515  #AA0000
 client.focused_inactive 
 client.unfocused        
 client.urgent  
 client.placeholder      
 
 client.background       #454545

Applications

In the i3wm configuration, bindsym creates a new hotkey. exec launches programs. You can put them together to make your own hotkeys to launch the programs that you use most without using the launcher. For example:

bindsym $mod+Shift+w exec firefox

You can run applications at startup, too. Just use exec for those.

exec firefox

Status Bar

The status bar is one of the most important parts of your desktop. It displays your workspaces as well as loads of other vital information. With i3wm there are a ton of options for your status bar.

Near the bottom of the configuration file you’ll find a block called “bar.” Everything for the status bar will go in there.

First, you’ll find the “status_command.” It dictates which status bar is used. The default is i3status, but you can use a load of others like i3blocks, lemonbar, and polybar. They are all different and have their own unique benefits and drawbacks.

You can change the position of the bar here, too.

position top

You can create a separate “colors” block here that you can use just like the other color configuration to customize i3’s color scheme.

colors {
        #class             #border   #bg        #txt
        focused_workspace  #454565   #252525    #1E1E1E
        active_workspace   
        inactive_workspace 
        urgent_workspace   
        binding_mode    
        background         #151515
}

What’s Next?

From here you can do anything that you want. There is much more customization that you can do with i3. Search around and get inspired. There are even subreddits devoted to customizing Linux desktops where you can get inspired.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Nick Congleton

Nick is a freelance tech. journalist, Linux enthusiast, and a long time PC gamer.