eww icon indicating copy to clipboard operation
eww copied to clipboard

[BUG] Widgets do not open on screen specified by --screen flag under wlroots

Open taylor85345 opened this issue 2 years ago • 2 comments

Checklist before submitting an issue

  • [X] I have searched through the existing closed and open issues for eww and made sure this is not a duplicate
  • [X] I have specifically verified that this bug is not a common user error
  • [X] I am providing as much relevant information as I am able to in this bug report (Minimal config to reproduce the issue for example, if applicable)

Description of the bug

Using the Wayland build of eww in a wlroots compositor, when opening a widget using the --screen flag, the widget will always open on the active monitor regardless of which monitor index was specified.

The widget does seem to be aware of the dimensions of the monitor specified by the --screen flag, as a widget with a width of 100% will appear with the correct dimensions for the specified --screen, even if that is not the width of the screen it actually appears on. For example if monitor 0 is 2560x1080 and monitor 1 is 1920x1080, and I run eww open --screen 1 bar while screen 0 is active, the bar appears on screen 0, but only measures 1920px wide.

I have confirmed this behavior in Sway and Hyprland.

Reproducing the issue

  1. Configure any window, with or without a :monitor specified. Name it bar for example.
  2. Open a terminal on screen 0 in your wlroots compositor of choice (obviously with multiple monitors connected and configured)
  3. Execute eww open --screen 1 bar
  4. Observe that bar opens on screen 0, instead of 1.

Expected behaviour

Bar should open on screen index 1

Additional context

It shouldn't matter, but I am using an alternative config location, and in fact do not have a $HOME/.config/eww directory present. My open command actually looks like eww -c ~/.config/hypr/neon/bar/ open --screen 1 bar

taylor85345 avatar Aug 10 '22 19:08 taylor85345

Can confirm I have this issue as well, though I will add that the ability to open on the active monitor is a desired behavior for me. I wonder if there is a way to have some sort of eww open mywidget --screen active flag option as part of the resolution to this issue.

IllustratedMan-code avatar Aug 30 '22 15:08 IllustratedMan-code

Workaround for hyprland

I have my laptop screen (0) and an external screen (1)

I define two windows showing the same topbar widget :

(defwindow topbar-laptop
  :monitor 0
  :geometry (geometry
    :x "0%"
    :width "100%"
    :height "20px"
    :anchor "top center"
  )
  :exclusive true
  :focusable true
  (topbar)
)

(defwindow topbar-external
  :monitor 1
  :geometry (geometry
    :x "0%"
    :width "100%"
    :height "20px"
    :anchor "top center"
  )
  :exclusive true
  :focusable true
  (topbar)
)

At startup, this bash script is run :

eww daemon

# Show bar on laptop screen
hyprctl dispatch focusmonitor 0
eww open topbar-laptop --screen 0

# Show bar on external screen if connected
NB_MONITORS=$(hyprctl monitors -j | jq length)
if [ "$NB_MONITORS" -eq "2" ]; then
    hyprctl dispatch focusmonitor 1
    eww open topbar-external --screen 1
fi

dependencies : hyprctl jq eww

It works so far, bar size respected on both screen.

pomarec avatar Aug 30 '22 17:08 pomarec