Adding a new display resolution in Linux
Short story. I get a new laptop with Windows 10, so I need to install Linux, installed but… I get 1366x768 as display resolution, but also I don’t get any alternatives with the display manager. So, how I can change the resolution ?
First, search the resolution you want with your laptop (you can use the website of the manufacturer or test it with xrandr)
# name of the display - resolution - refresh rate$ xrandr --output eDV1 --mode 1920x1080 --rate 60
When you get the resolution that you want, generate a modeline with CVT (width height resfresh-rate)
$ cvt 1920 1080 60
# 1920x1080 59.95 Hz (CVT 1.76MA) hsync: 65.29 kHz; pclk: 146.25 MHz
Modeline "1920x1080_60.00" 146.25 1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync
The values at the end are created as demo, you need to get it with your laptop.
now, you need to create a new mode with xrandr, copying the last content from cvt command:
$ xrandr --newmode "1920x1080_60.00" 146.25 1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync
And now you need to add it to the table of resolutions, with the output of your choice (my case was a WAYLAND0, I reach this later)
$ xrandr --addmode WAYLAND0 1920x1080_60.00
Now you can use it with display manager or with xrandr:
$ xrandr -s 1920x1080_60.00
Problems?
Always.
First, when you reboot your machine, the changes are lost, so, create the next file: ~/.xprofile and add this (with your config), this will persists your changes:
#!/bin/sh
xrandr --newmode "1920x1080_60.00" 146.25 1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync
xrandr --addmode WAYLAND0 1920x1080_60.00
Now, I found some troubles like:
xrandr failed to change the screen configuration
xrandr configure crtc 0 failed
When you run xrandr, he tells you what display is using, in my case was: WAYLAND0 (which is a display server protocol , better (I think) than X window, but It’s causing me problems, so I disabled it, uncommenting a line in this file (or some variation of gdm folder):
/etc/gdm3/custom.conf#WaylandEnable=false
Reboot and now you can use xrandr for change your display resolution.