fix(tray): call AboutToShow before opening tray menus - #1604
Conversation
|
Looks good - could you fix the build issues please |
|
The code works. If a few missing spaces are a dealbreaker for a working bugfix, feel free to close the PR. I'm done here. |
|
Yes, I ask that you fix both linting and formatting issues, as per the contribution guide which I expect any potential contributors to read before submitting code, as to avoid wasting anybody's time. Enforcing such standards on a public repository is both good practice and normal in an attempt to meet some minimum level of code quality. The guidelines do also ask that you don't submit fully AI generated content, and this is clearly AI generated. I don't appreciate the lack of effort to even write your own description, and then the curt reply when I ask for the absolute bare minimum changes. If you can't or don't want to continue working on a PR for any reason that's fine, you just have to say. Since the fix supposedly works and the code is most of the way there, I'll pick it up from here. |
Calls `AboutToShow` before the item is opened Co-authored-by: Jake Stanger <mail@jstanger.dev>
f535bdc to
39a6801
Compare
JakeStanger
left a comment
There was a problem hiding this comment.
One cargo fmt and one line change later, good to go
What
Follows the DBusMenu spec by sending an
AboutToShowsignal to the SNI item before (and while) its popover menu is opened, using theabout_to_show_menuitem(address, path, id)method already exposed by thesystem-traycrate.Why
Many items build their menus lazily and only refresh their layout in response to
AboutToShow. The most visible example isnm-applet: the list of available Wi-Fi networks is only populated when something explicitly triggers it. Native panels (GNOME Shell, Plasma, etc.) do this automatically, so this is invisible to most users — but on a standalone bar like ironbar the network list stays empty/stale until a coincidentalLayoutUpdatedarrives.Changes
src/clients/tray.rs: passthroughabout_to_show_menuitemon ironbar's tray client (mirrors the existingactivatepassthrough).src/modules/tray/mod.rs: newUiEvent::AboutToShow { address, path }, handled in the module controller by callingabout_to_show_menuitem(address, path, 0).src/modules/tray/interface.rs: the click handler now sends this event when opening the menu. To let the handler read the D-Bus object path (previously only stored on the struct and not used at click time), the path is shared through anRc<RefCell<Option<String>>>instead of a plainOption<String>.