Bug 476084 - When an icon isn't found in the theme, look in its fallback theme before falling back to a more generic icon in the current theme
Summary: When an icon isn't found in the theme, look in its fallback theme before fall...
Status: CONFIRMED
Alias: None
Product: frameworks-kiconthemes
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.111.0
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Christoph Feck
URL:
Keywords: usability
Depends on:
Blocks:
 
Reported: 2023-10-25 14:41 UTC by Kristen McWilliam
Modified: 2023-10-31 14:08 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Shows annotations toolbar with incorrect icons (7.66 KB, image/png)
2023-10-25 14:41 UTC, Kristen McWilliam
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kristen McWilliam 2023-10-25 14:41:25 UTC
Created attachment 162563 [details]
Shows annotations toolbar with incorrect icons

SUMMARY

If the active icon theme is missing an icon used in the annotations toolbar, it fails to fallback to the icon from a different theme.


STEPS TO REPRODUCE
1. Use an icon theme that is missing one of the used icons; Tela icon theme is known to be missing a couple, or delete for example `draw-arrow.svg` from any other theme, and (re)apply that icon theme.
2. Open Spectacle and take a screenshot
3. Show the annotation tools

OBSERVED RESULT

If the active icon theme is missing the named icon specified in https://invent.kde.org/graphics/spectacle/-/blob/c35da74aafbbfac9c7fa55259a1b9e1c8ee9915b/src/Gui/AnnotationsToolBarContents.qml#L101 it falls back to a pink brush like icon every time.

EXPECTED RESULT

If a named icon is missing from the active theme it should fall back to the appropriate icon from Breeze, hicolor, etc.


SOFTWARE/OS VERSIONS
Linux: Fedora 38
KDE Plasma Version: 5.27.8
KDE Frameworks Version: 5.110.0
Qt Version: 5.15.10
Also present in git master and dev session with kf6
Comment 1 Nate Graham 2023-10-25 15:06:04 UTC
I'm afraid this isn't the way Freedesktop icon themes work. When the requested icon in the current theme is missing, the fallback icon is generated by chopping off the last word of the missing icon and then seeing if the icon theme has an icon by that name. In this case, it does.

Whether this behavior is appropriate or not could be debated. I can definitely see the argument that is causes icons to become needlessly generic and maybe even meaningless. However we oughtn't break the spec just because of this; we should change it instead.
Comment 2 Kristen McWilliam 2023-10-25 15:31:07 UTC
Agreed, the behaviour seems slightly problematic - as evidenced by every missing icon here falling back to "draw" instead of "draw-highlight", "draw-arrow", etc.
Comment 3 Nate Graham 2023-10-25 15:36:27 UTC
Indeed. Ordinarily I might recommend that you bring this up upstream, but TBH I doubt it would get anywhere. The FreeDesktop icon spec is probably one of the most problematic ones out there, with major glaring flaws and unclear paths to compliance by icon themes. It's for this reason that GNOME has started abandoning it. We like to play nice and adhere to common standards in KDE, but sometimes this bites us in cases where the common standards themselves aren't ideal.

We could probably change KIconLoader to fall back to an icon in the fallback theme for every single icon that's missing from the active theme, but this would cause the iconography of apps' to switch between two styles much more commonly. And again, it would break the spec. But maybe that's the lesser of two evils?

Worth bringing up in a Gitlab Issue at https://invent.kde.org/groups/teams/vdg/-/issues, IMO.
Comment 4 Kristen McWilliam 2023-10-25 15:47:44 UTC
Do you have a reference for this behaviour? Accoring to the Freedesktop Icon Theme Spec (https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html):

"Inherits: The name of the theme that this theme inherits from. If an icon name is not found in the current theme, it is searched for in the inherited theme (and recursively in all the inherited themes)."

I checked Tela, and it does specify Inherits: "Inherits=hicolor,Adwaita,breeze". I haven't seen anything about how it searches for the first part of the name instead so far.
Comment 5 Nate Graham 2023-10-26 21:14:25 UTC
Check out the part that starts with "In some cases you don't always want to fall back to an icon in an inherited theme."
Comment 6 Kristen McWilliam 2023-10-27 19:07:07 UTC
Thank you~

I read through the spec..

"In some cases you don't always want to fall back to an icon in an inherited theme. For instance, sometimes you look for a set of icons, prefering any of them before using an icon from an inherited theme. To support such operations implementations can contain a function that finds the first of a list of icon names in the inheritance hierarchy . . . This can be very useful for example when handling mimetype icons, where there are more and less "specific" versions of icons."

This sounds to me like it is intended to be optional, and only for specific circumstances. I'm not actually clear on why this behaviour would be desired instead of a fallback theme really.
Comment 7 Nate Graham 2023-10-30 20:17:26 UTC
Interesting. After reading that again, it does indeed seem like there's wiggle room here for our implementation to have a different behavior. I'm re-opening this ticket and moving it to KIconThemes, where KIconLoader (which implements this behavior) lives, and also CCing people who have thoughts on icon theming from the perspective of an app developer, who can check my reasoning.

I think the idea is to preserve visual fidelity by not presenting icons from multiple themes in the same UI. But I agree that it's probably better to do so than to preserve visual fidelity at the costs of losing meaning.
Comment 8 Nate Graham 2023-10-30 20:18:46 UTC
Might be mutually exclusive with what's requested in Bug 445804.
Comment 9 Kristen McWilliam 2023-10-30 22:26:59 UTC
I like the way you re-worded the title here, checking for the fallback theme _and then_ a generic icon in the current theme sounds quite reasonable (at least at first glance, I am not super familiar with the intricacies.)
Comment 10 Noah Davis 2023-10-30 22:55:25 UTC
(In reply to Nate Graham from comment #8)
> Might be mutually exclusive with what's requested in Bug 445804.

Seems like it, which is troubling since both have a point.

This bug (476084): A tool icon must look like the corresponding tool to make sense. Even if it looks worse, the usability is much better.

That bug (445804): A templates folder doesn't necessarily have to have a templates folder icon to make sense. A generic folder icon in the same theme would look better than a templates folder icon from a different theme.
Comment 11 Kristen McWilliam 2023-10-31 14:08:50 UTC
Agreed, I can see value to both. I am not sure how to reconcile that.