Skip to content

Instantly share code, notes, and snippets.

@nakamuraos
Last active March 4, 2023 18:07
Show Gist options
  • Save nakamuraos/ee091d3aa4370237ba765cb5f50dd0b0 to your computer and use it in GitHub Desktop.
Save nakamuraos/ee091d3aa4370237ba765cb5f50dd0b0 to your computer and use it in GitHub Desktop.
Fix touchscreen position for Asus Dual Screen (UX8402ZE,...)
#!/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
@nakamuraos
Copy link
Author

Fix touchscreen position

  • Fix touchscreen position for Asus Zenbook Dual Screen on Ubuntu/Debian
    • ASUS Zenbook Pro 14 Duo OLED (UX8402ZE,...)
    • ASUS Zenbook Pro Duo (UX581)
    • ASUS ZenBook Duo 14 (UX482)
    • ...

1. Find device ID of touchscreen

xinput

1166049

2. Find display name

xrandr|grep " connected"

Screenshot_2023-03-04_13-07-55

3. Mapping touchscreen's ID to display name

# Example
xinput map-to-output 13 "eDP-1"
xinput map-to-output 17 "DP-1"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment