lots: shellcheck, streaming stuff, fixes
[distro-setup] / obs-auto-scene-switch-toggle
diff --git a/obs-auto-scene-switch-toggle b/obs-auto-scene-switch-toggle
new file mode 100755 (executable)
index 0000000..cc067b1
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/bash
+set -e; . /usr/local/lib/bash-bear; set +e
+
+# the last select is so jq -e will tell us when it isn't found, which is
+# a bit cooler than doing an output comparison... maybe? I'm not sure
+if i3-msg -t get_tree | jq -e '.. | select(.focused? == true) | select(.floating == "user_on")' &>/dev/null; then
+  exit 0
+fi
+
+f=/tmp/no-obs-auto-scene-switch
+
+if [[ -e $f ]]; then
+  rm -f $f
+else
+  touch $f
+fi