Dotfiles/desktopenvs/hyprlua/scripts/ewwstart.sh

24 lines
979 B
Bash
Executable File

#!/bin/bash
# Kill any running Eww instance before starting a fresh daemon to avoid
# duplicate bars or stale widget state after a reload/monitor change.
killall eww
# Start the Eww daemon in the background; subsequent `eww open` calls connect to it.
/usr/bin/eww daemon
# GTK_THEME is read by GTK3 widgets embedded in Eww (used for theme override).
GTK_THEME=cyberqueer
# Count connected monitors via hyprctl — each "ID" line corresponds to one monitor.
monitorsum=$(hyprctl monitors | grep ID | wc -l)
# Open one bar instance per monitor. Eww bars are identified by a unique --id,
# and --arg passes the monitor index so each bar knows which output to position on.
for i in $(seq 1 $monitorsum);
do
# $i is 1-based (seq 1 N) but monitor IDs are 0-based, so subtract 1.
declare -i curmon=$i-1
/usr/bin/eww open bar --id bar$curmon --arg monitor=$curmon
done
#/usr/bin/eww open bar --id primary --arg monitor=1
#/usr/bin/eww open bar --id secondary --arg monitor=0