sxmo-utils/scripts/core/sxmo_type.sh
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

48 lines
736 B
Bash

#!/bin/sh
wtype_to_xdotool() {
if [ "$#" -eq 0 ]; then
exit
fi
if [ "-M" = "$1" ] || [ "-P" = "$1" ]; then
key="$2"
shift 2
xdotool keydown "$key"
sxmo_type.sh -f xorg "$@"
xdotool keyup "$key"
exit
elif [ "-m" = "$1" ] || [ "-p" = "$1" ]; then
xdotool keyup "$2"
shift 2
elif [ "-k" = "$1" ]; then
xdotool key "$2"
shift 2
elif [ "-s" = "$1" ]; then
printf 'scale=2; %s/1000\n' "$2" | bc -l | xargs xdotool sleep
shift 2
else
xdotool type "$1"
shift
fi
wtype_to_xdotool "$@"
}
# enforce wm
# usefull to recurse without reprobing the wm
if [ "$1" = "-f" ]; then
wm="$2"
shift 2
else
wm="$(sxmo_wm.sh)"
fi
case "$wm" in
sway)
wtype "$@"
;;
dwm|xorg)
wtype_to_xdotool "$@"
;;
esac