Bug 507678 - Allow desktop plasmoids to provide an applet icon displayable in Widget Explorer panel
Summary: Allow desktop plasmoids to provide an applet icon displayable in Widget Explo...
Status: RESOLVED WORKSFORME
Alias: None
Product: plasmashell
Classification: Plasma
Component: general (other bugs)
Version First Reported In: 6.4.80
Platform: Other Linux
: NOR wishlist
Target Milestone: 1.0
Assignee: Mark Capella
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-07-30 23:58 UTC by Mark Capella
Modified: 2025-09-16 20:27 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Capella 2025-07-30 23:58:26 UTC
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
Comment 3 Mark Capella 2025-08-14 00:50:28 UTC
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
Comment 4 Nate Graham 2025-08-14 15:10:01 UTC
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.
Comment 5 Mark Capella 2025-08-14 17:42:11 UTC
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.
Comment 6 Mark Capella 2025-08-18 08:03:33 UTC
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.
Comment 7 Nate Graham 2025-08-19 17:07:52 UTC
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.
Comment 8 Mark Capella 2025-08-19 17:11:09 UTC
So, quickly, how do i obtain $HOME from QML/JS Here?
Comment 9 Nate Graham 2025-08-19 17:18:23 UTC
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.
Comment 10 Mark Capella 2025-09-03 18:15:57 UTC
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
Comment 11 Nate Graham 2025-09-16 20:27:12 UTC
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.