aboutsummaryrefslogtreecommitdiff
path: root/.config/eww/scripts
diff options
context:
space:
mode:
authorJustine Smithies <justine@smithies.me.uk>2024-08-01 20:18:18 +0100
committerJustine Smithies <justine@smithies.me.uk>2024-08-01 20:18:18 +0100
commit1cfc688fd2e0c06133ccfa254352093880624480 (patch)
tree726116033cdc6c3a53504e115a7e238e9a5d6abc /.config/eww/scripts
parentc1591e647ce297856fb6ad8c7e1fd23867d48d51 (diff)
Remove duplicated code
Diffstat (limited to '.config/eww/scripts')
-rwxr-xr-x.config/eww/scripts/workspace.sh20
1 files changed, 7 insertions, 13 deletions
diff --git a/.config/eww/scripts/workspace.sh b/.config/eww/scripts/workspace.sh
index e0c34dd..91a3cf6 100755
--- a/.config/eww/scripts/workspace.sh
+++ b/.config/eww/scripts/workspace.sh
@@ -1,12 +1,6 @@
#! /bin/bash
active() {
-if [[ $arg = 0 && $(river-bedload -print outputs | jq -r '.[''] | select(.).name' | wc -l | xargs) -gt 1 ]]
-then
- arg=1
-else
- arg=0
-fi
num=$(river-bedload -print outputs | jq -r '.['$arg'] | select(.).view_tags')
b=0
while [[ $num -gt 0 ]]
@@ -35,19 +29,19 @@ export arg="$1"
o1 o2 o3 o4 o5 o6 o7 o8 o9 \
f1 f2 f3 f4 f5 f6 f7 f8 f9
-ows="$(active)"
-for num in $ows; do
- export o"$num"="$num"
-done
-
-# Get Focused workspace for current monitor ID
-export arg="$1"
if [[ $arg = 0 && $(river-bedload -print outputs | jq -r '.[''] | select(.).name' | wc -l | xargs) -gt 1 ]]
then
arg=1
else
arg=0
fi
+
+ows="$(active)"
+for num in $ows; do
+ export o"$num"="$num"
+done
+
+# Get Focused workspace for current monitor ID
num=$(river-bedload -print focused | jq -r '.['$arg'] | select(.).focused_id')
export f"$num"="$num"