Isso funciona bem para mim com a Nvidia Optimus (Bumblebee) sem nenhuma configuração especial, apenas os padrões:
#!/bin/bash
#
# Source: https://bbs.archlinux.org/viewtopic.php?id=140315
#
r=`zenity --width 400 --height 250 --title "Display setup" --text "Choose display mode:" --list --column "Modes" "Internal" "External" "Clone" "Extended"`
case "$r" in
Internal)
xrandr --output LVDS1 --auto \
--output VGA1 --off ;;
External)
xrandr --output LVDS1 --off \
--output VGA1 --auto ;;
Clone)
xrandr --output LVDS1 --auto \
--output VGA1 --auto --same-as LVDS1 ;;
Extended)
xrandr --output LVDS1 --auto --primary \
--output VGA1 --auto --left-of LVDS1 ;;
esac
Os monitores LVDS1 e VGA1 são definidos em ~ / .config / monitors.xml. Para mais informações sobre o monitors.xml, consulte http://www.sudo-juice.com/dual-monitor-settings-in-ubuntu/ .
Exemplo:
<monitors version="1">
<configuration>
<clone>no</clone>
<output name="LVDS1">
<vendor>AUO</vendor>
<product>0x213c</product>
<serial>0x00000000</serial>
<width>1366</width>
<height>768</height>
<rate>60</rate>
<x>1280</x>
<y>256</y>
<rotation>normal</rotation>
<reflect_x>no</reflect_x>
<reflect_y>no</reflect_y>
<primary>yes</primary>
</output>
<output name="VGA1">
<vendor>GSM</vendor>
<product>0x43ff</product>
<serial>0x00035928</serial>
<width>1280</width>
<height>1024</height>
<rate>60</rate>
<x>0</x>
<y>0</y>
<rotation>normal</rotation>
<reflect_x>no</reflect_x>
<reflect_y>no</reflect_y>
<primary>no</primary>
</output>
<output name="HDMI1">
</output>
<output name="DP1">
</output>
</configuration>
</monitors>