diff options
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 + |