lxqt / libqtxdg

Qt implementation of freedesktop.org xdg specs
https://lxqt.github.io
GNU Lesser General Public License v2.1
72 stars 35 forks source link

Supported set use the dash fallback for icon name on XdgIconLoader #273

Closed zccrs closed 2 years ago

zccrs commented 2 years ago

Add XdgIconLoader::dashFallback XdgIconLoader::setDashFallback. Allows the caller to decide whether to use "dash fallback" behavior, when finding some type of icon, often expects to do dash fallback operation, such as https://specifications.freeDesktop.org/icon-naming-spec/icon-naming-spec -latest.html icon of the MimeTypes class mentioned.

tsujan commented 2 years ago

Would you please tell us where freedesktop.org says that dash fallback can be optional?

zccrs commented 2 years ago

Would you please tell us where freedesktop.org says that dash fallback can be optional?

The dash fallback is not optional in the freedesktop.org, but it should exclude the MimeTypes contexts. ref from https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec:

The dash “-” character is used to separate levels of specificity in icon names, for all contexts other than MimeTypes. For instance, we use “input-mouse” as the generic item for all mouse devices, and we use “input-mouse-usb” for a USB mouse device. However, if the more specific item does not exist in the current theme, and does exist in a parent theme, the generic icon from the current theme is preferred, in order to keep consistent style.
tsujan commented 2 years ago

How is this PR related to what you quoted?

tsujan commented 2 years ago

Dash fallbacks are already considered, in a way that's better for UX (like in KDE). See the comment that starts with https://github.com/lxqt/libqtxdg/blob/add94435fbe699610ab0eb61053945e1f7ce462d/src/xdgiconloader/xdgiconloader.cpp#L354 It includes what you quoted.

tsujan commented 2 years ago

If your emphasis is on MimeTypes, this PR doesn't do anything either.

However, if dash fallbacks were skipped with MimeTypes, many icons might be replaced by "unknown". freedesktop.org isn't practical in this case. It's followed as far as helpful.

There are other parts of freedesktop.org that even Gnome doesn't follow word by word (e.g., desktop entry spec).

zccrs commented 2 years ago

If your emphasis is on MimeTypes, this PR doesn't do anything either.

However, if dash fallbacks were skipped with MimeTypes, many icons might be replaced by "unknown". freedesktop.org isn't practical in this case. It's followed as far as helpful.

There are other parts of freedesktop.org that even Gnome doesn't follow word by word (e.g., desktop entry spec).

I admit, the problem I'm having has nothing to do with Mimetypes. As you said, the freedesktop.org is not always correct in all cases, and some icons do not want to use the dash fallback behavior (eg, the icons of PWA applications created by chrome all starts with "chrome-", if a theme contains an icon named "chrome", then all PWA applications will use the same icon(The "chrome"), not the PWA application's own icon), so this commit can allow the caller to decide whether it should use the dash fallback, so libqtxdgicon That is, there is no intentional violation of the freedesktop.org, and it also allows the caller to use the dash fallback behavior flexibly.

zccrs commented 2 years ago

I see the "https://github.com/lxqt/libqtxdg/pull/261",It's can fix the chrome problom.