From 21379b79146646ce4b979480c5f9d2875126f9c0 Mon Sep 17 00:00:00 2001 From: Maarten van Gompel Date: Sat, 10 Apr 2021 13:47:22 +0200 Subject: [PATCH] Renamed sxmo_gesturehandler.sh to sxmo_inputhandler.sh (after Sam Bowly's patches), renamed gesture hook to inputhandler hook. Removed hotcorner script and powerbutton scripts and their hooks (now all handled by inputhandler and its hook). --- scripts/core/sxmo_hotcorner.sh | 25 ---------- ...gesturehandler.sh => sxmo_inputhandler.sh} | 20 ++++++-- scripts/core/sxmo_lisgdstart.sh | 50 +++++++++---------- scripts/core/sxmo_powerbutton.sh | 17 ------- 4 files changed, 42 insertions(+), 70 deletions(-) delete mode 100755 scripts/core/sxmo_hotcorner.sh rename scripts/core/{sxmo_gesturehandler.sh => sxmo_inputhandler.sh} (85%) delete mode 100755 scripts/core/sxmo_powerbutton.sh diff --git a/scripts/core/sxmo_hotcorner.sh b/scripts/core/sxmo_hotcorner.sh deleted file mode 100755 index 2a9a933..0000000 --- a/scripts/core/sxmo_hotcorner.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env sh -if [ -z "$1" ]; then - exit 1 -else - CORNER="$1" -fi - -if [ -x "$XDG_CONFIG_HOME/sxmo/hooks/hotcorner_$CORNER" ]; then - "$XDG_CONFIG_HOME/sxmo/hooks/hotcorner_$CORNER" - exit $? -fi - -case "$CORNER" in - "topleft") - sxmo_appmenu.sh sys & - ;; - "topright") - ;; - "bottomleft") - sxmo_lock.sh & - ;; - "bottomright") - sxmo_rotate.sh & - ;; -esac diff --git a/scripts/core/sxmo_gesturehandler.sh b/scripts/core/sxmo_inputhandler.sh similarity index 85% rename from scripts/core/sxmo_gesturehandler.sh rename to scripts/core/sxmo_inputhandler.sh index d263dfe..5968ef3 100755 --- a/scripts/core/sxmo_gesturehandler.sh +++ b/scripts/core/sxmo_inputhandler.sh @@ -1,5 +1,8 @@ #!/usr/bin/env sh +# This script handles input actions, it is called by lisgd for gestures +# and by dwm for button presses + ACTION="$1" # include common definitions @@ -10,9 +13,9 @@ XPROPOUT="$(xprop -id "$(xdotool getactivewindow)")" WMCLASS="$(echo "$XPROPOUT" | grep WM_CLASS | cut -d ' ' -f3- | cut -d ' ' -f1 | tr -d '\",')" HANDLE=1 -if [ -x "$XDG_CONFIG_HOME"/sxmo/hooks/gesture ]; then +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/gesture "$WMCLASS" "$@" + "$XDG_CONFIG_HOME"/sxmo/hooks/inputhandler "$WMCLASS" "$@" HANDLE=$? fi @@ -151,7 +154,7 @@ if [ "$HANDLE" -ne 0 ]; then xdotool key --clearmodifiers Alt+space ;; "voldown_two") - xdotool key --clearmodifiers Alt+Return + xdotool key --clearmodifiers Alt+Return ;; "voldown_three") sxmo_blinkled.sh red && xdotool windowkill "$(xdotool getactivewindow)" @@ -159,6 +162,17 @@ if [ "$HANDLE" -ne 0 ]; then "voldown_four") sxmo_blinkled.sh red & xdotool windowclose "$(xdotool getactivewindow)" ;; + "topleftcorner") + sxmo_appmenu.sh sys & + ;; + "toprightcorner") + ;; + "bottomleftcorner") + sxmo_lock.sh & + ;; + "bottomrightcorner") + sxmo_rotate.sh & + ;; *) #fallback, just execute the command "$@" diff --git a/scripts/core/sxmo_lisgdstart.sh b/scripts/core/sxmo_lisgdstart.sh index 011c59c..117e275 100755 --- a/scripts/core/sxmo_lisgdstart.sh +++ b/scripts/core/sxmo_lisgdstart.sh @@ -20,30 +20,30 @@ else # 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_hotcorner.sh bottomright' \ - -g '1,DLUR,BL,*,sxmo_hotcorner.sh bottomleft' \ - -g '1,ULDR,TL,*,sxmo_hotcorner.sh topleft' \ - -g '1,URDL,TR,*,sxmo_hotcorner.sh topright' \ - -g '1,LR,B,L,sxmo_gesturehandler.sh enter' \ - -g '1,RL,B,L,sxmo_gesturehandler.sh back' \ - -g '1,LR,L,*,sxmo_gesturehandler.sh prevdesktop' \ - -g '1,RL,R,*,sxmo_gesturehandler.sh nextdesktop' \ - -g '1,DU,L,*,P,sxmo_gesturehandler.sh volup' \ - -g '1,UD,L,*,P,sxmo_gesturehandler.sh voldown' \ - -g '1,LR,T,*,P,sxmo_gesturehandler.sh brightnessup' \ - -g '1,RL,T,*,P,sxmo_gesturehandler.sh brightnessdown' \ - -g "1,DU,B,*,sxmo_gesturehandler.sh showkeyboard" \ - -g "1,UD,B,*,sxmo_gesturehandler.sh hidekeyboard" \ - -g "1,UD,T,*,sxmo_gesturehandler.sh showmenu" \ - -g "1,DU,T,*,sxmo_gesturehandler.sh hidemenu" \ - -g "2,UD,T,*,sxmo_gesturehandler.sh showsysmenu" \ - -g "2,UD,B,*,sxmo_gesturehandler.sh closewindow" \ - -g "3,UD,B,*,sxmo_gesturehandler.sh killwindow" \ - -g '2,RL,*,*,sxmo_gesturehandler.sh moveprevdesktop' \ - -g '2,LR,*,*,sxmo_gesturehandler.sh movenextdesktop' \ - -g '1,DU,R,*,P,sxmo_gesturehandler.sh scrollup_short' \ - -g '1,UD,R,*,P,sxmo_gesturehandler.sh scrolldown_short' \ - -g '1,LR,R,S,sxmo_gesturehandler.sh scrollright_short' \ - -g '1,RL,L,S,sxmo_gesturehandler.sh scrollleft_short' \ + -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 enter' \ + -g '1,RL,B,L,sxmo_inputhandler.sh back' \ + -g '1,LR,L,*,sxmo_inputhandler.sh prevdesktop' \ + -g '1,RL,R,*,sxmo_inputhandler.sh nextdesktop' \ + -g '1,DU,L,*,P,sxmo_inputhandler.sh volup' \ + -g '1,UD,L,*,P,sxmo_inputhandler.sh voldown' \ + -g '1,LR,T,*,P,sxmo_inputhandler.sh brightnessup' \ + -g '1,RL,T,*,P,sxmo_inputhandler.sh brightnessdown' \ + -g "1,DU,B,*,sxmo_inputhandler.sh showkeyboard" \ + -g "1,UD,B,*,sxmo_inputhandler.sh hidekeyboard" \ + -g "1,UD,T,*,sxmo_inputhandler.sh showmenu" \ + -g "1,DU,T,*,sxmo_inputhandler.sh hidemenu" \ + -g "2,UD,T,*,sxmo_inputhandler.sh showsysmenu" \ + -g "2,UD,B,*,sxmo_inputhandler.sh closewindow" \ + -g "3,UD,B,*,sxmo_inputhandler.sh killwindow" \ + -g '2,RL,*,*,sxmo_inputhandler.sh moveprevdesktop' \ + -g '2,LR,*,*,sxmo_inputhandler.sh movenextdesktop' \ + -g '1,DU,R,*,P,sxmo_inputhandler.sh scrollup_short' \ + -g '1,UD,R,*,P,sxmo_inputhandler.sh scrolldown_short' \ + -g '1,LR,R,S,sxmo_inputhandler.sh scrollright_short' \ + -g '1,RL,L,S,sxmo_inputhandler.sh scrollleft_short' \ & fi diff --git a/scripts/core/sxmo_powerbutton.sh b/scripts/core/sxmo_powerbutton.sh deleted file mode 100755 index 1cdb4bb..0000000 --- a/scripts/core/sxmo_powerbutton.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env sh - -# include common definitions -# shellcheck source=scripts/core/sxmo_common.sh -. "$(dirname "$0")/sxmo_common.sh" - -if [ -x "$XDG_CONFIG_HOME/sxmo/hooks/powerbutton" ]; then - "$XDG_CONFIG_HOME/sxmo/hooks/powerbutton" -else - XPROPOUT="$(xprop -id "$(xdotool getactivewindow)")" - WMCLASS="${1:-$(echo "$XPROPOUT" | grep WM_CLASS | cut -d ' ' -f3-)}" - if echo "$WMCLASS" | grep -i "megapixels"; then - xdotool key --clearmodifiers "space" - else - sxmo_keyboard.sh toggle - fi -fi