Home > Linux, Misc > i3 window manager: quick setup and configuration

i3 window manager: quick setup and configuration


i3 example [Wikipedia]

The i3 window manager is a tiling window manager: it enables power users to operate/arrange/manage application windows in a very fast way in tiles, without any requirements to use a mouse. Alex Booker provides an excellent introduction and overview to the i3 window manager, which is divided into 3 videos: general introduction, configuration, and (visual) fine tuning. In this post we summarize the i3 configuration we use atm for a quick lookup (which is partially based on Alex Booker’s videos).


sudo apt-get install i3

Logout, then login to i3. The i3 configuration wizard starts automatically if there is no i3 configuration file yet (we recommend using Super as the mod key at this point, because Alt is used by a huge amount of applications for other tasks). You can always remove the i3 config file at ~/.config/i3/config and start the wizard again using i3-config-wizard.

Basic usage

We strongly recommend to go through all the shortcuts in the official i3 reference card (it just takes a moment and is the core of how you will operate i3 afterwards). Be aware that if you are using an alternative keyboard layout, i3 automatically detects which keys are located at the positions that i3 would normally use – so you will be able to use the same physical keys, even if you are using a completely different layout.

After being aware of the basic usage of i3, skimming through the official i3 user’s guide will make sense. This should highlight the possibilities with i3 (in both how to operate i3 and how to configure it), which will make later configuration tasks easier by far.

i3 config file

The main i3 config is located in ~/.config/i3/conf. This file is created by i3-config-wizard at first and can be modified as wished afterwards.

Be aware that changing any i3 config at least requires i3 to be reloaded (“restarted in place”) with Mod+Shift+R. Some configuration also require the underlying application that is started/controlled by i3 (e.g. compton) to be restarted. If i3 restarts those applications on each reload depends on its configuration (that’s the difference between exec and exec_always in the config file). If the underlying application was started with exec, restarting the application by hand or logging out/loging back in is required.

(Re)starting i3 from command line

To start i3 from a native tty command line:

DISPLAY=:0 # or :1 etc...
export DISPLAY
# killall i3 # required in case i3 is running
i3 -c .config/i3/config

To instead restart a running i3 from a native tty command line:

i3-msg reload
i3-msg restart

Media buttons etc.

Most likely i3 does not recognize your media buttons correctly from the beginning. You at first need playerctl to enable control over (parts) of the media buttons, of which you can get different packages (including .deb) here. The i3 FAQ then provides a config snippet that can be copied (appended) to your i3 config file to map keys to the media buttons. Be aware that the number of the pulse audio device may be different (in the script it’s 0, but for others it might e.g. be 1). If e.g. the buttons cause the currently focused window to flicker, but the volume does not change, this might be an indication for using the wrong device.

Set wallpaper

You need e.g. feh to set a wallpaper in i3:

sudo apt-get install feh

By adding the following to your i3 config file you always set the wallpaper when i3 is started/reloaded:

exec_always feh --bg-scale /path/to/your/wallpaper.jpg

For different wallpaper scaling options, check out the man page of feh (it provides e.g. –bg-center, –bg-fill, –bg-max, –bg-scale, –bg-tile, …)

Launch applications on specified workspaces

At first, you need to find out the xprop window class of your target application. For this, start xprop and click on the application window. The 2nd string under WM_CLASS(STRING) is the string you need to know in the next step: add the following line to your i3 config file (and replace CLASS with the just determined string):

assign [class="CLASS"] 10

10 in this case indicates the nr. of the workspace the application window should be positioned.

Autostart applications

To automatically start applications, add one of the following lines to your i3 config file:



exec only executes the command when i3 is started, and exec_always executes the command each time i3 is reloaded. For example, starting your web browser is only useful for each fresh i3 start, but setting the wallpaper is useful to be done each time i3 is reloaded.

Monitor configuration

An easy way to configure the monitor setup using an UI is with arandr (UI for randr):

sudo apt-get install arandr

If you want to make a certain monitor configuration permanent you can a) configure monitors as wished in arandr, then b) save the configuration to a file, and c) add “exec_always CONFIG_FILE” to your i3 config file.

Wifi controls

