After I bought a new monitor, the first pain point I saw with my setup was how I had to open up arandr for reconfiguration every time I plugged/unplugged the monitors.
Surely there has to be an easier way? A way where the system detects new display has been added/removed and runs some pre-configured script to set them up as I like.
Turns out autorandr is just the tool I was looking for. Simply connect all your display devices, configure them using arandr, and then save the configuration using autorandr
. From then on, anytime you add/remove displays, if the connected devices match with the saved profile, that configuration will be applied.
Quick tutorial:
# Installation sudo apt install autorandr # View current connected devices autorandr --fingerprint # Configure your current connected devices using arandr # Then save the configuration as a profile autorandr --save some-profile-name
Some profiles I created:
- laptop: Just my laptop screen without any monitors connected to it.
- laptop-lid-up-two-monitor: My laptop with its lid open and two monitors connected.
- laptop-lid-down-two-monitor: My laptop with its lid down and two monitors connected.
This is when I faced a new problem. While autorandr
can detect any external displays being plugged/unplugged with the system, it doesn’t detect lid up/down as a display plug/unplug event. So the transition from lid-up to lid-down profile doesn’t get triggered.
Like I said before, solving a problem just leads to more problems🤦♂️. Let’s discuss this in a follow-up post.