I have three monitors! I want to choose one monitor as my main screen. How to set xorg
— xrandr --listmonitors —
0: +HDMI-0 1920/470x1080/260+0+0 HDMI-0
1: +HDMI-2 3840/520x2160/290+1920+0 HDMI-2
— xrandr -q —
Screen 0: minimum 8 x 8, current 5760 x 2160, maximum 32767 x 32767
HDMI-0 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 470mm x 260mm
1920x1080 60.00+ 59.95 50.00
1440x900 74.99 59.89
1280x1024 75.03 70.04 60.00
1280x720 60.00 59.94 50.00
1024x768 75.03 70.07 60.01
800x600 75.00 60.32 56.25
640x480 75.00 72.81 59.94
HDMI-1 disconnected (normal left inverted right x axis y axis)
HDMI-2 connected 3840x2160+1920+0 (normal left inverted right x axis y axis) 520mm x 290mm
3840x2160 60.02*+ 59.98 50.01 30.00 29.97 25.00 24.00 23.98
4096x2160 60.02 59.98 50.01 30.00 29.97 25.00 24.00 23.98
1920x1080 120.00 100.00 60.00 59.95 50.00 30.00 29.97 25.00 24.00 23.98
1280x720 120.00 100.00 60.00 59.94 50.00 30.00 29.97 25.00 24.00 23.98
Basically you would add correct “Monitor” sections in your
xorg.conf and add the Option “Primary” for the Monitor of your choice. The man pages for
xorg.conf have more details on this.
But setting up a correct
xorg.conf can be tricky. If you really need to use
xorg.conf the recommended way is to use
nvidia-xconfig and if necessary customize the file afterwards (make a backup of the file first!).
xrandr also has a command line option
--primary, but that does not modify
Last but not least you should much rather use the graphical user interface of your distribution to handle multi monitor setups since that should make overall behavior more robust and consistent.
Because my monitor may be connected but it won’t show up on the screen
Only the main display will always be displayed! So you need to specify the main display as soon as you turn it on.
It cannot be set manually using the user interface.
I have tried to use xrandr settings to specify the main display,
But adding it to the startup script will cause an error
No protocol specified
Can’t open display :0
It seems that the problem is rather related to one of your monitors not being detected properly.
What happens if you try to use your system only with the one monitor that does not show up?
What graphics card are you using and what displays?
The xrandr output states that you have a graphics adapter with 3 HDMI outputs, but only two have a connected display.
I want to add the script of xrandr so that it can be executed automatically after the system is turned on. Where should it be executed?
You should be able to execute it for example as a cronjob, or you can add it as a separate execution script to your XSession startup, usually as a new script in
/etc/X11/Xsession.d/ . It really depends on your setup, but those two options should give you an idea.