2 Monitors one Touchscreen

Touch events at the right place


I often connect my laptop to a larger touch screen. Its touch events are misaligned if not re-configured. This can be adjusted With just xrandr and xinput in a single line.

First run xrandr while both monitors are active. The output will show a line starting with Screen 0: and various lines like VGA-0, HDMI-0 and/ or eDP. In my case eDP and HDMI-0 are connected and the touch screen at HDMI-0.

Second run xinput list to get a list of the input devices. My touch monitor is also connected via USB and its device name is SBest Technology SiS HID Touch Controller. Now all parameters are known to map touch events to the coordinates of HDMI-0:

xinput --map-to-output "USBest Technology SiS HID Touch Controller" HDMI-0

To easily re-issue this command I created a starter on my desktop with this command. It'd also be possible to have a line in .xinitrc if this were the common setup. I do not recommend to put this into .bashrc or any of the profile files. Otherwise this would be executed each time a terminal is opened or at least upon login – even through SSH.