From c9efca47cdb51dca243a03a37e0fd597227d7b38 Mon Sep 17 00:00:00 2001 From: ZachIR Date: Thu, 13 Oct 2022 17:34:36 -0500 Subject: add bsp scratchpad script --- bspt | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 bspt diff --git a/bspt b/bspt new file mode 100755 index 0000000..541d525 --- /dev/null +++ b/bspt @@ -0,0 +1,29 @@ +#!/bin/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 -- cgit v1.2.3