See this nvidia page for details.
----------------------- -----------------------------
| screen 1 (external) | | screen 0 (laptop default) |
| device: "nvidia" | <---- | device: "intel" |
| driver: nvidia | | driver: intel |
----------------------- -----------------------------
| | /++++++++++++++++++++++++++++\
===== ------------------------------
- Run
startx, only the external monitor will be activated by default. - Then execute
xrandrscript below, the laptop default monitor will be activated.
Two monitor will share one screen, where you can drag windows between.
/etc/X11/xorg.conf:
Section "ServerLayout"
Identifier "layout"
Screen 0 "nvidia"
Inactive "intel"
EndSection
Section "Device"
Identifier "nvidia"
Driver "nvidia"
BusID "PCI:1:0:0"
Option "TripleBuffer" "True"
EndSection
Section "Screen"
Identifier "nvidia"
Device "nvidia"
Option "AllowEmptyInitialConfiguration"
EndSection
Section "Device"
Identifier "intel"
Driver "intel"
BusID "PCI:0:2:0"
Option "TearFree" "true"
EndSection
Section "Screen"
Identifier "intel"
Device "intel"
EndSection
xrandr script (example):
xrandr --setprovideroutputsource Intel NVIDIA-0
xrandr --output eDP1 --auto --output DP-0 --left-of eDP1