当“显示设置”中没有可用分辨率时,如何使用 xrandr 设置自定义分辨率

当“显示设置”中没有可用分辨率时,如何使用 xrandr 设置自定义分辨率

我是一个新的 Linux 用户,试图更改屏幕分辨率,因为显示下没有选项。我按照在线指南成功地成功添加了新的分辨率。我没有GPU,不知道是不是这个问题?下面是我的xrandr -q输出。

root@kali:~# 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

答案1

以下是添加新的自定义分辨率并应用它所需的步骤。以下步骤用于添加 1920x1080 分辨率,但您可以将其用于所需的任何其他分辨率。但请确保您的显示器和板载显卡支持该分辨率。

# 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"

原始来源:https://gist.github.com/debloper/2793261

我还编写了一个脚本来自动执行所有这些步骤。如果上述步骤对您来说太复杂,您可以尝试一下:https://gist.github.com/chirag64/7853413

答案2

可以使用选项--size/ :-s

xrandr -s 1440x900

应适用于RandR1.1 或更高版本。

答案3

我有同样的问题。在“显示”设置中,最大分辨率为 1280x720。所以:

  1. 使用 xrandr 命令我看到了该显示器的名称和分辨率列表。
  2. 我已经执行了脚本: xrandr --output {监视器名称} --mode {分辨率}

例如:

xrandr --output DP-2-1 --mode 2560x1440

答案4

我跑:

xrandr --verbose

这给了我一个尺寸标签和相应像素值的列表

然后我用了

xrandr -s 6

选择1920x1080分辨率

相关内容