summaryrefslogtreecommitdiff
path: root/river
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
parentf84ec770ae64100ec2d98e07b615b8ac04e7387e (diff)
simplify river_sp command
Diffstat (limited to 'river')
-rwxr-xr-xriver/init22
-rwxr-xr-xriver/sp/river_sp65
2 files changed, 34 insertions, 53 deletions
diff --git a/river/init b/river/init
index ebd3224..d5f609c 100755
--- a/river/init
+++ b/river/init
@@ -106,17 +106,17 @@ riverctl map normal $mod1+Shift 0 set-view-tags $all_tags
# scratchpad tags
BINPATH="${XDG_CONFIG_HOME:-$HOME/.config}/river/sp"
-riverctl map normal $mod1+Control z spawn "$BINPATH/river_sp -n z"
-riverctl map normal $mod1+Control x spawn "$BINPATH/river_sp -n x"
-riverctl map normal $mod1+Control c spawn "$BINPATH/river_sp -n c"
-riverctl map normal $mod1+Control v spawn "$BINPATH/river_sp -n v"
-riverctl map normal $mod1+Control b spawn "$BINPATH/river_sp -n b"
-riverctl map normal $mod1+Control a spawn "$BINPATH/river_sp -n a"
-riverctl map normal $mod1+Control s spawn "$BINPATH/river_sp -n s"
-riverctl map normal $mod1+Control d spawn "$BINPATH/river_sp -n d"
-riverctl map normal $mod1+Control f spawn "$BINPATH/river_sp -n f"
-riverctl map normal $mod1+Control g spawn "$BINPATH/river_sp -n g"
-riverctl map normal $mod1+Control q spawn "$BINPATH/river_sp -n q"
+riverctl map normal $mod1+Control z spawn "$BINPATH/river_sp z"
+riverctl map normal $mod1+Control x spawn "$BINPATH/river_sp x"
+riverctl map normal $mod1+Control c spawn "$BINPATH/river_sp c"
+riverctl map normal $mod1+Control v spawn "$BINPATH/river_sp v"
+riverctl map normal $mod1+Control b spawn "$BINPATH/river_sp b"
+riverctl map normal $mod1+Control a spawn "$BINPATH/river_sp a"
+riverctl map normal $mod1+Control s spawn "$BINPATH/river_sp s"
+riverctl map normal $mod1+Control d spawn "$BINPATH/river_sp d"
+riverctl map normal $mod1+Control f spawn "$BINPATH/river_sp f"
+riverctl map normal $mod1+Control g spawn "$BINPATH/river_sp g"
+riverctl map normal $mod1+Control q spawn "$BINPATH/river_sp q"
# $mod1+Space to toggle float
riverctl map normal $mod1+Control Space toggle-float
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
#}}}