屏幕不断切换显示端口名称/号码 - 如何配置设置?

屏幕不断切换显示端口名称/号码 - 如何配置设置?

我有一台运行 Ubuntu 21.10 的笔记本电脑(Lenovo Thinkpad T14)(还有另一台运行 Ubuntu 20.4 的类似笔记本电脑),带有 Xfce4(又名 XUbuntu)和 Thinkpad USB-C 扩展坞,我已将两个外接屏幕连接到它。除了笔记本电脑屏幕外,我还将其中一个屏幕垂直放置,另一个屏幕水平放置。

不幸的是,每次我启动系统时(有时当我断开然后重新连接扩展坞时),屏幕到显示端口号的分配都是不同的,因此之前保存的屏幕排列不再起作用。我发现了一些分配:

  • DisplayPort-5 上为垂直,DisplayPort-6 上为水平
  • DisplayPort-5 上为垂直,DisplayPort-3 上为水平
  • DisplayPort-3 上为垂直,DisplayPort-4 上为水平
  • DisplayPort-3 上为垂直,DisplayPort-5 上为水平
  • DisplayPort-6 上为垂直,DisplayPort-5 上为水平

有一次我甚至得到了第七个显示端口,不过那可能是在我另外尝试了第二个扩展坞的时候。

我当前的解决方案是在显示设置中存储一个配置文件(每次我遇到一个之前没有得到的新配置文件时,我都会将其添加到那里)。当登录后屏幕错误时:

  1. 关闭电源(屏幕和基座),断开所有屏幕的连接
  2. 再次打开电源→然后弹出“屏幕”对话框:(屏幕对话图像)
  3. 尝试按钮,直到其中一个按钮以正确的方式排列屏幕
  4. 如果都不适合,则创建一个新的设置(并调用 arandr 来获取显示器的名称)。

我最近发现,在我的 Thinkpad 键盘上,我也可以使用 Fn+F7 键来获取对话框,这样我就不必关闭和打开电源。

但是,是否有某种方法可以实现自动化,以便我每次无需手动输入就可以正确排列屏幕?


一些细节:

举个例子,当我最初写这个问题时,xrandr -q打印了以下内容:

Screen 0: minimum 320 x 200, current 3000 x 1275, maximum 16384 x 16384
eDP connected 1280x720+0+0 (normal left inverted right x axis y axis) 309mm x 174mm
   1920x1080     60.05 +
   1680x1050     60.05  
   1280x1024     60.05  
   1440x900      60.05  
   1280x800      60.05  
   1280x720      60.05* 
   1024x768      60.05  
   800x600       60.05  
   640x480       60.05  
HDMI-A-0 disconnected (normal left inverted right x axis y axis)
DisplayPort-0 disconnected (normal left inverted right x axis y axis)
DisplayPort-1 disconnected (normal left inverted right x axis y axis)
DisplayPort-2 disconnected (normal left inverted right x axis y axis)
DisplayPort-3 disconnected (normal left inverted right x axis y axis)
DisplayPort-4 disconnected (normal left inverted right x axis y axis)
DisplayPort-5 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 509mm x 286mm
   1920x1080     60.00*+
   1600x900      60.00  
   1280x1024     75.02    60.02  
   1152x864      75.00  
   1024x768      75.03    60.00  
   800x600       75.00    60.32  
   640x480       75.00    59.94  
   720x400       70.08  
DisplayPort-6 connected 1920x1080+1080+195 (normal left inverted right x axis y axis) 531mm x 299mm
   1920x1080     60.00*+
   1680x1050     59.88  
   1280x1024     75.02    60.02  
   1440x900      59.90  
   1280x960      60.00  
   1280x800      59.91  
   1152x864      75.00  
   1280x720      60.00  
   1024x768      75.03    70.07    60.00  
   832x624       74.55  
   800x600       72.19    75.00    60.32    56.25  
   640x480       75.00    72.81    66.67    59.94  
   720x400       70.08  
DVI-I-4-4 disconnected (normal left inverted right x axis y axis)
DVI-I-3-3 disconnected (normal left inverted right x axis y axis)
DVI-I-2-2 disconnected (normal left inverted right x axis y axis)
DVI-I-1-1 disconnected (normal left inverted right x axis y axis)

因此屏幕连接到“DisplayPort-5”和“DisplayPort-6”。

