Added sxmo_keyboard script that acts as an intermediary to opening and closing the keyboard

master
Maarten van Gompel 4 years ago
parent c51414257e
commit 4eb914265d
  1. 4
      scripts/appscripts/sxmo_reddit.sh
  2. 4
      scripts/appscripts/sxmo_timer.sh
  3. 4
      scripts/appscripts/sxmo_websearch.sh
  4. 4
      scripts/core/sxmo_dmenu_with_kb.sh
  5. 4
      scripts/core/sxmo_gesturehandler.sh
  6. 23
      scripts/core/sxmo_keyboard.sh
  7. 4
      scripts/core/sxmo_pipecomplete.sh
  8. 6
      scripts/core/sxmo_rotate.sh
  9. 4
      scripts/core/sxmo_surf_linkselect.sh
  10. 4
      scripts/core/sxmo_xinit.sh

@ -7,12 +7,12 @@
[ -z "$SXMO_SUBREDDITS" ] && SXMO_SUBREDDITS="pine64official pinephoneofficial unixporn postmarketos linux"
menu() {
pidof "$KEYBOARD" || "$KEYBOARD" &
sxmo_keyboard.sh open
SUBREDDIT="$(
printf %b "Close Menu\n$(echo "$SXMO_SUBREDDITS" | tr " " '\n')" |
dmenu -p "Subreddit:" -c -l 10
)"
pkill "$KEYBOARD"
sxmo_keyboard.sh close
[ "Close Menu" = "$SUBREDDIT" ] && exit 0
REDDITRESULTS="$(

@ -29,7 +29,7 @@ timerrun() {
}
menu() {
pidof "$KEYBOARD" || "$KEYBOARD" &
sxmo_keyboard.sh open
TIMEINPUT="$(
echo "
1h
@ -47,7 +47,7 @@ menu() {
Close Menu
" | awk 'NF' | awk '{$1=$1};1' | dmenu -p Timer -c -l 20
)"
pkill "$KEYBOARD"
sxmo_keyboard.sh close
[ "Close Menu" = "$TIMEINPUT" ] && exit 0
st -f Monospace-50 -e "$0" timerrun "$TIMEINPUT"
}

@ -4,11 +4,11 @@
# shellcheck source=scripts/core/sxmo_common.sh
. "$(dirname "$0")/sxmo_common.sh"
pidof "$KEYBOARD" || "$KEYBOARD" &
sxmo_keyboard.sh open
SEARCHQUERY="$(
echo "Close Menu" | dmenu -t -p "Search:" -c -l 20
)"
pkill "$KEYBOARD"
sxmo_keyboard.sh close
[ "Close Menu" = "$SEARCHQUERY" ] && exit 0
echo "$SEARCHQUERY" | grep . || exit 0

@ -1,6 +1,6 @@
#!/usr/bin/env sh
pidof "$KEYBOARD" >&2 || "$KEYBOARD" &
sxmo_keyboard.sh open
OUTPUT="$(cat | dmenu "$@")"
pkill "$KEYBOARD" >&2
sxmo_keyboard.sh close
echo "$OUTPUT"

@ -75,10 +75,10 @@ if [ "$HANDLE" -ne 0 ]; then
sxmo_vol.sh down &
;;
"showkeyboard")
pidof "$KEYBOARD" || "$KEYBOARD" &
sxmo_keyboard.sh open
;;
"hidekeyboard")
pkill -9 "$KEYBOARD"
sxmo_keyboard.sh close
;;
"showmenu")
pidof dmenu || setsid -f sxmo_appmenu.sh &

@ -0,0 +1,23 @@
#!/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"
open() {
#Note: KEYBOARD_ARGS is not quoted by design as it may includes a pipe and further tools
# shellcheck disable=SC2086
pidof -q "$KEYBOARD" || "$KEYBOARD" $KEYBOARD_ARGS &
}
close() {
pkill "$KEYBOARD"
}
if [ "$1" = "close" ]; then
close
else
open
fi

@ -3,14 +3,14 @@ INPUT="$(cat)"
STWIN="$(xprop -root | sed -n '/^_NET_ACTIVE_WINDOW/ s/.* //p')"
menu() {
pidof "$KEYBOARD" || "$KEYBOARD" &
sxmo_keyboard.sh open
RESULT="$(
printf %b "$(
echo "Close Menu";
echo "$INPUT" | grep -Eo '\S+' | tr -d '[:blank:]' | sort | uniq
)" | dmenu -p "$PROMPT" -l 10 -i -c
)"
pkill "$KEYBOARD"
sxmo_keyboard.sh close
}
copy() {

@ -18,7 +18,7 @@ isrotated() {
}
rotnormal() {
pkill "$KEYBOARD"
sxmo_keyboard.sh close
xrandr -o normal
applyptrmatrix 0 0 0 0 0 0 0 0 0
pidof lisgd && pkill lisgd | sxmo_lisgdstart.sh -o 0 &
@ -26,7 +26,7 @@ rotnormal() {
}
rotright() {
pkill "$KEYBOARD"
sxmo_keyboard.sh close
xrandr -o right
applyptrmatrix 0 1 0 -1 0 1 0 0 1
pidof lisgd && pkill lisgd | sxmo_lisgdstart.sh -o 1 &
@ -34,7 +34,7 @@ rotright() {
}
rotleft() {
pkill "$KEYBOARD"
sxmo_keyboard.sh close
xrandr -o left
applyptrmatrix 0 -1 1 1 0 0 0 0 1
pidof lisgd && pkill lisgd | sxmo_lisgdstart.sh -o -1 &

@ -73,7 +73,7 @@ link_select() {
link_normalize "$(xprop -id "$SURF_WINDOW" _SURF_URI | cut -d '"' -f 2)"
}
pidof "$KEYBOARD" || "$KEYBOARD" &
sxmo_keyboard.sh open
VAL="$(link_select)"
pkill "$KEYBOARD"
sxmo_keyboard.sh close
echo "$VAL"

@ -45,10 +45,14 @@ xdefaults() {
defaultkeyboard() {
if command -v svkbd-mobile-intl; then
export KEYBOARD=svkbd-mobile-intl
export KEYBOARD_ARGS=
elif command -v svkbd-mobile-plain; then
export KEYBOARD=svkbd-mobile-plain
export KEYBOARD_ARGS=
else
#legacy
export KEYBOARD=svkbd-sxmo
export KEYBOARD_ARGS=
fi
}

Loading…
Cancel
Save