Cleanup hooks

This add a script to use either the user hook or the default one.

Sometime we checked the user hook or a default code. We move this
default code in a defaut hook.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
This commit is contained in:
Stacy Harper 2021-06-29 19:21:00 +02:00 committed by Maarten van Gompel
parent 0ed27f8538
commit e6ea657634
22 changed files with 160 additions and 254 deletions

View file

@ -0,0 +1,55 @@
#!/usr/bin/env sh
# include common definitions
# shellcheck source=scripts/core/sxmo_common.sh
. "$(which sxmo_common.sh)"
pkill -9 lisgd
if [ -z "$LISGD_THRESHOLD" ]; then
LISGD_THRESHOLD=125
fi
if [ -z "$LISGD_THRESHOLD_PRESSED" ]; then
LISGD_THRESHOLD_PRESSED=60
fi
#-g format:
# fingers,swipe,edge,distance,command
#order matters, only the first match gets executed
lisgd "$@" -t "$LISGD_THRESHOLD" -T "$LISGD_THRESHOLD_PRESSED" \
-g '1,DRUL,BR,*,sxmo_inputhandler.sh bottomrightcorner' \
-g '1,DLUR,BL,*,sxmo_inputhandler.sh bottomleftcorner' \
-g '1,ULDR,TL,*,sxmo_inputhandler.sh topleftcorner' \
-g '1,URDL,TR,*,sxmo_inputhandler.sh toprightcorner' \
-g '1,LR,B,L,sxmo_inputhandler.sh rightbottomcorner' \
-g '1,RL,B,L,sxmo_inputhandler.sh leftbottomcorner' \
-g '1,LR,L,*,sxmo_inputhandler.sh rightleftcorner' \
-g '1,RL,R,*,sxmo_inputhandler.sh leftrightcorner' \
-g '1,DU,L,*,P,sxmo_inputhandler.sh upleftcorner' \
-g '1,UD,L,*,P,sxmo_inputhandler.sh downleftcorner' \
-g '1,LR,T,*,P,sxmo_inputhandler.sh righttopcorner' \
-g '1,RL,T,*,P,sxmo_inputhandler.sh lefttopcorner' \
-g "1,DU,B,*,sxmo_inputhandler.sh upbottomcorner" \
-g "1,UD,B,*,sxmo_inputhandler.sh downbottomcorner" \
-g "1,UD,T,*,sxmo_inputhandler.sh downtopcorner" \
-g "1,DU,T,*,sxmo_inputhandler.sh uptopcorner" \
-g "2,UD,T,*,sxmo_inputhandler.sh twodowntopcorner" \
-g "2,UD,B,*,sxmo_inputhandler.sh twodownbottomcorner" \
-g "r,UD,B,*,sxmo_inputhandler.sh threedownbottomcorner" \
-g '1,DU,R,*,P,sxmo_inputhandler.sh uprightcorner' \
-g '1,UD,R,*,P,sxmo_inputhandler.sh downrightcorner' \
-g '1,LR,R,S,sxmo_inputhandler.sh rightrightcorner_short' \
-g '1,RL,L,S,sxmo_inputhandler.sh leftrightcorner_short' \
-g '1,RL,*,*,sxmo_inputhandler.sh left' \
-g '1,LR,*,*,sxmo_inputhandler.sh right' \
-g '1,DU,*,*,sxmo_inputhandler.sh up' \
-g '1,UD,*,*,sxmo_inputhandler.sh down' \
-g '1,DRUL,*,*,sxmo_inputhandler.sh upleft' \
-g '1,URDL,*,*,sxmo_inputhandler.sh downleft' \
-g '1,DLUR,*,*,sxmo_inputhandler.sh upright' \
-g '1,ULDR,*,*,sxmo_inputhandler.sh downright' \
-g '2,RL,*,*,sxmo_inputhandler.sh twoleft' \
-g '2,LR,*,*,sxmo_inputhandler.sh tworight' \
-g '2,DU,*,*,sxmo_inputhandler.sh twoup' \
-g '2,UD,*,*,sxmo_inputhandler.sh twodown' \
>"$CACHEDIR/lisgd.log" 2>&1

View file

@ -0,0 +1,3 @@
#!/usr/bin/env sh
pkill -9 lisgd

View file

@ -0,0 +1,9 @@
#!/usr/bin/env sh
VIBS=5
VIBI=0
while [ $VIBI -lt $VIBS ]; do
sxmo_vibratepine 400 &
sleep 0.5
VIBI=$(echo $VIBI+1 | bc)
done

View file

@ -0,0 +1,11 @@
#!/usr/bin/env sh
# This script is called prior to suspending
# include common definitions
# shellcheck source=scripts/core/sxmo_common.sh
. "$(which sxmo_common.sh)"
pkill -STOP conky
pkill clickclack
pkill -f "$KEYBOARD"

View file

@ -0,0 +1,4 @@
#!/usr/bin/env sh
[ "$(xrandr | grep DSI-1 | cut -d ' ' -f 5)" = "right" ] && ORIENTATION=1 || ORIENTATION=0
sxmo_hooks.sh lisgdstart -o $ORIENTATION &

View file

@ -0,0 +1,37 @@
#!/usr/bin/env sh
# include common definitions
# shellcheck source=scripts/core/sxmo_common.sh
. "$(dirname "$0")/sxmo_common.sh"
modem_n() {
MODEMS="$(mmcli -L)"
echo "$MODEMS" | grep -oE 'Modem\/([0-9]+)' | cut -d'/' -f2
return
}
sim_n() {
SIMS="$(mmcli -m "$(modem_n)" | grep SIM)"
echo "$SIMS" | grep -oE 'SIM\/([0-9]+)' | cut -d'/' -f2
return
}
retry=1
pkill dmenu #kill existing dmenu
while [ $retry -eq 1 ]; do
PICKED="$(
# shellcheck disable=SC2039,SC3037
echo -e "Cancel\n0000\n1234" | sxmo_dmenu_with_kb.sh -l 3 -c -p "PIN:" | tr -d "\n\r "
)"
if [ -n "$PICKED" ] && [ "$PICKED" != "Cancel" ]; then
retry=0
mmcli -i "$(sim_n)" --pin "$PICKED" > /tmp/unlockmsg 2>&1 || retry=1
MSG=$(cat /tmp/unlockmsg)
[ -n "$MSG" ] && notify-send "$MSG"
if echo "$MSG" | grep -q "not SIM-PIN locked"; then
retry=0
fi
else
retry=0
fi
done