Skip to content

Conversation

@leaanthony
Copy link
Member

@leaanthony leaanthony commented Dec 17, 2025

Summary

  • Add DisableMenu property to WindowsWindow struct to allow disabling the menu bar on Windows
  • When DisableMenu is true, the window will not display a menu bar even if one is configured
  • Follows the same pattern as existing DisableIcon and DisableFramelessWindowDecorations properties

Fixes #4273

Test plan

  • Create a window with Windows.DisableMenu: true and verify no menu bar appears
  • Create a window with Windows.DisableMenu: false (or omitted) and verify menu bar works normally
  • Test SetMenu() at runtime with DisableMenu: true and verify it has no effect
  • Test toggleMenuBar() and showMenuBar() with DisableMenu: true and verify they have no effect

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added a new DisableMenu option for Windows applications. When enabled, the menu bar is hidden regardless of menu configuration. This option defaults to false, preserving existing behavior and allowing developers to optionally hide the menu bar.

✏️ Tip: You can customize this high-level summary in your review settings.

Vibe Kanban added 2 commits December 17, 2025 22:05
Fixed GitHub Issue wailsapp#4273 - Added the missing `DisableMenu` property to the `WindowsWindow` struct in Wails v3.

### Changes Made:

1. **`webview_window_options.go:284-286`** - Added `DisableMenu bool` property to the `WindowsWindow` struct with documentation:
   ```go
   // DisableMenu will disable the menu for the window.
   // Default: false
   DisableMenu bool
   ```

2. **`webview_window_windows.go:87-89`** - Updated `setMenu()` to respect `DisableMenu` by returning early if disabled

3. **`webview_window_windows.go:362`** - Updated window creation to not process menu when `DisableMenu` is true:
   ```go
   if !options.Frameless && !options.Windows.DisableMenu {
   ```

4. **`webview_window_windows.go:2342-2344`** - Updated `toggleMenuBar()` to respect `DisableMenu`

5. **`webview_window_windows.go:2457-2459`** - Updated `showMenuBar()` to respect `DisableMenu`

### Usage:
```go
app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
    Windows: application.WindowsWindow{
        DisableMenu: true,
    },
})
```

This follows the same pattern as other `Disable*` properties like `DisableIcon` and `DisableFramelessWindowDecorations`.
## Summary

### Code Changes

1. **`v3/pkg/application/webview_window_options.go:284-286`** - Added `DisableMenu` property to `WindowsWindow` struct:
   ```go
   // DisableMenu will disable the menu for the window.
   // Default: false
   DisableMenu bool
   ```

2. **`v3/pkg/application/webview_window_windows.go:87-89`** - Updated `setMenu()` to return early if `DisableMenu` is true

3. **`v3/pkg/application/webview_window_windows.go:362`** - Updated window creation to skip menu processing when `DisableMenu` is true

4. **`v3/pkg/application/webview_window_windows.go:2342-2344`** - Updated `toggleMenuBar()` to respect `DisableMenu`

5. **`v3/pkg/application/webview_window_windows.go:2457-2459`** - Updated `showMenuBar()` to respect `DisableMenu`

### Documentation Changes

1. **`v3/UNRELEASED_CHANGELOG.md`** - Added entry:
   ```
   - Add `DisableMenu` option to `WindowsWindow` to disable the menu bar on Windows (wailsapp#4273)
   ```

2. **`docs/src/content/docs/features/windows/options.mdx`** - Updated Windows Options section to include `DisableMenu` with documentation and examples
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 17, 2025

Warning

Rate limit exceeded

@leaanthony has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 25 minutes and 18 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between f30219b and d292928.

📒 Files selected for processing (2)
  • v3/UNRELEASED_CHANGELOG.md (1 hunks)
  • v3/pkg/application/webview_window_windows.go (4 hunks)

Walkthrough

This pull request adds a new DisableMenu boolean option to the Windows window configuration. When enabled, it prevents the menu bar from being displayed. The feature is implemented across the public API, runtime logic, and documentation.

Changes

Cohort / File(s) Change Summary
Public API and Configuration
v3/pkg/application/webview_window_options.go
Added DisableMenu bool field to WindowsWindow struct (defaults to false)
Windows Implementation
v3/pkg/application/webview_window_windows.go
Added early-return guards in setMenu(), toggleMenuBar(), showMenuBar() functions and conditional menu creation in run() to skip menu operations when DisableMenu is true
Documentation and Changelog
docs/src/content/docs/features/windows/options.mdx, v3/UNRELEASED_CHANGELOG.md
Added documentation for DisableMenu option with purpose, default value, and usage examples; added changelog entry under "Added"

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Guard logic is repetitive and straightforward across multiple functions
  • Changes are localized to Windows menu handling
  • Public API addition is minimal (single boolean field)

Possibly related PRs

Suggested labels

Enhancement, Documentation, Windows, v3-alpha, size:S

Poem

