Skip to content

feat(windows): Add DisableMenu option to WindowsWindow - #4813

Merged
taliesin-ai merged 7 commits into
wailsapp:masterfrom
leaanthony:vk/d154-v3-disablemenu-p
Jul 1, 2026
Merged

taliesin-ai merged 7 commits into
wailsapp:masterfrom
leaanthony:vk/d154-v3-disablemenu-p

Conversation

@leaanthony

@leaanthony leaanthony commented Dec 17, 2025 •

Copy link
Copy Markdown
Member

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 per-window Windows option (DisableMenu) to hide the window menu bar, even when a menu is configured.
    • Available in window settings with a default of off.
  • Documentation

    • Updated Windows options documentation and examples to include DisableMenu and its default.
  • Bug Fixes

    • Menu creation, toggling, and menu bar display now respect DisableMenu when enabled.

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

coderabbitai Bot commented Dec 17, 2025 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6888b0bd-395b-43c9-8b1c-edc7e45d11fc

📥 Commits

Reviewing files that changed from the base of the PR and between 997ba95 and 7fa5186.

📒 Files selected for processing (1)
  • v3/pkg/application/webview_window_windows.go
💤 Files with no reviewable changes (1)
  • v3/pkg/application/webview_window_windows.go

Walkthrough

Adds a DisableMenu boolean to WindowsWindow, updates Windows menu handling to exit early when it is set, and documents the new option in the Windows docs and example.

Changes

DisableMenu Windows Option

Layer / File(s) Summary
DisableMenu field and runtime guards
v3/pkg/application/webview_window_options.go, v3/pkg/application/webview_window_windows.go
Adds DisableMenu bool to WindowsWindow and gates menu setup, menu selection, and menu bar show/hide behavior on the new flag.
Windows options docs
docs/src/content/docs/features/windows/options.mdx
Adds DisableMenu: false to the Windows example and documents the field’s effect and default value.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • wailsapp/wails#4944: Also changes Windows window menu wiring in webview_window_windows.go using a new per-window option.

Poem

🐇 Hop, hop—no menu bar,
A tiny flag goes very far.
The window hums, the rabbit grins,
With DisableMenu set, the quiet wins.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and accurately summarizes the main change: adding a DisableMenu option to WindowsWindow.
Description check ✅ Passed It includes the change summary, fixed issue, test plan, and environment details, with only some template checklist items omitted.
Linked Issues check ✅ Passed The PR adds the missing WindowsWindow DisableMenu field and related menu-suppression behavior requested by #4273.
Out of Scope Changes check ✅ Passed The changes are limited to the requested Windows option, its runtime behavior, and matching docs, with no obvious unrelated edits.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown

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

@leaanthony
leaanthony changed the base branch from v3-alpha to master April 29, 2026 13:10
Copilot AI review requested due to automatic review settings June 29, 2026 06:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

# Conflicts:
#	docs/src/content/docs/features/windows/options.mdx
#	v3/pkg/application/webview_window_options.go

@taliesin-ai taliesin-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approving DisableMenu. De-conflicted against master's restructured options.mdx and struct; dropped the stale drag-effect fields that master has since removed (kept only DisableMenu). darwin + windows cross-builds pass.

@taliesin-ai
taliesin-ai enabled auto-merge (squash) June 30, 2026 00:40
@taliesin-ai
taliesin-ai disabled auto-merge June 30, 2026 00:56
@taliesin-ai
taliesin-ai enabled auto-merge (squash) June 30, 2026 04:22
@taliesin-ai
taliesin-ai merged commit 5044abd into wailsapp:master Jul 1, 2026
16 of 17 checks passed
leaanthony pushed a commit that referenced this pull request Jul 1, 2026
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.

[v3] DisableMenu Property missing

3 participants