unexpected

When I replaced an old laptop with Manjaro system before, the resolution of the screen of the original laptop suddenly decreased when the external monitor was connected, and the original 1380×760 resolution was lost in the system setting page, and the maximum resolution was only 960×540.

Problem Solved – Add custom resolution from command line

Since this is a Linux system, the setup of the content can be resolved by the command line.

The system Settings lost the resolution mode, you manually add on the line.

First step, xrandr lookup

First, view the resolution mode of the current display with administrator privileges

sudo xrandr -q

[parrysms@parrysms-pc ~]$ sudo xrandr -q Screen 0: minimum 8 x 8, current 960x540, maximum 32767 x 32767 LVDS1 connected primary 960x540+0+0 (normal left inverted right x axis y axis) 310mm x 170mm DP1 Disconnected (Normal left Inverted right x axis Y axis) HDMI1 disconnected (normal left inverted right x axis y axis) VGA1 disconnected (normal left inverted right x axis y axis)Copy the code

The command line displays the resolution available on the system. If you don’t have the resolution for your monitor, add it yourself.

Second, the CVT sets the resolution

The first step in adding is to set custom resolutions using the CVT. Note that the resolution parameters of the CVT command must be less than or equal to the maximum resolution supported by the monitor.

sudo cvt 1360 768

[parrysms@parrysms-pc ~]$CVT 1360 768 # 1360x768 59.80 Hz (CVT) hsync: 47.72 kHz; PCLK: 84.75mhz Modeline "1360x768_60.00" 84.75 1360 1432 1568 1776 768 771 781 798 -hsync +vsyncCopy the code

Third, newMode adds its own resolution

Two lines of information will be displayed, finding this part of the Modeline “1360x768_60.00”. The “1380x760_60.00” section after Modeline is the schema and name of this resolution, copied from quotes to the end. (Right mouse button in command line has copy option)

To add a resolution mode, use the following command: xrandr –newmode plus the resolution mode name followed by Modeline and a string of numbers

For example, my command would be sudo xrandr –newmode “1360x768_60.00” 84.75 1360 1432 1568 1776 768 771 781 798-hsync +vsync

Step 4: Add mode adds the configuration

You also need to add a new custom resolution mode to the specified display configuration, the name of which is the monitor you first saw resolution mode on in the sudo xrandr -q command.

If you don’t want to go up, you can type the command again.

[parrysms@parrysms-pc ~]$ sudo xrandr -q
Screen 0: minimum 8 x 8, current  960x540 maximum 32767 x 32767
LVDS1 connected primary  960x540+0+0 (normal left inverted right x axis y axis) 310mm x 170mm
   960x540       59.82  
   864x486       60.00    59.92    59.57  
   640x480       59.94  
DP1 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
VGA1 disconnected (normal left inverted right x axis y axis)
Copy the code

Here you can see that the laptop’s built-in display name is LVDS1, so use the addmode command to add it. The instructions are as follows:

Sudo xrandr -- addMode Display name Resolution mode name

So my command is (note the quotes) : sudo xrandr –addmode LVDS1 “1360x768_60.00”

Step 5, output takes effect

As a final step, output makes its configuration effective. The instructions are as follows:

Sudo xrandr --output display name --mode Resolution mode name

So my command is (note the quotes) : sudo xrandr –output LVDS1 –mode “1360x768_60.00”

Finally, hit Enter, and with a flash of the screen, the custom resolution takes effect.

This setting may fail when the computer restarts, so you can save the commands in a separate shell file for easy execution.

So for my own laptop, I can save the following commands as xrandr_1360.sh

Sudo CVT 1360 768 sudo xrandr --newmode "1360x768_60.00" 84.75 1360 1432 1568 1776 768 771 781 798 -hsync +vsync sudo Xrandr --addmode LVDS1 "1360x768_60.00" sudo xrandr --output LVDS1 --mode "1360x768_60.00"Copy the code

To do this, use bash xrandr_1360.sh.