#!/linuxSucks/Setup monitor resolution with X11 file
Jul 01, 2020Facing a wrong resolution that is not the correct for you monitor. One option is to set the resolution using xrandr, but xrandr is just for that session. When the computer is rebooted the resolutions will be lost.
There is an easy why to fix that with 10-monitor.conf. Here is a example of the file:
# /etc/X11/xorg.conf.d/10-monitor.conf
# only the Identifier is mandatory
Section "Monitor"
Identifier "HDMI1"
ModelName "PHILIPS L22W-2"
Option "primary" "true"
Option "PreferredMode" "1920x1080_60.00"
HorizSync 31.0 - 83.0
VertRefresh 56.0 - 75.0
EndSection
You need to change the identifier, you can find out the identifier by running this command in you terminal:
xrandr
The output will be something like this
Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 32767 x 32767
HDMI1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 530mm x 300mm
1920x1080 60.00*+ 59.94
1920x1080i 60.00 59.94
1680x1050 59.88
1280x1024 75.02 60.02
1440x900 59.90
1280x960 60.00
1280x720 60.00 59.94
1024x768 75.03 70.07 60.00
832x624 74.55
800x600 72.19 75.00 60.32 56.25
720x480 60.00 59.94
640x480 75.00 72.81 66.67 60.00 59.94
720x400 70.08
HDMI2 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
In the output the second line has the identifier.
That’s it. Now just create the file in /etc/X11/xorg.conf.d/ make sure to name the file 10-monitor.conf. Then just restart your computer, if everything goes well you will see that the resolution is OK.
Examples
Let’s say you have a computer with two video outputs, but you want to use just one of them it will be something like
# /etc/X11/xorg.conf.d/10-monitor.conf
# only the Identifier is mandatory
Section "Monitor"
Identifier "HDMI-1"
ModelName "PHILIPS L22W-2"
Option "primary" "true"
Option "PreferredMode" "1920x1080_60.00"
HorizSync 31.0 - 83.0
VertRefresh 56.0 - 75.0
EndSection
Section "Monitor"
Identifier "eDP-1"
Option "ignore" "true"
EndSection
Or can be like
# /etc/X11/xorg.conf.d/10-monitor.conf @ hortensia
# only the Identifier is mandatory
Section "Monitor"
Identifier "HDMI1"
ModelName "PHILIPS L22W-2"
Option "primary" "true"
Option "PreferredMode" "1920x1080_60.00"
HorizSync 31.0 - 83.0
VertRefresh 56.0 - 75.0
EndSection
Section "Monitor"
Identifier "eDP1"
Option "ignore" "true"
ModelName "PHILIPS L22W-2"
Option "primary" "false"
Option "PreferredMode" "1920x1080"
HorizSync 31.0 - 83.0
VertRefresh 56.0 - 75.0
EndSection