diff options
author | Justine Smithies <justine@smithies.me.uk> | 2024-11-08 20:48:58 +0000 |
---|---|---|
committer | Justine Smithies <justine@smithies.me.uk> | 2024-11-08 20:48:58 +0000 |
commit | c2fbc4d1717864a0055592e0b73d71c010e8686c (patch) | |
tree | 76e5bf50cc0f9c1b83f474740a8015d7f4e0ef26 /.config/eww/scripts/bar-toggle.sh | |
parent | b9d24b3b6bdaed04fab07d9150c51d4f0f7a5c7d (diff) |
Initial commit
Diffstat (limited to '.config/eww/scripts/bar-toggle.sh')
-rwxr-xr-x | .config/eww/scripts/bar-toggle.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/.config/eww/scripts/bar-toggle.sh b/.config/eww/scripts/bar-toggle.sh new file mode 100755 index 0000000..78d0050 --- /dev/null +++ b/.config/eww/scripts/bar-toggle.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +monitors=$(river-bedload -print outputs | jq -r -c '.[] | .name' | wc -l | xargs) + +for ((i = 0 ; i < $monitors ; i++)); do + echo $i + active_monitor=$(river-bedload -print outputs | jq 'map(.focused)|to_entries|.[]|select(.value)|.key') + # Flip value e.g 0 to 1 + if [ "$monitors" != "1" ]; then + ((active_monitor ^= 1)) + fi + bar=$(eww active-windows | grep "bar$i") + if [ "$active_monitor" == "$i" ] && [ "$bar" == "bar$i: bar$i" ]; then + eww close bar$i + elif [ "$active_monitor" == "$i" ]; then + eww open bar$i + fi +done + |