Thanks, it works as wanted. I would buy you a drink if I could ;)
Only bemol: as you can see in the attached screenshot - at some boots but not all boots - the lightdm login window is divided in three “small window” (I have a 4K laptop monitor and two 1080p external monitors). Is there a way to fix this ugly login window?
To sum up what I have done to resolve the initial problem:
- Delete the Xorg conf file:
rm /etc/X11/xorg.conf
- Configure the Display Manager to use Nvidia GPU only. In my example below, it’s LightDM but you can find the instruction for the other display managers in NVIDIA Optimus#Display_managers from Arch Linux doc.
Create the following file/etc/lightdm/display_setup.shand add:
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
- Create the Nvidia configuration file
/etc/X11/xorg.conf.d/10-nvidia-primary.confand add:
Section "OutputClass"
Identifier "nvidia"
MatchDriver "nvidia-drm"
Driver "nvidia"
Option "PrimaryGpu" "yes"
Option "AllowEmptyInitialConfiguration" "true"
EndSection
