Add custom resolution and refresh rate when using Wayland

Add custom resolution and refresh rate when using Wayland

Monitors and/or adapters don't always return all the supported resolutions and refresh rates to your computer. In those cases you may need to do some finagling to get the right configuration to work.

On Windows you can usually rely on your graphics card's accompanying software to offer such functionality, and with X11 you can create a configuration file to add whatever setting might be missing. If you're using GNOME (and possibly other DEs) on Wayland, however, there currently doesn't seem to be a way to do this either through settings or via a configuration file.

Fortunately, grub comes to the rescue.

What resolutions does it claim to support?

Let's first take a peek to see what your monitor or adapter actually reports as being supported. In order to see all the resolutions your monitor and/or adapter lists as being supported, open up a Terminal window and run the following command:

❯ ls /sys/class/drm/card*

This will return a list of all your graphics cards and the ports they have. If you only have one GPU (and no integrated graphics), you'll probably want to look for card0, but this command should help you see what applies to your specific system.

Now that you know what card to look for, and what the exact name of the port your monitor is plugged in to, we can run the following command which should return a full list of supported resolutions. Substitute my card0-HDMI-A-1 example with the appropriate port of your setup:

❯ cat /sys/class/drm/card0-HDMI-A-1/modes

Also make note of this port name, as you'll need to use it in the next step. In my case, the port name is HDMI-A-1.

You'll notice that this list has no information on supported refresh rates. If you're interested in obtaining that, we actually need to try to parse the monitor/adapter's provided edid data. You can do this by installing the read-edid package, and then piping the monitor's edid data into the parse-edid tool like so:

❯ cat /sys/class/drm/card0-HDMI-A-1/edid | parse-edid

That should give you some more information, specifically the VertRefresh value.

But perhaps this check is less relevant, as you're here to find a way to add a resolution and refresh rate combination that you know your monitor supports, but your computer somehow isn't made aware of. Let's go ahead and deal with that next.

Adding a supported resolution using GRUB

Using your favorite text editor, open up the grub configuration file and look for the GRUB_CMDLINE_LINUX_DEFAULT value. Your particular setup might already have a few things there, or not.

Using the port name we found previously (ie. HDMI-A-1 on my system), let's add the missing resolution and refresh rate.

In my specific case my LG Flatron GZ T910B CRT monitor —connected through an HDMI to VGA adapter— correctly reports that it supports 1280x1024, but the listed supported refresh rate maxes out at 75Hz, even though the monitor supports 85Hz. Whatever your specific resolution and refresh rate combination might be, the process is of course the same. Simply substitute my example resolution (1280x1024) and refresh rate (@85) with your own.

Here's the format you'll have to use:


Using my resolution and refresh rate as an example it would look like this:


A more complete example would look something like this:

GRUB_CMDLINE_LINUX_DEFAULT="quiet video=HDMI-A-1:1280x1024@85"

If you need to configure additional custom resolutions for other ports, you can do this by defining video= multiple times, one for each port. I'm not sure if it's actually possible to provide multiple different resolutions for one port though, as I couldn't find any information on that unfortunately. If someone happens to know more about this, please do let me know.

For more technical information on what options are available, check out this kernel documentation page on the frame buffer.

That's all there is to it. Pretty easy, right?

After saving your grub config, now all you have to do is apply these changes and reboot. Run sudo update-grub on systems that have this included, or otherwise you'll likely want to run sudo grub2-mkconfig -o /boot/grub2/grub.cfg. Please refer to your flavor's documentation if you are unsure which method to use to update grub.

Now, reboot and open your system preferences. If all went well, you should now see the newly added resolution and refresh rate.