SETTING UP A TOUCHSCREEN MONITOR WHEN WORKING WITH MULTIPLE DISPLAYS

I recently acquired a new screen. You can see it in my other post "Working with three screens".

Ubuntu/Linux has a few problems, and one of them is that touch device inputs are bound to the entire "visible" space of all monitors. This means that if I click on one corner of my touch screen ... in truth ubuntu interprets that the click has been made on another part of another screen. This is a problem, as it renders the usefulness of having a touchscreen unusable if you have more than one monitor connected.

Summary of the problem

Summary, I have one touch screen, and since the other two I have connected are not ... ubuntu does strange things, it doesn't correctly assign the "touch space" to the correct screen.

Solution

So, to apply a solution to this problem, the touch input must be assigned to the correct monitor.

We can use 2 Linux applications to enumerate this information.

1. xinput is used to enumerate the input devices.

2. xrandr is used to display/set the size, orientation and/or mirroring of the outputs for a display. You can also set the screen size.

xinput

First, we find out what the new touch screen is called:

robert@pop-os:~$ xinput
⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ ITE Tech. Inc. ITE Device(8910) Consumer Control  id=10   [slave  pointer  (2)]
⎜   ↳ Corsai Corsair Gaming K95 RGB PLATINUM Keyboard Consumer Control  id=20   [slave  pointer  (2)]
⎜   ↳ SYNA7DB5:01 06CB:CD5F Touchpad            id=26   [slave  pointer  (2)]
⎜   ↳ Gaming KB  Gaming KB  Consumer Control    id=17   [slave  pointer  (2)]
⎜   ↳ Kensington Slimblade Trackball            id=30   [slave  pointer  (2)]
⎜   ↳ eGalax Inc. eGalaxTouch EXC3200-2505-09.00.00.00  id=19   [slave  pointer  (2)]
.
.
.

You can make sure of the input device name by disconnecting and reconnecting it. Then, you write down the device id value.

In this case, our target system is :

eGalax Inc. eGalaxTouch EXC3200-2505-09.00.00.00  id=19   [slave  pointer  (2)]

The part of interest is "id=19".

xrandr

Now what we need to know is the name of the monitor/screen where we are watching things:

robert@pop-os:~$ xrandr
Screen 0: minimum 8 x 8, current 4480 x 2160, maximum 32767 x 32767
DP-0 connected 1920x1080+320+1080 (normal left inverted right x axis y axis) 344mm x 194mm
  1920x1080     60.00*+  59.94   
.
.
.
DP-1 disconnected (normal left inverted right x axis y axis)
HDMI-0 connected 2560x1080+0+0 (normal left inverted right x axis y axis) 673mm x 284mm
  2560x1080     60.00*+
.
.
.
eDP-1-1 connected primary 1920x1080+2560+0 (normal left inverted right x axis y axis) 344mm x 194mm
  1920x1080    144.00*+  60.01    59.97    59.96    59.93 

The output interface name is the first value reported in each section of the xrandr output.

In my case we will use DP-0 which is the screen I want to use as touch.

Therefore, mapping the touch input to the correct monitor can be done using this command, where we basically tell it the two ids that are related:

xinput map-to-output 19 DP-0.

The same strategy can be followed if you have more than 2 monitors.

This command is not persistent and must be run every time you reboot or crash the PC.

Therefore, it could be added to an executable script and run every time you log on to the system.

echo "xinput map-to-output 19 DP-0" > /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

Have Any Project in Mind?

If you want to do something in Drupal maybe you can hire me.

Either for consulting, development or maintenance of Drupal websites.