Your Guide to a Practical Linux Desktop With i3WM

Robert Washbourne - 3 years ago - desktop environments

Technically, what you see in my screenshot above is not really i3. The distance between the windows and the screen edges is from a fork of i3, dubbed i3-gaps, created by Ingo Bürk. Also, the bar is an alternative to i3bar, which I will go over later in the list of bars for i3.

i3WM is not a traditional desktop environment, such as Unity or Gnome. Instead, it is only a window manager, and it's only purpose is to control the layout of your screen. i3 is not recommended for beginners to Linux, as all the configuration you do is in text files, with almost no gui.

You have two major choices for configuration in i3. You can have the files in a dot folder (such as /home/user/.i3/) or in the .config folder (/home/user/.config/i3/). It does not really matter which you use, but in this guide I will be referring to the .config approach.

Installing

If your distro is not listed, look it up. You should be able to find instructions easily.

Arch

sudo pacman -S i3

Ubuntu

source

# login to the root shell for one 'echo' command sudo -i echo "deb http://debian.sur5r.net/i3/ $(lsb_release -c -s) universe" >> /etc/apt/sources.list logout # we've returned to our user account sudo apt-get update sudo apt-get --allow-unauthenticated install sur5r-keyring sudo apt-get update sudo apt-get install i3

Fedora

source

sudo dnf install i3 i3status dmenu i3lock

If you are using Arch, the easiest way to get to i3 is with a session manager.

I reccomend lightdm, which can be installed from the aur with

yaourt -S lightdm-webkit-greeter

When you install i3, it gives you a choice of using the defaults or setting it up yourself. If you are a beginner, I recommend using the defaults, which includes a mod key of Alt . You use the mod key in several keyboard shortcuts, such as when you move windows or resize them.

Using i3

Here are the keyboard command to use i3. They might seem complicated and hard to use at first, but with time they become second nature. When I was using Ubuntu on my friends laptop, I found myself tapping Alt + Enter for a terminal. Remember, if you stuck with the defaults, Mod is Alt .

Mod + Enter

This opens a terminal.

Mod + Arrow Keys

This selects a window, kind of like Alt Tab.

Mod + Shift + Arrow Keys

This moves the selected window.

Mod + Shift + Space

This floats the window. Move with Alt drag , resize with Alt right click drag .

Mod + R

This enters resize mode. Resize using the arrow keys, exit with Enter .

Another useful method to resize windows is Alt + right click drag .

Mod + H

This sets the layout mode to horizontal. New windows tile left and right.

Mod + V

This sets the layout mode to vertical. New windows tile up and down.

Mod + W

This sets the layout mode to tabs. New windows are tabbed.

Mod + S

This sets the layout mode to stacked. New windows are stacked.

Configuring

.config/i3/config is the file that controls the window manager. Here, you define startup applications, custom keyboard shortcuts, and layout rules. If you use i3bar, this is where you configure it.

Useful snippets

Place these at the end of the file ( .config/i3/config ). Exec means run command.

Set a background with feh

exec feh --bg-scale /path/to/your/image.png

Restore set background (chosen with gui) using nitrogen

exec nitrogen --restore

Start compton for window effects

exec --no-startup-id compton

Open dmenu desktop (application search) with the super key

bindsym Super_L exec i3-dmenu-desktop

Lock the screen with Control+Alt+L

bindsym Control+Mod1+l exec i3lock

Bind your audio keyboard keys to change volume and pause/play

bindsym XF86AudioRaiseVolume exec amixer -q set Master 5%+ unmute bindsym XF86AudioLowerVolume exec amixer -q set Master 5%- unmute bindsym XF86AudioMute exec amixer -q set Master mute bindsym XF86AudioPlay exec playerctl play-pause bindsym XF86AudioNext exec playerctl next bindsym XF86AudioPrev exec playerctl previous

GTK

You can change gtk settings with lxappearance. If you need to choose a theme, check out my article on the best linux themes.

Bars

Bars are what you use to see info on your system, and in some cases launch apps and change settings. The default bar is i3bar with i3status, so that is not included here. If you want the same look as the screenshots, the files are linked.

Lemonbar



Lemonbar is very configurable and is probably the most popular solution, but has no clickable areas . To get this look, install lemonbar, and download the dots.

To run lemonbar on startup, add

exec /path/to/i3_lemonbar.sh

to your .config/i3/config file.

Yabar



This is my custom config for yabar, a simple bar from /u/geommer. Open the image in a new tab, because it looks small on the website. To get this config, install yabar and edit .config/yabar/yabar.conf with the contents of my gist.

To run yabar on startup, add

exec --no-startup-id yabar

to your .config/i3/config file.

XFCE4 Panel



Xfce4 panel can be run on i3, and it looks pretty good. This is a good option if you want a GUI config.

To run it on startup, add

exec --no-startup-id xfce4-panel --disable-wm-check

to your .config/i3/config file.

Positron Bar



Positron bar is another alternative to i3bar, with the clickability that lemonbar and yabar lack. It is powered by Node.js and styled with css. Follow the instructions in the git repo to install it.

Wrapup

Have fun with i3! You can do some pretty cool stuff with it.