I have a laptop that's normally docked to a large monitor. When docked, I want to use the large monitor as the primary display, with the laptop screen as a secondary display off to the right. When undocked, the laptop screen is the only display.
XFCE doesn't seem to have that kind of multi-monitor support built in. I found ARandR, which let me set up my monitors the way I want. I can use ARandR to save profiles for docked and undocked configurations (which are really just shell scripts that invoke xrandr).
But how do I get those profiles to apply automatically when the laptop is docked and undocked? Should I try to create a udev rule that detects the docking station? Is there a better way?
Best Answer
One way is to create an udev rule, but as I wanted something more portable, I have this bash script. It relies on inotifywait support, does not have some kind of loops and is considered efficient.
external-lcd.sh
Don't forget to make the file executable (
chmod +x external-lcd.sh
). Then just start it whenever you launch your DE.I am using this on archlinux so I think it should work. You can change xrandr parameters or swap it to use arandr configurations.