-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linux: checkbox item Uncheck doesn't work in submenu #72
Comments
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. |
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: 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
Invoking Check() or Uncheck() on Item1, Item3 works fine |
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. Now I'm curious to try it with Cinnamon myself. But IIRC I had the same issue in Gnome too. |
Yes
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.
The text was updated successfully, but these errors were encountered: