elkowar / eww

ElKowars wacky widgets
https://elkowar.github.io/eww
MIT License
9.47k stars 385 forks source link

Is it possible to recursively render an eww bar on the list of connected monitors? #1109

Open 0xN1nja opened 5 months ago

0xN1nja commented 5 months ago

I can recursively render polybar on multiple monitors like this:

for mon in $(polybar --list-monitors | cut -d":" -f1); do
    MONITOR=$mon polybar -q emi-bar -c "${rice_dir}"/config.ini &
done

But I'm not sure how to render the eww bar in the same way for each monitor.

So far, I've tried this:

Firstly, I created a bar-external component for the bar:

(defwindow bar
  :monitor 0
  :geometry (geometry :x "15px"
                     :y "0%"
                     :anchor "left center"
                     :height "90%"
                     :width "47px")

  :reserve (struts :distance "5px"
                   :side "left")
  :wm-ignore false
  (bar))

(defwindow bar-external
  :monitor 1
  :geometry (geometry :x "15px"
                     :y "0%"
                     :anchor "left center"
                     :height "90%"
                     :width "47px")

  :reserve (struts :distance "5px"
                   :side "left")
  :wm-ignore false
  (bar))

Then I'm rendering it like this:

eww -c "${rice_dir}"/bar open --toggle bar --screen 0
eww -c "${rice_dir}"/bar open --toggle bar-external --screen 1

But this approach isn't flexible, and it's also not correct; because the bar is being exactly mirrored on the other monitor. When I hover over the power menu, I expect it to open on my first monitor's bar, but it also opens on the second one (bar-external):

image

I want to recursively do it, so that if I connect "n" number of monitors, the bar gets rendered on all of them.

So how can I achieve this? Is there any official method for rendering components on multiple monitors that I might be missing somewhere?

NovaAndrom3da commented 3 months ago

Indeed, I have a script that manually configures this by calling eww on loop to spawn each bar, and it is a janky solution at best. I would like to be able to have an option as like "on all monitors" built into a window definition but yeah.