Skip to content

Instantly share code, notes, and snippets.

@tuxdna
Last active February 20, 2025 18:24
Show Gist options
  • Save tuxdna/7b093eeb9aefe19d09b5a77bcb4da89a to your computer and use it in GitHub Desktop.
Save tuxdna/7b093eeb9aefe19d09b5a77bcb4da89a to your computer and use it in GitHub Desktop.
Disable touchscreen

Create a file ~/disabletouch.sh

Create a autostart file ~/.config/autostart/disabletouch.sh.desktop

Contents are of these files are present in this gist.

#!/usr/bin/env bash
# Python one-liners are ugly
# xinput --list | python -c 'import sys; import re;[print(m.group(1)) for m in [re.search(r"ELAN Touchscreen.*id=(\d+).*", l) for l in sys.stdin] if m]'
# xinput --list | python -c 'import sys; import re; list(map(lambda m: print(m.group(1)), filter(lambda x: x, map(lambda l: re.search(r"ELAN Touchscreen.*id=(\d+).*", l), sys.stdin))))'
# Using good old bash pipes
xinput disable $(xinput --list | grep 'ELAN Touchscreen' | cut -d= -f2 | cut -f1)
[Desktop Entry]
Type=Application
Exec=/home/user/disabletouch.sh
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_US]=disable-touch
Name=disable-touch
Comment[en_US]=Disable ELAN Touch Screen
Comment=Disable ELAN Touch Screen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment