Skip to content

Instantly share code, notes, and snippets.

@pojntfx
Created February 7, 2024 22:53
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 pojntfx/de12d6a63fe58a424e55751f2e2e353f to your computer and use it in GitHub Desktop.
Save pojntfx/de12d6a63fe58a424e55751f2e2e353f to your computer and use it in GitHub Desktop.
Run a command each time a touchscreen is touched Linux
#!/bin/bash
DEVICE="/dev/input/event4" # Replace with your actual device
COMMAND="echo 'Touch detected'" # Replace with the command you want to run
sudo evtest "$DEVICE" | while read line; do
if echo "$line" | grep -q "EV_KEY"; then # Adjust based on actual output for a touch event
eval "$COMMAND"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment