Desktop on external monitor (wired to the nvidia chip) and dual-screen with laptop
Because everything is rendered through the nvidia chip, the nvidia card must stay on (see above for disabling PM) and the OpenGL library path must be set to nvidia' libGL.so directory. Alternatively, uninstall Bumblebee as it does currently not fully support external monitors.
If you want to keep bumblebee and have desktop on external monitor, you can do it killing bumblebee, setting your nvidia graphic card on (/proc/acpi/bbswitch), then you need to export your nvidia library:
export LD_LIBRARY_PATH=/usr/lib32/nvidia:/usr/lib/nvidia:$LD_LIBRARY_PATH #on archlinux
Section "ServerLayout" Identifier "Layout0" EndSection Section "Device" Identifier "Device1" Driver "nvidia" VendorName "NVIDIA Corporation" Option "NoLogo" "true" Option "ConnectedMonitor" "DFP" EndSection #For the configuration with bumblebee installed #Section that follows come from archlinux adapt it from your distro if necessary. Section "Files" ModulePath "/usr/lib/nvidia/xorg/" ModulePath "/usr/lib/xorg/modules/" EndSection
DFP to something else if necessary (e.g.
CRT). For more details on DFP/CRT, see this.
After creating the file, restart the X server or reboot.
Note for novice users: you may get a black screen which indicated failure, reboot into recovery mode and remove configuration with
rm /etc/X11/xorg.conf. Check
/var/log/Xorg.0.log.old for details.
For a dual screen configuration (nvidia wired output + intel wired laptop screen) adapted from this and what is written above you can have a dual screen rendered by your nvidia card with the nvidia proprietary driver. You need nvidia driver >= 319.2. If you keep bumblebee installed and you have a recent version of the intel driver you do not need the modesetting driver. You can use this alternate
xorg.conf (adapt it if needed) and follow the steps given before.
Additionally you need to run:
xrandr --setprovideroutputsource Intel NVIDIA-0
to enable your laptop screen.
Section "ServerLayout" Identifier "layout" Screen 0 "nvidia" Inactive "intel" EndSection Section "Device" Identifier "nvidia" Driver "nvidia" BusID "PCI:1:0:0" # Option "DPI" "96 x 96" # Uncoment to fix the size of fonts EndSection Section "Screen" Identifier "nvidia" Device "nvidia" # Uncomment this line if your computer has no display devices connected to # the NVIDIA GPU. Leave it commented if you have display devices # connected to the NVIDIA GPU that you would like to use. # Option "UseDisplayDevice" "none" EndSection Section "Device" Identifier "intel" Driver "intel" Option "AccelMethod" "uxa" EndSection Section "Screen" Identifier "intel" Device "intel" EndSection Section "Files" ModulePath "/usr/lib/nvidia/xorg/" ModulePath "/usr/lib/xorg/modules/" EndSection
Source: Dual Monitor - Bumblebee Wiki