blob: 78d00501f4bfdea8c63e0274059bdf44738d909a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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
|