blob: ea7e6b064a89216ec4021f18fea06db94e65a8ea (
plain) (
tree)
|
|
#!/bin/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
((active_monitor ^= 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
|