Bug 485072

Summary: Can't configure visibility for 3rd party plasmoid
Product: [Plasma] plasmashell Reporter: gudvinr+kde
Component: System TrayAssignee: Plasma Bugs List <plasma-bugs>
Status: REPORTED ---    
Severity: normal CC: istillalive, martchus, materka, nate, o.freyermuth
Priority: NOR    
Version: 6.0.3   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: screenshot from gh issues page
top of the list
somewhere at the bottom

Description gudvinr+kde 2024-04-05 10:18:01 UTC
Created attachment 168175 [details]
screenshot from gh issues page

SUMMARY

After update to Plasma 6, plasmoid for syncthing-tray no longer can be configured to be always hidden, always shown, etc.
All settings are blocked.

STEPS TO REPRODUCE
1. Set up syncthing-tray (qt6 version)
2. Open tray settings

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.0.3
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.3
Kernel Version: 6.6.24-1-lts (64-bit)
Graphics Platform: X11

ADDITIONAL INFORMATION
ref issue on project github:
https://github.com/Martchus/syncthingtray/issues/239
Comment 1 martchus 2024-04-05 10:40:35 UTC
This makes it sound like you cannot configure the visibility at all. I can reproduce the issue but in my case the wrong entry at the top is just a cosmetic issue not preventing me from configuring the visibility using the real entry further down. And in my case the entry further down also shows its icon correctly.

Note that the problem is also reproducible under openSUSE Tumbleweed and under Wayland and with Qt 6.7.0 and the current kernel so all these details probably don't matter.

I suspect the problem lies somewhere in the code of the system tray plasmoid. Of course the problem could also be on my side so a review of the plasmoid-specific code under https://github.com/Martchus/syncthingtray might also be useful. I've already tried (mainly comparing with how official plasmoids are structured) but couldn't find any obvious mistakes.
Comment 2 Nate Graham 2024-08-18 22:50:17 UTC
I can't reproduce this issue with syncthing-tray or syncthing-gtk in current git master (notably, both were installed from flathub). There have been a lot of system tray related changes recently. Have you seen this again in Plasma 6.1.4 or later?
Comment 3 gudvinr+kde 2024-08-19 11:06:05 UTC
Still there

Operating System: Arch Linux 
KDE Plasma Version: 6.1.4
KDE Frameworks Version: 6.5.0
Qt Version: 6.7.2
Kernel Version: 6.10.5-arch1-1 (64-bit)
Graphics Platform: X11
Comment 4 gudvinr+kde 2024-08-19 11:07:59 UTC
Created attachment 172749 [details]
top of the list
Comment 5 gudvinr+kde 2024-08-19 11:08:20 UTC
Created attachment 172750 [details]
somewhere at the bottom
Comment 6 martchus 2024-08-19 11:23:24 UTC
> I can't reproduce this issue with syncthing-tray or syncthing-gtk in current git master (notably, both were installed from flathub). There have been a lot of system tray related changes recently. Have you seen this again in Plasma 6.1.4 or later?

That's unfortunately not how you can reproduce this issue. I suppose the steps to reproduce should have been more detailed:

1. Install the **Plasmoid** provided by https://github.com/Martchus/syncthingtray. The repository contains instructions for building and installing and for some distributions there are pre-built packages available.
2. Configure the Plasma-provided system tray Plasmoid to show the entry for the Syncthing Plasmoid. Note that the README of Syncthing Tray mentions several ways for configuring the Plasmoid under "Configuring Plasmoid". This is about the first point in that list.
3. The configuration done in step 2 generally works. However, at *some* point, after reopening the configuration of the Plasma-provided system tray Plasmoid, it shows a faulty/empty entry with the Syncthing Tray icon on top of the list. It is not impairing functionality.

Note that this is about the Plasmoid. The problem is *not* concerning the Qt Widgets based tray application. The Flatpak is only providing the Qt Widgets based tray application because to my knowledge it is not possible to provide a Plasmoid via Flatpak. (At least none that is backed by a C++ plug-in.)

Note that syncthing-gtk is a whole different project and not related to this issue.
Comment 7 martchus 2024-08-19 11:28:49 UTC
Of course you can also have a look at the code on https://github.com/Martchus/syncthingtray first. Maybe I made a mistake that is even obvious to you and the problem is on my side after all.

You could also have a look at the binary packages mentioned on https://github.com/Martchus/syncthingtray?tab=readme-ov-file#packages-and-binaries (e.g. the Arch Linux or openSUSE Tumbleweed packages) to check whether the resulting packages contain valid configuration files for the Plasmoid.

