Created
February 7, 2024 22:53
-
-
Save pojntfx/de12d6a63fe58a424e55751f2e2e353f to your computer and use it in GitHub Desktop.
Run a command each time a touchscreen is touched Linux
This file contains 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 | |
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