Repeatedly reaching for your mouse slows you down in the short term, and in the long term brings on health problems (RSI). To stay fast and healthy, keep your hands on your keyboard. To keep your hands there, this series, “Look ma, no mouse!” will guide you through easy to use tools to use your keyboard to control your computer instead of your mouse.
In this piece, we’ll discuss how to use your keyboard for one of the most mouse intensive activities: window management.
Why is window management so mouse intensive?
Window repositioning, and to a lesser extent resizing.
Switching windows can be done easily with the keyboard using Alt+Tab if you have less than 10 windows open at a time, which is 99% of the time.
Solution? A keyboard first window manager.
i3
i3 is a keyboard first, tiling window manager available only on Linux. There are keyboard first, tiling window managers for Windows (bug.n) and macOS (Amethyst) that work well, but today we’re just covering i3.
Instead of windows looking like:
They look like:
The manager automatically lines up windows instantly and perfectly.
But wait, why do we need a “tiling window manager?”
We’re just trying to use the mouse less, right? Well, the reason we need a mouse in a regular window manager is because we’re telling the computer complicated instructions.
Move the window from pixel coordinates (1043, 949) to (123, 405).
If all we told the computer was, “split all windows horizontally” or “move the active window to workspace 3”, that’s simple enough to be a few keys. To ditch the mouse, we need a new style of window manager with simpler instructions. We need a tiling window manager.
Getting familiar with tiling
Most desktop window managers today support tiling-like functionality, macOS is the major exception. This is great practice for getting used to i3, although its clunkier than i3, and in Windows its less keyboard based.
Window snapping
Most desktop window managers today, except on macOS, support window snapping with the keyboard. Just press Win(dows button) + Up/Down/Left/Right to snap a window into a side or corner. In i3, windows only snap, so getting used to only working with snapped windows will be great practice.
If you later find i3 to be a bit much, using the window snapping keyboard shortcuts can still drastically reduce your mouse usage and your health and speed will benefit greatly from it.
Multiple Workspaces (or desktops)
i3 uses multiple workspaces (or as they’re called in Windows desktops) heavily. Multiple workspaces are also available in the standard desktop window manager in Linux and Windows. Switch between different workspaces with Ctrl+Alt+Left/Right.
In Linux, you can move the active window to a different workspace with Ctrl+Alt+Shift+Left/Right.
In Windows there’s no keyboard shortcut, you have to use your mouse to navigate through menus to move a desktop between windows, see this guide.
Installing i3
Installing’s easy if you’re using ubuntu or mint:
sudo apt install i3
Next, logout and next to your login name you’ll see a little icon.
Click it and change it to i3.
When you log into i3 for the first time, it’ll give you a 2 step wizard.
2 step Wizard
1 - Yes, create the config file.
2 - Do you want your mod(ifier) key to be Windows or Alt?
Alt, unless:
you have a program that you absolutely requires the alt key but not the windows key, then use windows
you have a mac keyboard, then use windows (really ⌘)
you have a kinesis advantage 2 and you don’t absolutely need the windows key for any applications, then use windows.
On standard PC keyboards, Alt is easier to reach than windows, so to reduce RSI (and therefore be faster), use Alt.
i3 minimal command set
Since i3 is keyboard based, we have to memorize a few commands (basically shortcuts), but only a few! You can even write them on an index card and leave it next to your computer for the first day. This section is the smallest set of the i3 commands to get up and running. There’s a lot more functionality in i3, but don’t worry about it until you’re comfortable with the basics As mentioned in the wizard, i3 commands are invoked by using the mod key. It will be either Alt or the Windows key, depending on what you picked.
Quit i3 - mod + shift + e, then use your mouse to click “yes quit”
Quitting is rare so the mouse stress is negligible and its impossible to accidentally quit. Other tiling managers make it so easy to quit I’ve quit by fat fingering the q key instead of the w key. Major points to i3 for making it impossible to accidentally quit.
Open terminal - mod + enter.
As the terminal is a keyboard first interface, its a great way to navigate the filesystem and start programs. To start firefox, for example, instead of clicking on a Firefox logo, in a terminal type “firefox &”
Switch window - mod + j (or mod + k)
With multiple windows, cycle through them with mod + j (or if that doesn’t work try mod + k). mod + j works when windows are full screen or tiled horizontally, mod + k works when windows are tiled vertically.
Switch active workspace - mod + number (1,2,…,9,0)
As we mentioned above, i3 supports multiple workspaces, specifically it supports 10, numbered 1-10. To go to a workspace, just press mod + {the number of the workspace} (to go to workspace ten, press 0).
There’s more of course, but this small set is perfect for starting out.
Installing training wheels
This advice you won’t see anywhere else. We’re going to put a desktop window manager inside i3.
Transitioning from desktop and mouse based thinking to tiling and keyboard based, thinking takes time, so having a desktop window manager backup will be a familiar friend for whenever you get stuck.
Here’s how:
In a terminal, install the following:
sudo apt install -y tightvncserver vinagre xfce4 xfce4-goodies
In a terminal, start a vncserver:
# without -localhost, your computer becomes exposed on your local network, it's very important
vncserver -localhost
The first time, it’ll give you a wizard. Yes create the initial file. For your password, use “password” to remind yourself that vnc passwords provide absolutely no protection (just google vnc server brute force, tons of tools out there). The real protection comes from using -localhost which means vnc is only exposed to your computer and not the network.
In a terminal, kill the server because we need to fix the startup file:
vncserver -kill :1
Change the ~/.vnc/xstartup file to:
#!/usr/bin/env bash
xrdb $HOME/.Xresources
startxfce4 &
In a terminal, startup the server again
vncserver -localhost
In a terminal, start up vinagre, a vnc client
vinagre
Click Connect
This should popup
Change the protocol from “SSH” to “VNC” and set the host to localhost:1
Don’t fill out anything else and press connect. Another modal will popup asking for the password (it’s password), and if everything worked right, you will see a very cute mouse.
Viola, you have a desktop window manager inside i3. It has an application menu, sections for bluetooth and audio, desktop icons. Everything familiar from a desktop window manager. If you’re ever stuck and you don’t know how to open the right application in i3, just jump into vnc and navigate the menu. Personally I jump in to manage hardware like Bluetooth and Printers even though I’ve used tiling window managers since 2011.
Conclusion
Welcome to the wonderful world of i3. You now have it setup, know the basic commands, and have a fallback desktop window manager running on vnc which you can access within i3.
Next week, we’ll finish off our “Look ma, no mouse” series with some simple, universal tricks to enable you to use your mouse less.
If you don’t want to miss out, click “Subscribe now” below, and if this article helped you, you can help others too by clicking “Share”
This looks very cool, and I was already considering switching to i3 myself. Only one question: do you know if there's a way to make it so i3 *can* be exited using only the keyboard? It can be an obscure key combination if necessary, but it would be nice to be able to exit even if my mouse wasn't working or I wanted to use a device with no mouse at all.