sxmo-utils/configs/default_hooks/inputhandler
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

67 lines
1.1 KiB
Bash

#!/bin/sh
WMCLASS="$1"
WMNAME="$2"
ACTION="$3"
# You must exit 0 if you handled the input to not trigger default behaviors
if [ "$(sxmo_screenlock.sh getCurState)" != "unlock" ]; then
# Here you could override locked input handlers
exit 1
fi
# Here you can handle normal input handler
exit 1 # Remove this in your user hook
# Here is an example of possible custom actions
# We already exited but you may adapt it for you own use cases
# 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