Skip to content

Conversation

@Jianbe-03
Copy link
Contributor

@Jianbe-03 Jianbe-03 commented Nov 28, 2025

This pull request adds the ability to programmatically show the tray context menu in the menu bar. The main changes include introducing a new API endpoint, updating the PHP facade and manager, and adding a test for the new functionality.

Feature addition: Show context menu programmatically

  • Added a new API endpoint /show-context-menu in menuBar.ts that triggers the tray to display its context menu.
  • Added the showContextMenu method to the MenuBar PHP facade to expose the new functionality.
  • Implemented the showContextMenu method in MenuBarManager.php to call the new API endpoint from the PHP side.

Testing

  • Added a new test case in MenuBarTest.php to verify that the context menu can be shown programmatically and that the correct API request is sent.
  • Imported Http facade in the test file to support HTTP request faking for the new test.

Documentation
I also created a pull request to update the documentation with this method as an addition.
NativePHP/nativephp.com#235

@simonhamp simonhamp requested a review from a team December 1, 2025 10:26
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.

3 participants