A small thing, but a bit annoying: if you have two or more monitors at boot up using Xorg, SDDM displays it's menu on ALL screens but only the final screen (last to initialize) shows the password entry. It seems more "normal" to me that only the primary screen should display anything - and everything. So I went looking for a solution...
I found several references to using xrandr in /usr/share/sddm/scripts/Xsetup to turn off all but the primary monitor. All of them claimed this was the solution and at log in all the screens would light up. Not true - at least not here. The second monitor stayed off until I issued an xrandr command to turn it on. Not sure if this is a distro variation or what, but it didn't work by itself for me.
A bit more research and I found a solution that works. YMMV.
Steps:
Step details:
Step 1:
In a console run this command: xrandr |grep ' connected'
The output will show you what monitors are connected and their details.
In my case, DisplayPort-0 is the left most and desired "Primary" monitor - the one I want the login screen on. This information "converts" to xrandr commands like so:
xrandr --output DisplayPort-0 --mode 3840x2160 --pos 0x0
xrandr --output DisplayPort-1 --mode 3840x2160 --pos 3840x0
The above "--mode" is the resolution and "--pos" is the relative XY position on a cartesian plane. This means "0x0" is the center of the plane and the upper left corner of DisplayPort-0 and "3840x0" means that DisplayPort-1 is aligned at the top and to the right of DisplayPort-0.
Your set up may be wildly different. For example, if your secondary display is to the left of the primary, you use a negative X number, like "-3840x0". The Y axis can vary if your second monitor is a different resolution or above (negative number) or below (positive number) the primary.
There are many other xrandr options but all you need should be revealed in the output.
Step 2:
To turn off all but the primary monitor, I put this in /usr/share/sddm/scripts/Xsetup (as suggested on various other posts on the internet):
xrandr --output DisplayPort-0 --mode 3840x2160 --pos 0x0 --output DisplayPort-1 --off
Notice it's a single command that controls both monitors. DisplayPort-0 is correctly set up and DisplayPort-1 is just "off".
This results in a single screen with sddm on it and the second monitor is off, but as I mentioned above, it stayed off even after log in.
Step 3:
Finally, I needed to turn on the second monitor at log in. The series of events is sddm hands off to the login in scripts which source a couple others and end up at /etc/sddm/Xsession which looks for these three files and sources the first one of the three it finds:
$HOME/.bash_profile
$HOME/.bash_login
$HOME/.profile
Default *buntus don't have the first two files so I edited .profile in my home folder and added this line at the top:
xrandr --output DisplayPort-0 --primary --mode 3840x2160 --pos 0x0 --output DisplayPort-1 --mode 3840x2160 --pos 3840x0
Note I added "--primary" to DisplayPort-0 and the second monitor is now activated as it should be. I'm not 100% sure what --primary will do for me if anything, but I figured it wouldn't hurt.
Also note that if you have more than one user you would have to edit all the .profile files or locate the command elsewhere. I feel like since the X session is run at the user level, it's more "proper" to execute the command as the user.
I would love to be able to do this with GRUB also, but everything I read says GRUB follows the BIOS settings as far as active screens and it doesn't appear I can control that with my PC and external video card.
If you try this, please post that you did and what your results are. Thanks.
I found several references to using xrandr in /usr/share/sddm/scripts/Xsetup to turn off all but the primary monitor. All of them claimed this was the solution and at log in all the screens would light up. Not true - at least not here. The second monitor stayed off until I issued an xrandr command to turn it on. Not sure if this is a distro variation or what, but it didn't work by itself for me.
A bit more research and I found a solution that works. YMMV.
Steps:
- Determine correct xrandr setup for each monitor.
- Turn off all but primary monitor in sddm.
- Turn on all monitors during login.
Step details:
Step 1:
In a console run this command: xrandr |grep ' connected'
The output will show you what monitors are connected and their details.
Code:
stuart@office:~$ xrandr |grep ' connected' DisplayPort-0 connected 3840x2160+0+0 (normal left inverted right x axis y axis) 621mm x 341mm DisplayPort-1 connected 3840x2160+3840+0 (normal left inverted right x axis y axis) 621mm x 341mm
xrandr --output DisplayPort-0 --mode 3840x2160 --pos 0x0
xrandr --output DisplayPort-1 --mode 3840x2160 --pos 3840x0
The above "--mode" is the resolution and "--pos" is the relative XY position on a cartesian plane. This means "0x0" is the center of the plane and the upper left corner of DisplayPort-0 and "3840x0" means that DisplayPort-1 is aligned at the top and to the right of DisplayPort-0.
Your set up may be wildly different. For example, if your secondary display is to the left of the primary, you use a negative X number, like "-3840x0". The Y axis can vary if your second monitor is a different resolution or above (negative number) or below (positive number) the primary.
There are many other xrandr options but all you need should be revealed in the output.
Step 2:
To turn off all but the primary monitor, I put this in /usr/share/sddm/scripts/Xsetup (as suggested on various other posts on the internet):
xrandr --output DisplayPort-0 --mode 3840x2160 --pos 0x0 --output DisplayPort-1 --off
Notice it's a single command that controls both monitors. DisplayPort-0 is correctly set up and DisplayPort-1 is just "off".
This results in a single screen with sddm on it and the second monitor is off, but as I mentioned above, it stayed off even after log in.
Step 3:
Finally, I needed to turn on the second monitor at log in. The series of events is sddm hands off to the login in scripts which source a couple others and end up at /etc/sddm/Xsession which looks for these three files and sources the first one of the three it finds:
$HOME/.bash_profile
$HOME/.bash_login
$HOME/.profile
Default *buntus don't have the first two files so I edited .profile in my home folder and added this line at the top:
xrandr --output DisplayPort-0 --primary --mode 3840x2160 --pos 0x0 --output DisplayPort-1 --mode 3840x2160 --pos 3840x0
Note I added "--primary" to DisplayPort-0 and the second monitor is now activated as it should be. I'm not 100% sure what --primary will do for me if anything, but I figured it wouldn't hurt.
Also note that if you have more than one user you would have to edit all the .profile files or locate the command elsewhere. I feel like since the X session is run at the user level, it's more "proper" to execute the command as the user.
I would love to be able to do this with GRUB also, but everything I read says GRUB follows the BIOS settings as far as active screens and it doesn't appear I can control that with my PC and external video card.
If you try this, please post that you did and what your results are. Thanks.
Comment