Skip to content

Instantly share code, notes, and snippets.

@itskenny0
Created September 22, 2021 11:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itskenny0/24a4ca24dce6c03a10c32db9c75423e7 to your computer and use it in GitHub Desktop.
Save itskenny0/24a4ca24dce6c03a10c32db9c75423e7 to your computer and use it in GitHub Desktop.
assign touchscreen to monitor in linux

You need to replace DP-1 with your display name from xrandr, and "MTouch" with a string that shows up in your touch screen's name when executing "xinput".

#!/bin/bash
IDS=$(xinput | grep MTouch | grep -oP 'id=[0-9]{2}' | sed 's/id=//g')
for i in $IDS; do
xinput map-to-output $i DP-1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment