DEV Community

Stack All Flow
Stack All Flow

Posted on • Originally published at stackallflow.com on

How to Set a Custom Resolution in Ubuntu?

Ubuntu – How to set a custom resolution

display-resolutionxrandr

I tried to use xrandr to set 1680×1050 as a new mode to VGA output, but it says:

sudo xrandr --addmode VGA-0 1680
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 140 (RANDR)
Minor opcode of failed request: 18 (RRAddOutputMode)
Serial number of failed request: 35
Current serial number in output stream: 36
Enter fullscreen mode Exit fullscreen mode

Accepted Answer

First generate a “modeline” by using cvt

Syntax is: cvt width height refreshrate

cvt 1680 1050 60

Enter fullscreen mode Exit fullscreen mode

this gives you:

# 1680x1050 59.95 Hz (CVT 1.76MA) hsync: 65.29 kHz; pclk: 146.25 MHz
Modeline "1680x1050_60.00" 146.25 1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync

Enter fullscreen mode Exit fullscreen mode

Now tell this to xrandr :

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

Enter fullscreen mode Exit fullscreen mode

Then you can now add it to the table of possible resolutions of an output of your choice:

xrandr --addmode VGA-0 1680x1050_60.00

Enter fullscreen mode Exit fullscreen mode

The changes are lost after reboot, to set up the resolution persistently, create the file ~/.xprofile with the content:

#!/bin/sh
xrandr --newmode "1680x1050_60.00" 146.25 1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync
xrandr --addmode VGA-0 1680x1050_60.00

Enter fullscreen mode Exit fullscreen mode

The post How to Set a Custom Resolution in Ubuntu? appeared first on Stack All Flow.

Discussion (0)