Setting up a linux distro

May 1, 2013 at 12:00

Adding a Custom Screen Resolution

I am running Gnome 2.4 on Debian, and it’s been a while since I’ve hacked an xorg.conf file. So long in fact, that you don’t need to do that any more: you now use xrandr.

Firstly start an xterm as root, and type xrandr:

root@debian:/home/me# xrandr
Screen 0: minimum 64 x 64, current 1920 x 1200, maximum 32000 x 32000
VBOX1 connected 1920x1200+0+0 0mm x 0mm
   1920x1200      60.0*+
   1680x1050      60.0
   1600x1024      60.2
   1400x1050      60.0
   1280x1024      60.0
   1440x900       59.9
   1280x960       60.0
   1360x768       59.8
   1152x864       60.0
   1024x768       60.0
   800x600        60.3
   640x480        59.9
   1920x1200_60.00   59.9

Note the VBOX that’s the output adaptor for the Virtual Box video.

Next run cvt:

root@debian:/home/me# cvt -h

usage: cvt [-v|--verbose] [-r|--reduced] X Y [refresh]

 -v|--verbose : Warn about CVT standard adherance.
 -r|--reduced : Create a mode with reduced blanking (default: normal blanking).
            X : Desired horizontal resolution (multiple of 8, required).
            Y : Desired vertical resolution (required).
      refresh : Desired refresh rate (default: 60.0Hz).

Calculates VESA CVT (Coordinated Video Timing) modelines for use with X.

So we want to add a custom mode for 1920x1200 pixels:

root@debian:/home/me# cvt 1920 1200
# 1920x1200 59.88 Hz (CVT 2.30MA) hsync: 74.56 kHz; pclk: 193.25 MHz
Modeline "1920x1200_60.00"  193.25  1920 2056 2256 2592  1200 1203 1209 1245 -hsync +vsync

Then finally, these are the commands that we want to execute in a root xterm to change the screen resolution:

xrandr --newmode "1920x1200_60.00"  193.25  1920 2056 2256 2592  1200 1203 1209 1245 -hsync +vsync

xrandr --addmode VBOX1 1920x1200_60.00

xrandr --output VBOX1 --mode 1920x1200_60.00

However this is only temporary, so we need to add it to Gnome’s start up configuration;

Edit /etc/gdm3/Init/Default, and add the above three lines immeadiately near the top, e.g.:

#!/bin/sh
# Stolen from the debian kdm setup, aren't I sneaky
# Plus a lot of fun stuff added
#  -George

PATH="/usr/bin:$PATH"
OLD_IFS=$IFS

#
xrandr --newmode "1920x1200_60.00"  193.25  1920 2056 2256 2592  1200 1203 1209 1245 -hsync +vsync
xrandr --addmode VBOX1 1920x1200_60.00
xrandr --output VBOX1 --mode 1920x1200_60.00

And now reboot the Virtual Box image.