1.9 KiB
1.9 KiB
title | date |
---|---|
xRandr and dual screen | 2010-06-09 18:28:23 |
As always when you have to study an exam, you notice something on your computer that doesn't work ... Today was the easy way to connect an external display and use it to ... hum ... work.
As I don't use fancy desktop environment, no gui tools are available. That's not a problem, you just have to do it the easy way: Some obscure key bindings that will launch a script that will do what you wanted.
The program used for display "manipulations" is xrandr. Very useful, simple, does what it claims to do ... and command line ! Perfect, let's do our little script :
#!/bin/bash
RESOLUTION="800x600"
INTERNAL="LVDS1"
EXTERNAL="VGA1"
touch /tmp/xrandr
loop=`cat /tmp/xrandr`
case "$loop" in
vga_right)
xrandr --output $INTERNAL --auto --output $EXTERNAL --auto --left-of $INTERNAL
echo "vga_left" > /tmp/xrandr
;;
vga_left)
xrandr --output $INTERNAL --mode $RESOLUTION --output $EXTERNAL --mode $RESOLUTION --same-as $INTERNAL
echo "vga_double" > /tmp/xrandr
;;
vga_double)
xrandr --output $INTERNAL --auto --output $EXTERNAL --off
echo "vga_off" > /tmp/xrandr
;;
*)
xrandr --output $INTERNAL --auto --output $EXTERNAL --auto --right-of $INTERNAL
echo "vga_right" > /tmp/xrandr
;;
esac
To be able to use it, just modify the internal and external display name. You can find them just by typing:
$ xrandx -q
</pre>
The output should tell you the names:
<pre>
Screen 0: minimum 320 x 200, current 2880 x 1200, maximum 8192 x 8192
VGA1 connected 1600x1200+1280+0 (normal left inverted right x axis y axis) 408mm x 306mm
1600x1200 60.0*+
1280x1024 75.0 60.0
[...]
LVDS1 connected 1280x800+0+0 (normal left inverted right x axis y axis) 286mm x 179mm
1280x800 59.9*+
1024x768 85.0 75.0 70.1 60.0
[...]
TV1 disconnected (normal left inverted right x axis y axis)