From 28172aa6757042ff2e12cf753d76166e8d67b582 Mon Sep 17 00:00:00 2001 From: Stacy Harper Date: Mon, 23 Aug 2021 09:12:20 +0200 Subject: [PATCH] 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 Signed-off-by: Maarten van Gompel --- scripts/core/sxmo_multikey.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/core/sxmo_multikey.sh b/scripts/core/sxmo_multikey.sh index 72569ae..a2950e9 100644 --- a/scripts/core/sxmo_multikey.sh +++ b/scripts/core/sxmo_multikey.sh @@ -16,22 +16,24 @@ else counter=1 fi +printf %s "$counter" > "$count_file" + shift "$counter" if [ "$#" -eq 0 ]; then exit fi -printf %s "$counter" > "$count_file" 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 fi eval "$1" & -if [ "$#" -eq 1 ]; then - sleep "$threshold" # prevent holded presses to chain +if [ "$counter" != "$new_counter" ]; then # overlowed + printf "%s * 2" "$threshold" | bc | xargs sleep fi rm "$count_file"