Raspberry-Pi

在 Raspbian 中將 2 個顯示視為 1

  • August 12, 2019

我正在執行使用LXDEand的最新 Raspbian Openbox,並且我想將 2 個離散輸出視為 1。當我點擊最大化或全屏時,我希望應用程序跨越兩個監視器。

最終,我將以自動方式使用它chromium-browser --kiosk,因此不能在兩個螢幕上手動拖動應用程序。我還希望能夠靈活地使用不同的程序,因此chromium不需要特定的命令行選項。

我試圖開始Compiz工作,因為我看到了一個關於如何讓它跨越 2 個輸出並將它們視為 1 個顯示的教程,但我似乎無法讓它執行。compiz --replace丟棄我的視窗裝飾並拋出一些警告(見下文),我不能使用桌面,直到我這樣做openbox --replace。無論如何,我不確定我是否想要一個像合成視窗管理器一樣繁重的解決方案——儘管在這一點上我會盡我所能。

順便說一句,那裡有大量過時的資訊Xinerama

我願意接受任何能夠實現能夠執行chromium-browser --kiosk並讓一個視窗跨越兩個顯示器的目標的選項。

pi@raspberrypi:~ $ xrandr
Screen 0: minimum 320 x 200, current 3840 x 1080, maximum 7680 x 7680
HDMI-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 509mm x 286mm
  1920x1080     60.00*+  60.00    50.00    59.94  
  1600x900      60.00  
  1280x1024     75.02    60.02  
  1152x864      75.00  
  1280x720      60.00    60.00    50.00    59.94  
  1024x768      75.03    60.00  
  800x600       75.00    60.32  
  720x576       50.00    50.00  
  720x480       60.00    60.00    59.94    59.94    59.94  
  640x480       75.00    60.00    59.94    59.94  
  720x400       70.08  
HDMI-2 connected 1920x1080+1920+0 (normal left inverted right x axis y axis) 509mm x 286mm
  1920x1080     60.00*+  60.00    50.00    59.94  
  1600x900      60.00  
  1280x1024     75.02    60.02  
  1152x864      75.00  
  1280x720      60.00    60.00    50.00    59.94  
  1024x768      75.03    60.00  
  800x600       75.00    60.32  
  720x576       50.00    50.00  
  720x480       60.00    60.00    59.94    59.94    59.94  
  640x480       75.00    60.00    59.94    59.94  
  720x400       70.08  
pi@raspberrypi:/etc/X11/openbox $ compiz --replace

(process:10097): dbind-WARNING **: 22:08:01.498: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files

(process:10097): dbind-WARNING **: 22:08:01.500: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files
dbus[10097]: arguments to dbus_connection_get_data() were incorrect, assertion "connection != NULL" failed in file ../../../dbus/dbus-connection.c line 6080.
This is normally a bug in some application using the D-Bus library.

 D-Bus not built with -rdynamic so unable to print a backtrace
Aborted

解決方案

https://gist.github.com/eslindsey/70bbc0080e335b38836fab09d19686d0

此 Gist 允許您提供任意命令(和可選參數),並自動檢測創建的視窗和螢幕大小。

概念

chromium-browser --kiosk <url> &
sleep 5
wmctrl -r Chromium -b remove,fullscreen
wmctrl -r Chromium -b remove,maximized_vert,maximized_horz
wmctrl -r Chromium -e 0,0,0,3840,1080

--kiosk論點是從chromium-browser. 這sleep是為了確保視窗有時間出現。前兩wmctrl行從視窗中刪除最大化和全屏屬性(並且不能組合,因為wmctrl只允許您同時刪除“最多兩個視窗屬性”)。finalwmctrl完成了實際移動視窗的工作。g,x,y,w,h是參數(g是重力)。3840x1080 覆蓋了我的兩個 1920x1080 並排顯示器,其中一個 Chromium 瀏覽器在 kiosk 模式下執行。

經測試

這適用於目前版本的 Raspbian:

Raspbian Buster with desktop
Image with desktop based on Debian Buster
Version:July 2019
Release date:2019-07-10
Kernel version:4.19
Size: 1149 MB
SHA-256:6a1a5f20329e580d5161a0255b3d4163db6f56c3997e1c3b36bdd51140bd768e

引用自:https://unix.stackexchange.com/questions/534467