DIY desktop with the i3 window manager
01.07.2018 PermalinkLinux offers several desktop environments and window managers, so if you don't want to stick to the default of your distro you're free to explore alternatives. I started using Ubuntu Linux in 2010 on my business notebook. Back then Ubuntu came with its Unity desktop environment, but this was eventually dropped in favor of Gnome 3 in 2017, featuring a virtual desktop feature called workspaces.
I usually have to handle at least a dozen of running applications, among them several terminals, Thunderbird, Slack, Emacs, a twin-panel file manager named Krusader, at least four different browser based apps and so on. Often I need to switch quickly between applications. To manage the corresponding windows I made heavy use of Gnome workspaces, giving me a multiple of desktop real estate.
Over time I observed that:
- I assign a specific application always to the same workspace.
- Even then, switching between windows or workspaces often enough involves switching back and forth until I was at the right place.
- I use most of my applications in maximized mode, overlapping windows rarely bring any benefit to me.
- I find it bugging to reach out for the mouse to position windows or switch input focus.
Looking for a solution, I came across a specific class of windows managers. A tiling window manager promises to automate arrangement of application windows to some degree. The main idea is that the window manager avoids any overlap and automatically splits the available screen space horizontally or vertically when a new window opens. Among the popular implementations i3 seemed to be the best choice for me, so I gave it a try. The following screenshot shows how i3 arranges multiple terminal windows.
i3 has some characteristics that I appreciate:
- Windows and navigation between them can be controlled completely via keyboard.
- The text based configuration of key bindings and applications is quite powerful, yet easy to understand.
- Every workspace is bound to a keybinding Super+1, Super+2, ...
- i3 gets workspace output on multi monitor setups right.
- i3 has a well written user's guide.
- It is only a window manager, and does this task well.
The following table shows which Linux tools I used together with a bit of Bash scripting. This illustrates that learning i3 is only the tip of the iceberg. I had to pick up with many more tools that make up a usable desktop experience on an X window system.
Feature | Tool |
Notebook display brightness control | xbacklight or xrandr |
Notebook display night light | redshift or xrandr |
Turn external monitors on/off | xrandr |
Screen lock | i3lock, xdpyinfo, compton |
Screen saver | xset (dpms feature) |
Wallpaper | feh |
Audio and music control | pavucontrol, pactl, clementine |
Bluetooth control | blueman-applet |
Networking control | nm-applet |
Switch keyboard layout, adjust autorepeat | setxkbmap, xmodmap, inputplug, xset (r feature) |
Application launcher | dmenu |
USB storage automount | udiskie |
Screenshot tool | flameshot |
System information in status bar | i3blocks |
Provide keyring keys | gnome-keyring-daemon |
After all, it was a fun project, and it eventually improved my productivity on Linux. The whole configuration including all scripts is hosted on Github.