Open nohajc opened 7 months ago
Are you testing only on Linux?
For radio vs checkbox we are restricted by the different OS implementations like macOS and Window as well.
I understand but that's beside the point. My example uses normal checkboxes with additional logic which just happens to emulate radio button behavior. There's obviously a problem with updating the submenu checkbox state when I call Uncheck explicitly.
I only tested on Linux but I also tried a different StatusNotifierItem implementation in Rust which doesn't exhibit this issue (i.e. uncheck works the same in both root menu and submenu).
I was responding to the two parts of your bug report. Initially curious about what systems you test on to help track down the issue. My comments about radio were in response to you considering a radio pull request. Sorry I didn't make that more clear.
I was responding to the two parts of your bug report. Initially curious about what systems you test on to help track down the issue. My comments about radio were in response to you considering a radio pull request. Sorry I didn't make that more clear.
Sure, no problem. Anyway, the checkbox item is already a Linux only feature (or at least it says so in the code). I suppose it will be the same for radio buttons.
Sure, no problem. Anyway, the checkbox item is already a Linux only feature (or at least it says so in the code). I suppose it will be the same for radio buttons.
Oh, that shouldn't be the case - can you point me to where that is? The ability for items to be checked is on all platforms now, I think that Linux uses a checkbox but nonetheless checks can be displayed on macOS and Windows too.
I was referring to this comment: https://github.com/fyne-io/systray/blob/master/systray.go#L147-L149
Maybe it's not up to date?
Thanks for that, hopefully this PR helps fix the comments:
@nohajc any luck on this? I am encountering the same bug - submenus cannot be programmatically checked/unchecked via Check()/Uncheck(). Works fine for first level menu items
Item 1
Item 2 >
Subitem 1
Subitem 2
Item 3
Invoking Check() or Uncheck() on Item1, Item3 works fine On Linux only, Invoking Check() or Uncheck() on Subitem1 or Subitem2 does not work.
No luck, I'm afraid. I was hoping somebody would investigate after I reported it.
I just tested on Cinnamon and the demo code works as expected...
I just coded up a simple client and can confirm that the data structures through DBus are updated correctly. The update signal is also sent.
This makes me wonder if there is a bug in the KDE menu handling, or if there is some special case where we are not sending the right signals and KDE is strict where Gnome/others are flexible...
@andydotxyz just to be clear, your test has you clicking on one submenu item (not a top level menu item, but at least one level deep), which programmatically checks/unchecks a completely different submenu item ?
I think it's my test I posted above. https://github.com/nohajc/systray-issue-minimal-example
Now I'm curious to try it with Cinnamon myself. But IIRC I had the same issue in Gnome too.
@andydotxyz just to be clear, your test has you clicking on one submenu item (not a top level menu item, but at least one level deep), which programmatically checks/unchecks a completely different submenu item ?
Yes
I think it's my test I posted above.
Correct, thanks
When I try to programmatically deselect a checkbox menu item (call
Uncheck
), it doesn't work if the menu item is part of a submenu.I wrote a minimal example reproducing the issue. Basically, I wanted to emulate radio button group behavior which means only one item can be selected at a time and I need to deselect the previous selection without any associated input event.
While it works correctly in the root menu, it breaks when I use the same logic for submenu items. The clicked item gets selected but the state of the others in the group doesn't change.
Here's the demonstration (tested in KDE): https://github.com/nohajc/systray-issue-minimal-example
Thanks for any help.
BTW, I also wanted to submit a PR adding support for actual radio buttons (which are part of the dbusmenu interface) but I got stuck because of this issue. D-Bus basically only lets you select the type of the "tick" icon. It doesn't enforce any particular behavior so multiselect is still possible unless you add your own logic. Now, I believe my logic is correct but I was very surprised to see it doesn't work consistently.