Call common script, moved icons to common script, removed unnecessary aliases from common (let's add them only when there are conflicts), made sure plays along with shellcheck

This commit is contained in:
Maarten van Gompel 2021-01-31 22:02:40 +01:00
parent 32c4cb6682
commit f4ba3978c9
12 changed files with 241 additions and 421 deletions

View file

@ -1,13 +1,10 @@
#!/usr/bin/env sh
LOGDIR="$XDG_DATA_HOME"/sxmo/modem
NOTIFDIR="$XDG_DATA_HOME"/sxmo/notifications
ALSASTATEFILE="$XDG_CACHE_HOME"/precall.alsa.state
CACHEDIR="$XDG_CACHE_HOME"/sxmo
trap "gracefulexit" INT TERM
DIR=$(dirname "$0")
# shellcheck source=./sxmo_icons.sh
. "$DIR/sxmo_icons.sh"
# include common definitions
# shellcheck source=scripts/core/sxmo_common.sh
. "$(dirname "$0")/sxmo_common.sh"
modem_n() {
MODEMS="$(mmcli -L)"

View file

@ -1,3 +1,7 @@
#!/usr/bin/env sh
LOGDIR="$XDG_DATA_HOME"/sxmo/modem
# include common definitions
# shellcheck source=scripts/core/sxmo_common.sh
. "$(dirname "$0")/sxmo_common.sh"
st -f "Terminus-14" -e tail -n9999 -f "$LOGDIR"/modemlog.tsv

View file

@ -1,9 +1,10 @@
#!/usr/bin/env sh
LOGDIR="$XDG_DATA_HOME"/sxmo/modem
NOTIFDIR="$XDG_DATA_HOME"/sxmo/notifications
CACHEDIR="$XDG_CACHE_HOME"/sxmo
trap "gracefulexit" INT TERM
# include common definitions
# shellcheck source=scripts/core/sxmo_common.sh
. "$(dirname "$0")/sxmo_common.sh"
err() {
echo "sxmo_modemmonitor: Error: $1">&2
notify-send "$1"

View file

@ -4,13 +4,16 @@
# It optionally takes a parameter "on" or "off"
# forcing it to toggle only to that desired state if applicable.
# include common definitions
# shellcheck source=scripts/core/sxmo_common.sh
. "$(dirname "$0")/sxmo_common.sh"
if [ "$1" != "on" ] && pgrep -f sxmo_modemmonitor.sh; then
pgrep -f sxmo_modemmonitor.sh | grep -Ev "^${$}$" | xargs -IP kill -TERM P
elif [ "$1" != "off" ]; then
setsid -f sxmo_modemmonitor.sh &
fi
NOTIFDIR="$XDG_CONFIG_HOME"/sxmo/notifications
rm "$NOTIFDIR"/incomingcall*
# E.g. wait until process killed or started -- maybe there's a better way..

View file

@ -1,5 +1,8 @@
#!/usr/bin/env sh
LOGDIR="$XDG_DATA_HOME"/sxmo/modem
# include common definitions
# shellcheck source=scripts/core/sxmo_common.sh
. "$(dirname "$0")/sxmo_common.sh"
info() {
echo "$1" > /dev/stderr

View file

@ -1,12 +1,12 @@
#!/usr/bin/env sh
LOGDIR="$XDG_DATA_HOME"/sxmo/modem
# include common definitions
# shellcheck source=scripts/core/sxmo_common.sh
. "$(dirname "$0")/sxmo_common.sh"
TERMMODE=$([ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ] && echo "true")
DRAFT_DIR="$XDG_DATA_HOME/sxmo/modem/draft"
DIR=$(dirname "$0")
# shellcheck source=./sxmo_icons.sh
. "$DIR/sxmo_icons.sh"
menu() {
if [ "$TERMMODE" != "true" ]; then
"$@"
@ -17,7 +17,7 @@ menu() {
err() {
echo "$1">&2
echo "$1" | menu dmenu -fn Terminus-20 -c -l 10
echo "$1" | menu dmenu -c -l 10
kill $$
}