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)
- $mod+Enter - terminal. By default it's gonna try to open
urxvt
- $mod+D - dmenu (app menu)
Window management
- $mod+Shift+Q - close the current window.
- $mod+V - vertical mode. All windows will be arranged vertically.
- $mod+E - tiling mode. All window well be arranged in their own tiles.
- $mod+W - tab mode. New windows will be opened in the horizontal tabs in one pane.
- $mod+S - stacking mode. Same as mode, but the arrangement will be vertical - as a stack.
- $mod+R - resize mode.
- $mod+Shift+←/↓/↑/→ - move the window to specified direction.
- $mod+←/↓/↑/→ - focus on the window at the specified direction.
Resize mode
- there will be the label
resize
in the left corner of the statusbar - $mod+← - expand the window to the left
- $mod+→ - expand the window to the right
- $mod+↑ - expand the window upwards
- $mod+↓ - expand the window downwards
- Esc - quit the resize mode
Session
- $mod+Shift+E - quit the session
- $mod+Shift+R - reload the i3 config
-
To unlock the screen, you have to just type your password on the keyboard.i3lock # locks the screen
Workspaces
- $mod+Shift+0-9 - create a workplace on the specified slot
- $mod+0-9 - switch to a workplace on the specified slot
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.
bindsym $mod+shift+l exec i3lock
- binds the hotkey on executing a shell command.exec rhythmbox
- executes a shell command on creating the i3 session. You can use it for apps auto-start.exec_always rhythmbox
- executes a shell command on every i3 config reload.
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
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
:
-c #ff0000
- background color (it's white by default)-i path/to/image.png
- background image-u
- removes the password indicator
man i3lock
for more information.