Last active
March 4, 2023 18:07
-
-
Save nakamuraos/ee091d3aa4370237ba765cb5f50dd0b0 to your computer and use it in GitHub Desktop.
Fix touchscreen position for Asus Dual Screen (UX8402ZE,...)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Fix touchscreen position, see | |
# https://forums.linuxmint.com/viewtopic.php?f=49&t=333354&p=1908272#p1908272 | |
# https://askubuntu.com/questions/1061452/making-xinput-map-to-output-permanent/1285897#1285897 | |
# Make sure you are running correctly in case of multiple OS usage | |
if [ $(uname -n) == 'Zenbook-UX8402ZE' ] | |
then | |
sleep 10 | |
# Replace with your device ID (this case is UX8402ZE) | |
internal_touch_screen_id=( | |
$(xinput|grep pointer|grep "ELAN9008:00 04F3:2F29"|cut -f2|cut -d= -f2) | |
$(xinput|grep pointer|grep "ELAN9009:00 04F3:2F2A"|head -1|cut -f2|cut -d= -f2) | |
) | |
internal_screen_name=( | |
$(xrandr|grep DP|grep DP-1|head -1|cut -d " " -f1|cut -d= -f1) | |
$(xrandr|grep DP|grep DP-1|head -2|cut -d " " -f1|cut -d= -f1|tail -1) | |
) | |
echo "Mapping ${internal_touch_screen_id[0]} to ${internal_screen_name[0]}" | |
test "${internal_touch_screen_id[0]}" && test "${internal_touch_screen_id[0]}" -gt 0 && xinput map-to-output "${internal_touch_screen_id[0]}" "${internal_screen_name[0]}" & | |
echo "Mapping ${internal_touch_screen_id[1]} to ${internal_screen_name[1]}" | |
test "${internal_touch_screen_id[1]}" && test "${internal_touch_screen_id[1]}" -gt 0 && xinput map-to-output "${internal_touch_screen_id[1]}" "${internal_screen_name[1]}" & | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fix touchscreen position
1. Find device ID of touchscreen
2. Find display name
3. Mapping touchscreen's ID to display name