elkowar / eww

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

[BUG] Eww uses monitor model instead of a serial #1086

Open coderPaddyS opened 2 months ago

coderPaddyS commented 2 months ago

Checklist before submitting an issue

Description of the bug

Spawning a widget on each monitor is only possible, if they aren't the same model. If they are, eww will spawn the widget on the same monitor. Using the monitor serial primarily and the model as fallback (or any property specified by the user) or the monitor description would resolve this issue. Usage of an index as id could be a solution, but sometimes the monitor ordering is not the same as reported by the DE (in my case Hyprland) as seen below. Eww uses the same ordering in which my DE lists the monitors, not by the ID.

Reproducing the issue

$>eww open bar --id 1 --arg screen=609NTFAF4483
failed to open window `1`

Caused by:
    Failed to get monitor 609NTFAF4483
    The available monitors are:
        [0] 0x1551
        [1] 24EB23
        [2] 24EB23

The monitor ordering:

$> hyprctl monitors
Monitor eDP-1 (ID 0):
        3840x2400@59.99400 at 960x1200
        description: Sharp Corporation 0x1551
        make: Sharp Corporation
        model: 0x1551
        serial:

Monitor DP-8 (ID 2):
        1920x1200@59.95000 at 1920x0
        description: LG Electronics 24EB23 305NDGL87831
        make: LG Electronics
        model: 24EB23
        serial: 305NDGL87831

Monitor DP-7 (ID 1):
        1920x1200@59.95000 at 0x0
        description: LG Electronics 24EB23 609NTFAF4483
        make: LG Electronics
        model: 24EB23
        serial: 609NTFAF4483

Expected behaviour

Eww spawns a window on each monitor correctly by specifying the serial, model or description of the monitor.

Additional context

2024-04-25T15:14:54,802040489+02:00

krims0n32 commented 2 months ago

Having the same issue, after suspend/resume or reboot eww sees the monitor order differently which puts my bars in the wrong location. wayland-info and hyprctl monitors always shows the correct info, order is not changed there.

I have tried using the JSON monitor matcher but specifying DP-1/2/3 doesn't seem to do anything, only matching the monitor model is working but as I have 3 screens and 2 are of the same model this is a problem.

Making matching possible on display port, e.g. DP-1/2/3 would be a nice solution and I guess according to the docs this should be working so this probably is a bug?

elkowar commented 2 months ago

Yea, I've noticed the issue that monitor specifications on wayland are kind of annoyingly meaningless. I haven't yet figured out how to get any more specific info through GTK, though -- if anyone has any ideas or would be willing to tackle an implementation of a fix for this, I'd love that! GTK doesn't give me all that much info about the underlying wayland monitor, and I'm unsure how much details I can get about the monitor in a standardized way on wayland either way :/

coderPaddyS commented 2 months ago

I'm not that experienced with the wayland protocol and gtk, but it seems that migrating to gtk4 would atleast allow to get the monitor information in an easy fashion. Would it be feasible to migrate? Is a migration even wanted? If so, I'd could try to implement the migration, but someone with more experience should most definitely look at it thoroughly and it would most likely not be backwards compatible to the gtk3 based config.

krims0n32 commented 1 month ago

There is some discussion and a proposed fix for another bar here:

https://github.com/Aylur/ags/issues/363

Maybe this could help you? If I can do anything to debug this, let me know.