Change Ubuntu Screen Resolution to what ever you want

Ok this one is more for me so I can remember what I did next time!

Basically the story is I have a monitor attached to a computer running Ubuntu (Minimalist) via a 20m VGA cable. The monitor is mounted on a wall and rotated 90o
clockwise. It is also a small widescreen so has a strange resolution. When I connect it to the computer with a short VGA cable it is fine and Ubuntu picks up the details, however with the long VGA cable it doesn’t so puts on an even stranger resolution.

As Ubuntu won’t pick up the monitors resolution, I have to add it.
All the instuctions on the intertubes say edit this edit that (/etc/X11/xorg.conf amongst others). Great, apart from the fact those files don’t exist and I don’t fancy making them manually. Sure there is likely to be an obscure command somewhere to do it but I don’t know what it is…

So how did I make the resolution back to normal?
With the power of xrandr (and cvt).
This is what you do (All commands need to be run in a terminal):

$ cvt X Y

Replace X & Y with desired resolution, so in my case cvt 1440 900. You can put a refresh rate at the end as well if you want.
This will churn out a modeline that you can apparently put in xorg.conf but if it don’t exist….


# 1440x900 59.89 Hz (CVT 1.30MA) hsync: 55.93 kHz; pclk: 106.50 MHz
Modeline "1440x900_60.00" 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync

We are interesting in the bit in bold.
Next we want to add a new mode using xrandr –newmode

$ xrandr --newmode big 106.50 1440 1528 1672 1904 900 903 909 934

note that you can change ‘big’ to whatever you want, just remember what!
Now we want to add that new mode to the output.

$ xrandr --addmode VGA-1 big

Tip: VGA-1 may be different on your machine. If you type xrandr –output then press tab twice a list of outputs will appear. Choose the one you (think) are using.
Now we want to make that output actually use that mode!

$ xrandr --output VGA-1 --mode big

Change the output and mode to whatever you used.

Now that only works once, and after a reboot your computer will go back to normal 🙁
There a couple of options here, but I went the easy way. I created a small script to run the above commands then added that script to the startup / login programs in Ubuntu (System -> Preferences -> Startup Applications)

changeRes.sh

#!/bin/bash
#run cvt to get the modeline!
xrandr --newmode big 106.50 1440 1528 1672 1904 900 903 909 934
xrandr --addmode VGA-1 big
xrandr --output VGA-1 --mode big


Leave a Reply

Your email address will not be published. Required fields are marked *