From c2fbc4d1717864a0055592e0b73d71c010e8686c Mon Sep 17 00:00:00 2001 From: Justine Smithies Date: Fri, 8 Nov 2024 20:48:58 +0000 Subject: Initial commit --- .config/eww/scripts/bar-toggle.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 .config/eww/scripts/bar-toggle.sh (limited to '.config/eww/scripts/bar-toggle.sh') 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 + -- cgit v1.2.3