Currently, plasmoid designers can use Cuttlefish to review themeable icons to represent their applets in the AppletDelegate, and in their apps configuration AboutPlugin. Mostly the available icons are sufficient choices, but sometimes lack panache or whimsy :-D I'd like that the icon in the metatdata.json can be referenced and packaged in the /contents/ folder delivered with each widget. My small prototype works by adding a settable property called "appletName" to kirigami/icon .h & .cpp & consuming it in AppletDelegate.qml and AboutPlugin.qml
https://invent.kde.org/markcapella/kirigami/-/compare/master...master?from_project_id=2506 https://invent.kde.org/markcapella/plasma-desktop/-/compare/master...master?from_project_id=2802
https://invent.kde.org/frameworks/kirigami/-/merge_requests/1893 https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/3139
I've revised the approach after a little further research. This patch feels cleaner. Instead of posting merge requests to three different repos, I thought I'd post a WIP from pastebin "never expire" and ask for comments? https://pastebin.com/DdQfeZ4V
Discussing the approach before writing code is definitely a good idea. Can you describe it here? I'm still not sure why we need so many changes for this.
The source for Kirigami.Icons need to be changed in three places to try to locate and use an icon I'd like plasmoid devs to be able to embed/provide through their githubs and Kde store. The installed location for plasmoids is the users $HOME which I can't get through QML (new here?) so I created a helper QML plugin to provide the fully qualified name of the icon.
This change requires devs to wait until this software feature rolls out to employ it, as it doesn't allow override of an already existing system theme icon. This could be done with a small change to Kirigami Icon, then devs could design a plasmoid who's icon updates automatically as the feature rolls out.
Changing Kirigami.Icon is the wrong approach here. It's a generic component, and shouldn't be changed for this specific use case. We should instead be changing AppletDelegate and AboutPlugin to read these icons, if they exist, and if they do, pass them to the Kirigami.Icon items that render the icons.
So, quickly, how do i obtain $HOME from QML/JS Here?
That doesn't sound like the right question to ask. You would get the metadata from the package, which is exposed to QML in a C++ model. If the package needs new metadata, that should go into the C++ model to expose it to QML.
So finding this: https://invent.kde.org/plasma/plasma-workspace/-/blob/master/components/shellprivate/plasmaappletitemmodel.cpp?ref_type=heads#L62-67 It seems I can already specify a custom icon in my metadata.json file as: "Icon" : "/lightstrands.png", And my whimsical icon "lightstrands.png" will be located in my /contents/ folder & used to populate the WidgetsExplorer panel nicely :-) There is one oddity I noticed. The results of iconName = pkg.filePath("", pkg.metadata().iconName()); is returned in my case as: /home/mark/.local/share/plasma/plasmoids/inc.skyrmion.lightstrands/contents///lightstrands.png with an odd "///" bit that seems ignored at runtime. This is caused here: https://invent.kde.org/frameworks/kpackage/-/blob/master/src/kpackage/package.cpp?ref_type=heads#L345-347
If this is already possible, it probably makes sense to identify specific issues with new bug reports. The status here is a bit hard to follow at this point.