Touchscreen problems on dual head fedora

Today had an interesting issue that my colleague faced. He has touch screen Sony Vaio and normal, non-touch screen monitor attached for dual head. While he was trying to work with touch screen and special pen, then cursor was going weird.

The solution here is to limit the touch screen input to touch screen area only and it is done with xinput command. But keep in mind that the ID’s for input devices in xinput are different after each boot, so if you wish to have some kind of a script to do the job, make sure you work with correct IDs.

As we were dealing with N-trig DuoSense input device, I wrote a short script that can be put somewhere and then enabled in Start Up Applications for Gnome/MATE/Whatever.

The script is as follows (adjust the input/output devs as per your needs by checking xinput –list and xrandr):

#!/bin/bash

INPUT_DEV="N-trig";
OUTPUT_DEV="eDP1";

for i in `xinput --list | grep $INPUT_DEV | sed 's/.*id=\([0-9]\+\).*/\1/g'`;
do
xinput --map-to-output $i $OUTPUT_DEV;
done;