Xrandr (re-size windows)

From The World according to Vissie
Jump to navigation Jump to search


First, determine which interface is connected to your display:

xrandr -q

Add missing modes

gtf 1920 1200 60 -x
xrandr --newmode "1920x1200_60.00"  193.16  1920 2048 2256 2592  1200 1201 1204 1242  -HSync +Vsync
xrandr --addmode VGA1 1920x1200_60.00
xrandr --output VGA1 --mode 1920x1200_60.00

gtf 1440 900 60 -x
xrandr --newmode "1440x900_60.00"  106.47  1440 1520 1672 1904  900 901 904 932  -HSync +Vsync
xrandr --addmode VGA-1 1440x900_60.00
xrandr --output VGA-1 --mode 1440x900_60.00
xrandr --newmode "1440x900_60.00"  106.47  1440 1520 1672 1904  900 901 904 932  -HSync +Vsync
xrandr --addmode DVI-I-2 1440x900_60.00
xrandr --output DVI-I-2 --mode 1440x900_60.00

Set as Primary

xrandr --auto --output DVI-I-1 --mode 1920x1200 --primary --right-of DVI-I-2

Make your changes permanent

You can add the following lines at the beginning of your /etc/gdm/Init/Default to set the resolution automatically every time you log in:

xrandr --newmode "1600x900_60.00"  118.25  1600 1696 1856 2112  900 903 908 934 -hsync +vsync
xrandr --addmode VGA1 1600x900_60.00
xrandr --output VGA1 --mode 1600x900_60.00

Modify /etc/lightdm/lightdm.conf to add the following options:

display-setup-script > calls your mycustomloginvideo.sh before the login screen appears
session-setup-script > calls your mycustomdesktopvideo.sh before the user desktop session starts
# for your login screen, e.g. LightDM (Ubuntu 11.10) or GDM (11.04 or earlier)
# for your desktop session

After I VNC into my laptop, the screen resolution is not as expected.

So I can now adjust my screen like this:

Screen 0: minimum 320 x 200, current 1440 x 900, maximum 8192 x 8192
VGA disconnected (normal left inverted right x axis y axis)
LVDS connected (normal left inverted right x axis y axis)
  1440x900       59.9*+
  1280x854       59.9  
  1280x800       59.8  
$ xrandr --output LVDS --mode 1280x800

When multiple refresh rates are present in the list (not in the example above), it may be changed by the --rate option, either at the same time or independently. For example:

$ xrandr --output LVDS --mode 1280x800 --rate 75