sb

shitty bar for dwm
git clone git://git.ckyln.com/~cem/sb.git
Log | Files | Refs | README | LICENSE

commit 3f69d861b59c9e6f529d589634fde7463a5f9b79
parent 05621a5dc6030eb4296330792f708135b9935640
Author: Cem Keylan <cem@ckyln.com>
Date:   Wed, 12 Feb 2020 15:20:23 +0300

add explanation + don't use if statement

Diffstat:
Msb | 13++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/sb b/sb @@ -39,15 +39,14 @@ esac # Load Functions for func in "$FUNCPATH/"* ; do [ -f "$func" ] && . "$func"; done -if [ -z "$nobar" ]; then - if [ -e "/tmp/sb-$USER.pid" ] ; then - [ -z "$KILLEXISTING" ] && printf "ERROR: sb is already running\\nIf you think otherwise, remove /tmp/sb-$USER.pid manually.\\n" && exit 1 - kill "$(cat "/tmp/sb-$USER.pid")" 2>/dev/null - fi - printf "$$\\n" > "/tmp/sb-$USER.pid" -fi for func in "$HOME/.config/sb-func/"* ; do [ -f "$func" ] && . "$func" ; done +# Unless running from the command line, check for +# an existing instance +[ "$nobar" ] || { [ -e "/tmp/sb-$USER.pid" ] && { + [ -z "$KILLEXISTING" ] && printf 'ERROR: sb is already running\nIf you think otherwise, remove /tmp/sb-%s$.pid manually.\n' "$USER" && exit 1 + kill "$(cat "/tmp/sb-$USER.pid")" 2>/dev/null ;} + printf '%s\n' "$$" > "/tmp/sb-$USER.pid" ;} command -v bar >/dev/null 2>&1 || bar() { storage ; ram ; gethostname ; datetime ;}