How to set custom resolution using xrandr when the resolution is not available in 'Display Settings'

  • I'm a new Linux user trying to change the screen resolution as there is no option under display. I have successfully managed to add new resolutions by fluke by following online guide. I don't have a GPU, I don't know if this is the issue? Below is my xrandr -q output.

    [email protected]:~# xrandr -q
    xrandr: Failed to get size of gamma for output default
    Screen 0: minimum 1280 x 1024, current 1280 x 1024, maximum 1280 x 1024
    default connected 1280x1024+0+0 0mm x 0mm
       1280x1024       0.0* 
      1920x1200_60.00 (0x145)  193.2MHz
            h: width  1920 start 2056 end 2256 total 2592 skew    0 clock   74.6KHz
            v: height 1200 start 1203 end 1209 total 1245           clock   59.9Hz
      1440x900_59.90 (0x156)  106.3MHz
            h: width  1440 start 1520 end 1672 total 1904 skew    0 clock   55.8KHz
            v: height  900 start  901 end  904 total  932           clock   59.9Hz
    

    xrandr -q is not listed in their manual.

  • Here are the steps you need to add a new custom resolution and apply it. Following steps are for adding a 1920x1080 resolution, but you can use it for any other resolution you want. But make sure your monitor and onboard graphics support that resolution.

    # First we need to get the modeline string for xrandr
    # Luckily, the tool "gtf" will help you calculate it.
    # All you have to do is to pass the resolution & the-
    # refresh-rate as the command parameters:
    gtf 1920 1080 60
    
    # In this case, the horizontal resolution is 1920px the
    # vertical resolution is 1080px & refresh-rate is 60Hz.
    # IMPORTANT: BE SURE THE MONITOR SUPPORTS THE RESOLUTION
    
    # Typically, it outputs a line starting with "Modeline"
    # e.g. "1920x1080_60.00"  172.80  1920 2040 2248 2576  1080 1081 1084 1118  -HSync +Vsync
    # Copy this entire string (except for the starting "Modeline")
    
    # Now, use "xrandr" to make the system recognize a new
    # display mode. Pass the copied string as the parameter
    # to the --newmode option:
    xrandr --newmode "1920x1080_60.00"  172.80  1920 2040 2248 2576  1080 1081 1084 1118  -HSync +Vsync
    
    # Well, the string within the quotes is the nick/alias
    # of the display mode - you can as well pass something
    # as "MyAwesomeHDResolution". But, careful! :-|
    
    # Then all you have to do is to add the new mode to the
    # display you want to apply, like this:
    xrandr --addmode VGA1 "1920x1080_60.00"
    
    # VGA1 is the display name, it might differ for you.
    # Run "xrandr" without any parameters to be sure.
    # The last parameter is the mode-alias/name which
    # you've set in the previous command (--newmode)
    
    # It should add the new mode to the display & apply it.
    # Usually unlikely, but if it doesn't apply automatically
    # then force it with this command:
    xrandr --output VGA1 --mode "1920x1080_60.00"
    

    Original source: https://gist.github.com/debloper/2793261

    I also wrote a script that does all these steps automatically. You can try it out if the above steps seem too complicated for you: https://gist.github.com/chirag64/7853413

    Failed the very last step...

    What error did you get? Try the automated script that I linked at the end of the answer.

    When I run your file `chmod +x Desktop/xrandr.sh` No error or no change I feel.

    `chmod +x Desktop/xrandr.sh` only gives you permissions to run that file. You need to run it by running `Desktop/xrandr.sh`.

    :o Okay Mean I missed to fire the weapon.

    If you have some part of your second display shown on the first display after fallowing the answer above, you should re-arrange display layout from displays settings. Reason is in xrandr the number after plus sign is not refreshed after changing res from 960 to 1920: eg: 2560x1080+960+0 to 2560x1080+1920+0

    In case you receive `xrandr: cannot find output "VGA1"`, check your output devices with: `xrandr --listmonitors` (source: https://unix.stackexchange.com/a/413304/106621)

    `X Error of failed request: BadMatch (invalid parameter attributes) Major opcode of failed request: 139 (RANDR) Minor opcode of failed request: 7 (RRSetScreenSize) Serial number of failed request: 22 Current serial number in output stream: 23` What the hell does that mean?

    Instead of `gtf` one may use `cvt`, e.g. `cvt 1920 1080`, which produces the same output as `gtf`, but it calculates also valid refresh rate. (Giving refresh rate to `gtf` by hand may not always give supported output values).

License under CC-BY-SA with attribution


Content dated before 6/26/2020 9:53 AM