SUMMARY STEPS TO REPRODUCE 1. Look at the system tray widget icons 2. Look at the icons in system tray widget settings -> Entries OBSERVED RESULT Icons differ between system tray widget and its settings. The ones in the system tray are monochrome and the ones in the settings are partially colorful. EXPECTED RESULT The icons in the settings should also be monochrome Reason: when i go into this settings page I use the icons to orient myself quickly E.g., I look at the system tray settings icon for the klipper and want to change its visibility to hidden. Then I look for a visual cue in the list of entries (system tray settings -> icons) in the form of the same icon...but this icon is nowhere to be found. PS. If someone points me to the code for this, I could try to submit a patch. SOFTWARE/OS VERSIONS Windows: macOS: Linux/KDE Plasma: (available in About System) KDE Plasma Version: KDE Frameworks Version: Qt Version: ADDITIONAL INFORMATION
This is now fixable in Plasma 6. I shall endeavor to fix it.
Investigated a bit. We have two options: 1. Append "-symbolic" to the current name of the icon we're asking for in the config window, which is the icon in the applet's JSON metadata 2. Stop using the JSON Metadata icon in the config window, and instead use the icon that the applet is currently showing in the System Tray itself The downside to option 1 is that it's not guaranteed to actually accomplish the goal, because there may not be a symbolic version of the icon specified in the JSON metadata available. We can guarantee this for 1st party applets when using the Breeze theme but not in other circumstances. The downside to option 2 is that the icon shown in the config window will match the applet's active status, rather than just being a generic representation of it. For example when Bluetooth is disabled, the Bluetooth icon is sort of fades and desaturated in the System Tray, and this would appear in the config window as well. Another problem with option 2 is that currently, asking for the applet's icon causes plasmashell to crash and I haven't figured out how to fix it yet. The code change in both cases is quite small, just a little change for Qt::DecorationRole in plasma-workspace/applets/systemtray/systemtraymodel.cpp. We just need to decide which one to do (and if we choose option 2, fix the crash).
I think the downside of option two is actually more of an upside, at least for me, since you might already be looking for exactly that icon (with that active status) anyway. So I would favor option two.
I agree, and that's the option I started implementing. Unfortunately I have not been able to figure out how to fix the crash that it causes, so this work is on hold for now.
Could you upload your current state of work to a branch and post a link here? I could try to take a look as well.
Or cc @eric on Gitlab
Sure, apply this diff to plasma-workspace: diff --git a/applets/systemtray/systemtraymodel.cpp b/applets/systemtray/systemtraymodel.cpp index da2dcf8d2..d81775c92 100644 --- a/applets/systemtray/systemtraymodel.cpp +++ b/applets/systemtray/systemtraymodel.cpp @@ -119,7 +119,8 @@ QVariant PlasmoidModel::data(const QModelIndex &index, int role) const return pluginMetaData.name(); } case Qt::DecorationRole: { - QIcon icon = QIcon::fromTheme(pluginMetaData.iconName()); + QIcon icon = QIcon::fromTheme(applet->icon(), + QIcon::fromTheme(pluginMetaData.iconName())); return icon.isNull() ? QVariant() : icon; } default:
Haven't gotten much time at hand, the problem is we need to check whether applet is nullptr diff --git a/applets/systemtray/systemtraymodel.cpp b/applets/systemtray/systemtraymodel.cpp index da2dcf8d2..9d1d9b5c3 100644 --- a/applets/systemtray/systemtraymodel.cpp +++ b/applets/systemtray/systemtraymodel.cpp @@ -119,7 +119,7 @@ QVariant PlasmoidModel::data(const QModelIndex &index, int role) const return pluginMetaData.name(); } case Qt::DecorationRole: { - QIcon icon = QIcon::fromTheme(pluginMetaData.iconName()); + QIcon icon = QIcon::fromTheme(applet ? applet->icon() : "", QIcon::fromTheme(pluginMetaData.iconName())); return icon.isNull() ? QVariant() : icon; } default: The result seems to work somewhat, e.g. shows the plasma-pa applet with the currently active status but does not work for notifications and network. I hope it is okay if I let you figure that out as you are probably know a whole lot more about where the icons stem from.
Ah yeah, that works! I was so fixated on the icon being nullptr that I didn't consider that the applet itself might be nullptr. I can take it from here, yeah. Thanks a lot for your help.
Looks like these applets aren't setting their Plasmoid.Icon properties at all, and are relying on custom icon items which happen to get drawn in the tray. This should be easy enough to fix, and it's good that we found this. It will make it easier to porting everything to the default CompactRepresentation later.
Git commit 78ce06fcaeef0e3ff0c272291b6f18509db0f3bc by Nate Graham. Committed on 16/08/2023 at 19:20. Pushed by ngraham into branch 'master'. applets/batterymonitor: use symbolic fallback icon when in panel M +28 -1 applets/batterymonitor/package/contents/ui/main.qml https://invent.kde.org/plasma/plasma-workspace/-/commit/78ce06fcaeef0e3ff0c272291b6f18509db0f3bc
Git commit 33d319ca3bbbc7598130dc4520e3c71f98fb0dd0 by Nate Graham. Committed on 16/08/2023 at 19:20. Pushed by ngraham into branch 'master'. applets/batterymonitor: use fallback icon that exists "batteries" doesn't exist in the breeze-icon theme, which is one of the most complete ones for KDE systems. Instead use "battery-full" which will exist everywhere. M +1 -1 applets/batterymonitor/package/contents/ui/main.qml https://invent.kde.org/plasma/plasma-workspace/-/commit/33d319ca3bbbc7598130dc4520e3c71f98fb0dd0
Git commit fe44091520ad123fbb599cfa59e7ab2278affa11 by Nate Graham. Committed on 16/08/2023 at 19:25. Pushed by ngraham into branch 'master'. applets/notifications: set Plasmoid.icon The actual icon is drawn by CompactRepresentation, and currently it has to be this way because it does a lot of complicated things including animations, which can't be handled by Plasmoid.icon. However we should set Plasmoid.icon anyway so that it can be used in other contexts that read this property. M +36 -0 applets/notifications/package/contents/ui/main.qml https://invent.kde.org/plasma/plasma-workspace/-/commit/fe44091520ad123fbb599cfa59e7ab2278affa11
Git commit db3aa99a63318e47f0d875c4b6935c4988ebcb5f by Nate Graham. Committed on 16/08/2023 at 19:44. Pushed by ngraham into branch 'master'. applet: always show symbolic icon when in a panel The icon used for the tooltip--which is often non-symbolic--is fine for the applet's CompactRepresentation when it's on the desktop, but not when it's on a panel. In the future, connectionIconProvider.connectionTooltipIcon should be made full-color on a more consistent basis. But it's fine for now. M +6 -2 applet/contents/ui/main.qml https://invent.kde.org/plasma/plasma-nm/-/commit/db3aa99a63318e47f0d875c4b6935c4988ebcb5f
Git commit f00f39467bed3a07f095aced292b2c16f0ad7e7d by Nate Graham. Committed on 16/08/2023 at 19:51. Pushed by ngraham into branch 'master'. applets/konsoleprofiles: use symbolic icon when in a panel M +7 -4 applets/konsoleprofiles/package/contents/ui/konsoleprofiles.qml https://invent.kde.org/plasma/kdeplasma-addons/-/commit/f00f39467bed3a07f095aced292b2c16f0ad7e7d
Git commit c6f0afc645bb9226662b756656dca5586736a7d2 by Nate Graham. Committed on 16/08/2023 at 19:54. Pushed by ngraham into branch 'master'. applets/katesessions: set Plasmoid.icon to a symbolic icon when in panel Previously it wasn't set at all, so it was just falling back to the generic icon. Currently this code produces no changes since there is no "kate-symbolic" icon in the Breeze icon theme, and therefore presumably not in any other ones either. But, once one exists, it will be used here automatically. M +7 -0 applets/katesessions/contents/ui/main.qml https://invent.kde.org/plasma/kdeplasma-addons/-/commit/c6f0afc645bb9226662b756656dca5586736a7d2
Git commit f0030033758f6a54f0f4cfb0e2a6927c493de0fa by Nate Graham. Committed on 16/08/2023 at 20:09. Pushed by ngraham into branch 'master'. applets/weather: use symbolic icons when in panel Currently this code produces no changes when using the Breeze icon theme since it lacks any -symbolic variants of these icons; see https://bugs.kde.org/show_bug.cgi?id=403833. However it will make the icons symbolic when using an icon theme that does have -symbolic variants of these icons. And it will do the same automatically once Breeze gets them too. Related: bug 403833 M +25 -3 applets/weather/package/contents/ui/main.qml https://invent.kde.org/plasma/kdeplasma-addons/-/commit/f0030033758f6a54f0f4cfb0e2a6927c493de0fa
Ok, I think that's as good as I can do right now. The Kate Sessions and Weather widgets still show colorful icons because symbolic versions of them don't exist yet. See Bug 473461 and Bug 403833. That's a general problem that's also affecting Bug 473215. Beyond that, I think it's time to flip the switch here!
Git commit caadfa0c6a5fb0c86ad0304733461e43b2511ebb by Nate Graham. Committed on 16/08/2023 at 20:19. Pushed by ngraham into branch 'master'. applets/systemtray: show the symbolic tray icons in the config window This way what's shown in the config window will always match what's in the tray, making it easy to visually associate them. It also means that as we clean up our tray icons to always use symbolic icons (when available), the config window's icons will follow suit and eventually become 100% symbolic as well. FIXED-IN: 6.0 M +1 -1 applets/systemtray/systemtraymodel.cpp https://invent.kde.org/plasma/plasma-workspace/-/commit/caadfa0c6a5fb0c86ad0304733461e43b2511ebb
Thanks a lot for fixing this
You're welcome!
A possibly relevant merge request was started @ https://invent.kde.org/utilities/yakuake/-/merge_requests/117
Git commit a7f4bb6123d62c35633f18cb724581f06c25412c by Nate Graham. Committed on 26/11/2023 at 17:43. Pushed by ngraham into branch 'master'. Use symbolic icon for system tray We have it; let's use it! If `yakuake-symbolic` doesn't exist in the icon theme, it will safely fall back to the base icon. Related: bug 477228 FIXED-IN: 24.02 M +1 -1 app/mainwindow.cpp https://invent.kde.org/utilities/yakuake/-/commit/a7f4bb6123d62c35633f18cb724581f06c25412c