2024-01-26 09:58:21 +01:00
|
|
|
#!/bin/dash
|
|
|
|
|
2024-03-07 20:11:47 +01:00
|
|
|
# Monitor duplication daemon
|
2024-01-26 09:58:21 +01:00
|
|
|
WIDGET_NAME=bar
|
|
|
|
|
|
|
|
mon_count=0
|
|
|
|
|
|
|
|
# Generates $1 different window names
|
|
|
|
gen_names () {
|
|
|
|
end=$(($1-1))
|
|
|
|
out=""
|
|
|
|
for i in $(seq 0 $end); do
|
|
|
|
out="$out $WIDGET_NAME:$WIDGET_NAME$i"
|
|
|
|
done
|
|
|
|
echo $out
|
|
|
|
}
|
|
|
|
|
|
|
|
# Generates $1 monitor args
|
|
|
|
gen_args () {
|
|
|
|
end=$(($1-1))
|
|
|
|
out=""
|
|
|
|
for i in $(seq 0 $end); do
|
|
|
|
out="$out --arg $WIDGET_NAME$i:monitor=$i"
|
|
|
|
done
|
|
|
|
echo $out
|
|
|
|
}
|
|
|
|
|
|
|
|
update (){
|
|
|
|
monitors=$(hyprctl monitors -j)
|
|
|
|
count=$(echo "$monitors" | jq -c length)
|
|
|
|
|
|
|
|
if [ $mon_count -ne $count ]; then
|
|
|
|
# Close bars
|
|
|
|
eww close $(seq -s " " 0 $(($mon_count-1)))
|
|
|
|
# Open new window count
|
|
|
|
echo "eww open-many $(gen_names $count) $(gen_args $count)"
|
|
|
|
eww open-many $(gen_names $count) $(gen_args $count)
|
|
|
|
# Update mon_count
|
|
|
|
mon_count=$count
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2024-03-24 10:10:04 +01:00
|
|
|
# Open bar
|
2024-01-26 09:58:21 +01:00
|
|
|
update
|
2024-03-24 10:10:04 +01:00
|
|
|
|
|
|
|
# Open other widgets
|
2024-06-23 12:53:46 +02:00
|
|
|
eww open-many timer music notification_overlay
|
2024-03-24 10:10:04 +01:00
|
|
|
|
2024-05-21 09:54:24 +02:00
|
|
|
socat -u UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | while read -r line; do
|
2024-01-26 09:58:21 +01:00
|
|
|
update
|
|
|
|
done
|
|
|
|
|