Manually control your displays with xrandr

Lets face it Linux doesn't always handle multiple displays so well. Rather than wasting time messing around in the system settings it is sometimes easier to to set up a couple scripts to get the settings you want.

In my case I was running into problems having my laptop properly use a second monitor. And another laptop that has the main monitor detached and rotated and with another monitor connected to the VGA. Depending on my current task at the moment I may want any number of configurations, changing the settings manually is simply not worth it

Using xrandr is simple. First open a terminal and type:

You will be presented with the available displays. In my case my laptop is called LVDS1 and my other monitor is called VGA1 as its connected through the VGA port, HDMI is called HDMI1, the naming scheme is pretty straightforward. Take note of the names of your monitors you are using.

Then we just have to write out the command and save it as a script. The first one I want is to force an extended display (its actually been working automatically lately, but doesn't hurt to be able to force the configuration if necessary). Since I have a laptop display and VGA monitor (which I want to be the primary display) use your favorite editor and type:
xrandr --output LVDS1 --auto --output VGA1 --auto --primary --right-of LVDS1

This is saying that my laptop display, LVDS1, is going to be automatically configured and my second display is going to be automatically configured, placed to the right of my laptop, and made the primary display. This leaves no ambiguity, say you have yours set up differently you just need to change the "--right-of ... " and "--primary" parameters.

That is all good for an extended set up, but how about rotating a monitor? Simply append "--rotate (left, right, inverted, normal)" after the appropriate output. And sometimes you don't want an extended set up at all. Just append the "--off" option to the appropriate output

Notice the format:
--output display_name --options --output display_name --options

You can get really specific with xrandr and customize the resolution, refresh rate, gamma, etc. I just use the auto option, and the options I mentioned, if it aint broke don't fix it.