Make the existing inputhandler a pinephone specific hook
This commit is contained in:
47
scripts/core/sxmo_inputhandler.sh → configs/default_hooks/pinephone-1.2pine64/sxmo_hook_inputhandler.sh
Executable file → Normal file
47
scripts/core/sxmo_inputhandler.sh → configs/default_hooks/pinephone-1.2pine64/sxmo_hook_inputhandler.sh
Executable file → Normal file
@@ -7,7 +7,7 @@ ACTION="$1"
|
||||
|
||||
# include common definitions
|
||||
# shellcheck source=scripts/core/sxmo_common.sh
|
||||
. "$(dirname "$0")/sxmo_common.sh"
|
||||
. sxmo_common.sh
|
||||
|
||||
# this action will move the lock state $1 levels higher
|
||||
lock_screen_action() {
|
||||
@@ -36,11 +36,6 @@ XPROPOUT="$(sxmo_wm.sh focusedwindow)"
|
||||
WMCLASS="$(printf %s "$XPROPOUT" | grep app: | cut -d" " -f2- | tr '[:upper:]' '[:lower:]')"
|
||||
WMNAME="$(printf %s "$XPROPOUT" | grep title: | cut -d" " -f2- | tr '[:upper:]' '[:lower:]')"
|
||||
|
||||
if [ -x "$XDG_CONFIG_HOME"/sxmo/hooks/inputhandler ]; then
|
||||
#hook script must exit with a zero exit code ONLY if it has handled the gesture!
|
||||
"$XDG_CONFIG_HOME"/sxmo/hooks/inputhandler "$WMCLASS" "$WMNAME" "$@" && exit
|
||||
fi
|
||||
|
||||
if ! grep -q unlock "$SXMO_STATE"; then
|
||||
case "$ACTION" in
|
||||
"powerbutton_one")
|
||||
@@ -80,9 +75,49 @@ fi
|
||||
|
||||
#special context-sensitive handling
|
||||
case "$WMCLASS" in
|
||||
*"mpv"*)
|
||||
case "$ACTION" in
|
||||
"oneright")
|
||||
sxmo_type.sh -k Left
|
||||
exit 0
|
||||
;;
|
||||
"oneleft")
|
||||
sxmo_type.sh -k Right
|
||||
exit 0
|
||||
;;
|
||||
"oneup")
|
||||
sxmo_type.sh m
|
||||
exit 0
|
||||
;;
|
||||
"onedown")
|
||||
sxmo_type.sh p
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*"foot"*|*"st"*)
|
||||
# First we try to handle the app running inside st:
|
||||
case "$WMNAME" in
|
||||
*"weechat"*)
|
||||
case "$ACTION" in
|
||||
*"oneleft")
|
||||
sxmo_type.sh -M Alt -k a
|
||||
exit 0
|
||||
;;
|
||||
*"oneright")
|
||||
sxmo_type.sh -M Alt -k less
|
||||
exit 0
|
||||
;;
|
||||
*"oneup")
|
||||
sxmo_type.sh -k Page_Down
|
||||
exit 0
|
||||
;;
|
||||
*"onedown")
|
||||
sxmo_type.sh -k Page_Up
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*" sms")
|
||||
case "$ACTION" in
|
||||
*"upbottomedge")
|
@@ -1,70 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
WMCLASS="$1"
|
||||
WMNAME="$2"
|
||||
ACTION="$3"
|
||||
|
||||
# You must exit 0 if you handled the input to not trigger default behaviors
|
||||
# You must exit 1 at the end in order for sxmo_inputhandler.sh to handle the
|
||||
# other behaviours.
|
||||
|
||||
if ! grep -q unlock "$SXMO_STATE"; then
|
||||
# Here you could override locked input handlers
|
||||
# You must exit 1 at the end to allow defaults too
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Here you can handle normal input handler
|
||||
|
||||
# Here is an example of possible custom actions
|
||||
# Please share your recipes to the community :D
|
||||
|
||||
case "$WMCLASS" in
|
||||
*"foot"*)
|
||||
case "$WMNAME" in
|
||||
*"weechat"*)
|
||||
case "$ACTION" in
|
||||
*"oneleft")
|
||||
sxmo_type.sh -M Alt -k a
|
||||
exit 0
|
||||
;;
|
||||
*"oneright")
|
||||
sxmo_type.sh -M Alt -k less
|
||||
exit 0
|
||||
;;
|
||||
*"oneup")
|
||||
sxmo_type.sh -k Page_Down
|
||||
exit 0
|
||||
;;
|
||||
*"onedown")
|
||||
sxmo_type.sh -k Page_Up
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*"mpv"*)
|
||||
case "$ACTION" in
|
||||
"oneright")
|
||||
sxmo_type.sh -k Left
|
||||
exit 0
|
||||
;;
|
||||
"oneleft")
|
||||
sxmo_type.sh -k Right
|
||||
exit 0
|
||||
;;
|
||||
"oneup")
|
||||
sxmo_type.sh m
|
||||
exit 0
|
||||
;;
|
||||
"onedown")
|
||||
sxmo_type.sh p
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
# Don't forget to exit 1 at end!
|
||||
exit 1
|
@@ -22,45 +22,45 @@ fi
|
||||
#order matters, only the first match gets executed
|
||||
sxmo_daemons.sh start lisgd lisgd "$@" -d "$LISGD_INPUT_DEVICE" ${orientation:+-o $orientation} \
|
||||
-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 rightbottomedge' \
|
||||
-g '1,RL,B,L,sxmo_inputhandler.sh leftbottomedge' \
|
||||
-g '1,LR,L,*,sxmo_inputhandler.sh rightleftedge' \
|
||||
-g '1,RL,R,*,sxmo_inputhandler.sh leftrightedge' \
|
||||
-g '1,DU,L,*,P,sxmo_inputhandler.sh upleftedge' \
|
||||
-g '1,UD,L,*,P,sxmo_inputhandler.sh downleftedge' \
|
||||
-g '1,LR,T,*,P,sxmo_inputhandler.sh righttopedge' \
|
||||
-g '1,RL,T,*,P,sxmo_inputhandler.sh lefttopedge' \
|
||||
-g "1,DU,B,*,sxmo_inputhandler.sh upbottomedge" \
|
||||
-g "1,UD,B,*,sxmo_inputhandler.sh downbottomedge" \
|
||||
-g "1,UD,T,*,sxmo_inputhandler.sh downtopedge" \
|
||||
-g "1,DU,T,*,sxmo_inputhandler.sh uptopedge" \
|
||||
-g "2,UD,T,*,sxmo_inputhandler.sh twodowntopedge" \
|
||||
-g "2,UD,B,*,sxmo_inputhandler.sh twodownbottomedge" \
|
||||
-g '1,DU,R,*,P,sxmo_inputhandler.sh uprightedge' \
|
||||
-g '1,UD,R,*,P,sxmo_inputhandler.sh downrightedge' \
|
||||
-g '1,LR,R,S,sxmo_inputhandler.sh rightrightedge_short' \
|
||||
-g '1,RL,L,S,sxmo_inputhandler.sh leftrightedge_short' \
|
||||
-g '1,RL,*,L,sxmo_inputhandler.sh longoneleft' \
|
||||
-g '1,LR,*,L,sxmo_inputhandler.sh longoneright' \
|
||||
-g '1,DU,*,L,sxmo_inputhandler.sh longoneup' \
|
||||
-g '1,UD,*,L,sxmo_inputhandler.sh longonedown' \
|
||||
-g '1,RL,*,M,sxmo_inputhandler.sh mediumoneleft' \
|
||||
-g '1,LR,*,M,sxmo_inputhandler.sh mediumoneright' \
|
||||
-g '1,DU,*,M,sxmo_inputhandler.sh mediumoneup' \
|
||||
-g '1,UD,*,M,sxmo_inputhandler.sh mediumonedown' \
|
||||
-g '1,RL,*,*,sxmo_inputhandler.sh oneleft' \
|
||||
-g '1,LR,*,*,sxmo_inputhandler.sh oneright' \
|
||||
-g '1,DU,*,*,sxmo_inputhandler.sh oneup' \
|
||||
-g '1,UD,*,*,sxmo_inputhandler.sh onedown' \
|
||||
-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'
|
||||
-g '1,DRUL,BR,*,sxmo_hook_inputhandler.sh bottomrightcorner' \
|
||||
-g '1,DLUR,BL,*,sxmo_hook_inputhandler.sh bottomleftcorner' \
|
||||
-g '1,ULDR,TL,*,sxmo_hook_inputhandler.sh topleftcorner' \
|
||||
-g '1,URDL,TR,*,sxmo_hook_inputhandler.sh toprightcorner' \
|
||||
-g '1,LR,B,L,sxmo_hook_inputhandler.sh rightbottomedge' \
|
||||
-g '1,RL,B,L,sxmo_hook_inputhandler.sh leftbottomedge' \
|
||||
-g '1,LR,L,*,sxmo_hook_inputhandler.sh rightleftedge' \
|
||||
-g '1,RL,R,*,sxmo_hook_inputhandler.sh leftrightedge' \
|
||||
-g '1,DU,L,*,P,sxmo_hook_inputhandler.sh upleftedge' \
|
||||
-g '1,UD,L,*,P,sxmo_hook_inputhandler.sh downleftedge' \
|
||||
-g '1,LR,T,*,P,sxmo_hook_inputhandler.sh righttopedge' \
|
||||
-g '1,RL,T,*,P,sxmo_hook_inputhandler.sh lefttopedge' \
|
||||
-g "1,DU,B,*,sxmo_hook_inputhandler.sh upbottomedge" \
|
||||
-g "1,UD,B,*,sxmo_hook_inputhandler.sh downbottomedge" \
|
||||
-g "1,UD,T,*,sxmo_hook_inputhandler.sh downtopedge" \
|
||||
-g "1,DU,T,*,sxmo_hook_inputhandler.sh uptopedge" \
|
||||
-g "2,UD,T,*,sxmo_hook_inputhandler.sh twodowntopedge" \
|
||||
-g "2,UD,B,*,sxmo_hook_inputhandler.sh twodownbottomedge" \
|
||||
-g '1,DU,R,*,P,sxmo_hook_inputhandler.sh uprightedge' \
|
||||
-g '1,UD,R,*,P,sxmo_hook_inputhandler.sh downrightedge' \
|
||||
-g '1,LR,R,S,sxmo_hook_inputhandler.sh rightrightedge_short' \
|
||||
-g '1,RL,L,S,sxmo_hook_inputhandler.sh leftrightedge_short' \
|
||||
-g '1,RL,*,L,sxmo_hook_inputhandler.sh longoneleft' \
|
||||
-g '1,LR,*,L,sxmo_hook_inputhandler.sh longoneright' \
|
||||
-g '1,DU,*,L,sxmo_hook_inputhandler.sh longoneup' \
|
||||
-g '1,UD,*,L,sxmo_hook_inputhandler.sh longonedown' \
|
||||
-g '1,RL,*,M,sxmo_hook_inputhandler.sh mediumoneleft' \
|
||||
-g '1,LR,*,M,sxmo_hook_inputhandler.sh mediumoneright' \
|
||||
-g '1,DU,*,M,sxmo_hook_inputhandler.sh mediumoneup' \
|
||||
-g '1,UD,*,M,sxmo_hook_inputhandler.sh mediumonedown' \
|
||||
-g '1,RL,*,*,sxmo_hook_inputhandler.sh oneleft' \
|
||||
-g '1,LR,*,*,sxmo_hook_inputhandler.sh oneright' \
|
||||
-g '1,DU,*,*,sxmo_hook_inputhandler.sh oneup' \
|
||||
-g '1,UD,*,*,sxmo_hook_inputhandler.sh onedown' \
|
||||
-g '1,DRUL,*,*,sxmo_hook_inputhandler.sh upleft' \
|
||||
-g '1,URDL,*,*,sxmo_hook_inputhandler.sh downleft' \
|
||||
-g '1,DLUR,*,*,sxmo_hook_inputhandler.sh upright' \
|
||||
-g '1,ULDR,*,*,sxmo_hook_inputhandler.sh downright' \
|
||||
-g '2,RL,*,*,sxmo_hook_inputhandler.sh twoleft' \
|
||||
-g '2,LR,*,*,sxmo_hook_inputhandler.sh tworight' \
|
||||
-g '2,DU,*,*,sxmo_hook_inputhandler.sh twoup' \
|
||||
-g '2,UD,*,*,sxmo_hook_inputhandler.sh twodown'
|
||||
|
@@ -32,7 +32,7 @@ if [ "$counter" != "$new_counter" ] && [ "$#" -ne 1 ]; then # Only the last coun
|
||||
exit
|
||||
fi
|
||||
|
||||
eval sxmo_inputhandler.sh "$1" &
|
||||
eval sxmo_hook_inputhandler.sh "$1" &
|
||||
|
||||
if [ "$counter" != "$new_counter" ]; then # overlowed
|
||||
printf "%s * 2" "$threshold" | bc | xargs sleep
|
||||
|
Reference in New Issue
Block a user