X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=obs-clip;h=60bafda5b9e3fbf75de7918716db86b228e8507a;hb=7b33a0e88d9ccdaf8601aa77f9fc597d592b4c10;hp=7d075a07530e7a9ec1094397d4035726ae5eb0e9;hpb=12e4748d67a2891d120f0ce7c29c2cf44a6119df;p=distro-setup diff --git a/obs-clip b/obs-clip index 7d075a0..60bafda 100755 --- 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