elkowar / eww

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

[FEATURE/QUESTION] show bar on all available monitors #648

Open Le-Kat opened 1 year ago

Le-Kat commented 1 year ago

Description of the requested feature

when setting a bar to be visible, you need to have a segment that says :monitor 0 (or whatever monitor number you use). However, for a multi-head setup, it would be usefull to be able to display the same bar on all monitors, without having to copy/paste the current bar definition multiple times.

Proposed configuration syntax

This is the part where I'm not sure if there's already a syntax for this, but I tried :monitor * (and also not including the segment at all), I figure a sensible syntax would be either using a wildcard to signify all monitors, and an array to signify specific monitors.

Additional context

No response

rosshadden commented 10 months ago

Since eww gives an error if you don't specify a :monitor, but works when you pass the --screen argument when opening a bar, it seemed intuitive to me that you would leave off a hardcoded :monitor definition in the config and just run a loop over your monitors to launch a bar on every monitor. But it does not work.

That's exactly how it works with polybar (for example). This is a snippet of a script I wrote to launch my bars on every monitor:

local monitors="$(polybar -m | sort -r | awk -F: '{ print $1 }')"
for m in $monitors; do
    MONITOR=$m polybar top &
    MONITOR=$m polybar bottom &
    sleep 1
done

Is this really not possible with eww? I found this issue while trying to figure out what I was missing.

JustAlternate commented 2 months ago

This still is a problem in 2024...

danyspin97 commented 5 days ago

Currently, I am creating a bar<monitor_id> for each monitor. I do so by defining the yuck inside a shell script and then writing it to eww.yuck. Then I start each bar, I don't need to set the monitor anymore. (To iterate over the available displays, I had to write my own tool as well). This is the resulting output:

(defwindow barDP-3
  :monitor "DP-3"
  :geometry (geometry :x "0%"
                      :y "1%"
                      :width "98%"
                      :anchor "top center")
  :stacking "fg"
  :reserve (struts :distance "40px" :side "top")
  :exclusive true
  :class "bar"
    (bar :display_id "DP-3"))

(defwindow barDP-4
  :monitor "DP-4"
  :geometry (geometry :x "0%"
                      :y "1%"
                      :width "98%"
                      :anchor "top center")
  :stacking "fg"
  :reserve (struts :distance "40px" :side "top")
  :exclusive true
  :class "bar"
    (bar :display_id "DP-4"))

(include "./modules.yuck")

I am also looking into a better way to do this, because using a shellscript to generate yuck seems pretty bad to me.