Linux强制应用程序在特定显示器上全屏显示
Linux force application to full screen on a specific display
为了工作,我正在开发一款非常专业的软件。它需要运行两个全屏应用程序,每个监视器上一个。为了简单起见,我目前使用的是LUbuntu 64位,带有AMD Radeon HD显卡(目前无法回忆起确切的版本,但它相当新(。
如果可能的话,我想继续使用SDL2,但如果我需要用它进行一些黑客攻击或转移到另一个库,我对此相当满意。
所以,我的问题是,在Linux中,有可能在不同的监视器上运行两个全屏应用程序吗(如果有,我需要采取什么样的设置步骤(?枚举显示器以获得其左上角x/y位置,这样我就可以告诉SDL将我的窗口移动到监视器上以全屏显示它,我的最佳选择是什么?
注意:我没有把这个发布到askubuntu,因为我不确定这个问题是否严格围绕Ubuntu平台。
更新:
以下是xrandr -q
:的输出
Screen 0: minimum 320 x 200, current 3200 x 1080, maximum 3200 x 3200
DFP1 disconnected (normal left inverted right x axis y axis)
DFP2 disconnected (normal left inverted right x axis y axis)
DFP3 disconnected (normal left inverted right x axis y axis)
DFP4 disconnected (normal left inverted right x axis y axis)
DFP5 disconnected (normal left inverted right x axis y axis)
DFP6 disconnected (normal left inverted right x axis y axis)
DFP7 disconnected (normal left inverted right x axis y axis)
DFP8 disconnected (normal left inverted right x axis y axis)
DFP9 connected 1920x1080+1280+0 (normal left inverted right x axis y axis) 533mm x 312mm
1280x1024 50.0 + 75.0 60.0 30.0 24.0
1920x1080 60.0 + 50.0* 59.9 30.0 25.0 30.0 24.0 30.0 30.0 24.0
1776x1000 50.0 59.9 25.0 24.0 30.0 30.0
1680x1050 50.0 60.0 30.0 24.0
1400x1050 50.0 60.0 30.0 24.0
1600x900 50.0 60.0 30.0 24.0
1440x900 50.0 59.9 30.0 24.0
1280x960 50.0 60.0 30.0 24.0
1280x800 50.0 59.8 30.0 24.0
1152x864 50.0 59.9 75.0 30.0 24.0
1280x768 50.0 59.8 30.0 24.0
1280x720 60.0 50.0 59.9 30.0 24.0
1024x768 50.0 75.0 70.1 30.0 24.0 60.0
1152x648 50.0 59.9
800x600 50.0 30.0 24.0 72.2 75.0 60.3 56.2
720x576 59.9 30.0 24.0 50.0
720x480 50.0 30.0 24.0 60.0 59.9
640x480 50.0 30.0 24.0 75.0 72.8 67.0 60.0 59.9
DFP10 connected 1280x1024+0+0 (normal left inverted right x axis y axis) 376mm x 301mm
1280x1024 60.0*+ 76.0 75.0 72.0
1280x960 76.0 75.0 72.0 60.0
1152x864 75.0 60.0
1280x768 76.0 75.0 72.0 60.0
1280x720 76.0 75.0 72.0 60.0
1024x768 75.0 70.1 60.0
800x600 72.2 75.0 60.3
640x480 75.0 72.8 67.0 59.9
640x350 60.0 70.1
CRT1 disconnected (normal left inverted right x axis y axis)
我试着在一些论坛上搜索,以更好地解释如何处理这些信息,似乎我应该做一些类似的事情:
xrandr --output DFP9 --auto --output DFP10 --auto
当我这样做时,我仍然只有一个显示器(":0"(。
您的设置是什么?你真的有两个单独的X显示器吗,还是用Xinerama将两者结合起来?
如果使用两个显示器,它们应该有自己的-display或display env变量。你可以用它来执行一个新的应用程序。
$ echo $DISPLAY
:0.0
$ xterm -display :0.0
在另一个显示器中打开一个shell以获取另一个显示环境变量。
还有几何体,格式为[Wth,Ht+X+Y]
$ xterm -geometry 132x80+500+0
启用Xinerama后,其他显示通常为+X+Y偏移。
当然,这确实需要应用程序处理命令行参数。然后,在初始化窗口时,它将这些值传递给X。对于xterm,宽度和高度是文本字符的单位,其中X/Y是屏幕像素。
如果您可以控制X配置,并且生产工作站上不会显示其他应用程序,则可能需要禁用"Xinerama"功能并设置两个屏幕。然后你可以让你的应用程序连接到:0.0
和:0.1
,并从中获取屏幕大小。
- 比较并显示使用最小值(a,b)和最大值(a、b)升序排列的4个数字
- C++,OpenCV,尝试显示图像时"OpenCV(4.3.0) Error: Assertion failed (size.width>0 && size.height>0)"此错误
- 字符串-C++后显示的随机字符
- 继承期间显示未知行为的子类
- 仅使用绝对值对数组进行排序,并在C++中显示实际值
- 程序崩溃并显示"std::out_of_range"错误
- 如何在C++中用std::cout正确显示带十六进制的字符串文本
- 为什么在C的循环中使用printf的Rust代码不显示输出,而在C++的循环中显示std::cout
- 从数据库实时显示QT c++中的数据
- 当使用比格式支持的精度更高的精度来显示数字时,会写出什么数据
- 显示错误输出的简单数组排序程序
- Qt自定义QPush按钮未显示在布局上
- C++射线示踪剂ppm表示没有足够的数据来显示图像
- C++列出屏幕以在第二台显示器中显示图像
- 使用多个显示器 - XOpenDisplay(NULL) 有时无法获取窗口的当前显示吗?
- 如何使用OpenCV在不同的显示器中显示不同的窗口
- 如何在液晶显示器上显示粗体字
- 如何拆分在多个8位显示器上显示的值
- Linux强制应用程序在特定显示器上全屏显示
- 更改第二显示器显示设置为复制