Recently Written · git

dsad

Dmenu interface for Simple Audio Daemon

git clone https://github.com/equwal/dsad

Log | Files | Refs


commit 927f24e6e35aa6db7c2be612a5e9275ef7c17e0c
Spenser Truex <truex@equwal.com>
2022-08-23 01:04:48 -0300

Bugfixes in named scripts

 sad-start |  7 ++++++-
 sadcmd    | 10 +++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/sad-start b/sad-start
index 46195e4..46db27d 100755
--- a/sad-start
+++ b/sad-start
@@ -1,3 +1,8 @@
 #!/bin/sh
-${SAD_SOCK:-"$HOME"/.socket}
+SAD_SOCK=${SAD_SOCK:-"$HOME"/.socket}
+[ -e "$SAD_SOCK" ] \
+    && echo "socket already exists at $SAD_SOCK" \
+    && echo "sad is probably running" \
+    && echo "exiting" \
+    && exit 1
 sad -f "$SAD_SOCK" &
diff --git a/sadcmd b/sadcmd
index 5b03c54..86c282d 100755
--- a/sadcmd
+++ b/sadcmd
@@ -1,2 +1,10 @@
 #!/bin/sh
-printf -- %s\\n "$1" | nc -NU "$SAD_SOCK"
+# see PROTOCOL for details
+
+nosock () {
+    echo "Socket not found at $SAD_SOCK"
+    echo "Did you start the SAD?\nsad -f $SAD_SOCK &"
+}
+
+[ -e "$SAD_SOCK" ] || nosock
+printf "%s %s\\n" "$1" "$2" | nc -NU "$SAD_SOCK"