(I have of course done this checking myself and compared my code/packaging with official Plasmoids. However, I couldn't find any mistakes.)
Comment 8 Konrad Materka 2024-08-19 22:34:42 UTC
Try this:

rerun Plasma with debugging:
QT_LOGGING_RULES="kde.systemtray=true" plasmashell --replace &

check if you see your applet in logs (console output), for example:
kde.systemtray: Adding applet: "org.kde.plasma.battery"
Do you see any errors/warnings?

While looking at console output, open system tray configuration. Go to Entries. Do you see anything suspicious?

check ~/.config/plasma-org.kde.plasma.desktop-appletsrc file, sections:
extraItems=
hiddenItems=
knownItems=
You can have it multiple times, for example some old configs or configs from several panels (if you use multi-screen).
Check all of them, do you see anything suspicious?
Comment 9 gudvinr+kde 2024-08-21 06:51:24 UTC
> Do you see any errors/warnings?

Only relevant to this plasmoid is this:  
file:///usr/share/plasma/plasmoids/martchus.syncthingplasmoid-qt6/contents/ui/main.qml:18:25: QML FullRepresentation: Binding loop detected for property "implicitWidth"

Also this:
file:///usr/share/plasma/plasmoids/org.kde.plasma.private.systemtray/contents/ui/main.qml:162:21: QML KSortFilterProxyModel: Binding loop detected for property "sourceModel"

> While looking at console output, open system tray configuration. Go to Entries. Do you see anything suspicious?

file:///usr/share/plasma/shells/org.kde.plasma.desktop/contents/configuration/AppletConfiguration.qml:142:5: QML Connections: Detected function "onSettingValueChanged" in Connections element. This is probably intended to be a signal handler but no signal of the target matches the name.

> check ~/.config/plasma-org.kde.plasma.desktop-appletsrc file
> You can have it multiple times

Nope. In fact, I did have human readable "Syncthing something" and "martchus.syncthingplasmoid-qt6" entries before (when I reported this issue) but now I have not.
Comment 10 martchus 2024-08-21 10:28:45 UTC
I'll have a look into the QML errors/warnings caused by the Plasmoid code itself. However, I doubt they influence how the system settings Plasmoids handles the settings of its entries.

---

I have the following settings in `/.config/plasma-org.kde.plasma.desktop-appletsrc`:

```
[Containments][7][General]
extraItems=org.kde.plasma.notifications,org.kde.plasma.battery,org.kde.plasma.volume,org.kde.kscreen,org.kde.plasma.mediacontroller,org.kde.plasma.keyboardlayout,org.kde.plasma.brightness,org.kde.plasma.bluetooth,org.kde.plasma.clipboard,org.kde.plasma.keyboardindicator,org.kde.plasma.devicenotifier,org.kde.plasma.networkmanagement,org.kde.kdeconnect,org.kde.plasma.cameraindicator,org.kde.plasma.printmanager,org.kde.plasma.manage-inputmethod,martchus.syncthingplasmoid-qt6
knownItems=org.kde.plasma.notifications,org.kde.plasma.battery,org.kde.plasma.volume,org.kde.kscreen,org.kde.plasma.mediacontroller,org.kde.plasma.keyboardlayout,org.kde.plasma.brightness,org.kde.plasma.bluetooth,org.kde.plasma.clipboard,org.kde.plasma.keyboardindicator,org.kde.plasma.devicenotifier,org.kde.plasma.networkmanagement,org.kde.kdeconnect,org.kde.plasma.cameraindicator,org.kde.plasma.printmanager,org.kde.plasma.manage-inputmethod
shownItems=martchus.syncthingplasmoid-qt6
```

```
[Containments][321][General]
extraItems=org.kde.plasma.notifications,org.kde.plasma.battery,org.kde.plasma.volume,org.kde.kscreen,org.kde.plasma.mediacontroller,org.kde.plasma.keyboardlayout,org.kde.plasma.brightness,org.kde.plasma.bluetooth,org.kde.plasma.clipboard,org.kde.plasma.keyboardindicator,org.kde.plasma.devicenotifier,org.kde.plasma.networkmanagement,org.kde.kdeconnect,org.kde.plasma.cameraindicator,org.kde.plasma.printmanager,org.kde.plasma.manage-inputmethod,martchus.syncthingplasmoid-qt6
hiddenItems=Discover-Benachrichtigungen_org.kde.DiscoverNotifier
knownItems=org.kde.plasma.notifications,org.kde.plasma.battery,org.kde.plasma.volume,org.kde.kscreen,org.kde.plasma.mediacontroller,org.kde.plasma.keyboardlayout,org.kde.plasma.brightness,org.kde.plasma.bluetooth,org.kde.plasma.clipboard,org.kde.plasma.keyboardindicator,org.kde.plasma.devicenotifier,org.kde.plasma.networkmanagement,org.kde.kdeconnect,org.kde.plasma.cameraindicator,org.kde.plasma.printmanager,org.kde.plasma.manage-inputmethod
shownItems=martchus.syncthingplasmoid-qt6
```

So `martchus.syncthingplasmoid-qt6` is present twice per system settings Plasmoid. (I have two of such Plasmoids, one per screen/panel.) If I delete the entry under `extraItems` I can get rid of the problematic/empty entry in the settings UI. I have first deleted it in one of the containments and that helped with the system settings Plasmoid on one screen while the other one still had the problematic/empty entry. Then I removed both and everything was cleaned up. So the duplicate entries in the settings are definitely one part of the symptom.

Interestingly, if I go into the settings and change the visibility from "Show always" to "Show when important" (not sure about the wording, I'm translating these from German) the entry is moved from `showItems` to `extraItems` in the settings file. That is expected but if I now close and reopen the settings dialogue again, the problematic/empty entry on top is back (but the newly assigned visibility is still correctly shown in the correct entry below). If I change the visibility back to "Show always" the entry is added under  `showItems` but not removed under  `extraItems` leading to the duplicate entry situation I saw initially.

So I guess we have two concrete problems:

* When `martchus.syncthingplasmoid-qt6` is part of `extraItems` in the settings file an erroneous entry for it is shown in the settings UI.
* When the visibility of an entry is changed in the UI the `extraItems` field in the settings file is not cleared.
Comment 11 Konrad Materka 2024-08-22 19:28:47 UTC
(In reply to gudvinr+kde from comment #9)

I "installed" it by just copying /usr/share/plasma/plasmoids/martchus.syncthingplasmoid-qt6/, after plasmashell restart I see it in Items, I can enable it and disable (plasmoid itself does not work, because all required libraries are not installed, but I guess that should not matter). No empty entries, even after few restarts.

I installed something random (https://store.kde.org/p/2140856) using "Get new stuff", it works as expected. It it for you as well?

> Nope. In fact, I did have human readable "Syncthing something" and
> "martchus.syncthingplasmoid-qt6" entries before (when I reported this issue)
> but now I have not.

That's probably the reason - maybe you have some old metadata somewhere? Try something like:
grep -i syncthing -R /usr/share/plasma/plasmoids/

If possible, can you test it on completely fresh setup, for example in VM?
Comment 12 Konrad Materka 2024-08-22 19:59:27 UTC
(In reply to martchus from comment #10)
> * When `martchus.syncthingplasmoid-qt6` is part of `extraItems` in the
> settings file an erroneous entry for it is shown in the settings UI.
> * When the visibility of an entry is changed in the UI the `extraItems`
> field in the settings file is not cleared.

this is correct logic:
https://invent.kde.org/plasma/plasma-workspace/-/blob/master/applets/systemtray/package/contents/ui/ConfigEntries.qml#L193
it's removed from `extraItems` only when applet is disabled. It should be in `knownItems` - this is reserved for plasmoids enabled by default (if (pluginMetaData.isEnabledByDefault()) {).

Maybe you have it installed twice? in ~/.loca/share/ and /usr/share? Can you try testing using new user (or even fresh install in VM)?
Comment 13 gudvinr+kde 2024-08-23 07:23:39 UTC
(In reply to Konrad Materka from comment #11)
> (In reply to gudvinr+kde from comment #9)
> That's probably the reason - maybe you have some old metadata somewhere? Try
> something like:
> grep -i syncthing -R /usr/share/plasma/plasmoids/

I only have /usr/share/plasma/plasmoids/martchus.syncthingplasmoid-qt6/ which is the content of syncthingtray-qt6 from martchus' arch linux repo. No matches inside ~/.local/share/plasma/ too.

There are no matches for 'syncthing.*?plasmoid' or 'martchus' in ~/.config or ~/.local either other than one entry in 'extraItems' of ~/.config/plasma-org.kde.plasma.desktop-appletsrc
Comment 14 martchus 2024-08-23 08:35:46 UTC
I also definitely have no additional installations in my home or globally. I also have no installations of the Qt 5 based version anymore.