i3 does not come with a built in UI for to control your wifi. To avoid configuring it via config files (which is still pretty cumbersome in Linux after all those years) you can use e.g. the graphical frontend wicd-gtk:

sudo apt-get install wicd-gtk

Change system fonts

One possible cosmetic improvement is to use different system fonts in i3. Alex recommends the Yosemite San Francisco Font: you can download it from its github page (under “manual install”), then change the font entry in the i3 config file to:

font pango:System San Francisco Display 10

Further, changing the font for the used gtk is recommended. You can do this is the gtk configuration file (in ~/gtkrc-2.0 and/or .config/gtk-3.0/…) by changing the font line to e.g.:

gtk-font-name="System San Franzisco 10"

Another option is to use the lxappearance config UI (but it currently seems buggy as not detecting all installed fonts correctly, as long they are not already in use with the system):

sudo apt-get install lxappearance

Replace dmenu with rofi

sudo apt-get install rofi

In the i3 config file, replace the dmenu-shortcut with e.g.

bindsym $mod+a exec rofi -show run -lines 20 -eh 1.3 -opacity "85" -bw 0 -font "System San Francisco Display 10"

or, to have different colors:

set $bg-color   #2f343f
set $text-color #f3f4f5
bindsym $mod+a exec rofi -show run -lines 20 -eh 1.3 -opacity "90" -bw 0 -bc "$bg-color" -bg "$bg-color" -fg "$text-color" -hlbg "$text-color" -hlfg "$bg-color" -font "System San Francisco Display 10"

Transparency and fading effects

i3 does not provide for transparency or fading effects itself (it has less purpose in doing so, as e.g. windows don’t overlap in a tiling arrangement). To add those, use e.g. compton:

sudo apt-get install compton

and add “exec compton” to your i3 config file. The configuration is for compton is done via ~/.config/compton.conf, which you first have to copy from the example file location. With Ubuntu, this is:

cp /usr/share/doc/compton/examples/compton.sample.conf ~/.config/compton.conf

Afterwards, you can change settings there to your needs. We usually do the following:

  • Increase window fading speed, which is specified in milliseconds between fading steps: “”fade-delta = 5;”
  • Remove transparency from unfocused windows and menues (increases their readability). To do so, comment out “inactive-opacity” and “menu-opacity”.

Replace the i3status bar (bottom/top bar) with i3blocks

sudo apt-get install i3blocks

Copy the example i3blocks config file:

cp /etc/i3blocks.conf ~/.config/i3/i3blocks.conf

And change the value of the “status_command” from “i3status” with “i3blocks -c ~/.config/i3/i3blocks.conf” in your i3 config file.

Then you can customize i3blocks in your ~/.config/i3/i3blocks.conf file. For example:

  • Set the interval of date/time to 1 to have a 1s time update interval.
  • For volume add “command=/usr/share/i3blocks/volume 5 pulse” and set the interval 1 to use the pulse audio volume level with 1s interval.
  • Replace the text of labels with character/utf-8 icons as you like – this saves space in the bar. Alex has some nice examples for this in his own config file on github.

Workspaces on predefined screens

For users using a multi-monitor setup configuring to which screen specific workspace automatically go might be interesting:

# put workspaces on specific screens
workspace 1 output HDMI-1
workspace 2 output DVI-I-1

More i3 shortcuts

  • Auto back-and-forth: after switching from workspace A to workspace B, pressing the shortcut for workspace B again to switch back to workspace A. Add “workspace_auto_back_and_forth yes” to enable this feature.

Application configuration

Usability of some applications benefits from some more configuration:

  • The new mail attention add-on for Thunderbird makes i3 raise the urgent notification flag for new mails, so that the corresponding workspace is highlighted.
  • Enabling the “Message Notification” add-on in Pidgin makes i3 raise the urgent notification flag for new messages, so that the corresponding workspace is highlighted.

More hints

As i3 does not come with a built in network configuration UI: to configure networks like VPNs you can use the following (parts of the network-manager and network-manager-gnome packages):

  • nm-connection-editor allows editing network settings
  • nmtui allows for activating/deactivating networks over the command line

Backup your i3 configuration

Most (if not all) i3 configuration is located in those 3 files, which consequently are the only ones that need to be backed up:


Categories: Linux, Misc
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: