How to: Set monitor resolution

Last Updated on: 19th September 2023, 10:52 pm

Monitors resolution used to be set properly during a live system testing and/or the hard drive installation. In some cases, some monitors settings have to be fixed manually.

This short tutorial lets you set it right.

1. As the first step, check what exact resolution of your monitor is offered by the monitor producer.

2. Use ‘XRandR’ – a console tool which lets you detect existing settings and set new settings right.
In my case it should be 1366×768 but my system set it wrong, to small resolution 1024×768.

xrandr -q
VGA1 connected (normal left inverted right x axis y axis)
   1024x768       60.0 
   800x600        60.3     56.2 
   848x480        60.0 
   640x480        59.9 
DP1 disconnected (normal left inverted right x axis y axis)

3. Generate ‘modeline’ using ‘gtf’ command:
gtf width height refresh-frequency
In my case, it is:
gtf 1366 768 60
 
# 1368x768 @ 60.00 Hz (GTF) hsync: 47.70 kHz; pclk: 85.86 MHz
Modeline "1368x768_60.00" 85.86 1368 1440 1584 1800 768 769 772 795 -HSync +Vsync

4. Set right settings for your monitor (copy the last line after ‘Modeline’):
xrandr --newmode "1368x768_60.00" 85.86 1368 1440 1584 1800 768 769 772 795 -HSync +Vsync

xrandr --addmode VGA1 1368x768_60.00
xrandr --output VGA1 --mode 1368x768_60.00
* Change “1368x768_60.00” for your resolution.
* Change ‘VGA1″ for your monitor description.

This is a temporary solution only.
You can make it more permanent.

5. Create a new empty file in your home directory, for example:
.mymonitor
6. Copy the last three commands, we used before and past them to the file (see above):

#! /bin/bash
xrandr --newmode "1368x768_60.00" 85.86 1368 1440 1584 1800 768 769 772 795 -HSync +Vsync
xrandr --addmode VGA1 1368x768_60.00
xrandr --output VGA1 --mode 1368x768_60.00

7. Make the file executeable:
chmod a+x .mymonitor
8. Add the file “.mymonitor” to the system’s startup list.
You can do it manually – create a new ‘desktop’ file, for example:
mymonitor.desktop
in your home directory:
~HOME/.config/autostart/
9. Copy the text below and past it to the ‘desktop’ file:

[Desktop Entry]
Encoding=UTF-8
Name=MyMonitor
Comment=MyMonitor
Exec=sh /home/user/.mymonitor
StartupNotify=true
Terminal=false

* Change ‘user’ for your user nick name.

More information about XRandR you can get with commands:

xrandr --help
man xrandr

2 thoughts on “How to: Set monitor resolution”

  1. This was very helpful, thank you for the insight! Also, thank you for an “excellent” Linux distribution!

    Reply
  2. Sometimes I am limited to a few remedial VGA settings based on GPU settings data, rather than a (fairly) full array of settings my display device can accommodate. Thank you for laying out an effective coping procedure.
    (Trusting EDID is a common trap.)

    Reply

Leave a Comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Skip to content