Skip to content

fix(tray): call AboutToShow before opening tray menus - #1604

Merged
JakeStanger merged 1 commit into
JakeStanger:masterfrom
molnari811023:fix/tray-about-to-show
Sep 19, 2026
Merged

JakeStanger merged 1 commit into
JakeStanger:masterfrom
molnari811023:fix/tray-about-to-show

Conversation

@molnari811023

Copy link
Copy Markdown
Contributor

What

Follows the DBusMenu spec by sending an AboutToShow signal to the SNI item before (and while) its popover menu is opened, using the about_to_show_menuitem(address, path, id) method already exposed by the system-tray crate.

Why

Many items build their menus lazily and only refresh their layout in response to AboutToShow. The most visible example is nm-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 coincidental LayoutUpdated arrives.

Changes

  • src/clients/tray.rs: passthrough about_to_show_menuitem on ironbar's tray client (mirrors the existing activate passthrough).
  • src/modules/tray/mod.rs: new UiEvent::AboutToShow { address, path }, handled in the module controller by calling about_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 an Rc<RefCell<Option<String>>> instead of a plain Option<String>.

@github-actions github-actions Bot added the Z:Review Required Pull request pending review label Sep 9, 2026
@JakeStanger

Copy link
Copy Markdown
Owner

Looks good - could you fix the build issues please

@molnari811023

Copy link
Copy Markdown
Contributor Author

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.

@JakeStanger

Copy link
Copy Markdown
Owner

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.

@JakeStanger JakeStanger reopened this Sep 19, 2026
Calls `AboutToShow` before the item is opened

Co-authored-by: Jake Stanger <mail@jstanger.dev>
@JakeStanger
JakeStanger force-pushed the fix/tray-about-to-show branch from f535bdc to 39a6801 Compare September 19, 2026 20:43

@JakeStanger JakeStanger left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One cargo fmt and one line change later, good to go

@JakeStanger JakeStanger removed the Z:Review Required Pull request pending review label Sep 19, 2026
@JakeStanger
JakeStanger merged commit 766b420 into JakeStanger:master Sep 19, 2026
45 checks passed
@molnari811023
molnari811023 deleted the fix/tray-about-to-show branch September 19, 2026 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants