summaryrefslogtreecommitdiff
path: root/bspt
diff options
context:
space:
mode:
authorzachir <zachir@librem.one>2022-08-12 04:30:51 -0500
committerzachir <zachir@librem.one>2022-08-12 04:30:51 -0500
commitc4d96716c05c41a3b18f2326cb588cd19246da5f (patch)
treeaa6b16c2e89ee63d37eb05e38577ec0b0bddea59 /bspt
initial commit
Diffstat (limited to 'bspt')
-rwxr-xr-xbspt29
1 files changed, 29 insertions, 0 deletions
diff --git a/bspt b/bspt
new file mode 100755
index 0000000..8fed85a
--- /dev/null
+++ b/bspt
@@ -0,0 +1,29 @@
+#!/sbin/sh
+
+get_cmd () {
+ echo "$@" | sed "s/"$1" //"
+}
+
+toggle_sp() {
+ id="$(xdotool search --class "$1")"
+ if [ "$id" != "" ]; then
+ bspc node "$id" --flag hidden -f
+ fi
+}
+
+spawn_sp() {
+ st -c "$1" -g 100x40 -e "${@:2}"
+}
+
+unset __SP_EXISTS
+
+pgrep -x `get_cmd $@` && __SP_EXISTS=y
+
+if [ -z "$__SP_EXISTS" ]; then
+ st -c "$1" -g 100x40 -e "$(get_cmd $@)"
+else
+ id="$(xdotool search --class $1)"
+ if [ "$id" != "" ]; then
+ bspc node "$id" --flag hidden -f
+ fi
+fi