Set a custom screen resolution in Ubuntu 17.04

In some cases, I have to set my Ubuntu computer to run with a screen resolution that does not show up in the Settings (1366x768 or 16:9, because the monitor does not support it). Here is a pretty neat strick:

1. Check all the support screen sizes and device names:

xrandr

Screen 0: minimum 320 x 200, current 1366 x 768, maximum 8192 x 8192
VGA-1 connected primary 1024x768+0+0 (normal left inverted right x axis y axis) 410mm x 230mm
   1024x768      75.03    60.00
   800x600       75.00    60.32
   640x480       75.00    59.94
   720x400       70.08

Remember name of the device which is VGA-1.

2. Run the cvt command to calculate the VESA Coordinated Video Timing modes:

cvt 1366 768

# 1368x768 59.88 Hz (CVT) hsync: 47.79 kHz; pclk: 85.25 MHz

Modeline "1368x768_60.00"   85.25  1368 1440 1576 1784  768 771 781 798 -hsync +vsync

Remember the modeline which is in bold.

3. Create a new mode with the xrandr:

sudo xrandr --nemode "1368x768_60.00"   85.25  1368 1440 1576 1784  768 771 781 798 -hsync +vsync

4. Add the new mode to the device:

sudo xrandr --addmode VGA-1 "1368x768_60.00"

5. Go to Display settings and select the new resolution :D

6. Add these above commands to ~/.profile to add the screen mode next system startup:

cvt 1366 768
xrandr --nemode "1368x768_60.00"   85.25  1368 1440 1576 1784  768 771 781 798 -hsync +vsync
xrandr --addmode VGA-1 "1368x768_60.00"

Comments