Low Widescreen Resolution in Lubuntu

I recently installed Lubuntu on my old laptop and got around to addressing something that has bugged me for a while – the lack of available low widescreen resolutions.  I understand that for most people, this isn’t an issue and most people tend towards the higher resolutions, but limited eyesight is never more a problem than when you’re trying to use a laptop.

I was able to drop my resolution to 640×480 without much difficulty using the Display Settings GUI, but of course that pillar-boxes on my widescreen display, so I set about looking into whether I could force the issue and get a widescreen resolution working.  Some Googling led me to the xrandr and cvt tools.

Creating and testing new screen resolutions

With my screen at 480 pixels high, I wanted to figure out how wide it would be to fill my display, so using the mathematics and the fact that my system detected a WXGA+ 1440×900 resolution, I got 480*(1440/900) = 768. Putting these figures through cvt, we get the following modeline:

brendan@ubuntu:~$ cvt 768 480
# 768x480 59.90 Hz (CVT 0.37MA) hsync: 29.95 kHz; pclk: 28.75 MHz
Modeline "768x480_60.00"   28.75  768 792 864 960  480 483 489 500 -hsync +vsync

We then make the new resolution available using xrandr, copying the data from the modeline above…

brendan@ubuntu:~$ xrandr --newmode "768x480_60.00"   28.75  768 792 864 960  480 483 489 500 -hsync +vsync
brendan@ubuntu:~$ xrandr --addmode LVDS1 768x480_60.00

… and switch to it:

brendan@ubuntu:~$ xrandr --output LVDS1 --mode 768x480_60.00

Ah, glorious lo-res! Let’s create another out of interest using the same technique – this very low res looked pretty dreadful but it’s nice to know it can be done.

$ cvt 320 200
$ xrandr --newmode "320x200_60.00"    5.00  320 336 360 400  200 203 209 212 -hsync +vsync
$ xrandr --addmode LVDS1 320x200_60.00
$ xrandr --output LVDS1 --mode 320x200_60.00

Making the new resolutions persistent

All our hard work in the terminal won’t survive a reboot, so we must do a bit more to make the changes permanent. While there are various ways of doing this, such as scripting the above to run at login, consensus seems to be that it’s best to do this at the X config level, as the new resolutions will be available earlier in the startup process.

It’s been a while since I looked at an xorg.conf file, so I was surprised to see that it no longer exists by default in *buntu. However, there are a set of conf files at /usr/share/X11/xorg.conf.d/ so I created a file there called 10-screen.conf and added the following:

Section "Monitor"
    Identifier    "Monitor0"
    Modeline "320x200_60.00"    5.00  320 336 360 400  200 203 209 212 -hsync +vsync
    Modeline "768x480_60.00"   28.75  768 792 864 960  480 483 489 500 -hsync +vsync
    Modeline "960x600_60.00"   45.25  960 992 1088 1216  600 603 609 624 -hsync +vsync
    Option "PreferredMode" "768x480_60.00"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Card0"
    Monitor        "Monitor0"
    SubSection "Display"
        Modes       "320x200_60.00" "768x480_60.00" "1440x900"
    EndSubSection
EndSection

Section "Device"
    Identifier    "Card0"
    Driver        "i915"
EndSection

The main things to note are the Modeline directives in the Monitor section – these are just the output given to us by cvt. As you can see I added another slightly higher resolution at 960×600. Also the PreferredMode option in the same block, which will be the default resolution. Also the Driver directive in the Device section. If you’re not sure which driver your using, you can obtain this by doing:

$ lshw -class display | grep driver

Now you can logout or reboot and have the X server restart with the new resolutions available. Enjoy the lo-res goodness!