aboutsummaryrefslogtreecommitdiff
path: root/.config/eww/scripts/workspace.sh
diff options
context:
space:
mode:
authorJustine Smithies <justine@smithies.me.uk>2024-12-16 18:17:27 +0000
committerJustine Smithies <justine@smithies.me.uk>2024-12-16 18:17:27 +0000
commitbeb6a47aa9e5cb73f5da36cabb2afd99dedea8b8 (patch)
tree60c8d8287487af71e98394e25b765883faaad93e /.config/eww/scripts/workspace.sh
parent435cd607149e3f7338ca347eb95b864c5afe1369 (diff)
Converted workspace.sh from bash to sh.
Diffstat (limited to '.config/eww/scripts/workspace.sh')
-rwxr-xr-x.config/eww/scripts/workspace.sh53
1 files changed, 31 insertions, 22 deletions
diff --git a/.config/eww/scripts/workspace.sh b/.config/eww/scripts/workspace.sh
index 7e48bfa..614cfcf 100755
--- a/.config/eww/scripts/workspace.sh
+++ b/.config/eww/scripts/workspace.sh
@@ -1,18 +1,18 @@
-#!/usr/bin/env bash
+#!/bin/sh
active() {
num=$(river-bedload -print outputs | jq -r '.['$arg'] | select(.).view_tags')
b=0
-while [[ $num -gt 0 ]]
+while [ "$num" -gt 0 ]
do
- let temp=$num%2
- if [[ $temp -eq 1 ]]
+ temp=$((num%2))
+ if [ $temp -eq 1 ]
then
- let count=$count+1
+ count=$((count+1))
fi
- let num=$num/2
- let b=b+1
- if [[ $temp -eq 1 ]]
+ num=$((num/2))
+ b=$((b+1))
+ if [ $temp -eq 1 ]
then
echo $b
fi
@@ -21,7 +21,16 @@ return
}
#define icons for workspaces 1-9
-ic=(0 1 2 3 4 5 6 7 8 9)
+
+ic1="1"
+ic2="2"
+ic3="3"
+ic4="4"
+ic5="5"
+ic6="6"
+ic7="7"
+ic8="8"
+ic9="9"
workspaces() {
export arg="$1"
@@ -29,7 +38,7 @@ export arg="$1"
o1 o2 o3 o4 o5 o6 o7 o8 o9 \
f1 f2 f3 f4 f5 f6 f7 f8 f9
-if [[ $arg = 0 && $(river-bedload -print outputs | jq -r '.[''] | select(.).name' | wc -l | xargs) -gt 1 ]]
+if [ "$arg" = 0 ] && [ "$(river-bedload -print outputs | jq -r '.[''] | select(.).name' | wc -l | xargs)" -gt 1 ]
then
arg=1
else
@@ -46,19 +55,19 @@ num=$(river-bedload -print focused | jq -r '.['$arg'] | select(.).focused_id')
export f"$num"="$num"
echo "(box :class \"workspace\" :orientation \"h\" :space-evenly \"false\" \
- (button :onclick \"riverctl set-focused-tags $((1 << (1 - 1)))\" :class \"w0$o1$f1\" \"${ic[1]}\") \
- (button :onclick \"riverctl set-focused-tags $((1 << (2 - 1)))\" :class \"w0$o2$f2\" \"${ic[2]}\") \
- (button :onclick \"riverctl set-focused-tags $((1 << (3 - 1)))\" :class \"w0$o3$f3\" \"${ic[3]}\") \
- (button :onclick \"riverctl set-focused-tags $((1 << (4 - 1)))\" :class \"w0$o4$f4\" \"${ic[4]}\") \
- (button :onclick \"riverctl set-focused-tags $((1 << (5 - 1)))\" :class \"w0$o5$f5\" \"${ic[5]}\") \
- (button :onclick \"riverctl set-focused-tags $((1 << (6 - 1)))\" :class \"w0$o6$f6\" \"${ic[6]}\") \
- (button :onclick \"riverctl set-focused-tags $((1 << (7 - 1)))\" :class \"w0$o7$f7\" \"${ic[7]}\") \
- (button :onclick \"riverctl set-focused-tags $((1 << (8 - 1)))\" :class \"w0$o8$f8\" \"${ic[8]}\") \
- (button :onclick \"riverctl set-focused-tags $((1 << (9 - 1)))\" :class \"w0$o9$f9\" \"${ic[9]}\") \
+ (button :onclick \"riverctl set-focused-tags $((1 << (1 - 1)))\" :class \"w0$o1$f1\" \"$ic1\") \
+ (button :onclick \"riverctl set-focused-tags $((1 << (2 - 1)))\" :class \"w0$o2$f2\" \"$ic2\") \
+ (button :onclick \"riverctl set-focused-tags $((1 << (3 - 1)))\" :class \"w0$o3$f3\" \"$ic3\") \
+ (button :onclick \"riverctl set-focused-tags $((1 << (4 - 1)))\" :class \"w0$o4$f4\" \"$ic4\") \
+ (button :onclick \"riverctl set-focused-tags $((1 << (5 - 1)))\" :class \"w0$o5$f5\" \"$ic5\") \
+ (button :onclick \"riverctl set-focused-tags $((1 << (6 - 1)))\" :class \"w0$o6$f6\" \"$ic6\") \
+ (button :onclick \"riverctl set-focused-tags $((1 << (7 - 1)))\" :class \"w0$o7$f7\" \"$ic7\") \
+ (button :onclick \"riverctl set-focused-tags $((1 << (8 - 1)))\" :class \"w0$o8$f8\" \"$ic8\") \
+ (button :onclick \"riverctl set-focused-tags $((1 << (9 - 1)))\" :class \"w0$o9$f9\" \"$ic9\") \
)"
}
-workspaces $1
-river-bedload -watch active | while read -r; do
-workspaces $1
+workspaces "$1"
+river-bedload -watch active | while read -r line; do
+workspaces "$1"
done