Add new screen resolution in X.Org 

Linux does not have as much options for display resolutions as in Microsoft Windows. A 22″ Monitor in linux will have 1920×1080, 1440×900, 1280×960, 1024×768 resolutions. Some users may need resolution like 1600×900, 1366×768 for some purposes. These resolutions can be added manually in Linux.

Basic steps for adding 1600×900 resolution are explained as under which can be modified for any other screen resolution by changing values 1600×900 with your required one.

  1. First step is to create modeline. This is done to get appropriate values of hsync, vsync and other parameters which are required to display a resolution properly in the backend. To add resolution of 1600×900, open terminal and type:

    cvt 1600 900

    This will create modeline for resolution of 1600×900 which will look something like this:

    # 1600x900 59.95 Hz (CVT 1.44M9) hsync: 55.99 kHz; pclk: 118.25 MHz
    Modeline "1600x900_60.00" 118.25 1600 1696 1856 2112 900 903 908 934 -hsync +vsync

    These numbers may vary according to your monitor.

  2. To add this resolution to monitor settings, type the following highlighted commands one by one:

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

    Note: values after xrandr –newmode to be pasted from second line of generated values with cvt command from your own computer, don’t copy from here. In other words, after writing xrandr –newmode in terminal, copy the output of cvt command from its second line excluding word Modeline upto its end and paste it after xrandr –addmode.

    xrandr --addmode VGA1 "1600x900_60.00"

    After these steps, resolution of 1600×900 will appear under the list of various resolutions available in display settings. This will remain listed for one session only. When computer is restarted, this will disappear. To make it appear permanently, we need to configure xorg.conf file and make this entry manually.

  3. In Mint, xorg.conf is not present by default and has to be created. This can be created only when X server is not working ie. in console mode otherwise system will give error. Type these highlighted commands one by one in console mode:

    Ctrl+Alt+F1 (switch to console mode)
    Login by typing user name and password
    sudo service lightdm stop (For Mint 12 Lisa users) or sudo service mdm stop (For Mint 13 Maya and above users)
    sudo X -configure (generates new xorg.conf file)

    File with name xorg.conf.new will be created in Home folder. Although some error message will appear but file will be created. Just ignore that message.

    Note:

    1. Use only one of the commands (from sudo service lightdm stop or sudo service mdm stop) according to your distro edition. These are used to kill X server.
    2. In Mint 13 Maya and above, after sudo service mdm stop, Ctrl+Alt+F1 has to be pressed again.

  4. To switch back to graphical mode, type:

    sudo start lightdm (Mint 12 Lisa users)
    sudo service mdm start (Mint 13 Maya and above users)

    If above commands fail to bring back graphical mode try to change it with Ctrl+Alt+F7 or Ctrl+Alt+F8. If that fails just restart your computer.

  5. Open Home folder. Rename this file from xorg.conf.new to xorg.conf. Open xorg.conf with text editor and make the following changes. Underline shows newly added lines:

    Modification #1 — Add Modeline in Monitor Section under each Identifier option. Example:

    Section "Monitor"
            Identifier   "Monitor0"
            Modeline     "1600x900_60.00"  118.25  1600 1696 1856 2112  900 903 908 934 -hsync +vsync
            VendorName   "Monitor Vendor"
            ModelName    "Monitor Model"
    EndSection

    Section "Monitor"
            Identifier   "Monitor1"
            Modeline     "1600x900_60.00"  118.25  1600 1696 1856 2112  900 903 908 934 -hsync +vsync
            VendorName   "Monitor Vendor"
            ModelName    "Monitor Model"
    EndSection

    Modification #2 — Add modes in screen section in similar way as described above in each subsection (screen1, screen2) under the element Depth (Also for each depth). Example:

    Section "Screen"
        Identifier "Screen0"
        Device     "Card0"
        Monitor    "Monitor0"
        SubSection "Display"
                   Viewport   0 0
                   Depth     1
                   Modes   "1600×900"
        EndSubSection
        SubSection "Display"
                    Viewport   0 0
                    Depth     4
                    Modes   "1600×900"
        EndSubSection
        SubSection "Display"
                     Viewport   0 0
                     Depth     8
                     Modes   "1600×900"
        EndSubSection

    (Upto Depth 24)

    EndSection

    Section "Screen"

     Identifier "Screen1"
        Device     "Card1"
        Monitor    "Monitor1"
        SubSection "Display"
                    Viewport   0 0
                    Depth     1
                    Modes   "1600×900"
        EndSubSection
        SubSection "Display"
                    Viewport   0 0
                    Depth     4
                    Modes   "1600×900"
        EndSubSection
        SubSection "Display"
                     Viewport   0 0
                     Depth     8
                     Modes   "1600×900"
        EndSubSection

        (Upto Depth 24)

    EndSection

  6. Save this file and copy this file to /etc/X11/ by typing following command…

    sudo cp xorg.conf /etc/X11

    … assuming that xorg.conf is located at Home folder, or do it by graphically if you know how.

