mmap.page

i3 Quick Start

Keybindings

When starting i3 without a config file, i3-config-wizard will let you choose Alt or Win as the Modifier, and generate a configure file. However, it will generate keybindings based on the key positions of QWERTY layout. Since I am using dvorak, so I copied /etc/i3/config to ~/.config/i3/config and replaced Mod1 (Alt) with Mod4 (Win) instead.

$mod+key function
Enter terminal
d dmenu
Arrow Keys move focus
Shift+Arrow Keys move window
0-9 switch workspace 10,1,...,9
Shift+0-9 switch workspace 10,1,...,9
a navigate one container up the tree
h/v split container splith/v
e toggle splith/v
f toggle fullscreen
s/w stacking/tabbed
Shift+Space toggle floating
Shift+q close window
Shift+r restart i3
Shift+e exit i3
Secondary mouse button adjust window size
r enter resize mode

Notes:

  1. By default, i3 uses dmenu_run, displaying all commands in $PATH. To only display applications shipping a .desktop file, replace dmenu_run with i3-dmenu-desktop instead.
  2. Multiple screens share workspaces. Workspace will be bound to the focused screen on its creation. Switching to a workspace will focus its screen.
  3. In resize mode, press arrow keys (or jkl;) to resize focused window: Left/Right: shirk/grow width; Up/Down: shrink/grow height; Esc: escape resize mode.

Configurations

Edit ~/.config/i3/config:

# No title bar, window borders
default_border none
# For old versions
# new_window none
# When already on workspace N, $mod+N will switch to the previous focused workspace
workspace_auto_back_and_forth yes
# Hide i3bar
bar {
    mode hide
    status_command i3status
}
# Lock screen
# keybinding inspired by macOS
bindsym Mod4+Ctrl+q exec --no-startup-id "i3lock -i $HOME/Pictures/wallpaper/F14-final-wallpaper-updated.png"
# i3lock-img is a shell script of the above i3lock command line
exec_always --no-startup-id "xautolock -time 1 -locker i3lock-img"

Layouts

A container contains windows or containers.

A container has one of the following layouts:

switch keys layout move focus
$mod+e tiling (it toggles splitv/splith) $mod+up/down/left/right (depends on orientation)
$mod+s stacking $mod+up/down
$mod+w tabbed $mod+left/right

And $mod+f will toggle fullscreen mode of the current window.

A new opened window will appear in the current container, next to the current window:

A new container can be created explicitly by splitting the current container vertically ($mod+v) or horizontally ($mod+h). And moving windows may implicitly create containers.

For example, suppose we have three windows in a splith container (window c is focused):

|a|b|c*|

$mod+Shift+Up results in the following layout:

|  c*   |
| a | b |

Here window a and b are in an implicitly created new container. That is,

splith             splitv
 / | \    --->      /   \
a  b  c            c   splith
                        /  \
                       a    b

Similarly, if we focus window a ($mod+Down), and move it up ($mod+Shift+Up):

| c  |
| a* |
| b  |

then move it left ($mod+Shift+Left), we will get the following layout:

|    | c |
| a* |
|    | b |

Let's review the whole process:

|a|b|c*|  --> |  c*   |  --> | c  | --> |    | c |
              | a | b |      | a* |     | a* |   |
                             | b  |     |    | b |

splith             splitv             splitv           splith
 / | \    --->      /   \       --->   / | \   --->     /   \
a  b  c            c   splith         a  b  c          a    splitv
                        /  \                                 /  \
                       a    b                               c    b

KDE

You can use i3 with other desktop environments such as KDE.

If you use i3 in KDE, you may want to uncomment the xautolock line above to lock screen via KDE. Also, vertical KDE panel is not supported under i3.