minor fixes
[distro-setup] / obs-clip
index 7d075a07530e7a9ec1094397d4035726ae5eb0e9..60bafda5b9e3fbf75de7918716db86b228e8507a 100755 (executable)
--- a/obs-clip
+++ b/obs-clip
@@ -52,10 +52,20 @@ case $type in
     ;;
 esac
 
+found=false
+
 p=$(cat /p/obs-ws-pass)
 # note, if the desktop audio is already on, this will do the wrong thing.
 # obs-cmd needs more commands. But, I don't use desktop audio for anything
 # else atm.
-obs-cmd -w obsws://localhost:4455/$p toggle-mute 'Desktop Audio'
+if pgrep '^obs$' &>/dev/null; then
+  # this is so the script keeps working when obs is not running, but
+  # also doesn't ignore errors.
+  found=true
+  obs-cmd -w obsws://localhost:4455/$p toggle-mute 'Desktop Audio'
+fi
 mpv --profile=a $clip ||:
-obs-cmd -w obsws://localhost:4455/$p toggle-mute 'Desktop Audio'
+
+if $found; then
+  obs-cmd -w obsws://localhost:4455/$p toggle-mute 'Desktop Audio'
+fi