complete revision of gestures, using new edge system

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
master
Maarten van Gompel 4 years ago
parent 72cc974f20
commit 6448587eb8
  1. 2
      programs/sxmo_screenlock.c
  2. 125
      scripts/core/sxmo_gesturehandler.sh
  3. 25
      scripts/core/sxmo_hotcorner.sh
  4. 2
      scripts/core/sxmo_killwindow.sh
  5. 8
      scripts/core/sxmo_lisgdonefingercheck.sh
  6. 51
      scripts/core/sxmo_lisgdstart.sh

@ -426,7 +426,7 @@ writefile(char *filepath, char *str)
} }
void usage() { void usage() {
fprintf(stderr, "Usage: sxmo_screenlock [--screen-off] [--suspend]\n"); fprintf(stderr, "Usage: sxmo_screenlock [--screen-off] [--suspend] [--wake-interval n]\n");
} }

@ -0,0 +1,125 @@
#!/usr/bin/env sh
ACTION="$1"
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
#hook script must exit with a zero exit code ONLY if it has handled the gesture!
"$XDG_CONFIG_HOME"/sxmo/hooks/gesture "$WMCLASS" "$@"
HANDLE=$?
fi
if [ "$HANDLE" -ne 0 ]; then
#special context-sensitive handling
case "$WMCLASS" in
"foxtrotgps")
# E.g. just a check to ignore 1-finger gestures in foxtrotgps
if [ "$ACTION" != "killwindow" ]; then
HANDLE=0
fi
;;
"st-256color")
# First we try to handle the app running inside st:
WMNAME=$(echo "$XPROPOUT" | grep -E "^WM_NAME" | cut -d ' ' -f3-)
if echo "$WMNAME" | grep -i -w tuir; then
if [ "$ACTION" = "enter" ]; then
xdotool key o
HANDLE=0
elif [ "$ACTION" = "back" ]; then
xdotool key s
HANDLE=0
fi
fi
;;
esac
fi
if [ "$HANDLE" -ne 0 ]; then
#standard handling
case "$ACTION" in
"prevdesktop")
xdotool key --clearmodifiers Alt+Shift+e
;;
"nextdesktop")
xdotool key --clearmodifiers Alt+Shift+r
;;
"moveprevdesktop")
xdotool key --clearmodifiers Alt+e
;;
"movenextdesktop")
xdotool key --clearmodifiers Alt+r
;;
"unmute")
sxmo_vol.sh unmute &
;;
"mute")
sxmo_vol.sh mute &
;;
"brightnessup")
sxmo_brightness.sh up &
;;
"brightnessdown")
sxmo_brightness.sh down &
;;
"volup")
sxmo_vol.sh up &
;;
"voldown")
sxmo_vol.sh down &
;;
"showkeyboard")
pidof "$KEYBOARD" || "$KEYBOARD" &
;;
"hidekeyboard")
pkill -9 "$KEYBOARD"
;;
"showmenu")
sxmo_appmenu.sh &
;;
"showsysmenu")
sxmo_appmenu.sh sys &
;;
"hidemenu")
pkill -9 dmenu
;;
"killwindow")
sxmo_killwindow.sh
;;
"scrollup_long")
xdotool key Prior
;;
"scrolldown_long")
xdotool key Next
;;
"scrollup_med")
xdotool key Up Up Up
;;
"scrolldown_med")
xdotool key Down Down Down
;;
"scrollup_short")
xdotool key Up
;;
"scrolldown_short")
xdotool key Down
;;
"scrollleft_short")
xdotool key Left
;;
"scrollright_short")
xdotool key Right
;;
"enter")
xdotool key Return
;;
"back")
xdotool key BackSpace
;;
*)
#fallback, just execute the command
"$@"
;;
esac
fi

@ -0,0 +1,25 @@
#!/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

@ -0,0 +1,2 @@
#!/usr/bin/env sh
xdotool windowkill "$(xdotool getactivewindow)"

@ -1,8 +0,0 @@
#!/usr/bin/env sh
ACTIVEWIN="$(xdotool getactivewindow)"
WMCLASS="$(xprop -id "$ACTIVEWIN" | grep WM_CLASS | cut -d ' ' -f3-)"
# E.g. just a check to ignore 1-finger gestures in foxtrotgps
if echo "$WMCLASS" | grep -vi foxtrot; then
"$@"
fi

@ -1,15 +1,42 @@
#!/usr/bin/env sh #!/usr/bin/env sh
pkill -9 lisgd pkill -9 lisgd
lisgd "$@" \ if [ -x "$XDG_CONFIG_HOME"/sxmo/hooks/lisgdstart ]; then
-g '1,LR,sxmo_lisgdonefingercheck.sh xdotool key --clearmodifiers Alt+Shift+e' \ "$XDG_CONFIG_HOME"/sxmo/hooks/lisgdstart &
-g '1,RL,sxmo_lisgdonefingercheck.sh xdotool key --clearmodifiers Alt+Shift+r' \ else
-g '1,DLUR,sxmo_lisgdonefingercheck.sh sxmo_vol.sh up' \ #-g format:
-g '1,URDL,sxmo_lisgdonefingercheck.sh sxmo_vol.sh down' \ # fingers,swipe,edge,distance,command
-g '1,DRUL,sxmo_lisgdonefingercheck.sh sxmo_brightness.sh up' \ #order matters, only the first match gets executed
-g '1,ULDR,sxmo_lisgdonefingercheck.sh sxmo_brightness.sh down' \ lisgd "$@" -t 200 \
-g '2,LR,xdotool key --clearmodifiers Alt+e' \ -g '1,DRUL,BR,*,sxmo_hotcorner.sh bottomright' \
-g '2,RL,xdotool key --clearmodifiers Alt+r' \ -g '1,DLUR,BL,*,sxmo_hotcorner.sh bottomleft' \
-g "2,DU,pidof $KEYBOARD || $KEYBOARD &" \ -g '1,ULDR,TL,*,sxmo_hotcorner.sh topleft' \
-g "2,UD,pkill -9 $KEYBOARD" \ -g '1,DRUL,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,L,sxmo_gesturehandler.sh unmute' \
-g '1,UD,L,L,sxmo_gesturehandler.sh mute' \
-g '1,DU,L,*,sxmo_gesturehandler.sh volup' \
-g '1,UD,L,*,sxmo_gesturehandler.sh voldown' \
-g '1,LR,T,*,sxmo_gesturehandler.sh brightnessup' \
-g '1,RL,T,*,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 killwindow" \
-g '2,LR,*,*,sxmo_gesturehandler.sh moveprevdesktop' \
-g '2,RL,*,*,sxmo_gesturehandler.sh movenextdesktop' \
-g '1,DU,R,L,sxmo_gesturehandler.sh scrollup_long' \
-g '1,UD,R,L,sxmo_gesturehandler.sh scrolldown_long' \
-g '1,DU,R,M,sxmo_gesturehandler.sh scrollup_med' \
-g '1,UD,R,M,sxmo_gesturehandler.sh scrolldown_med' \
-g '1,DU,R,S,sxmo_gesturehandler.sh scrollup_short' \
-g '1,UD,R,S,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' \
&
fi

Loading…
Cancel
Save