Skip to content

Instantly share code, notes, and snippets.

@gcoda
Last active August 16, 2020 21:15
Show Gist options
  • Save gcoda/2a893e80077487e630fb726a29d9d4ba to your computer and use it in GitHub Desktop.
Save gcoda/2a893e80077487e630fb726a29d9d4ba to your computer and use it in GitHub Desktop.
#!/usr/bin/sh
# i am not very good with bash, but looks like its working fine
########################################################
#
# evtest /dev/input/event14 | ./4click.sh 'notify-send tap4' | sh
#
########################################################
cancelTap=true
while read -r line; do
IFS=" "
eventArray=($line)
touchEvent=${eventArray[8]}
touchValue=${eventArray[10]}
touchTime=${eventArray[2]}
needleEvent="(BTN_TOOL_QUADTAP),"
cancelEvent="(ABS_MT_POSITION_X),"
if [ x"$touchEvent" == x"$cancelEvent" ]; then
cancelTap=true
fi
if [ x"$touchEvent" = x"$needleEvent" ];
then
#tapTime=${touchTime##*.}
if [ x"$touchValue" == x"0" ]; then # fingersUp
if ! $cancelTap; then
echo "$1"
fi
fi
if [ x"$touchValue" == x"1" ]; then # fingersDOWN
cancelTap=false
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment