Switching to i3 from XFCE
This article is mainly to keep track of what I’ve learned and done, configuring my own i3. If you’re new to i3, check out i3wm.org’s userguide
Configuration and keyboard shortcuts
The config file for i3 resides in ~/.config/i3/config
on Manjaro/Arch. Use mod+shift+r
to restart i3 after configuration changes. During first setup you choose a modifier key, normally this would be alt
or command
. If you configure yourself out of a usable system, deleting the config file will reset everything and run the configuration tool again.
The default keyboard shortcuts for getting started are:
Shortcut | Function |
---|---|
mod+enter |
Open new terminal |
mod+j |
Focus left |
mod+k |
Focus down |
mod+l |
Focus up |
mod+; |
Focus right |
mod+a |
Focus parent |
mod+space |
Toggle focus mode |
mod+shift+j |
Move window left |
mod+shift+k |
Move window down |
mod+shift+l |
Move window up |
mod+shift+; |
Move window right |
mod+0..9 |
Switch workspace |
mod+shift+0..9 |
Move window to workspace |
mod+d |
Application launcher (rofi) |
For more keyboard shortcuts, check out i3 reference card from i3wm.org
i3-gaps for the looks
i3-gaps is a fork of the original i3 window manager, which provides some whitespace between the windows. I find it aestethically pleasing. You’re free to configure the different features as you please, this is my current configuration, copied from user twodogsdave on the Manjaro forums:
# Disable window titlebars entirely
for_window [class="^.*"] border pixel 2
# Set inner/outer gaps
gaps inner 10
gaps outer 15
# Additionally, you can issue commands with the following syntax. This is useful to bind keys to changing the gap size.
# gaps inner|outer current|all set|plus|minus <px>
# gaps inner all set 10
# gaps outer all plus 5
# Smart gaps (gaps used if only more than one container on the workspace)
# smart_gaps on
# Smart borders (draw borders around container only if it is not the only container on this workspace)
# on|no_gaps (on=always activate and no_gaps=only activate if the gap size to the edge of the screen is 0)
smart_borders on
# Press $mod+Shift+g to enter the gap mode. Choose o or i for modifying outer/inner gaps. Press one of + / - (in-/decrement for current workspace) or 0 (remove gaps for current workspace). If you also press Shift with these keys, the change will be global for all workspaces.
set $mode_gaps Gaps: (o) outer, (i) inner
set $mode_gaps_outer Outer Gaps: +|-|0 (local), Shift + +|-|0 (global)
set $mode_gaps_inner Inner Gaps: +|-|0 (local), Shift + +|-|0 (global)
bindsym $mod+Shift+g mode "$mode_gaps"
mode "$mode_gaps" {
bindsym o mode "$mode_gaps_outer"
bindsym i mode "$mode_gaps_inner"
bindsym Return mode "default"
bindsym Escape mode "default"
}
mode "$mode_gaps_inner" {
bindsym plus gaps inner current plus 5
bindsym minus gaps inner current minus 5
bindsym 0 gaps inner current set 0
bindsym Shift+plus gaps inner all plus 5
bindsym Shift+minus gaps inner all minus 5
bindsym Shift+0 gaps inner all set 0
bindsym Return mode "default"
bindsym Escape mode "default"
}
mode "$mode_gaps_outer" {
bindsym plus gaps outer current plus 5
bindsym minus gaps outer current minus 5
bindsym 0 gaps outer current set 0
bindsym Shift+plus gaps outer all plus 5
bindsym Shift+minus gaps outer all minus 5
bindsym Shift+0 gaps outer all set 0
bindsym Return mode "default"
bindsym Escape mode "default"
}
Screen tearing in Firefox
i3 does not come with a compositor, like XFCE has. This results in some tearing when scrolling in Firefox, and other applications. In order to fix this, you need Picom, which is a maintained fork of the old compton project. To enable it, add the following to your i3 config file.
exec_always --no-startup-id picom -b
The exec_always
ensures it also runs when reloading i3.
Better application launcher
Issuing super+d
brings up dmenu
, which gives you a fuzzy-searchable list of all executables on your system.
If you’re coming from MacOS, you’ll probably find dmenu
a bit dull, compared to the awesomeness of Alfred and the likes. Check out rofi for a highly configurable drop-in replacement.
Here’s my .config/rofi/config.rasi
configuration {
modi: "window,drun,ssh,combi";
theme: "solarized";
font: "hack 10";
combi-modi: "window,drun";
}
To launch rofi
in combi-mode (all modes combined) instead of dmenu
, trade your dmenu
keybinding for:
bindsym $mod+d exec rofi -show combi
Kitty
The default terminal application shipping with i3 is not the pinnacle of terminals. Currently I’m using kitty, and I’m quite happy with it. After installing kitty, trade the following line:
bindsym $mod+Return exec i3-sensible-terminal
with
bindsym $mod+Return exec kitty
Polybar
I like to have a simple, but customizable statusbar. Currently I’m using Polybar instead of the default i3 statusbar.
Locking your screen
I use i3lock
for this, and bind it to super+shift+x
like this
bindsym $mod+shift+x exec i3lock -c 000000
The -c 000000
gives it a completely black background.
Recent Posts
Extend ActiveStorage::Blob with callbacks
ActiveStorage is currently missing both validations and callbacks, but you can easily extend it with the callbacks you need.
Writing a custom analyzer for ActiveStorage
Writing custom analyzers for your ActiveStorage blogs is not well documented, but quite easy. This is how I implemented a simple EDI file analyzer for my neverending hobby project.
Manjaro/Arch: transfer packages to another computer
How to make a backup of all installed packages on a Arch/Manjaro distro, and install them on a different machine.