Note: New resolution must be less than Maximum resolution that monitor can support. And care fully add those lines to each subsection Monitor0, Monitor1, Monitor2, Monitor3, Screen1, Screen2, Screen3, Screen4. For Screen section, add entries for every Depth from 1, 2, 4, 8, 16, 24.

The text above was originally posted at LinuxMint Community by Thinker. This also works for Zorin OS, Pinguy OS and many other X.Org based distros.

Another option is to create the following script, originally made by Danial Rikhteh Garan, and use it.

  1. Open a new file with your text editor and put the text below.

        #!/bin/bash
        #####
        ### Fix detect display resolution
        ## Please submit feedback and questions at d.rikhtehgaran@gmail.com
        ## Danial Rikhteh Garan 2013-04-06
        ##

        #### Config ###

        ### Define your suitable resolution that you want (you can get high resolution your display support using just xrandr)
        ## Set it in this format x
        resolution=”1440×900″

        ### Set delay for autostart this script
        delay=”10s”

        ### For find your display name run this command: xrandr
        ## Mine was VGA1
        displayName=”VGA1″

        ### This help may help you for dispaly name (https://wiki.ubuntu.com/X/Config/Resolution)     ##
           # Intel driver – UMS

             # VGA – Analog VGA output
             # LVDS – Laptop panel
             # DP1 – DisplayPort output
             # TV – Integrated TV output
             # TMDS-1 – First DVI SDVO output
             # TMDS-2 – Second DVI SDVO output
             # The SDVO and DVO TV outputs are not supported by the driver at this time.

           # Intel driver – KMS

             # LVDS1 – Laptop panel
             # VGA1 – Analog VGA output
             # DVI1 – Digital video output

           # ATI Radeon driver

             # VGA-0 – Analog VGA output
             # LVDS – Laptop panel
             # S-video – Integrated TV output
             # DVI-0 – DVI output
             # http://www.thinkwiki.org/wiki/Xorg_RandR_1.2
        ##

        sleep $delay
        var=$(xrandr | grep VGA) ; tmp=”${var#VGA?}”; vga=”${var%$tmp}”
        width=”${resolution%x*}”
        height=”${resolution#*x}”
        cvt=$(cvt $width $height)
        mod=”${cvt##*Modeline}”
        read -rd ‘ ‘ addMod < <(echo $mod)     xrandr --newmode $mod     xrandr --addmode $vga $addMod     xrandr -s "${width}x${height}"

  2. Don’t forget to change resolution, delay and displayName in the file to your desired values.

  3. Save it somewhere and make it executable (chmod 755 fixScreen.sh). Moving it to /usr/share/bin/ (sudo mv fixScreen.sh /usr/share/bin would be better, but you can save it anywhere.

  4. In the “Startup Applications” add the script like in the picture below:

    Adding it to Startup Applications

    We assume in the example above that you have saved it to /home/mgr/Script/fixScreen.sh.

  5. Done. Restart your PC or logout and login.

Hope this could be helpful.