🐰 A menu's dance, now under command,
DisableMenu flag, oh so grand!
Windows whisper, menus obey,
One boolean controls the display,
Through guards we hop, left and right,
The menu bar dims, a feature done bright! ✨

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed Title accurately describes the main change: adding a DisableMenu option to WindowsWindow. Clear, concise, and directly relevant to the changeset.
Description check ✅ Passed Description includes summary of changes, references linked issue #4273, provides test plan, and follows PR template requirements with appropriate context.
Linked Issues check ✅ Passed All requirements from issue #4273 are met: DisableMenu field added to WindowsWindow struct, follows existing pattern of similar properties, and enables disabling menu bar on Windows.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the DisableMenu feature: struct field addition, documentation updates, changelog entry, and menu-disabling logic in runtime.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
v3/pkg/application/webview_window_windows.go (1)

2465-2469: Consider adding a DisableMenu guard for consistency.

While the current implementation is functionally correct (since w.menu would be nil when DisableMenu is true), adding an explicit early-return guard like the other menu functions (setMenu, toggleMenuBar, showMenuBar) would improve consistency and code clarity.

 func (w *windowsWebviewWindow) hideMenuBar() {
+	if w.parent.options.Windows.DisableMenu {
+		return
+	}
 	if w.menu != nil {
 		w32.SetMenu(w.hwnd, 0)
 	}
 }
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a81cb18 and f30219b.

📒 Files selected for processing (4)
  • docs/src/content/docs/features/windows/options.mdx (3 hunks)
  • v3/UNRELEASED_CHANGELOG.md (1 hunks)
  • v3/pkg/application/webview_window_options.go (1 hunks)
  • v3/pkg/application/webview_window_windows.go (4 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2024-09-20T23:34:29.841Z
Learnt from: nixpare
Repo: wailsapp/wails PR: 3763
File: v3/examples/keybindings/main.go:16-17
Timestamp: 2024-09-20T23:34:29.841Z
Learning: In the codebase, `application.Options.KeyBindings` uses the `application.Window` type, whereas `application.WebviewWindowOptions.KeyBindings` uses `*application.WebviewWindow`. This is intentional and acceptable.

Applied to files:

  • v3/pkg/application/webview_window_options.go
  • v3/pkg/application/webview_window_windows.go
📚 Learning: 2025-01-24T22:41:18.566Z
Learnt from: leaanthony
Repo: wailsapp/wails PR: 4031
File: v3/pkg/application/menu.go:199-202
Timestamp: 2025-01-24T22:41:18.566Z
Learning: In the Wails menu system (v3/pkg/application/menu.go), shared state between menus is intentionally designed and desirable. Methods like `Append()` and `Prepend()` should maintain shared references to menu items rather than creating deep copies.

Applied to files:

  • v3/pkg/application/webview_window_windows.go
📚 Learning: 2025-10-17T23:16:11.570Z
Learnt from: Sammy-T
Repo: wailsapp/wails PR: 4570
File: v2/internal/frontend/desktop/linux/window_webkit6.go:97-108
Timestamp: 2025-10-17T23:16:11.570Z
Learning: For webkit_6/GTK4 builds in v2/internal/frontend/desktop/linux/window_webkit6.go, GTK widget creation should not be wrapped in invokeOnMainThread. The activation mechanism (activateWg + onActivate export) already handles thread safety, and additional wrapping would cause issues.

Applied to files:

  • v3/pkg/application/webview_window_windows.go
🔇 Additional comments (7)
v3/UNRELEASED_CHANGELOG.md (1)

20-20: LGTM!

The changelog entry clearly documents the new feature and references the related issue.

v3/pkg/application/webview_window_options.go (1)

284-286: LGTM!

The new DisableMenu field follows the established pattern used by DisableIcon and DisableFramelessWindowDecorations. The placement after the Menu field is logical, and the documentation clearly explains its purpose and default value.

docs/src/content/docs/features/windows/options.mdx (1)

699-699: LGTM!

The documentation is clear, comprehensive, and consistent with the existing pattern. The explanation correctly describes that the menu bar will not display even if one is configured when DisableMenu is true. The examples demonstrate proper usage.

Also applies to: 710-713, 835-835

v3/pkg/application/webview_window_windows.go (4)

87-89: LGTM!

The early return guard correctly prevents menu setup when DisableMenu is true. This ensures that even if setMenu() is called programmatically, it has no effect when the option is disabled.


362-369: LGTM!

The condition correctly ensures that the menu is only created during window initialization when both Frameless is false AND DisableMenu is false. This is the primary gate that prevents menu creation when the option is disabled.


2342-2344: LGTM!

The guard correctly prevents menu bar toggling when DisableMenu is true, ensuring the test plan requirement is met.


2457-2459: LGTM!

The guard correctly prevents showing the menu bar when DisableMenu is true, ensuring the test plan requirement is met.

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
B Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant