Config Multiple Monitors in i3
Here's how to conveniently set your screen configuration in X11/RandR for multiple monitors. It'll work for i3 or other windowing environments.
The Pieces
- X Window System - is a window system for Unix. Aka X. Aka X11, because v11 is its latest stable release.
- RandR - is an extension to X. Sets monitor config like resolution, rotation and refresh rate.
- XRandR - is a CLI utility to set RandR.
- ARandR - is a GUI for XRandR.
- AutoRandR - is a CLI utility to save, detect and switch to different RandR configurations.
- i3 - is a tiling window manager, similar to a desktop environment.
Whew.
Installations
You have X and RandR. Install the others as needed.
sudo apt install xrandr # as needed
sudo apt install arandr
sudo apt install autorandr
Set it Up
You can use xrandr
, but I'm not expert enough yet.
Open arandr
and set up your multiple screen relative positions, resolutions, etc, and save. This will save your RandR config. Your screens will flicker, but once everything's back up, you should be able to function as desired.
Detect Future Changes
autorandr
will help you for the next time that you have hardware change. It'll be able to tell what inputs are there and switch to it.
For me, I wanted two configurations: one for when I was docked (multi-monitor), one for on-the-go.
I plugged in the monitor, set it with arandr
. Then saved the config with autorandr
:
autorandr --save docked
Then I unplugged the monitor, turned off the input with xrandr
:
xrandr --output HDMI-1 --off
Then saved the on-the-go config:
autorandr --save solo
Now, I can see both configs, and depending on hardware connectivity, then get changed automatically:
> autorandr
solo
docked (detected) (current)
i3 should be happy with all this, and you'll be able to create new windows on different monitors.