From e428d0c4a450e66518c214c075bcaa11ad49d62a Mon Sep 17 00:00:00 2001 From: Stacy Harper Date: Thu, 17 Jun 2021 19:01:46 +0200 Subject: [PATCH] Simplify the termmode detection As we now rely on sxmo_terminal.sh and the TERMCMD env variable, we then can simplify things. In the sxmo dwm context, TERMCMD="st -e" so sxmo_terminal.sh will run the command in st. In the ssh context, we dont have TERMCMD so sxmo_terminal.sh will just run the command In a tmux context, we can set TERMCMD="tmux split-window" with set-environment -g TERMCMD "tmux split-window" so sxmo_terminal.sh will run the command in a splited window. Signed-off-by: Stacy Harper Signed-off-by: Maarten van Gompel --- configs/appcfg/xinit_template | 3 ++- scripts/core/sxmo_xinit.sh | 2 +- scripts/modem/sxmo_modemtext.sh | 8 +------- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/configs/appcfg/xinit_template b/configs/appcfg/xinit_template index f95f147..2da7520 100644 --- a/configs/appcfg/xinit_template +++ b/configs/appcfg/xinit_template @@ -52,7 +52,8 @@ command -v firefox && export BROWSER=firefox #(useful for getting notifications) #export SXMO_RTCWAKEINTERVAL=300 -export TERMCMD="st -e" +# Change the default terminal command +# export TERMCMD="st -e" # Immediately turn the screen off when locking the device export SXMO_LOCK_SCREEN_OFF=1 diff --git a/scripts/core/sxmo_xinit.sh b/scripts/core/sxmo_xinit.sh index 4fb755e..2d99502 100755 --- a/scripts/core/sxmo_xinit.sh +++ b/scripts/core/sxmo_xinit.sh @@ -6,7 +6,7 @@ envvars() { [ -f /etc/profile ] && . /etc/profile # shellcheck source=/dev/null [ -f "$HOME"/.profile ] && . "$HOME"/.profile - command -v "$TERMCMD" || export TERMCMD=st + command -v "$TERMCMD" || export TERMCMD="st -e" command -v "$BROWSER" || export BROWSER=surf command -v "$EDITOR" || export EDITOR=vis command -v "$SHELL" || export SHELL=/bin/sh diff --git a/scripts/modem/sxmo_modemtext.sh b/scripts/modem/sxmo_modemtext.sh index 802a38b..f044f05 100755 --- a/scripts/modem/sxmo_modemtext.sh +++ b/scripts/modem/sxmo_modemtext.sh @@ -4,8 +4,6 @@ # shellcheck source=scripts/core/sxmo_common.sh . "$(dirname "$0")/sxmo_common.sh" -TERMMODE=$([ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ] && echo "true") - err() { echo "$1">&2 echo "$1" | dmenu -c -l 10 @@ -53,11 +51,7 @@ sendtextmenu() { echo 'Enter text message here' > "$DRAFT" fi - if [ "$TERMMODE" != "true" ]; then - sxmo_terminal.sh "$EDITOR" "$DRAFT" - else - "$EDITOR" "$DRAFT" - fi + sxmo_terminal.sh "$EDITOR" "$DRAFT" while true do