This is one is mostly for my own reference. In my case, I'm hooking up my work Latitude to an HP external monitor, and I want the HP to have the main panels and be the main desktop. This must be executed as root, hence "#" and not "$" in example below:
# xrandr --output HDMI1 --primary
Running xrandr
without any options will list the all available devices and indicate which ones are connected and in use. In my case, LVDS1 is laptop's monitor:
# xrandr Screen 0: minimum 320 x 200, current 3040 x 1200, maximum 8192 x 8192 LVDS1 connected 1440x900+1600+300 (normal left inverted right x axis y axis) 331mm x 207mm 1440x900 60.0*+ 40.0 1024x768 60.0 800x600 60.3 56.2 640x480 59.9 VGA1 disconnected (normal left inverted right x axis y axis) HDMI1 connected 1600x1200+0+0 (normal left inverted right x axis y axis) 408mm x 306mm 1600x1200 60.0*+ 1280x1024 85.0 75.0 60.0 1280x960 60.0 1152x864 75.0 1024x768 85.0 75.1 60.0 832x624 74.6 800x600 85.1 60.3 640x480 85.0 75.0 60.0 720x400 70.1 DP1 disconnected (normal left inverted right x axis y axis) ...