~mil/sxmo-utils

ref: dbc3b1ab509aab5f1db72c5cece2ee2a6eb521e8 sxmo-utils/scripts/core/sxmo_keyboard.sh -rwxr-xr-x 603 bytes
dbc3b1abStacy Harper Allow the sendnewtextmenu to be used with a number as arg 1 year, 4 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env sh

# shellcheck disable=SC2034
SXMO_NO_ICONS=1 #just to make it a bit faster
# include common definitions
# shellcheck source=scripts/core/sxmo_common.sh
. "$(dirname "$0")/sxmo_common.sh"

isopen() {
	pidof "$KEYBOARD" > /dev/null
}

open() {
	#Note: KEYBOARD_ARGS is not quoted by design as it may includes a pipe and further tools
	# shellcheck disable=SC2086
	isopen || eval "$KEYBOARD" $KEYBOARD_ARGS &
}

close() {
	pkill "$KEYBOARD"
}

if [ "$1" = "toggle" ]; then
	close || open
elif [ "$1" = "close" ]; then
	close
elif [ "$1" = "isopen" ]; then
	isopen || exit 1
else
	open
fi