Search This Blog

July 27, 2020

Persisting Higher Resolution In Ubuntu For External Monitor

My Context

Monitor: 32 inches display LG FHD Monitor 
OS: Ubuntu 20.04 

Problem Statement

Even though the display resolution of my external monitor supports 1920x1080, it is not shown. I want to see this resolution as default when my Ubuntu OS is loaded and I login in.

Solution Recipe

Note: We will use xrandr for this, which is a CLI to RandR (Resize and Rotate) X Window System extension.
First thing first, you got to know how your external monitor is recognized by your ubuntu. For this run the following command in your terminal:
xrandr --listactivemonitors
The output will have one of VGA-1 or DP-1 or HDMI-1. In my case it is DP-1. Depending on the value you get in your terminal, you may have to change the below script accordingly.

Type cvt 1920 1080 (to get the --newmode args for the next step).

Type sudo xrandr --newmode "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync , where 1920x1080 is the resolution and 60.00 is the screen refresh rate.

Type sudo xrandr --addmode DP-1 "1920x1080_60.00" .

Now close the terminal and go to Settings > Display settings and change it to 1920x1080. Enjoy your FHD until you reboot.

To persist these display resolutions, create a script called in the directory /etc/profile.d/. using sudo vim /etc/profile.d/ and let the contents of the file have the above commands like below without sudo:
xrandr --newmode "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync
xrandr --addmode DP-1 "1920x1080_60.00"


To temporarily try to see if your desired settings fit your purpose you can test it out temporarily like below:
xrandr -q to know your current display resolution
xrandr -s 1920x1080 to set change resolution temporarily until reboot
xrandr -r 60 to set refrest-rate temporarily until reboot
xrandr -s 1920x1080 -r 60 to set both screen resolution and refresh rate temporarily until reboot
sudo lshw -c video to check for the currently used graphic driver. Alternatively, you may also install mesa-utils and run glxinfo -B.

No comments:

Post a Comment

Like it or hate it, feel free to share your feedback. Cheers!