diff options
author | Justine Smithies <justine@smithies.me.uk> | 2024-12-16 20:14:46 +0000 |
---|---|---|
committer | Justine Smithies <justine@smithies.me.uk> | 2024-12-16 20:14:46 +0000 |
commit | 76ad78fc358737374108db79e55c9f67ac3dd64d (patch) | |
tree | 175410dcb54e4b911f1e2715c94eb3d6769cd355 /.config/eww | |
parent | 22433999a6c10d599def4f06ce89f92f7503126a (diff) |
Convert start.sh converted from bash to sh.
Diffstat (limited to '.config/eww')
-rwxr-xr-x | .config/eww/scripts/start.sh | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/.config/eww/scripts/start.sh b/.config/eww/scripts/start.sh index ec305b9..4b5e9e9 100755 --- a/.config/eww/scripts/start.sh +++ b/.config/eww/scripts/start.sh @@ -1,22 +1,22 @@ -#!/usr/bin/env bash +#!/bin/sh focusactivetag() { export arg="$1" # Focus the lowest active tag - num=$(river-bedload -print outputs | jq -r '.['$arg'] | select(.).focused_tags') + num=$(river-bedload -print outputs | jq -r '.["$arg"] | select(.).focused_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 - riverctl set-focused-tags $((1 << ($b - 1))) + riverctl set-focused-tags $((1 << (b - 1))) return fi done @@ -31,11 +31,11 @@ eww kill # 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 +monitors=$((monitors-1)) +while [ "$monitors" -ge 0 ] +do + eww open bar"${monitors}" + riverctl focus-output "$("wlr-randr | grep "^[^ ]" | awk '{ print$1 }' | awk 'FNR == '$monitors+1' {print}'")" + focusactivetag "$monitors" + monitors=$(( monitors - 1 )) done |