#!/bin/bash # Kill any running Eww instance(s) so we start from a clean slate (e.g. after a # Hyprland reload or a monitor change re-runs this script). Give the old daemon a # moment to fully exit and drop its layer-shell surfaces before opening new ones. killall eww 2>/dev/null sleep 1 # GTK_THEME is read by the GTK3 widgets embedded in Eww. Export it (the previous # bare assignment was never exported, so it had no effect) so the bar picks up the # cyberqueer palette. export GTK_THEME=cyberqueer # Count connected monitors from hyprctl's JSON output. The previous # `hyprctl monitors | grep ID | wc -l` was fragile — any extra output line that # happened to contain "ID" would inflate the count. monitorsum=$(hyprctl monitors -j | jq 'length') # Open one bar per monitor, keyed by the 0-based monitor index. # # IMPORTANT: we deliberately do NOT run `eww daemon` separately and then loop # `eww open`. The old script did exactly that and it RACED: the first `eww open` # frequently ran before the freshly-started daemon was ready, so it spawned its # OWN second daemon and drew a second bar — leaving two stacked bars on a single # monitor. `eww open` already auto-starts the daemon and blocks until the window # is mapped, so the first call here establishes a single daemon that every # subsequent call reuses, guaranteeing one bar per monitor. for ((curmon=0; curmon