You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
736 B
49 lines
736 B
3 years ago
|
#!/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
|