I’m wondering if it’s possible to include a custom SVG icon for a desktop widget that I’m developing.
Neither iconproperty in the documentation seems to mention anything about this, and instead require you use a system icon.
For my personal use, I solved this by just copying the desired SVG into my own local icons directory, but ideally I’d like to have it contained within the package folder so it’s easier for others to install the widget.
I also tried setting the “Icon” field in metadata.json to “./widget_icon.svg" and "widget_icon.svg"(with the SVG file named widget_icon.svg and in the same directory as metadata.json), but neither seemed to work.
never made a widget, but a quick look at the docs suggest you just call out the icon location in your contents/ui/main.qml file.
where you put the icon file is up to you… for my service menus that use custom icons, i keep them in folder with the service menu ~/.local/share/kio/servicemenus/, you could likely just put the .svg in at the same level as the .json
but it seems you need to specify the full path, shortcuts like~, . or $HOME don’t seem to work which you will need to take care of with an install.sh script
So while you can ship a custom icon and display it when the widget is added to the panel/desktop (using Kirigami.Icon), other places like the widget explorer or the widget about page need an icon that is on the icon theme.
Is running post install scripts possible outside global themes? I don’t think it is but can’t find any documentation on install scripts of any kind of plasma add-ons
Turns out it is actually possible to but it seems I can’t read, even the issue I linked mentions that the icon needs to be placed inside the contents directory:
Icon can be "Icon": "/icons/icon.svg" or "Icon": "/icon.png" and both work, the issue i linked is only about the AboutPlugin which will not load this custom icon.