Bug 473278 - Icons in "System Tray Settings -> Entries" are mixed between monochrome and colorful
Summary: Icons in "System Tray Settings -> Entries" are mixed between monochrome and c...
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: System Tray (show other bugs)
Version: 5.27.7
Platform: Other Linux
: NOR minor
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-08-11 11:04 UTC by Eric Armbruster
Modified: 2023-11-29 20:56 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Armbruster 2023-08-11 11:04:04 UTC
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
Comment 1 Nate Graham 2023-08-11 21:09:02 UTC
This is now fixable in Plasma 6. I shall endeavor to fix it.
Comment 2 Nate Graham 2023-08-12 14:00:29 UTC
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).
Comment 3 Eric Armbruster 2023-08-13 13:51:20 UTC
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.
Comment 4 Nate Graham 2023-08-14 19:31:27 UTC
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.
Comment 5 Eric Armbruster 2023-08-15 05:37:48 UTC
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.
Comment 6 Eric Armbruster 2023-08-15 05:38:36 UTC
Or cc @eric on Gitlab
Comment 7 Nate Graham 2023-08-15 21:35:51 UTC
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:
Comment 8 Eric Armbruster 2023-08-16 07:46:21 UTC
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.
Comment 9 Nate Graham 2023-08-16 16:42:50 UTC
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.
Comment 10 Nate Graham 2023-08-16 16:48:19 UTC
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.
Comment 11 Nate Graham 2023-08-16 17:21:09 UTC
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
Comment 12 Nate Graham 2023-08-16 17:21:17 UTC
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
Comment 13 Nate Graham 2023-08-16 17:27:05 UTC
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
Comment 14 Nate Graham 2023-08-16 17:45:25 UTC
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
Comment 15 Nate Graham 2023-08-16 18:12:23 UTC
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
Comment 16 Nate Graham 2023-08-16 18:12:32 UTC
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
Comment 17 Nate Graham 2023-08-16 18:12:33 UTC
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
Comment 18 Nate Graham 2023-08-16 18:21:01 UTC
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!
Comment 19 Nate Graham 2023-08-16 18:21:47 UTC
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
Comment 20 Eric Armbruster 2023-08-16 18:56:38 UTC
Thanks a lot for fixing this
Comment 21 Nate Graham 2023-08-16 18:58:03 UTC
You're welcome!
Comment 22 Bug Janitor Service 2023-11-26 16:45:58 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/yakuake/-/merge_requests/117
Comment 23 Nate Graham 2023-11-29 20:56:07 UTC
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