sxmo-utils/scripts/core/sxmo_multikey.sh
Stacy Harper 8a27933c47 SWMO - SXMO over Wayland
This is a huge patch for Swmo, Sxmo over Sway.

It is Dwm backward compatible so dwm users should not expect regressions.

If you install all dependencies, you then can toggle between Sway and Dwm using a new config entry. It will reboot the phone.

This commit also contains:
    * Make the modemmonitor bullet proof
    * various other smaller fixes

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-08-22 13:23:22 +02:00

38 lines
583 B
Bash

#!/bin/sh
if [ "$1" = clear ]; then
rm -f "$XDG_RUNTIME_DIR"/sxmo.multikey.count.*
exit
fi
identifier="$1"
threshold="${SXMO_THRESHOLD:-0.30}"
count_file="$XDG_RUNTIME_DIR"/sxmo.multikey.count."$identifier"
if [ -f "$count_file" ]; then
counter="$(($(cat "$count_file")+1))"
else
counter=1
fi
shift "$counter"
if [ "$#" -eq 0 ]; then
exit
fi
printf %s "$counter" > "$count_file"
sleep "$threshold"
if [ "$counter" != "$(cat "$count_file")" ]; then
exit
fi
eval "$1" &
if [ "$#" -eq 1 ]; then
sleep "$threshold" # prevent holded presses to chain
fi
rm "$count_file"