如何在 Ubuntu 22.04 Wayland 中繪製多個觸控螢幕

如何在 Ubuntu 22.04 Wayland 中繪製多個觸控螢幕

對於 X-Window(或 Ubuntu 20.x),我可以執行“xinput map-to-output {device_id} {display_name}”將多個觸控螢幕輸入映射到視訊輸出。

現在 Ubuntu 22.04,預設為 Wayland,xinput 不再給我觸控螢幕裝置 ID。您能幫忙告訴我如何將多點觸控螢幕映射到影片嗎?

太感謝了。

答案1

我透過切換回 X 解決了這個問題。

sudo vim /etc/gdm3/custom.conf

取消註釋WaylandEnable=true並將其更改為WaylandEnable=false

重啟gdm

 systemctl restart gdm3

或重新啟動系統。

然後從外接顯示器取得觸控螢幕輸入的 ID:

xinput

取得外接顯示器的 ID

xrandr

將輸入映射到輸出:

 xinput map-to-output [touchscreen id ext. monitor] [id ext. monitor]

就我而言:

xinput map-to-output 13 DP-1
  • 每當我再次斷開/連接顯示器時,我都必須映射它
  • 觸控螢幕輸入的 ID 始終在兩個數字之間交替

更新:

這裡有一個 bash 腳本,您可以在插入外部顯示器後使用,以避免在斷開/連接時搜尋 ID:

#!/bin/bash

IDENTIFIER=<Identifier xinput shows, e.g. USBII_CTP_CONTROL>

IDS=$(xinput |  grep -E ".*$IDENTIFIER.*id=[0-9]+" | grep -v 'Keyboard' | grep -oP 'id=\K[0-9]+')

for ID in $IDS; do
    #echo "xinput map-to-output $ID DP-1"
    xinput map-to-output $ID DP-1
done

相關內容