R
G

Back to list2020-052

Save mutliple Linux display configurations with autorandr

In most cases setting up your displays under Linux is a non event. It usually happens automatically or requires a one time setup using a UI or the use of xrandr. Once set up there's normally no reason to touch the configuration ever again.

For a more complex setup however it can be useful to have some one liners available to change the setup quickly.

I for example found myself in need for three different configurations on a laptop. A default one with all three external displays on and the internal one off. One for mobile or remote desktop use with all external displays off and only the internal one on. And lasty one for gaming where only one of the external monitors is on.

This is when I came accross a tool called autorandr. Instead of writing a bunch of xrandr commands into a shell script this takes care of backing up a given confugration under some name and making it available for later use.

Example:

autorandr --save default

After that change your display settings as you would do normally. I'm lazy so I use the KDE display configuration. Once your displays are set as needed for a given profile save again:

autorandr --save mobile
# Change some more settings
autorandr --save gaming
# ...

Once saved just use --load to enable these configurations:

# Feeling productive?
autorandr --load default

# Too many screens?
autorandr --load mobile

# Play time!
autorandr --load gaming