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

Filter screenshots by environment #2210

Open
danirabbit opened this issue Sep 4, 2024 · 3 comments
Open

Filter screenshots by environment #2210

danirabbit opened this issue Sep 4, 2024 · 3 comments
Labels
Good First Issue Small, self-contained issue. Good for newcomers, and/or should be an easy fix. Priority: Wishlist Not a bug. A new feature or enhancement

Comments

@danirabbit
Copy link
Member

Problem

Apps can provide multiple screenshots for different desktop environments or using light and dark styles. There is a way now in appstream for developers to declare the environment of a screenshot, but AppCenter just shows all screenshots

Proposal

Filter screenshots to match the current desktop environment and match the dark/light style preference. For example, Harvey should show the light screenshot in light mode and the dark screenshot in dark mode, but not both

Prior Art (Optional)

No response

@danirabbit danirabbit added Priority: Wishlist Not a bug. A new feature or enhancement Good First Issue Small, self-contained issue. Good for newcomers, and/or should be an easy fix. labels Sep 4, 2024
edwood-grant pushed a commit to edwood-grant/appcenter that referenced this issue Dec 8, 2024
If the environment (if any) does not match the prefer dark setup.
Won't consider null environments.
edwood-grant pushed a commit to edwood-grant/appcenter that referenced this issue Dec 8, 2024
Will read the environment property of the
screenshot and will only show them if prefer dark
mode is enabled in the system and the screenshot
has a dark mode environment (i.e. has ':dark' in
the environment id). Won't consider null
environments in the screenshots.
@danirabbit
Copy link
Member Author

Keeping this issue open since we now have dark mode filtering but not desktop environment filtering

@edwood-grant
Copy link
Contributor

I can definitely get the desktop environment via Environment.get_variable("XDG_SESSION_DESKTOP"); and compare. But I have a question here, actually.

Let's see, for example, Harvey. The application has two screenshots. Their environment IDs on one is pantheon:dark and the other is pantheon

If I happen to be on GNOME for example, the environment ID will not match the XDG_SESSION_DESKTOP environment variable, and this would result in no screenshots. Would this be an acceptable filter? Or would you rather have at least one screenshot if nothing matches?

It's a bit important since the latter would surely involve a bit of more code to guarantee at least one screenshot if nothing matches... would probably be best to actually filter the screenshots by DE and style (dark, light) with sort_screenshots and then just iterate until you don't find anything.

And if you don't find anything then grab the first screenshot at the very least I suppose. I would still not take into account null environment screenshots, though.

Just wanting to understand what would be preferable here. It seems that latter option would be the actual complete solution for this allowing to have all the proper screenshots first and make it easy to verify if there is at least a screenshot that matches the filter (otherwise, leave the first screenshot, whatever it is and leave it like that)

@danirabbit
Copy link
Member Author

danirabbit commented Dec 10, 2024

Yeah I think what we want to do is, if we can get Pantheon screenshots, use those. But if we can't, use whatever is available. Prioritizing the desktop, then light or dark

So for example if we have a list that's ["Pantheon", "Pantheon:Dark", "GNOME", "GNOME:Dark]then we should show the Pantheon screenshots in light and dark mode respectively. This is like the ideal case.

If we have ["Pantheon", "GNOME", "GNOME:Dark] we should prefer the Pantheon screenshot, even in dark mode

If we have ["GNOME", "GNOME:Dark] then we should just go ahead and use the GNOME screenshots in dark and light mode respectively

If we only have ["GNOME:Dark"] for some reason we should still show this screenshot even in light mode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Issue Small, self-contained issue. Good for newcomers, and/or should be an easy fix. Priority: Wishlist Not a bug. A new feature or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants