Fix external monitor resolution in Ubuntu 20.04
By: Mohammed Essaid Mezerreg
Tags: Ubuntu, Resolutions, External Monitor, Ubuntu 20 04, Ubuntu Desktop

I never thought of writing this kind of article before. However, facing these problems whenever I change something in my working machine forced me to write whatever I find on fixing them.

HDMI to VGA adapter.

I have an old screen without an HDMI port in it. I love it, and I use it to put my note-taking apps and writing. Its highest resolution is 1368 x 768, so you can make anything looks bigger without changing the system accessibility settings or change font sizes, or zooming. On the other hand, my laptop doesn’t have a VGA port, and that’s why I need the adapter shown above. I had one before since the last I bought this screen to use with a Raspberry PI, and it lived for three years now until today. I tried to put the monitor away, but man, I couldn’t. Everything looks smaller when I read articles on the built-in screen, and I have to change to large text under the seeing category in the Universal Access setting in Ubuntu. I even wondered how I am writing code with this small font or developing this separation between apps and activities.

To cut the story short, I bought a new adapter. I plugged it, and the screen needed adjustments. The auto-adjusting button took care of this problem. However, the resolution wasn’t right. I checked the settings, and I didn’t find the usual options. I don’t remember what was there, but I knew the numbers are not right. After researching how to fix the issue after confirming my screen's right resolution from its website, I found this solution, which works like a charm.

Add a new screen mode

To add a new mode or resolution to your monitor or screen settings, you can follow these simple steps.

First, we find our monitor or screen handle using the xrandr command.

$ xrandr

I had these stupid results; honestly, I don’t know where they came from, but that’s what I had executing this command. As you can see, my monitor is the DP-3 output at the end.

Next, we create our new mode using the cvt command as follow:

$ cvt 1368 768

Outputs of the previous command.

Where the first argument is the width and the second is the height. We take the last outputted line without the Modeline word and pass it as an argument to the next command. Moreover, you can add the option -r to the command to decide on the highest frequency for your monitor or mode and create a mode without blanks on the screen. The command above without this option shows a black or blank line of two-pixel height at the screen's bottom. However, with the --reduced option, it filled the whole screen.

Then, we add the new mode to our monitor’s options list using the same command we used to list our monitors or displays in the first step.

$ xrandr --newmode "1368x768_60.00" 85.25 1368 1440 1576 1784 768 771 781 798 -hsync +vsync

Finally, we attach the newly created mode to our monitor using the --addmode option with the first argument being the monitor name and the second the name of our newly created mode.

$ xrandr --addmode DP-3 1368x768_60.00

Now, we can go to the settings and select the new mode, and voila. However, this is a temporary change, and when you reboot or power-up your machine the next day, it won’t have this setting. To make the changes permanent, you have to add the last two commands to your .profile script.

xrandr --newmode "1368x768_60.00" 85.25 1368 1440 1576 1784 768 771 781 798 -hsync +vsync

xrandr --addmode DP-3 1368x768_60.00