Skip to content

Instantly share code, notes, and snippets.

@ciarand
Created January 24, 2014 04:43
Show Gist options
  • Save ciarand/8592193 to your computer and use it in GitHub Desktop.
Save ciarand/8592193 to your computer and use it in GitHub Desktop.
Making xrandr modifications permanent with lightdm

Overview

xrandr is the easiest way to make a multiple display configuration work in Linux. Lightdm is my current display manager. This file explains how to make lightdm run an arbritrary script (in this case an xrandr script) on startup.

Here's the command we need:

#!/usr/bin/env bash
xrandr --output DVI-0 --mode 1920x1080 --left-of VGA-0

Obviously you can modify that to fit your specific setup. Any valid command works here.

sudo cat > /usr/share/multiple-monitors.sh << EOF
#!/usr/bin/env bash
xrandr --output DVI-0 --mode 1920x1080 --left-of VGA-0
EOF
sudo chmod +x /usr/share/multiple-monitors.sh

Open up /etc/lightdm/lightdm.conf and change the following line from:

#display-setup-script = 

To:

display-setup-script=/usr/share/multiple-monitors.sh

Restart everything as appropriate. Check in /var/log/lightdm/lightdm.log for errors.

@arindas
Copy link

arindas commented Oct 21, 2021

Note: Make the change under the [Seat] section in /etc/lightdm/lightdm.conf

@viniciosaltos93
Copy link

This solution really works, but it is important to clarify that the display-setup-script parameter to modify must be under the section [Seat:*], otherwise it will not work.

@lokka30
Copy link

lokka30 commented May 1, 2022

Thank you! This works great for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment