Custom screen resolution linux

How to Set Custom Resolution Using xrandr?

The “xrandr” is a built-in command line tool to customize screen resolution, orientation, and refresh rates and fix monitor-related bugs. This tool is also beneficial for setting a system-supported custom resolution unavailable in the default display settings. The “xrandr” tool first adds the specified screen resolution in the display settings and then enables it on the screen.

This guide enlists the complete procedure to set the custom resolution using the “xrandr” command line tool.

How to set Custom Resolution Using xrandr Via Command Line?

First, the resolution of the current system is checked. Then, the custom resolutions are generated which are added as a mode using the xrandr utility. This process will set the custom resolution to your system.

Step 1: Check The Current System Resolution

First, execute the “xrandr” command without passing any argument to display the current screen resolution of the Linux system:

The output shows an active system monitor “XWAYLAND0” having a “1595×851” resolution and also the list of its other associated resolution.

Step 2: Generating the Custom Display Resolution

The “gtf(General Transfer Format)” provides the horizontal and vertical resolution and refresh rate in “Hz”. In this case, it is used to get the modeline (set screen resolution) string for the “xrandr” utility.

For this, specify the desired screen resolution, i.e., “1920 1080” and the refresh rate (60) with the “gtf” as a command like this:

Copy the highlighted part of the “gtf” command output and run the “xrandr” command with the “– -newmode” option in this way:

$ xrandr --newmode "1920x1080_60.00" 172.80 1920 2040 2248 2576 1080 1081 1084 1118 -HSync +Vsync

  • The values “172.80 1920 2040 2248 2576 1080 1081 1084 1118” represents the parameters of the new mode which specify the timing and resolution of the new mode.
  • The “HSync” denotes the “horizontal sync” used for horizontal columns which indicates the beginning of the new line. The “VSync” represents the “Vertical sync” for vertical rows that denotes the start of the new field:

Step 3: Add the New Mode

Now, add the above specified “newmode” for the current monitor device “XWAYLAND0” using “xrandr” command with “addmode” flag:

$ xrandr --addmode XWAYLAND0 "1920x1080_60.00"

Step 4: Verify the Custom Resolution

Execute the “xrandr” command again to check whether the new custom version is applied or not:

Читайте также:  0a12 0001 bluetooth linux

The custom display resolution “1920x1080_60” has been set as shown with the device name and at the bottom of the list.

Step 5: Set the Custom Resolution Permanently

The “XWAYLAND0” device screen resolution is set temporarily. After the system reboots, it will set back to the default resolution.

Now, open the “~/.profile” to save it permanently:

Add the “newmode” and “addmode” commands in the “~/.profile” file using the following command:

xrandr --newmode "1920x1080_60.00" 172.80 1920 2040 2248 2576 1080 1081 1084 1118 -HSync +Vsync xrandr --addmode XWAYLAND0 "1920x1080_60.00"

Click on the “Save” button to save the new changes in the file. The custom resolution has been set permanently for device “XWAYLAND0”.

Conclusion

In Linux, the pre-installed “xrandr” command offers the “newmode” and the “addmode” flags to set the custom resolution of the system monitor. The custom resolution is set temporarily, i.e., before rebooting. Access the “~/.profile” to permanently set the specified custom resolution.

This guide has illustrated a brief description of setting the custom resolution using the xrandr command in Linux.

Источник

How to Set A Custom Screen Resolution in Ubuntu Desktop

This tutorial works for Ubuntu on Xorg. Since Ubuntu 21.04 uses Wayland as default, See another way works on both Xorg and Wayland.

Your preferred screen resolution is not available in the Display settings? Well, here I’m going to show you how to add a custom screen resolution in Ubuntu 17.04 (Work on all current Ubuntu releases).

On my Ubuntu 17.04 Desktop, the default 1920X1080 (16:9) resolution is kinda high for me. Though there are options to scale for menu, title bars, and text, I prefer 1600X900 (16:9) which is available in Ubuntu 16.04 LTS by default.

To get my screen resolution, I did the following steps:

1. Open terminal via Ctrl+Alt+T or by searching for “Terminal” from dash. When it opens, run command:

It outputs current screen resolution as well as all available solutions. ALL I need here is the display device name, in my case, it’s eDP-1.

2. Run command to calculate VESA CVT mode lines by given resolution:

Replace 1600 900 (1600X900 in my case) in the command to your desired screen resolution.

3. Copy the Modeline (words with red underline, see previous picture), and run command to add new mode:

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

UPDATE: For Ubuntu 17.10 Wayland, run xhost si:localuser:root command first in the terminal window to avoid sudo failure “No protocol specified Can’t open display 0:”

NOTE the command section after —newmode are COPIED from previous step output.

Читайте также:  Профиль firefox в линукс

