Breder.org

The Tiling Window Manager i3 for Linux is Pretty Interesting

Updated: 2023-07-24

A window manager is the program responsible for arranging programs to be displayed on the screen. Every consistent behavior you see of program windows with regards to showing a title bar; having close, minimize and maximize buttons; and the resizing and dragging behaviors, are all handled by the window manager of your platform of choice.

A floating window manager is the more common incarnation due to the user-friendliness, but it's not the only way to do it. i3 is a popular window manager for Linux which implements the tiling window manager paradigm. Here are the differences:

I've realized that what I tend to do with a classical floating window manager tends to mimic a tiling behavior anyway (such as using two programs side-by-side taking each a half of the screen), so I decided to try out i3.

i3 configuration

After a few hours of confusion and strangeness, I got used to the i3 keybindings and was able to do the usual terminal and web browsing activities. i3 is mainly keyboard-driven, which do I appreciate, but does entail in a learning curve to even get basic things done with it.

I needed to rebind the directions to the vim counterparts (hjkl for “left”, “down”, “up” and “right”), as that “muscle” memory is very much ingrained in me.

You are encouraged to configure every keybinding and behavior through a self-explaining simple configuration file syntax. This is what I've settled upon:

.config/i3/config

set $mod Mod1
set $super Mod4

font pango:Monospace Regular 10

# tray icons, background processes
# sudo apt pacman -S mate-media (for volume control tray icon)
exec --no-startup-id dex --autostart --environment i3
exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork
exec --no-startup-id nm-applet
exec --no-startup-id mate-volume-control-status-icon

# start with two terminal windows open
exec i3-sensible-terminal
exec i3-sensible-terminal

floating_modifier $mod
tiling_drag modifier titlebar
default_orientation horizontal

# launch programs
bindsym $mod+d exec --no-startup-id i3-dmenu-desktop
bindsym $mod+Return exec i3-sensible-terminal
bindsym $mod+Shift+Return split toggle, exec i3-sensible-terminal
bindsym $super+1 exec thunar
bindsym $super+2 exec chromium

# quit active program
bindsym $mod+Shift+q kill

# change focus
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right
bindsym $mod+a focus parent
bindsym $mod+Shift+a focus child

# move focused window
bindsym $mod+Shift+h move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+l move right


# change container layout, splitting
bindsym $mod+s layout stacking
bindsym $mod+t layout tabbed
bindsym $mod+e layout toggle split
bindsym $mod+b split h
bindsym $mod+v split v

# define workspaces
set $ws1 "1"
set $ws2 "2"
set $ws3 "3"
set $ws4 "4"
set $ws5 "5"
set $ws6 "6"
set $ws7 "7"
set $ws8 "8"
set $ws9 "9"
set $ws10 "10"

# switch to workspace
bindsym $mod+1 workspace number $ws1
bindsym $mod+2 workspace number $ws2
bindsym $mod+3 workspace number $ws3
bindsym $mod+4 workspace number $ws4
bindsym $mod+5 workspace number $ws5
bindsym $mod+6 workspace number $ws6
bindsym $mod+7 workspace number $ws7
bindsym $mod+8 workspace number $ws8
bindsym $mod+9 workspace number $ws9
bindsym $mod+0 workspace number $ws10

# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace number $ws1
bindsym $mod+Shift+2 move container to workspace number $ws2
bindsym $mod+Shift+3 move container to workspace number $ws3
bindsym $mod+Shift+4 move container to workspace number $ws4
bindsym $mod+Shift+5 move container to workspace number $ws5
bindsym $mod+Shift+6 move container to workspace number $ws6
bindsym $mod+Shift+7 move container to workspace number $ws7
bindsym $mod+Shift+8 move container to workspace number $ws8
bindsym $mod+Shift+9 move container to workspace number $ws9
bindsym $mod+Shift+0 move container to workspace number $ws10

# restart i3 inplace
bindsym $mod+Shift+r restart

mode "resize" {
        bindsym $mod+h resize shrink width 10 px or 10 ppt
        bindsym $mod+j resize grow height 10 px or 10 ppt
        bindsym $mod+k resize shrink height 10 px or 10 ppt
        bindsym $mod+l resize grow width 10 px or 10 ppt

        # back to normal: Enter or Escape or $mod+r
        bindsym Return mode "default"
        bindsym Escape mode "default"
        bindsym $mod+r mode "default"
}
bindsym $mod+r mode "resize"

bar {
        position top
        status_command i3status
}

for_window [class="Galculator"] floating enable
for_window [class="Pavucontrol"] floating enable
for_window [all] title_window_icon on
for_window [all] title_window_icon padding 3px

.Xresources

Adjusting font size and graphics for high-DPI displays:

Xft.dpi: 144

.config/i3status/config

For displaying the Ethernet network status, the audio volume and local time in ISO format in the i3 status bar:

general {
  colors = true
  color_good = "#a3be8c"
  color_bad = "#bf616a"
  color_degraded = "#ebcb8b"
  interval = 1
  separator = "  "
}

order += "ethernet eno1"
order += "volume master"
order += "tztime local"

ethernet eno1 {
	format_up = "Eth"
	format_down = "Eth"
}
volume master {
	format = "V:%volume"
	format_muted = "V:muted"
}
tztime local {
	format = "%Y-%m-%d %H:%M"
}

Resources