Sample Header Ad - 728x90

How do I correctly transfer xrandr settings to xorg.conf?

2 votes
1 answer
3392 views
I have run multiple xrandr commands to set all my monitors settings as I want them. Then I used autorandr to save the state to a config file printed here:
hanke@debian ~ » cat .config/autorandr/3-displays/config 
output DP-1
off
output DP-2
off
output DP-3
off
output DP-4
off
output DP-5
off
output DVI-D-0
crtc 1
mode 1600x900
pos 3840x0
rate 59.98
rotate left
output DP-0
crtc 0
mode 1920x1080
pos 1920x191
primary
rate 144.00
output HDMI-0
crtc 2
mode 1920x1080
pos 0x260
rate 60.00
I have been using autorandr --change 3-displays in my window managers startup script to configure the displays, but I run into problems with this approach if I enable lightdm to get the greeter/login screen, which is run before my window manager, and in extension before my monitors are configured correctly. Because of this, the login screen is displayed on the wrong monitors in the wrong resolutions and orientations. Because of this I now wish to transfer these settings to the /etc/X11/xorg.conf config file. Here is my attempt so far:
Section "Monitor"
        Identifier      "DP-0"
        Option          "Position"      "1920 191"
        Option          "Primary"       "true"
        Option          "PreferredMode" "1920x1080_144.00"
        Option          "Enable"        "true"
EndSection

Section "Monitor"
        Identifier      "HDMI-0"
        Option          "Position"      "0 260"
        Option          "PreferredMode" "1920x1080_60.00"
        Option          "Enable"        "true"
EndSection

Section "Monitor"
        Identifier      "DVI D-0"
        Option          "Rotate"        "left"
        Option          "Position"      "3840 900"
        Option          "PreferredMode" "1600x900_59.98"
        Option          "Enable"        "true"
EndSection

Section "Monitor"
        Identifier      "DP-1"
        Option          "Enable"        "false"
EndSection

Section "Monitor"
        Identifier      "DP-2"
        Option          "Enable"        "false"
EndSection

Section "Monitor"
        Identifier      "DP-3"
        Option          "Enable"        "false"
EndSection

Section "Monitor"
        Identifier      "DP-4"
        Option          "Enable"        "false"
EndSection

Section "Monitor"
        Identifier      "DP-5"
        Option          "Enable"        "false"
EndSection
Sadly, this does not seem to work. My gaming display is not getting set to 144 Hz refresh rate, the orientation on my DVI screen is all wrong and the positions seem to be ignored as well. I have previously had startx fail because of bad xorg.conf values, but using this config it starts without crashing. Am I missing something here? I just want my screens to be correctly configured in a nice and declarative way. Running a bunch of xrandr commands in scripts feels hacky. The xorg.conf file seems like the correct way to do it, but I am failing to get it to work correctly. Any help is appreciated.
Asked by Hannes Knutsson (33 rep)
Feb 6, 2022, 05:34 PM
Last activity: Jun 21, 2025, 10:02 AM