Set MacOS window levels (NSWindow)#3674
Conversation
WalkthroughThe recent changes enhance the functionality of the application by introducing a new command-line flag for port customization and environment variable support, improving testing capabilities, and implementing platform-specific features. Notably, macOS gains enhanced window management options, allowing users to define stacking levels for windows, while Windows receives fixes for mouse event handling. These updates collectively improve user experience and application reliability. Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
NSWindow)
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (2)
- v3/pkg/application/webview_window_darwin.go (3 hunks)
- v3/pkg/application/webview_window_options.go (1 hunks)
Additional comments not posted (5)
v3/pkg/application/webview_window_options.go (2)
384-385: Addition ofWindowLevelfield looks good.The
WindowLevelfield enhances theMacWindowstruct by allowing the configuration of window levels. Ensure that documentation and usage examples are updated accordingly.
388-399: Definition ofMacWindowLeveland constants is well-structured.The
MacWindowLeveltype and its associated constants provide a clear and modular way to manage window levels. This approach enhances code readability and maintainability.v3/pkg/application/webview_window_darwin.go (3)
219-226: Implementation of window level functions is clear and concise.The functions for setting various window levels are well-implemented, providing modular control over window stacking order. This enhances the maintainability and readability of the code.
1080-1099: Refactor ofsetWindowLevelmethod is effective.The switch statement in
setWindowLevelefficiently maps eachMacWindowLevelto its corresponding function, improving code clarity and modularity.
1187-1190: Setting a default window level inrunmethod is a good practice.The logic to assign a default window level if none is specified enhances robustness by preventing potential issues from uninitialized states.
|
Thanks 🙏 Please could you add an entry to the changelog located at |
|
Done |
|
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (2)
- mkdocs-website/docs/en/changelog.md (1 hunks)
- v3/pkg/application/webview_window_darwin.go (3 hunks)
Additional comments not posted (4)
mkdocs-website/docs/en/changelog.md (1)
51-51: Changelog entry added.The changelog entry for adding the ability to set a window's stacking level on macOS is correctly documented.
v3/pkg/application/webview_window_darwin.go (3)
219-226: Window level functions implemented correctly.The functions for setting various window levels are correctly implemented using Cocoa's
NSWindowLevelconstants.
1084-1103: MethodsetWindowLevelis well-structured and correct.The
setWindowLevelmethod effectively uses a switch statement to set the appropriate window level based on theMacWindowLevelenum.
1191-1194: Default window level logic is a good addition.Setting a default window level if none is provided ensures consistent behavior and prevents unexpected issues.
* set nswindow levels via mac options * add changelog description * update changelog to conform with others



Description
Adding ability to set
NSWindowlevel to be able to render the window on different levels. Mainly inspired by a need of rendering a window on top of MacOS menu bar. Well, on top of any window, including menu bar + task pane.This is an alternative of ElectronJS option here.
Sample usage:
Where
MacWindowLevelPopUpMenuallows me to render the window on top of everything else under the sun.Fixes # (issue)
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration using
wails doctor.Test Configuration
Please paste the output of
wails doctor. If you are unable to run this command, please describe your environment in as much detail as possible.Checklist:
website/src/pages/changelog.mdxwith details of this PRSummary by CodeRabbit
-portcommand-line flag for specifying the application port during development.WAILS_VITE_PORTenvironment variable for enhanced configuration.SetIgnoreMouseEventsfunctionality now works with already created windows on Windows.