Do not close svkbd if it was already open before dmenu

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
master
Stacy Harper 4 years ago committed by Maarten van Gompel
parent a604dab958
commit b574ff2f93
  1. 4
      scripts/core/sxmo_dmenu_with_kb.sh
  2. 8
      scripts/core/sxmo_keyboard.sh

@ -1,6 +1,8 @@
#!/usr/bin/env sh
wasopen="$(sxmo_keyboard.sh isopen && echo "yes")"
sxmo_keyboard.sh open
OUTPUT="$(cat | dmenu "$@")"
sxmo_keyboard.sh close
[ -z "$wasopen" ] && sxmo_keyboard.sh close
echo "$OUTPUT"

@ -6,10 +6,14 @@ SXMO_NO_ICONS=1 #just to make it a bit faster
# 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
pidof "$KEYBOARD" > /dev/null || eval "$KEYBOARD" $KEYBOARD_ARGS &
isopen || eval "$KEYBOARD" $KEYBOARD_ARGS &
}
close() {
@ -20,6 +24,8 @@ if [ "$1" = "toggle" ]; then
close || open
elif [ "$1" = "close" ]; then
close
elif [ "$1" = "isopen" ]; then
isopen || exit 1
else
open
fi

Loading…
Cancel
Save