Make all sxmo menu SSH mode compatible

We then simplify the sxmo_modemtext that was already using SSH related
behaviors.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
This commit is contained in:
Stacy Harper 2021-04-05 12:45:01 +02:00 committed by Maarten van Gompel
parent 33e6ce14b3
commit a3e4dc0fa4
6 changed files with 41 additions and 21 deletions

View file

@ -1,5 +1,9 @@
#!/usr/bin/env sh
# include common definitions
# shellcheck source=scripts/core/sxmo_common.sh
. "$(dirname "$0")/sxmo_common.sh"
ispaired() {
bluetoothctl info "$1" | grep Paired | grep -q yes
}

View file

@ -30,6 +30,9 @@ command -v "$KEYBOARD" > /dev/null || export KEYBOARD=svkbd-mobile-intl
# shellcheck disable=SC2039
command -v shopt > /dev/null && shopt -s expand_aliases
alias dmenu="sxmo_dmenu.sh"
alias st="sxmo_terminal.sh"
alias find="busybox find"
alias pkill="busybox pkill"
alias pgrep="busybox pgrep"

9
scripts/core/sxmo_dmenu.sh Executable file
View file

@ -0,0 +1,9 @@
#!/usr/bin/env sh
TERMMODE=$([ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ] && echo "true")
if [ "$TERMMODE" != "true" ]; then
exec dmenu "$@"
else
exec vis-menu -i -l 10
fi

View file

@ -1,5 +1,10 @@
#!/usr/bin/env sh
TERMMODE=$([ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ] && echo "true")
if [ "$TERMMODE" = "true" ]; then
exec vis-menu -i -l 10
fi
wasopen="$(sxmo_keyboard.sh isopen && echo "yes")"
sxmo_keyboard.sh open

14
scripts/core/sxmo_terminal.sh Executable file
View file

@ -0,0 +1,14 @@
#!/usr/bin/env sh
TERMMODE=$([ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ] && echo "true")
if [ "$TERMMODE" = "true" ]; then
while [ "-e" != "$1" ] || [ 0 -eq $# ]; do
shift
done
shift
else
set -- st "$@"
fi
exec "$@"