[ltp] xrandr output switching and debian (see bug #456778)
Carlos Moffat
linux-thinkpad@linux-thinkpad.org
Tue, 29 Jan 2008 10:08:34 -0500
On Tue, 2008-01-29 at 10:27 +0100, Csillag Tamas wrote:
> hi,
>
> I am using Debian unstable on my Thinkpad X40.
>
> I remember that I was able to switch to the external VGA output with the
> right Fn+Hotkey combination.
>
> That functionality is gone. I was using: reboot the machine with the VGA
> connected as a workaround (it is very inconvinient). Then I discovered
> xrandr on debian wiki http://wiki.debian.org/XStrikeForce/HowToRandR12.
> Now with simple commands I can switch outputs:
>
> autodetect and use all outputs with their defaults:
> xrandr --auto
>
> switch off VGA output:
> xrandr --output VGA --off
>
> switch off internal display output:
> xrandr --output LVDS --off
>
Hi Cstamas,
I use a little script to do this, which I modified from a code I found
somewhere else. I've been too lazy to hook it to any Hotkey:
#!/bin/bash
mode=$1
if [ -z "$mode" ]
then
echo "Usage: $0 <mode>" >&2
exit 1
fi
if [ "$mode" == "single" ]
then
xrandr --output LVDS --auto --mode 1600x1200 --dpi 133 --output
VGA-0 --off
xvattr -a XV_CRTC -v 0
gconftool-2 --set /desktop/gnome/font_rendering/dpi --type float
100
elif [ "$mode" == "dual" ]
then
xrandr --auto
xrandr --output VGA-0 --auto --mode 1280x1024 --dpi 86 --output
LVDS --off
gconftool-2 --set /desktop/gnome/font_rendering/dpi --type float
86
xvattr -a XV_CRTC -v 1
else
echo "Unknown mode $mode" >&2
exit 1
fi
I use this code doing 'xmode dual' when I run a external monitor or
'xmode single' when... well, it's pretty obvious.
I use gnome, so the code also changes the dpi value, and the xvattr
makes sure the video overlay is in the right screen (although I haven't
tried whether this is right or not). Of course, you'll need to change
the
Whatever desktop you're using, it is useful to have a keyboard shortcut
to 'xrandr --auto'. I use 'Ctrl-Alt-s', which ensures that if something
goes wrong with the screen detection, I can always get my screen back.
Hope this helps.
Carlos
> It would be nice to use the acpi hotkeys for this. I already filed a
> bug: http://bugs.debian.org/456778 But quite frankly I do not know how
> to do it properly on distribution wide, where multiple outputs: SVIDEO
> VGA are available.
>
> So if you have an idea on this please tell me and if we reach the
> conclusion I will forward it to the debian bts.
>
> Thanks in advance!
>
> Regards,
> cstamas
> --
> CSILLAG Tamas (cstamas) - http://digitus.itk.ppke.hu/~cstamas
>
> Put your hand on a hot stove for a minute, and it seems like an hour.
> Sit with a pretty girl for an hour, and it seems like a minute.
> That's relativity. -- Albert Einstein
>