4. Now add the new created mode for your display device:

sudo xrandr --addmode eDP-1 "1600x900_60.00"

Replace eDP-1 (see step1) and «1600x900_60.00» (Step 2 or 3) in the command.

Finally Apply the new resolution in the Display settings:

IMPORTANT: To make Ubuntu remember the new created screen resolution at next start, you have to edit the .profile via command:

add the last 2 commands to the end, commands in step 3 and 4, and save the file.

permalink

Ji m

I’m a freelance blogger who started using Ubuntu in 2007 and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please comment to remind me outdated tutorial! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via [email protected] Buy me a coffee: https://ko-fi.com/ubuntuhandbook1

47 responses to How to Set A Custom Screen Resolution in Ubuntu Desktop

A very cool tip! I now can use a notebook with physical 1280 x 800 resolution with 1638 x 1024 🙂 Thank you!

I’m getting the following error message. Any chance on helping me make it right? $ sudo xrandr –addmode eDP1 “1600x900_60.00”
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 140 (RANDR)
Minor opcode of failed request: 18 (RRAddOutputMode)
Serial number of failed request: 45
Current serial number in output stream: 46

After changing your screen resolution, it’s xy alignment may overlap or gap your other screens. Move them around, based on left,top origin 0,0 xrandr —output eDP-1 —pos 1600×0

Nice to see this technique laid out neatly – you don’t need to place the “cvt” command in your profile file though. That is only used to give you the format for placing in the –newmode xrandr command. It won’t do any harm there, but it won’t actually do anything 🙂

I get an error when doing this command: sudo xrandr –newmode “1920x1080_60.00” 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync X Error of failed request: BadName (named color or font does not exist)
Major opcode of failed request: 140 (RANDR)
Minor opcode of failed request: 16 (RRCreateMode)
Serial number of failed request: 41
Current serial number in output stream: 41

Thank you – not only is your English perfect, your guidance on screen resolution is also clear and precise. I’ve been trying to sort this problem out for weeks. Excellent…

Does not work at all. Xrander not found. Whye the HELL do you have to do these things in some little DOS box in Linux? Can’t they catch up with other operating systems where you do not have to use this little MS DOS box, and set things in a GUI?
And it should be forgiving of your spelling and or typing. I typed Xrander and it gave an error! Unbelievable. It should work spelled either way.
Then, the thing does not say anything about edp-1 so that does not work. I don’t know what else would. I got this…..
xrandr
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 16384 x 16384
HDMI-0 disconnected (normal left inverted right x axis y axis)
DVI-0 disconnected (normal left inverted right x axis y axis)
VGA-0 connected 1024×768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
1024×768 60.00*
800×600 60.32 56.25
848×480 60.00
640×480 59.94
[email protected]:~$ 1600 x 1200 / 75 Hz
1600: command not found
[email protected]:~$ cvt 1600 900
# 1600×900 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…..
THEN you notice, “command not found 1600! WHAT THE HELL. Why would you have to put in ANOTHER command? OK so then the cvt thing. …. xrander –newmode “1600x900_60.00” 118.25 1600 1696 1856 2112 900 903 908 934 -hsync +vsync
No command ‘xrander’ found, did you mean:
Command ‘xrandr’ from package ‘x11-xserver-utils’ (main)
xrander: command not found
[email protected]:~$ sudo xrandr –newmode “1600x900_60.00” 118.25 1600 1696 1856 2112 900 903 908 934 -hsync +vsync
and AGAIN command not found. I HATE MS DOS. …
thern to top it all off I finally get this. ….
xrandr –newmode “1600x900_60.00” 118.25 1600 1696 1856 2112 900 903 908 934 -hsync +vsync
X Error of failed request: BadName (named color or font does not exist)
Major opcode of failed request: 140 (RANDR)
Minor opcode of failed request: 16 (RRCreateMode)
Serial number of failed request: 33
Current serial number in output stream: 33
[email protected]:~$ sudo xrandr –addmode eDP-1 “1600x900_60.00”
xrandr: cannot find output “eDP-1″….
AND it simply does not work. Can’t someone write a damn display thingy that you can click on the numbers you want, picking displays from a list (mine is a Dell UltraScan P1110 – CRT monitor – 21″… which last I checked Window XP had listed, and I used.) Nothing showing up, you cannot select anything from the dropdown. AND I REFUSE to get a new monitor, this one is much better than those flat screen crap ones they now sell with the stupid widescreen, which I never saw the need for! Also it’s native resolution is 1800X1440, which I can’t seem to find in the dropdown. It only wants to let me set some widescreen thing , 1024X768 OR the old fashioned 800X600 which Windows 95 used. I think Linux is about 20 years behind the times on this one.

Читайте также:  Linux просмотр настроек сети

Источник

Оцените статью
Adblock
detector