Monitor Hotplugging

autorandr is a python script to manage the automatic detection and application of multiple monitor setups.


Single command to install, no systemd service required.

sudo pacman -S autorandr


Then create an initial profile, likely for your "mobile" setup. ie. no monitors connected to a laptop.

autorandr --save mobile

This writes the current configuration to ~/.config/autorandr/mobile/*.

Next, connect some monitors and set them up manually. For this example I'll set up the desk I use at work and name it "docked".

# 1. connect monitors
# 2. apply config with arandr or xrandr
autorandr --save docked

Repeat this process for all locations to build up a list of profiles. Now simply unplugging monitors will trigger autorandr to run its scripts and setup your monitors.


Content properties

  • Type: Note
  • Category: Arch Linux
  • Tags: linux, hardware
  • Custom slug: None

This is a preview of a simpler page design that I'm working on over the next little bit. I've finally added a (click it!) but there's still a few pages left to be converted so don't worry if things don't look quite right just yet 🙏

Content on blog pages use the CC-BY-SA license. The source code and notes use the MIT license. Unsure? Mention me on Mastodon.