DEV Community

Cover image for Setting up Custom Screen Resolution on Linux (Permanently)
Kaan Kuscu
Kaan Kuscu

Posted on

Setting up Custom Screen Resolution on Linux (Permanently)

Perhaps, you have searched how to setting custom screen resolution or just resolution on Linux before.

After a few process, you have set up screen resolution and saw it's not affected on next reboot.

Alright, how to setting up custom screen resolution on Linux? Permanently 🦾


Step.1

Learn name of your destination screen

In terminal,

xrandr
Enter fullscreen mode Exit fullscreen mode

You can see output like bellow.

$ xrandr
Screen 0: minimum 320 x 200, current 2880 x 900, maximum 16384 x 16384
eDP-1 connected primary 1280x720+0+0 (normal left inverted right x axis y axis) 344mm x 194mm
   1366x768      59.99 +  39.94
   1280x720      60.00*   59.99    59.86    59.74
   1024x768      60.04    60.00
   960x720       60.00
   928x696       60.05
   896x672       60.01
   1024x576      59.95    59.96    59.90    59.82
   960x600       59.93    60.00
   960x540       59.96    59.99    59.63    59.82
   800x600       60.00    60.32    56.25
   840x525       60.01    59.88
   864x486       59.92    59.57
   700x525       59.98
   800x450       59.95    59.82
   640x512       60.02
   700x450       59.96    59.88
   640x480       60.00    59.94
   720x405       59.51    58.99
   684x384       59.88    59.85
   640x400       59.88    59.98
   640x360       59.86    59.83    59.84    59.32
   512x384       60.00
   512x288       60.00    59.92
   480x270       59.63    59.82
   400x300       60.32    56.34
   432x243       59.92    59.57
   320x240       60.05
   360x202       59.51    59.13
   320x180       59.84    59.32
HDMI-1 connected 1280+720+0 (normal left inverted right x axis y axis) 160mm x 90mm
   1920x1080     60.00 +  50.00    59.94
   1280x1024     60.02
   1280x720      60.00    59.94
   1024x768      60.00
   800x600       60.32
   720x480       60.00    59.94
   640x480       60.00    59.94
   720x400       70.08
Enter fullscreen mode Exit fullscreen mode

My screen names are eDP-1 and HDMI-1.

In this example, i am gonna add custom screen resolution to HDMI-1 screen and set as permanently.


Step.2

Generate resolution parameter.

In terminal,

cvt 1600 900 60
Enter fullscreen mode Exit fullscreen mode

With cvt command, we can create resolution modeline data.
Let me show you output.

$ cvt 1600 900 60
# 1600x900 59.95 Hz (CVT 1.44M9) hsync: 55.99 kHz; pclk: 118.25 MHz
Modeline "1600x900_60.00"  118.25  1600 1696 1856 2112  900 903 908 934 -hsync +vsync
Enter fullscreen mode Exit fullscreen mode

To using on xrandr command, we have to copy output after Modeline word.

Like this,

"1600x900_60.00"  118.25  1600 1696 1856 2112  900 903 908 934 -hsync +vsync
Enter fullscreen mode Exit fullscreen mode

Step.3

Now we can create new resolution mode.

In terminal,

$ xrandr --newmode <copied commands>
Enter fullscreen mode Exit fullscreen mode

For example,

$ xrandr --newmode "1600x900_60.00"  118.25  1600 1696 1856 2112  900 903 908 934 -hsync +vsync
Enter fullscreen mode Exit fullscreen mode

Step.4

Add resolution mode.

$ xrandr --addmode HDMI-1 "<width>x<height>_<Hz>"
Enter fullscreen mode Exit fullscreen mode

Like this,

$ xrandr --addmode HDMI-1 "1600x900_60.00"
Enter fullscreen mode Exit fullscreen mode

Almost done!


Step.5

Set custom resolution.

$ xrandr --output HDMI-1 --mode "1600x900_60.00"
Enter fullscreen mode Exit fullscreen mode

Make permanent!

Add all xrandr mode commands to Xsetup file.

$ sudo nano /usr/share/sddm/scripts/Xsetup
Enter fullscreen mode Exit fullscreen mode

Add bellow,

xrandr --newmode "1600x900_60.00"  118.25  1600 1696 1856 2112  900 903 908 934 -hsync +vsync

xrandr --addmode HDMI-1 "1600x900_60.00"
Enter fullscreen mode Exit fullscreen mode

We are not add screen resolution command because system has stored resolution data of specific screen already.

Save file and see yourself!

Discussion (0)