Skip to content

My own i3 cheatsheet.

Basics

The mod key ($mod) - is the primary key that is part of pretty much every hotkey in i3. Usually the $mod key is Super (Win), and it's recommended to leave it as it is. I tried using the L Alt key, but at the time i3 key had some problems.

Arrow heys

In i3, besides of the arrow keys you can use the following keys:

J K L ;

It's kinda like arrow keys in Vim, but shifted by one key to the right.

Apps (basics)

Window management

Resize mode

Session

Workspaces

Configuration

When you launch i3 for the first time, the setup wizard will be opened, and it will propose to create a config file. If you somehow skipped it, you can do it re-launch the wizard:

i3-config-wizard

The new configuration will be located at ~/.config/i3/config.

Now you have to edit the config to your preference and, when you're done, reload the config by pressing $mod+Shift+R.

Font

You can change the font of the title bars and i3bar with the following line.

font pango:JetBrainsMono Nerd Font 8

Wallpaper

feh

Install feh

# ubuntu, debian
sudo apt install feh
# fedora
sudo dnf install feh
# archlinux
sudo pacman -S feh

In i3 config, add the line

exec_always feh --bg-scale /home/$USER/Pictures/wallpaper.jpg

nitrogen

# ubuntu, debian
sudo apt install nitrogen
# fedora
sudo dnf install nitrogen
# archlinux
sudo pacman -S nitrogen

In i3 config, add the line

exec --no-startup-id nitrogen --restore

Now launch nitrogen via terminal or dmenu and choose a wallpaper for each monitor you have, choose the filling mode and press the "Apply" button.

HiDPI

Source

Just create a file ~/.Xresources add a line

Xft.dpi: 144 ## Or 192 for the 200% scale (perfect for 4K monitors)

Keyboard layout switch

In the i3 config, add a line

exec --no-startup-id "setxkbmap -layout us,ru -option grp:win_space_toggle"

In the file /etc/X11/xorg.conf.d/00-keyboard.conf, find the InputClass section and add a line to its end:

Section "InputClass"
    Identifier "system-keyboard"
    MatchIsKeyboard "on"
    Option "XkbLayout" "us,ru"
    Option "XkbVariant" ","
+   Option "XkbOptions" "grp:win_space_toggle,terminate:ctrl_alt_bksp,grp_led:scroll,numpad:microsoft"
EndSection

If you'd like to use Alt + Shift instead ofWin + Spacebar, replace the win_space_toggle part with alt_shift_toggle. You can see the full list of hotkeys in xkeyboard-config manual.

man xkeyboard-config

Change the default terminal

By default, i3-sensible-terminal is launched. It basically tries to launch multiple terminals you could have. Here's the list of those terminals.

You can just set a $TERMINAL variable and use exec $TERNINAL in every hotkey where you need to launch a terminal.

set $TERMINAL alacritty
bindsym $mod+Return exec $TERMINAL

Lock scren

bindsym $mod+l exec i3lock

If you want to use a default $mod + L hotkey, you will have to disable the JKL: keys for navigation between the windows.
You can also use i3-nagbar for a prompt with Mod + Shift + E.

-bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'Do you really want to exit i3?' -B 'Yes, exit i3' 'i3-msg exit'"
+bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'Do you really want to exit i3?' -B 'Yes, exit i3' 'i3-msg exit' -B 'Lock screen' 'i3lock'"

You can use the following flags with i3lock:

man i3lock for more information.