How to change custom resolution in Ubuntu 10

I have been looking for the solution since I use Ubuntu 10 as an alternative OS with Windows. The only problem is that it doesn’t display correct resolution 1680×1050 for my 22″ HP Monitor (HPw2228h). I came across over this Xrandr Configuration from Ubuntu official documentation and this tread from Ubuntu Forum. Combine these two solutions, I finally manage to get correct resolution in Ubuntu.

gtf and cvt

Before you add new mode using xrandr, you need to type following one of command lines in Ubuntu terminal. I prefer using gtf.

gtf 1680 1050 60
cvt 1680 1050 60

1680 is X and 1050 is Y and 60 is refresh rate. For refresh rate, please check your monitor manual.

The command will produce the following output. Copy the text after word, Modeline.

Modeline "1680x1050_60.00"  146.25  1680 1784 1960 2240  1050 1053 1059 1089 -hsync +vsync

xrandr

Before you type the following command lines, please be sure to check the video mode your external monitor is using. To check your video mode, you can type the following command line

xrandr -q

It will list the displays you are using now. The result is something like this

Screen 0: minimum 320 x 200, current 1680 x 1050, maximum 8192 x 8192
VGA1 connected 1680x1050+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
1360x768       59.8
1024x768       60.0
800x600        60.3     56.2
848x480        60.0
640x480        59.9     59.9
1680x1050_60.00   59.9*
LVDS1 connected (normal left inverted right x axis y axis)
1280x800       59.9 +
1024x768       60.0
800x600        60.3
640x480        59.9
TV1 disconnected (normal left inverted right x axis y axis)

You will see VGA1, LVDS1 and TV1 … these are the mode your system is using. For my case, VGA1 is the video mode for my monitor. It may be different from video driver. Now it is time for add new resolution mode using xrandr. Type the following command lines

xrandr --newmode "1680x1050_60.00"  146.25  1680 1784 1960 2240  1050 1053 1059 1089 -hsync +vsync
xrandr --addmode VGA1 "1680x1050_60.00"
xrandr --output VGA1 --mode "1680x1050_60.00"

Tip: There are two minus “-” in newmode, addmode, output and mode . WordPress doesn’t display it correctly.

First line add a new mode. Following parameters will be different from the result produced by gtf and cvt. Second line add the Video Mode and Resolution along with refresh rate. After you type third command line, you will see the your resolution is already changed.

Permanent resolution

Well the command lines you are trying is not a permanent resolution in ubuntu. It only change the time you type those command lines. To make it permanent, ubuntu documentation suggests that you can change in ~/.xprofile, kdm/gdm and xorg.conf.

~/.xprofile

1. create a file, if it doesn’t exist yet.

nano ~/.xprofile

and Copy and paste the three command lines from above and put in xprofile file. and save it and make it executable. well, xprofile is only for the current user and other user can’t user the custom resolution.

kdm/gdm

I am using gdm in ubuntu. So I will cover the gdm only. Go to /etc/gdm/Init and login as super user root. Before you’re making changes to Default file, make sure you have a backup. Type the following.

cd /etc/gdm/Init
cp Default Default.backup

Then edit the Default file, type nano Default. (I personally prefer using nano editor)

nano Default

Find the following line.

initctl -q emit login-session-start DISPLAY_MANAGER=gdm

and put three command lines in my tutorial right before it.

xrandr --newmode "1680x1050_60.00"  146.25  1680 1784 1960 2240  1050 1053 1059 1089 -hsync +vsync
xrandr --addmode VGA1 "1680x1050_60.00"
xrandr --output VGA1 --mode "1680x1050_60.00"

initctl -q emit login-session-start DISPLAY_MANAGER=gdm

For xorg.conf and complex configuration. You can read Xorg configuration in Ubuntu. I hope this tutorial will help. If you have any problems, please drop comment.

ubuntu-1680x1050


Comments

6 responses to “How to change custom resolution in Ubuntu 10”

  1. Mr Fay Knaim Avatar
    Mr Fay Knaim

    This might be a very helpful tutorial for me, but I do not know what numbers I need to put in my case, when using this command:
    xrandr –newmode “1680x1050_60.00″ 146.25 1680 1784 1960 2240 1050 1053 1059 1089
    my TV accepts 1280×720 @ 50Hz, and 960×600 @ 52Hz.
    I need to set my resolution to something like 1200×680

    What numbers should I use?

    Thanks for any help that you can provide!

    –TJ

  2. Mr. Fay Knaim,

    I have send you the instructions in the email already. Please check it out! I hope it helps.

  3. I need to know the numbers as well. Please forward the info to me.

  4. Thanks, this is exactly what I looking for.

  5. Hi,

    I translated your tutorial to portuguese and publish on my blog. Can I keep it?

    I made a reference to your site at the end of the post.

    chears

  6. Abdul Mutaal Avatar
    Abdul Mutaal

    Hi , 

    Can you explain the steps to be followed for Fedora (for permanent solution) ?