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

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

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

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

@ -75,10 +75,10 @@ if [ "$HANDLE" -ne 0 ]; then
sxmo_vol.sh down & sxmo_vol.sh down &
;; ;;
"showkeyboard") "showkeyboard")
pidof "$KEYBOARD" || "$KEYBOARD" & sxmo_keyboard.sh open
;; ;;
"hidekeyboard") "hidekeyboard")
pkill -9 "$KEYBOARD" sxmo_keyboard.sh close
;; ;;
"showmenu") "showmenu")
pidof dmenu || setsid -f sxmo_appmenu.sh & 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')" STWIN="$(xprop -root | sed -n '/^_NET_ACTIVE_WINDOW/ s/.* //p')"
menu() { menu() {
pidof "$KEYBOARD" || "$KEYBOARD" & sxmo_keyboard.sh open
RESULT="$( RESULT="$(
printf %b "$( printf %b "$(
echo "Close Menu"; echo "Close Menu";
echo "$INPUT" | grep -Eo '\S+' | tr -d '[:blank:]' | sort | uniq echo "$INPUT" | grep -Eo '\S+' | tr -d '[:blank:]' | sort | uniq
)" | dmenu -p "$PROMPT" -l 10 -i -c )" | dmenu -p "$PROMPT" -l 10 -i -c
)" )"
pkill "$KEYBOARD" sxmo_keyboard.sh close
} }
copy() { copy() {

@ -18,7 +18,7 @@ isrotated() {
} }
rotnormal() { rotnormal() {
pkill "$KEYBOARD" sxmo_keyboard.sh close
xrandr -o normal xrandr -o normal
applyptrmatrix 0 0 0 0 0 0 0 0 0 applyptrmatrix 0 0 0 0 0 0 0 0 0
pidof lisgd && pkill lisgd | sxmo_lisgdstart.sh -o 0 & pidof lisgd && pkill lisgd | sxmo_lisgdstart.sh -o 0 &
@ -26,7 +26,7 @@ rotnormal() {
} }
rotright() { rotright() {
pkill "$KEYBOARD" sxmo_keyboard.sh close
xrandr -o right xrandr -o right
applyptrmatrix 0 1 0 -1 0 1 0 0 1 applyptrmatrix 0 1 0 -1 0 1 0 0 1
pidof lisgd && pkill lisgd | sxmo_lisgdstart.sh -o 1 & pidof lisgd && pkill lisgd | sxmo_lisgdstart.sh -o 1 &
@ -34,7 +34,7 @@ rotright() {
} }
rotleft() { rotleft() {
pkill "$KEYBOARD" sxmo_keyboard.sh close
xrandr -o left xrandr -o left
applyptrmatrix 0 -1 1 1 0 0 0 0 1 applyptrmatrix 0 -1 1 1 0 0 0 0 1
pidof lisgd && pkill lisgd | sxmo_lisgdstart.sh -o -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)" link_normalize "$(xprop -id "$SURF_WINDOW" _SURF_URI | cut -d '"' -f 2)"
} }
pidof "$KEYBOARD" || "$KEYBOARD" & sxmo_keyboard.sh open
VAL="$(link_select)" VAL="$(link_select)"
pkill "$KEYBOARD" sxmo_keyboard.sh close
echo "$VAL" echo "$VAL"

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

Loading…
Cancel
Save