Skip to content

Unify with_app_id and with_class on Linux/BSD #1739

Closed

Description

@chrisduerr

Winit currently has two calls that do very similar things, with_app_id and with_class. Generally I think these are rarely used with different parameters and more commonly the code is just duplicated between both of them. As an abstraction library that shouldn't make downstream care too much about Wayland/X11, I think this gives winit the opportunity to unify these two methods to make things a bit easier to use.

They are of course not exactly the same and depending on the platform the number of arguments is different, but since they should generally overlap this can be resolved by thorough documentation.

Of course even when unified, people could still do x11/Wayland checks on their own if they really want to treat these methods differently.

So the main reason why one wouldn't want to do this is that these aren't commonly set to the same thing. I can only speak for myself and Alacritty where we do indeed set these to the same value, so I'm curious about others here. Are there any downstream users treating these as different things?

Activity

  1. added
    DS - wayland
    DS - x11
    C - needs discussion
    S - api
    on Oct 10, 2020
  2. kchibisov commented on Oct 11, 2020

    @kchibisov
    Member

    I kind of agree, it should be fine to make one method out of them, however I'm not sure that with should call it with_class or with_app_id. Maybe something like with_application_name? What do you think?

  3. chrisduerr commented on Oct 11, 2020

    @chrisduerr
    ContributorAuthor

    Naming is a good point, I probably would have just used the name with_class since to me that's such a general concept. However I might be biased having been around X11 for so long, so windows having different "classes" might be a foreign concept to many.

    So having a with_application_name would certainly be a more general and self-descriptive term, which I certainly wouldn't mind. The biggest argument I could give against it would be that it's significantly longer than both with_class and with_app_id, so maybe with_name would also make sense?

  4. kchibisov commented on Apr 9, 2022

    @kchibisov
    Member

    Yeah, with_name is something I'd go with to be honest. Since gtk uses -name parameter for application name.

  5. self-assigned this
    on Apr 9, 2022
  6. added a commit that references this issue on Apr 9, 2022
    24b0574
  7. added 2 commits that reference this issue on Apr 17, 2022
    f026e28
    a78e801
  8. added a commit that references this issue on Apr 19, 2022
    cbba00d
  9. added a commit that references this issue on Aug 24, 2022
    5a72b99
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

C - needs discussionDS - waylandDS - x11S - api

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions