When using a dual touch screens on ubuntu, the touch may not be mapped correctly to the monitor and it may span both screens as input and only 1 monitor as an output.
Or simply touching any of them will result in having the input on the same screen (Relatively).
So, In order to apply a fix for this issue, The touch input should be mapped to the correct monitor
We may use 2 linux apps to list this info.
1. xinput is used for listing the input devices
2. xrandr is used to show/set the size, orientation and/or reflection of the outputs for a screen. It can also set the screen size.
user@ubuntu:~$ xinput ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ SynPS/2 Synaptics TouchPad id=18 [slave pointer (2)] ⎜ ↳ CoolTouch System id=11 [slave pointer (2)] ⎜ ↳ SYNAPTICS Synaptics Large Touch Screen id=15 [slave pointer (2)] ⎣ Virtual core keyboard id=3 [master keyboard (2)] ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)] ↳ Power Button id=6 [slave keyboard (3)] ↳ Video Bus id=7 [slave keyboard (3)] ↳ Video Bus id=8 [slave keyboard (3)] ↳ Power Button id=9 [slave keyboard (3)] ↳ Integrated_Webcam_HD: Integrate id=10 [slave keyboard (3)] ↳ MOSART Semi. 2.4G Keyboard Mouse id=12 [slave keyboard (3)] ↳ Yubico Yubikey 4 OTP+U2F+CCID id=14 [slave keyboard (3)] ↳ Dell WMI hotkeys id=16 [slave keyboard (3)] ↳ DELL Wireless hotkeys id=19 [slave keyboard (3)] ↳ MOSART Semi. 2.4G Keyboard Mouse id=20 [slave keyboard (3)]
You can make sure of the name of the input device by disconnecting and reconnecting it.Then Note the device id value.
In this case our target system is:
↳ CoolTouch System id=11 [slave pointer (2)]
user@ubuntu:~$ xrandr Screen 0: minimum 8 x 8, current 3968 x 1152, maximum 16384 x 16384 eDP-1-1 connected primary 2048x1152+1920+0 (normal left inverted right x axis y axis) 346mm x 194mm 3200x1800 59.98 + 59.96 59.94 2880x1620 59.96 59.97 2560x1600 59.99 59.97 2560x1440 59.99 59.99 59.96 59.95 2048x1536 60.00 1920x1440 60.00 1856x1392 60.01 1792x1344 60.01 2048x1152 59.99* 59.98 59.90 59.91 1920x1200 59.88 59.95 1920x1080 60.01 59.97 59.96 59.93 1600x1200 60.00 HDMI-1-1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 477mm x 268mm 1920x1080 60.00*+ 50.00 59.94 1920x1080i 60.00 50.00 59.94 1680x1050 59.88 1400x1050 59.95 1600x900 60.00 1280x1024 75.02 60.02 1440x900 59.90 DP-1-1 disconnected (normal left inverted right x axis y axis) HDMI-1-2 disconnected (normal left inverted right x axis y axis)
The name of the output interface is the 1st reported value in each section of xrandr’s output.
In this case We’ll be using HDMI-1-1
So, Mapping the CoolTouch’s input to the monitor connected to the HDMI interface can be done using this command
xinput map-to-output 11 HDMI-1-1
The same strategy can be followed If you have more than 2 monitors.
This command is not persistent and it should be executed every time the pc is restated or locked.
So it could be added to en executable script and executed every time you log in to the system
echo "xinput map-to-output 11 HDMI-1-1" > /usr/local/bin/align_touchinput chmod +x /usr/local/bin/align_touchinput cat << EOF > ~/.config/autostart/align_touchinput.desktop [Desktop Entry] Categories=System;Input;Touch Comment=align touch input Exec=/usr/local/bin/align_touchinput Name=align_touchinput Type=Application EOF