summaryrefslogtreecommitdiff
path: root/river/sp
diff options
context:
space:
mode:
Diffstat (limited to 'river/sp')
-rwxr-xr-xriver/sp/river_sp65
1 files changed, 23 insertions, 42 deletions
diff --git a/river/sp/river_sp b/river/sp/river_sp
index e354cc9..2203e40 100755
--- a/river/sp/river_sp
+++ b/river/sp/river_sp
@@ -24,47 +24,28 @@ spawnwindow () {
#}}}
#{{{ getopts
-while getopts "n:s:" o; do case "${o}" in
- n)
- case "$OPTARG" in
- z|1) ARG=1 ;;
- x|2) ARG=2 ;;
- c|3) ARG=3 ;;
- v|4) ARG=4 ;;
- b|5) ARG=5 ;;
- a|6) ARG=6 ;;
- s|7) ARG=7 ;;
- d|8) ARG=8 ;;
- f|9) ARG=9 ;;
- g|10) ARG=10 ;;
- q|11) ARG=11 ;;
- *) printf "Unknown scratchpad $1!\n" ; exit 1 ;;
- esac
- if pgrep -x "sp_$OPTARG"; then
- riverctl toggle-focused-tags $((1 << ($ARG + 9)))
- else
- riverctl toggle-focused-tags $(( 1 << ($ARG + 9)))
- riverctl spawn-tagmask $(( 1 << ($ARG + 9)))
- spawnwindow "$ARG"
- riverctl spawn-tagmask $(( (1 << 9) - 1))
- fi
- ;;
- s)
- case "$OPTARG" in
- z|1) ARG=1 ;;
- x|2) ARG=2 ;;
- c|3) ARG=3 ;;
- v|4) ARG=4 ;;
- b|5) ARG=5 ;;
- a|6) ARG=6 ;;
- s|7) ARG=7 ;;
- d|8) ARG=8 ;;
- f|9) ARG=9 ;;
- g|10) ARG=10 ;;
- q|11) ARG=11 ;;
- *) printf "Unknown scratchpad $1!\n" ; exit 1 ;;
- esac
+for i in "$@"; do
+ case "$i" in
+ z|1) ARG=1 ;;
+ x|2) ARG=2 ;;
+ c|3) ARG=3 ;;
+ v|4) ARG=4 ;;
+ b|5) ARG=5 ;;
+ a|6) ARG=6 ;;
+ s|7) ARG=7 ;;
+ d|8) ARG=8 ;;
+ f|9) ARG=9 ;;
+ g|10) ARG=10 ;;
+ q|11) ARG=11 ;;
+ *) printf "Unknown scratchpad $i!\n" ; exit 1 ;;
+ esac
+ if pgrep -x "sp_$OPTARG"; then
riverctl toggle-focused-tags $((1 << ($ARG + 9)))
- ;;
-esac done
+ else
+ riverctl toggle-focused-tags $(( 1 << ($ARG + 9)))
+ riverctl spawn-tagmask $(( 1 << ($ARG + 9)))
+ spawnwindow "$ARG"
+ riverctl spawn-tagmask $(( (1 << 9) - 1))
+ fi
+done
#}}}