Hi, I'd like some more comments from you on this: 
First of all,
xrandr --auto enables all inactive outputs, so why do you turn some output off before? It has no effect.
Secondly, on my setup with two monitors (laptop + HDMI connected), the output that was off is set to clone the other output (effectively
--same-as option). Though technically right, it is misleading to say that "This scrip auto sets best screen size" (for all available outputs I assume), because the monitor with higher resolution is padded with black space around the picture of the smaller output.
- thank you for mension. I'm using laptop & monitor, but using same output, usually close laptop. When changing from different monitor, xrandr --off will clear old resolution, so that new one will be used. -- Whille
xrandr --output <laptop_output_name> --off --output <external_output_name> --autois most likely what you want. But this is very simple configuration and oneliners can't be considered as scripts, so I will (re)move it. See also Multihead#Configuration_using_xrandr for more examples. -- Lahwaacz (talk) 07:53, 13 September 2013 (UTC)