aboutsummaryrefslogtreecommitdiff
path: root/.config/eww/scripts/bar-toggle.sh
blob: 74b18194b878822a4a89f8211f5decc088e9d618 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/bash
monitors=$(swaymsg -t get_outputs -r | jq -r -c '.[] | .name' | wc -l)

for ((i = 0 ; i < $monitors ; i++)); do
	echo $i
	active_monitor=$(swaymsg -t get_outputs | jq 'map(.focused)|to_entries|.[]|select(.value)|.key')
	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