Created
August 19, 2017 08:57
-
-
Save s-zeid/8ca170c629c35ca1b31d47c44074ca46 to your computer and use it in GitHub Desktop.
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/sh | |
# Thanks to Zorawar on unix.stackexchange: <https://unix.stackexchange.com/a/202489> | |
KEYBOARD_ID=12 # from `xinput list` | |
press="key press " | |
release="key release" | |
super=133 | |
time_ms() { | |
local x=0 | |
x=$(date +%s%N) | |
printf '%s' $((x / 1000000)) | |
} | |
last=$(time_ms) | |
xinput test "$KEYBOARD_ID" | while read i; do | |
now=$(time_ms) | |
if [ x"$i" = x"$press $super" ]; then | |
last=$now | |
elif [ x"$i" = x"$release $super" ]; then | |
if [ $((now - last)) -lt 10 ]; then | |
xdotool click --clearmodifiers 3 mouseup 3 | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment