Prevent more multikey hold chains
I enlarge the sleep on overflow by 2. But I make this check only applicable for holded buttons. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
This commit is contained in:
parent
8d2afc8e14
commit
28172aa675
1 changed files with 6 additions and 4 deletions
|
@ -16,22 +16,24 @@ else
|
||||||
counter=1
|
counter=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
printf %s "$counter" > "$count_file"
|
||||||
|
|
||||||
shift "$counter"
|
shift "$counter"
|
||||||
if [ "$#" -eq 0 ]; then
|
if [ "$#" -eq 0 ]; then
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
printf %s "$counter" > "$count_file"
|
|
||||||
|
|
||||||
sleep "$threshold"
|
sleep "$threshold"
|
||||||
|
|
||||||
if [ "$counter" != "$(cat "$count_file")" ]; then
|
new_counter="$(cat "$count_file")"
|
||||||
|
if [ "$counter" != "$new_counter" ] && [ "$#" -ne 1 ]; then # Only the last count can overflow
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
eval "$1" &
|
eval "$1" &
|
||||||
|
|
||||||
if [ "$#" -eq 1 ]; then
|
if [ "$counter" != "$new_counter" ]; then # overlowed
|
||||||
sleep "$threshold" # prevent holded presses to chain
|
printf "%s * 2" "$threshold" | bc | xargs sleep
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm "$count_file"
|
rm "$count_file"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue