Skip to content

Instantly share code, notes, and snippets.

@4i8
Created April 30, 2023 09:09
Show Gist options
  • Save 4i8/e485a9979e4f25677d487784c1101bb0 to your computer and use it in GitHub Desktop.
Save 4i8/e485a9979e4f25677d487784c1101bb0 to your computer and use it in GitHub Desktop.
This Gist provides the steps to add a custom resolution to your primary display on Ubuntu 22.04. It uses the cvt and xrandr commands to generate the timings for the new resolution and add it to your primary display.

Here are the steps to add a custom resolution to your primary display on Ubuntu 22.04:

  1. First, you need to generate the timings for your desired resolution and refresh rate. You can use the cvt command to generate the timings. For example, if you want to add a resolution of 1920x1080 at 60Hz, you can run the following command:
cvt 1920 1080 60

This will output the timings you need to add the resolution. image

  1. Next, you need to create a new mode using the timings you generated in the previous step. You can use the xrandr command to create a new mode. For example, if the timings you generated are:

    Modeline "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync

    You can create a new mode with the following command:

xrandr --newmode "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync
  1. Once you have created the new mode, you need to add it to your primary display. You can use the xrandr command to add the new mode to your primary display. For example, if your primary display is named VGA-1, you can add the new mode with the following command:
xrandr | grep " connected primary"

image

xrandr --addmode VGA-1 "1920x1080_60.00"
  1. Finally, you can set the new resolution on your primary display using the xrandr command. For example, if you want to set the resolution to 1920x1080 at 60Hz, you can run the following command:
xrandr --output VGA-1 --mode "1920x1080_60.00"

This will set the new resolution on your primary display.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment