I tried to use xrandr
to set 1680x1050 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
First generate a "modeline" by using cvt
Syntax is: cvt width height refreshrate
this gives you:
Now tell this to xrandr:
Then you can now add it to the table of possible resolutions of an output of your choice:
The changes are lost after reboot, to set up the resolution persistently, create the file
~/.xprofile
with the content:How to set a custom resolution previously specified. After executing the other steps defined to create the resolution, run:
How to set a custom resolution previously specified when running multiple monitors. After executing the other steps defined to create the resolution, run:
xrandr --output DVI-0 --mode 1680x1050
Replace
DVI-0
with your device-id, e.g.VGA-0
Thanks to thom and thirdender this is basically a single command configuration based on the most voted answer.
The above command will generate the desired
~/.xprofile
file. Just make sure you use the resolution (i.e. theRES
variable) of your liking. More info here.You could replace
with
in
$DISP
variable if that does not work for you.Definitely you have to take a look at autorandr, there seems to be no easier way.
This is the man page (from Ubuntu): http://manpages.ubuntu.com/manpages/bionic/man1/autorandr.1.html
And this is the source code: https://github.com/phillipberndt/autorandr
Install it in Ubuntu with:
Then just save your current config with:
and change config and save others with
Then just apply them whenever you want with:
for example:
will load the first config you saved in this example.
Nothing easier !!