aboutsummaryrefslogtreecommitdiff
path: root/.config
diff options
context:
space:
mode:
authorJustine Smithies <justine@smithies.me.uk>2024-07-06 20:36:25 +0100
committerJustine Smithies <justine@smithies.me.uk>2024-07-06 20:36:25 +0100
commite66eb551bb221b9ab91080d9f5fde7ea459a2bc1 (patch)
treeaa85a0125f5c801f79ee65380b4eeef222ec948e /.config
parent49837c3afd5c7f41997d2bfab337daa18db0e1d8 (diff)
Make sure that eww bar focus on lowest focused tag for each output
Diffstat (limited to '.config')
-rwxr-xr-x.config/eww/scripts/start.sh50
1 files changed, 30 insertions, 20 deletions
diff --git a/.config/eww/scripts/start.sh b/.config/eww/scripts/start.sh
index 9819fa0..5d46693 100755
--- a/.config/eww/scripts/start.sh
+++ b/.config/eww/scripts/start.sh
@@ -1,5 +1,30 @@
#!/bin/bash
+focusactivetag() {
+ export arg="$1"
+ echo "Arg: "$arg
+ # Focus the lowest active tag
+ num=$(river-bedload -print outputs | jq -r '.['$arg'] | select(.).view_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
+ echo $b
+ riverctl set-focused-tags $((1 << ($b - 1)))
+ return
+ fi
+done
+return
+}
+
# kill any running instances if they exist
eww kill
@@ -11,27 +36,12 @@ 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}
+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
if [ "$total" -gt "1" ]; then
riverctl focus-output HDMI-A-1
- # Focus the lowest active tag
- num=$(river-bedload -print outputs | jq -r '.['0'] | select(.).view_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)))
- exit 0
- fi
- done
fi
+