Using xrandr with fluxbox on a laptop or dual monitors

Recently I gave up on Mint Linux 15, the bloated slowness of the interface and unstable web browsing experience really disappointed me. I was fedup with disappointment on my desktop, previuosly being disappointed with Ubunut's Unity interface I jumped my workstation ship to Fedora. This didn't last long until I had Gnome 3 shoved down my throat. Which led me to follow the crowd to Mint. Fed up with being disappointed I went back to where I should never have left, hello fluxbox and damn my machine is responsive again.

The only problem is that all the little auto pilot things from "modern" window managers are not there. Volume buttons on my laptop do not work, nothing happens when I plug in a USB stick and when I plug in an external monitor it just shows me exactly the same output as my laptop display. The solution is easy though and once you know the commands it is infintly more useful than any window managers display manager. Added bonus, if you are doing a presentation and the projector isn't playing ball, with a few quick commands you can generally get it doing what you want, this does not half impress people (hint change the resolution down to 640x480). The command you need is xrandr and you really only need to know a couple of switches.

To see what monitors are available:

[~] $ xrandr -q
Screen 0: minimum 320 x 200, current 2880 x 1200, maximum 32767 x 32767
VGA1 connected 1280x1024+0+0 (normal left inverted right x axis y axis) 376mm x 301mm
1280x1024 60.0*+ 75.0
1280x960 60.0
1152x864 75.0
1024x768 75.1 70.1 60.0
832x624 74.6
800x600 72.2 75.0 60.3 56.2
640x480 72.8 75.0 66.7 60.0
720x400 70.1
HDMI1 connected 1600x1200+1280+0 (normal left inverted right x axis y axis) 408mm x 306mm
1600x1200 60.0*+
1280x1024 75.0 60.0
1280x960 60.0
1152x864 75.0 70.0
1024x768 75.1 70.1 60.0
832x624 74.6
800x600 72.2 75.0 60.3 56.2
640x480 72.8 75.0 66.7 60.0
720x400 70.1
DP1 disconnected (normal left inverted right x axis y axis)
HDMI2 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)

From that it is easy enough to see that two monitors are plugged in VGA1 and HDMI1. From there it is simply a matter of turning them on/off and posisitioning them.

To set the HDMI1 left of VGA1:

$ xrandr --output VGA1 --auto --output HDMI1 --auto --left-of VGA1

To clone the displays:

$ xrandr --output VGA1 --auto --output HDMI1 --auto --same-as VGA1

To make my life even easier I add the most common scenarios to my fluxbox menu:

$ cat menu
[begin] (fluxbox)
...

...
[exec] (Clone Monitor) {xrandr --output VGA1 --auto --output HDMI1 --auto --same-as VGA1}
[exec] (External Left Of) {xrandr --output VGA1 --auto --output HDMI1 --auto --left-of VGA1}
[exec] (External Right Of) {xrandr --output VGA1 --auto --output HDMI1 --auto --right-of VGA1}
[include] (/etc/X11/fluxbox/fluxbox-menu)
[end]