How To Install and Configure i3-wm

How To Install and Configure i3-wm

easier-docs-js-hero-image

i3-wm is a simple manual tiling window manager for linux. This tutorial will cover how to install it and configure it your liking.

Installation

Ubuntu/Debian

sudo apt install i3
# install additional packages
sudo apt install i3status
sudo apt install dmenu

Arch

sudo pacman -Syu i3-wm
# install additional packages
sudo pacman -Syu i3status
sudo pacman -Syu dmenu

Information about the additional packages

i3status is the package for configuring the default i3-wm status bar.

dmenu is a lightweight application launcher.

Launching i3-wm

If you are trying to launch i3-wm from a terminal, Use the following .xinitrc config.

.xinitrc
exec i3

If you are on some other desktop enviornment like Gnome, Xfce or Cinnamon, Logout and choose i3 option when you are logging in.

i3-wm installation - i3-wm wizard to generate config

As soon as you launch i3-wm it will prompt you if you would like to generate a config. Press Enter to let it generate a config for you. Also it will ask you to choose between the <Win> key or the <Alt> key. You can choose between the two of those but this guide will be based on Alt
Regardless, there will not be much differences.

Configuration

Based on what you chose, i3-config-wizard will generate config for you. at

~/.config/i3/config

open this file in vim or nano to edit the config file.

for full reference for this guide, visit the i3-wm userguide

We will only cover basic configuration and use.

Reload your config when you change it with $mod+Shift+c Or restart i3-wm with $mod+Shift+r restart

Change weird default keybindings

Change keybindings to use vim keys

~/.config/i3/config
# change focus
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right

# move focused window
bindsym $mod+Shift+h move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+l move right

# split in horizontal orientation
bindsym $mod+b split h

# split in vertical orientation
bindsym $mod+v split v

# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle

# change container layout (stacked, tabbed, toggle split)
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# toggle tiling / floating
bindsym $mod+Shift+space floating toggle

Fonts

You can install a font and use this line in your config to change your font.

This last number is the font size

~/.config/i3/config
font pango:monospace 8

Set a wallpaper

In order to set a wallpaper, You need to install feh

Debian

sudo apt install feh

Arch

sudo pacman -Syu feh

Now Add the following line to your i3-wm config with a correct path to the image.

~/.config/i3/config
exec --no-startup-id feh --bg-fill ~/wallpaper.png 

This i3-wm config command launches the given command when the config is loaded when i3-wm is launched each time.

Currently the config looks for a wallpaper.png in your home directory. So make sure you have them.

Remove window titles and change border size

~/.config/i3/config
for_window [class="^.*"] border pixel 1
new_window 1pixel

Bind a key to a command

bindsym will bind the mentioned key to a command.

--release ensures that the command is executed when the key is released. This is optional

~/.config/i3/config
bindsym --release Print exec --no-startup-id scrot 

scrot is a linux cli tool to take a screenshot. This can be any command you wish to execute.

So now when the PrintSc or Print key is pressed on your keyboard, a screenshot will be taken.

Last updated on