increased verbosity in various scripts, and do not run xargs kill when argument is empty (cleaner and clearer stderr messages)

This commit is contained in:
Maarten van Gompel 2021-01-30 16:52:12 +01:00
parent ca88d3029e
commit 1608ab1ae4
8 changed files with 39 additions and 28 deletions

View file

@ -4,13 +4,18 @@ WIN=$(xdotool getwindowfocus)
NOTIFDIR="$XDG_DATA_HOME"/sxmo/notifications
gracefulexit() {
echo "Gracefully exiting $0"
echo "Gracefully exiting $0">&2
kill -9 0
}
programchoicesinit() {
XPROPOUT="$(xprop -id "$(xdotool getactivewindow)")"
WMCLASS="${1:-$(echo "$XPROPOUT" | grep WM_CLASS | cut -d ' ' -f3-)}"
if [ -z "$XPROPOUT" ]; then
echo "sxmo_appmenu: detected no active window, no problem, opening system menu" >&2
else
echo "sxmo_appmenu: opening menu for wmclass $WMCLASS" >&2
fi
if echo "$WMCLASS" | grep -i "scripts"; then
# Scripts menu
@ -441,7 +446,7 @@ mainloop() {
LOOP="$(echo "$PROGCHOICES" | grep -m1 -F "$PICKED" | cut -d '^' -f2)"
CMD="$(echo "$PROGCHOICES" | grep -m1 -F "$PICKED" | cut -d '^' -f3)"
DMENUIDX="$(echo "$PROGCHOICES" | grep -m1 -F -n "$PICKED" | cut -d ':' -f1)"
echo "Eval: <$CMD> from picked <$PICKED> with loop <$LOOP>"
echo "sxmo_appmenu: Eval: <$CMD> from picked <$PICKED> with loop <$LOOP>">&2
if echo "$LOOP" | grep 1; then
eval "$CMD"
mainloop
@ -452,7 +457,7 @@ mainloop() {
) & wait
}
pgrep -f "$(command -v sxmo_appmenu.sh)" | grep -Ev "^${$}$" | xargs kill -TERM
pgrep -f "$(command -v sxmo_appmenu.sh)" | grep -Ev "^${$}$" | xargs -r kill -TERM
DMENUIDX=0
PICKED=""
ARGS="$*"

View file

@ -9,7 +9,7 @@ FILE_X="$(find /sys/bus/iio/devices/iio:device*/ -iname in_accel_x_raw)"
autorotatedisable() {
notify-send "Autorotate disabled"
pgrep -f "$(command -v sxmo_rotateautotoggle.sh)" | grep -Ev "^${$}$" | xargs kill -9
pgrep -f "$(command -v sxmo_rotateautotoggle.sh)" | grep -Ev "^${$}$" | xargs -r kill -9
exit 0
}

View file

@ -1,6 +1,6 @@
#!/usr/bin/env sh
trap "update" USR1
pgrep -f sxmo_statusbar.sh | grep -v $$ | xargs kill -9
pgrep -f sxmo_statusbar.sh | grep -v $$ | xargs -r kill -9
update() {
# In-call.. show length of call

View file

@ -1,2 +1,2 @@
#!/usr/bin/env sh
pgrep -f "$(command -v sxmo_statusbar.sh)" | xargs kill -USR1 &
pgrep -f "$(command -v sxmo_statusbar.sh)" | xargs -r kill -USR1 &