commit adb16aecd0fc677e364e8e95f99878b21bb65e80
parent 6055f3a321987f5da3e8ef77fdfb5daf4476d7c3
Author: mcol <mcol@posteo.net>
Date: Tue, 5 Feb 2019 21:00:30 +0000
when killing a bar/all bars and it/none exists, exit 1
Diffstat:
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/lemontools b/lemontools
@@ -121,11 +121,16 @@ kill_lemonbar() {
# if a theme name is passed, kill that bar
if [[ $# -gt 0 ]]
then
- rm $dir/run/fifo-$1
- rm $dir/run/log-$1
- _pid=$(cat $dir/run/pid-$1)
- rm $dir/run/pid-$1
- kill -TERM -- -$_pid
+ if [[ -e $dir/run/fifo-$1 ]]
+ then
+ rm $dir/run/fifo-$1
+ rm $dir/run/log-$1
+ _pid=$(cat $dir/run/pid-$1)
+ rm $dir/run/pid-$1
+ kill -TERM -- -$_pid
+ else
+ return 1
+ fi
else
# otherwise, kill them all
@@ -135,12 +140,14 @@ kill_lemonbar() {
do
kill -TERM -- -$(cat $pidfile)
done
+ [[ -n "$dir" ]] && {
+ rm -f $dir/run/pid-*
+ rm -f $dir/run/fifo-*
+ rm -f $dir/run/log-*
+ }
+ else
+ return 1
fi
- [[ -n "$dir" ]] && {
- rm -f $dir/run/pid-*
- rm -f $dir/run/fifo-*
- rm -f $dir/run/log-*
- }
fi
}