Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use gdk_screen_get_monitor_plug_name to provide more consistent monitor names on wayland #1129

Merged
merged 3 commits into from
Aug 25, 2024

Conversation

dragonnn
Copy link
Contributor

@dragonnn dragonnn commented Jul 1, 2024

Description

This fixes issue #1086 and #875 (at least partly).
It is based on the linked ags issue in 1086. Yes it is a bad workaround with does require unsafe, pulling in gdk-sys and using a deprecated function from it but really without it eww is basically not usable on wayland with any kind of dynamic monitor setup (common when using laptops).

Usage

Allows using monitor plug names under wayland like that:

(defwindow bar-DP-2
  :monitor "DP-2"
  :geometry (geometry :width "100%"
    :anchor "bottom center"
  )
  :exclusive true
  :namespace "eww"
  (bar)
)

Additional Notes

Even that it uses unsafe, deprecated functions and gdk-sys I really think this is worth adding since as far I have researched this topic they is no other way of improving wayland monitor support other then rewriting to gtk4 with I suspect doesn't happen soon.
Tested it on niri windows manager and works fine.

Checklist

Please make sure you can check all the boxes that apply to this PR.

  • All widgets I've added are correctly documented.
  • I added my changes to CHANGELOG.md, if appropriate.
  • The documentation in the docs/content/main directory has been adjusted to reflect my changes.
  • I used cargo fmt to automatically format all code before committing

@elkowar elkowar merged commit 510b824 into elkowar:master Aug 25, 2024
1 check passed
@w-lfchen
Copy link
Contributor

w-lfchen commented Aug 27, 2024

i've spent the past 4 hours looking into a better implementation for this but i sadly have to give up due to my lack of knowledge on this topic.
i think there is some way using the wayland_client and wayland_protocols crates, we need to get the compositor to list its outputs somehow.
i think this protocol is the one that we need to use, but i'm unsure about whether i'm right or whether this is even possible.
the name property is the one we're looking for.

maybe someone with more experience can pick this one up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants