aboutsummaryrefslogtreecommitdiff
path: root/.config/eww/scripts/start.sh
diff options
context:
space:
mode:
authorJustine Smithies <justine@smithies.me.uk>2024-11-08 20:48:58 +0000
committerJustine Smithies <justine@smithies.me.uk>2024-11-08 20:48:58 +0000
commitc2fbc4d1717864a0055592e0b73d71c010e8686c (patch)
tree76e5bf50cc0f9c1b83f474740a8015d7f4e0ef26 /.config/eww/scripts/start.sh
parentb9d24b3b6bdaed04fab07d9150c51d4f0f7a5c7d (diff)
Initial commit
Diffstat (limited to '.config/eww/scripts/start.sh')
-rwxr-xr-x.config/eww/scripts/start.sh41
1 files changed, 41 insertions, 0 deletions
diff --git a/.config/eww/scripts/start.sh b/.config/eww/scripts/start.sh
new file mode 100755
index 0000000..ec305b9
--- /dev/null
+++ b/.config/eww/scripts/start.sh
@@ -0,0 +1,41 @@
+#!/usr/bin/env bash
+
+focusactivetag() {
+ export arg="$1"
+ # Focus the lowest active tag
+ num=$(river-bedload -print outputs | jq -r '.['$arg'] | select(.).focused_tags')
+ b=0
+ while [[ $num -gt 0 ]]
+ do
+ let temp=$num%2
+ if [[ $temp -eq 1 ]]
+ then
+ let count=$count+1
+ fi
+ let num=$num/2
+ let b=b+1
+ if [[ $temp -eq 1 ]]
+ then
+ riverctl set-focused-tags $((1 << ($b - 1)))
+ return
+ fi
+done
+return
+}
+
+# kill any running instances if they exist
+eww kill
+
+# Start Eww daemon
+# eww daemon
+
+# start a bar for each monitor
+monitors=$(wlr-randr | grep "^[^ ]" | awk '{ print$1 }' | wc -l | xargs)
+total=$(wlr-randr | grep "^[^ ]" | awk '{ print$1 }' | wc -l | xargs)
+monitors=$(($monitors-1))
+# for ((i = 0 ; i < $monitors ; i++)); do
+for ((i = $monitors ; i >= 0 ; i-=1)); do
+ eww open bar${i}
+ riverctl focus-output $(wlr-randr | grep "^[^ ]" | awk '{ print$1 }' | awk 'FNR == '$i+1' {print}')
+ focusactivetag $i
+done