然后我关掉电脑,再次打开,屏幕就乱了(视口重叠)。xrandr -q显示如下:

Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 16384 x 16384
eDP connected 1280x720+0+0 (normal left inverted right x axis y axis) 309mm x 174mm
   1920x1080     60.05 +
   1680x1050     60.05  
   1280x1024     60.05  
   1440x900      60.05  
   1280x800      60.05  
   1280x720      60.05* 
   1024x768      60.05  
   800x600       60.05  
   640x480       60.05  
HDMI-A-0 disconnected (normal left inverted right x axis y axis)
DisplayPort-0 disconnected (normal left inverted right x axis y axis)
DisplayPort-1 disconnected (normal left inverted right x axis y axis)
DisplayPort-2 disconnected (normal left inverted right x axis y axis)
DisplayPort-3 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 509mm x 286mm
   1920x1080     60.00*+
   1600x900      60.00  
   1280x1024     75.02    60.02  
   1152x864      75.00  
   1024x768      75.03    60.00  
   800x600       75.00    60.32  
   640x480       75.00    59.94  
   720x400       70.08  
DisplayPort-4 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 531mm x 299mm
   1920x1080     60.00*+
   1680x1050     59.88  
   1280x1024     75.02    60.02  
   1440x900      59.90  
   1280x960      60.00  
   1280x800      59.91  
   1152x864      75.00  
   1280x720      60.00  
   1024x768      75.03    70.07    60.00  
   832x624       74.55  
   800x600       72.19    75.00    60.32    56.25  
   640x480       75.00    72.81    66.67    59.94  
   720x400       70.08  
DVI-I-4-4 disconnected (normal left inverted right x axis y axis)
DVI-I-3-3 disconnected (normal left inverted right x axis y axis)
DVI-I-2-2 disconnected (normal left inverted right x axis y axis)
DVI-I-1-1 disconnected (normal left inverted right x axis y axis)

因此,屏幕现在被识别为“DisplayPort-3”和“DisplayPort-4”,而不是以前的 5 和 6。

触发屏幕设置对话框并选择正确的屏幕(vDP3+hDP4+laptop,上面屏幕截图中的第二个自定义屏幕)后,它会显示以下内容(我不确定它是否显示了如何旋转):

Screen 0: minimum 320 x 200, current 3000 x 1996, maximum 16384 x 16384
eDP connected 1280x720+1080+1276 (normal left inverted right x axis y axis) 309mm x 174mm
   1920x1080     60.05 +
   1680x1050     60.05  
   1280x1024     60.05  
   1440x900      60.05  
   1280x800      60.05  
   1280x720      60.05* 
   1024x768      60.05  
   800x600       60.05  
   640x480       60.05  
HDMI-A-0 disconnected (normal left inverted right x axis y axis)
DisplayPort-0 disconnected (normal left inverted right x axis y axis)
DisplayPort-1 disconnected (normal left inverted right x axis y axis)
DisplayPort-2 disconnected (normal left inverted right x axis y axis)
DisplayPort-3 connected 1080x1920+0+0 left (normal left inverted right x axis y axis) 509mm x 286mm
   1920x1080     60.00*+
   1600x900      60.00  
   1280x1024     75.02    60.02  
   1152x864      75.00  
   1024x768      75.03    60.00  
   800x600       75.00    60.32  
   640x480       75.00    59.94  
   720x400       70.08  
DisplayPort-4 connected 1920x1080+1080+196 (normal left inverted right x axis y axis) 531mm x 299mm
   1920x1080     60.00*+
   1680x1050     59.88  
   1280x1024     75.02    60.02  
   1440x900      59.90  
   1280x960      60.00  
   1280x800      59.91  
   1152x864      75.00  
   1280x720      60.00  
   1024x768      75.03    70.07    60.00  
   832x624       74.55  
   800x600       72.19    75.00    60.32    56.25  
   640x480       75.00    72.81    66.67    59.94  
   720x400       70.08  
DVI-I-4-4 disconnected (normal left inverted right x axis y axis)
DVI-I-3-3 disconnected (normal left inverted right x axis y axis)
DVI-I-2-2 disconnected (normal left inverted right x axis y axis)
DVI-I-1-1 disconnected (normal left inverted right x axis y axis)

相关内容