How to set the exact screen resolution of your monitor if it is not in your Linux desktop settings

botond published 2019. 01. 14., h - 02:15 time

Content

 

Introductory

After a recent Linux installation, the resolution of our monitor is not among the screen resolutions in the desktop setting. Thus, we cannot use our monitor in native resolution. The lines are out of focus, the letters are blurred, what did we do wrong?

If you are familiar with this situation, you can learn from this description how to create custom resolutions associated with the appropriate screen refresh rates. Whatever monitor we have, we can then set the resolution exactly.

 

 

Set the screen resolution

In most of these cases, we did everything right, but the system cannot read the exact resolution and refresh rate of our monitor. This happens with some hardware, or with one About the machine running VirtualBox is involved, then this situation occurs more often. Virtualbox in this case, it is advisable to install the guest integration servicesto better recognize the hardware of our machine. If the resolution still does not appear, the following may occur.

Open a terminal window and ask your regular user for available monitor inputs and their associated resolutions in the xrandr command to see what's going on around our resolutions:

xrandr -q

At my recent installation, it gave this output:

Screen 0: minimum 320 x 200, current 1024 x 768, maximum 8192 x 8192
VGA-1 connected primary 1024x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
   1024x768      60.00*  
   800x600       60.32    56.25  
   848x480       60.00  
   640x480       59.94  
HDMI-1 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
HDMI-2 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)

I have an Intel HD7 video card integrated into an Intel I4000 and a 19 "monitor with a native resolution of 1440x900, 75 Hz but not listed, so it did not recognize the resolution of my monitor after installation.

In what follows, I will follow the example with my own screen resolution and refresh rate (1440x900x75), everyone substitute the appropriate parameters for their own monitor in the commands.

To configure it, you first need to calculate the "modeline", a set of parameters that will allow the hardware to work properly. If you have a newer LCD / TFT / etc monitor then this one cvt command we can query:

cvt 1440 900 75

Where the horizontal and vertical resolutions of our monitor are given separately, separated by spaces, and then the refresh rate. This returns the modeline, which looks like this to me:

# 1440x900 74.98 Hz (CVT 1.30MA) hsync: 70.64 kHz; pclk: 136.75 MHz
Modeline "1440x900_75.00"  136.75  1440 1536 1688 1936  900 903 909 942 -hsync +vsync

If you are using an old crt monitor, it will contain the old standards gtf run the command:

gtf 1440 900 75

Here, the parameters are given in the same order. The output here is slightly different:

# 1440x900 @ 75.00 Hz (GTF) hsync: 70.50 kHz; pclk: 136.49 MHz
  Modeline "1440x900_75.00"  136.49  1440 1536 1688 1936  900 901 904 940  -HSync +Vsync

Of course, I use the first one because I have an LCD monitor, I only showed you the use of the gtf command if someone has an older monitor.

Then use the xrandr command to create a new resolution based on the resulting modeline:

xrandr --newmode "1440x900_75.00"  136.75  1440 1536 1688 1936  900 903 909 942 -hsync +vsync

Leaving the word "Modeline", copy the following section one-by-one after the --newmode parameter of the xrandr command. It does not output when operating properly.

If we then query the resolutions again:

xrandr -q

then the newly added resolution has already been found, but is not yet "in place":

Screen 0: minimum 320 x 200, current 1024 x 768, maximum 8192 x 8192
VGA-1 connected primary 1024x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
   1024x768      60.00* 
   800x600       60.32    56.25  
   848x480       60.00  
   640x480       59.94  
HDMI-1 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
HDMI-2 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
  1440x900_75.00 (0xd6) 136.750MHz -HSync +VSync
        h: width  1440 start 1536 end 1688 total 1936 skew    0 clock  70.64KHz
        v: height  900 start  903 end  909 total  942           clock  74.98Hz

So here you can see the inputs of your monitor (VGA, HDMI, etc.). Then we need to add the resolution to which we use our computer. I use the standard VGA connector so I use "VGA-1" from the list of inputs:

xrandr --addmode VGA-1 1440x900_75.00

Then when we look at our resolutions again, the newly added screen resolution is in the right place:

xrandr -q
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 8192 x 8192
VGA-1 connected primary 1024x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
   1024x768      60.00* 
   800x600       60.32    56.25  
   848x480       60.00  
   640x480       59.94  
   1440x900_75.00  74.98  
HDMI-1 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
HDMI-2 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)

Then all you have to do is switch to the new resolution. The resolution now appears in the graphical settings window of the desktop, so you can change it there or issue the following command:

xrandr -s 1440x900

The monitor will then switch to the requested resolution.

 

 

Durable setup

So we have the resolution and it works nicely. However, if we restart the machine, we would have to play it again. Therefore, with a simple solution, we make our setting durable.

Create a shell script file for yourself, for example:

nano ~/.config/sajat_felbontas.sh

Then add the necessary configuration commands as described above:

#!/bin/bash                                                                                    
xrandr --newmode "1440x900_75.00"  136.75  1440 1536 1688 1936  900 903 909 942 -hsync +vsync
xrandr --addmode VGA-1 1440x900_75.00
xrandr -s 1440x900

(The query (cvt / gtf) does not need to be inserted here because the modeline has already been read and does not change its content.)

Let's make a chmod command:

chmod +x ~/.config/sajat_felbontas.sh

Then, let's get it started automatically in our graphical desktop environment.

 

Conclusion

This method allows you to set the appropriate resolution for any monitor if your window manager does not recognize it automatically. Of course, this requires the proper functioning of our video card driver. The resolutions are not working properly with a faulty or poorly configured video controller.