diff options
author | ZachIR <zachir@librem.one> | 2022-10-13 17:34:36 -0500 |
---|---|---|
committer | ZachIR <zachir@librem.one> | 2022-10-13 17:34:36 -0500 |
commit | c9efca47cdb51dca243a03a37e0fd597227d7b38 (patch) | |
tree | 67e7f95c1c41bb76a3c420948c82c8be86e269f1 | |
parent | 37759aa56cbe00d80a6b5d68894ff79e01ed6214 (diff) |
add bsp scratchpad script
-rwxr-xr-x | bspt | 29 |
1 files changed, 29 insertions, 0 deletions
@@ -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 |