summaryrefslogtreecommitdiff
path: root/river/sp
diff options
context:
space:
mode:
authorzachir <zachir@librem.one>2023-02-24 11:28:01 -0600
committerzachir <zachir@librem.one>2023-02-24 11:28:01 -0600
commitb14a3e0bd1e9fc36ca9b8cb2945edf1f254cc091 (patch)
tree98de918634f1c020a7ef879e23d52f6068f855ca /river/sp
parentf84ec770ae64100ec2d98e07b615b8ac04e7387e (diff)
simplify river_sp command
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
#}}}