aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2022-09-03 16:16:32 +0200
committerInigoGutierrez <inigogf.95@gmail.com>2022-09-03 16:16:32 +0200
commit88f2bc0c0aa848a1bba915afaa57adf04a330f9e (patch)
treeb7c72c9128594d2392671366032b9b3cb94b0604
parent9598e57f845516680045709085f4c998f78189f0 (diff)
downloadscripts-88f2bc0c0aa848a1bba915afaa57adf04a330f9e.tar.gz
scripts-88f2bc0c0aa848a1bba915afaa57adf04a330f9e.zip
Scripts for bspwm.
-rwxr-xr-xbspc/bspcDirectionFocus.sh31
-rwxr-xr-xbspc/bspcToggleSticky.sh8
2 files changed, 39 insertions, 0 deletions
diff --git a/bspc/bspcDirectionFocus.sh b/bspc/bspcDirectionFocus.sh
new file mode 100755
index 0000000..5222298
--- /dev/null
+++ b/bspc/bspcDirectionFocus.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+# bspcDirectionFocus.sh: Directionally select node with same floating state
+#
+# Usage: bspcDirectionFocus.sh DIRECTION
+
+usageMessage="Usage: bspcDirectionFocus.sh DIRECTION"
+
+direction="$1"
+
+if ! echo "$direction" | grep -Eq '(west)|(south)|(north)|(east)'; then
+ echo "$usageMessage" 1>&2
+ exit 1
+fi
+
+status="$(bspc wm --get-status)"
+
+# If floating (TF) select floating in direction.
+# Else if monocle (LM) and west or east select previous or next local window in direction.
+# Else select non-floating in direction.
+if echo "$status" | grep -q ':TF:'; then
+ bspc node --focus "$direction".floating;
+elif echo "$status" | grep -q ':LM:'; then
+ if [ "$direction" = "west" ]; then
+ bspc node --focus prev.local.window.!floating
+ elif [ "$direction" = "east" ]; then
+ bspc node --focus next.local.window.!floating
+ fi
+else
+ bspc node --focus "$direction".!floating
+fi
diff --git a/bspc/bspcToggleSticky.sh b/bspc/bspcToggleSticky.sh
new file mode 100755
index 0000000..c2aefbb
--- /dev/null
+++ b/bspc/bspcToggleSticky.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+# bspcToggleSticky.sh: Toggles the sticky bit of the focused window. A sticky
+# window stays in the focused desktop of its monitor.
+#
+# Usage: bspcToggleSticky.sh
+
+bspc node --flag sticky