Topic: Xrandr quick scripts

I hook my laptop to my tv an a quite regular basis. I store all recorded tv episodes and such on my desktop and I use sshfs to view them on the tv via this connection. I find grandr a little odd to understand so I just put together to very short scripts that give me what I want.

#!/bin/bash

xrandr --output VGA1 --auto --right-of LVDS1 &

exit

This adds VGA as an extended desktop to the right of LVD.

This handles both resolutions very well and once you set up the wallpapers with the seperate options for both in nitrogen, nitro will store that config in a file and will automatically reapply the settings when you reconnect.

#!/bin/bash

xrandr --output VGA1 --off &
exit

That restores to the original single monitor settings.
That is much simpler than fussing with grandr every time I have to hook it up so my daughter can watch cinderella or sleeping beauty.

Last edited by monkeybritt (2010-01-12 05:05:01)

failure is only a negative way to describe a learning experience.
i am constantly learning. smile

Re: Xrandr quick scripts

Well done monkeybritt!  I do something very similar, except I just scroll through my xterm history to run the xrandr commands - they seem to stay relatively fresh in the history.

while ( ! ( succeed = try() ) );

Re: Xrandr quick scripts

thank you, I do the scroll back for most things but I'm a bit of a neat freak and regularly clear my histroy. smile

failure is only a negative way to describe a learning experience.
i am constantly learning. smile

Re: Xrandr quick scripts

I have a question please.
I am using 9.04 now but wrote (stole from somewhere I can't remember) the following script when using 8.10.
Connect the projector and then run the script. It displays on both laptop and the projector.
It worked really well on 8.10 and it works on 9.04 BUT when I run it to connect to the projector, it logs me out. Almost like I did a ctrl-alt-backspace.

#!/bin/bash
if xrandr -q | grep "VGA connected" > /dev/null ; then
    xrandr --output LVDS --mode "1024x768" --output VGA --mode "1024x768"
    else
        xrandr --output LVDS --auto --output VGA --auto
fi

Any ideas why it logs me out?

Thanks

Re: Xrandr quick scripts

I have had xrandr shutme out a few times but it was do to poor execution.  I would try man xrandr and add the option for either --right-of or the clone option.

failure is only a negative way to describe a learning experience.
i am constantly learning. smile