如何设置自定义分辨率?

我尝试使用xrandr将1680×1050设置为VGA输出的新模式,但它说:

  sudo xrandr --addmode VGA-0 1680 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: 35 Current serial number in output stream: 36 

首先使用cvt生成“modeline”
语法是: cvt width height refreshrate

 cvt 1680 1050 60 

这给你:

 # 1680x1050 59.95 Hz (CVT 1.76MA) hsync: 65.29 kHz; pclk: 146.25 MHz Modeline "1680x1050_60.00" 146.25 1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync 

现在告诉xrandr

 xrandr --newmode "1680x1050_60.00" 146.25 1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync 

然后,您现在可以将其添加到您选择的输出的可能分辨率表中:

 xrandr --addmode VGA-0 1680x1050_60.00 

重启后更改丢失,要持久设置解析, ~/.xprofile使用以下内容创建文件~/.xprofile

 #!/bin/sh xrandr --newmode "1680x1050_60.00" 146.25 1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync xrandr --addmode VGA-0 1680x1050_60.00 

如何设置以前指定的自定义分辨率。 执行定义的其他步骤以创建分辨率后,运行:

 xrandr -s 1680x1050 

如何设置运行多个监视器时先前指定的自定义分辨率。 执行定义的其他步骤以创建分辨率后,运行:

xrandr --output DVI-0 --mode 1680x1050

DVI-0替换为您的设备ID,例如VGA-0

感谢thomthirdender,这基本上是基于最多投票答案的单一命令配置。

 RES="1920 1200 60" && \ DISP=$(xrandr | grep -e " connected [^(]" | sed -e "s/\([A-Z0-9]\+\) connected.*/\1/") && \ MODELINE=$(cvt 1920 1200 60 | grep -e "Modeline [^(]" | sed -r 's/.*Modeline (.*)/\1/') && \ MODERES=$(echo $MODELINE | grep -o -P '(?<=").*(?=")') && \ cat > ~/.xprofile << _EOF #!/bin/sh xrandr --newmode $MODELINE xrandr --addmode $DISP $MODERES _EOF 

上面的命令将生成所需的~/.xprofile文件。 只需确保使用您喜欢的分辨率(即RES变量)。 更多信息在这里 。