nil `mac.Options` causes NSWindowZoomButton to be disabled

Open Beginner friendly
#5,519 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
70/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
go, macos, objective-c
Domain
desktop

Research direction

Start in v2/internal/frontend/desktop/darwin/window.go around the zoomable initialization and frontendOptions.Mac guard, then inspect WailsContext.m around lines 208-211 to trace the native button behavior. Reproduce with nil mac.Options and with an empty mac.Options, then verify that the green NSWindowZoomButton remains enabled by default.

Written by the indexing model from the issue text.

Description

Bug MacOS P2 v2
Description

When options.Mac is nil (not set) in wails.Run(), the green zoom/fullscreen button (NSWindowZoomButton) in the macOS window titlebar traffic lights is disabled. Users cannot enter fullscreen via the native button, only through F11 or a custom menu item.

File: v2/internal/frontend/desktop/darwin/window.go

At line 65, zoomable is declared as a C.int — Go initializes it to 0 (the zero value):

var fullSizeContent, hideTitleBar, zoomable, hideTitle, useToolbar, webviewIsTransparent C.int

At lines 92-129, the assignment that sets zoomable is inside an if frontendOptions.Mac != nil guard:

if frontendOptions.Mac != nil {
    // ...
    zoomable = bool2Cint(!frontendOptions.Mac.DisableZoom)  // line 121
    // ...
}

When Mac is nil, zoomable stays at 0.

This value is then passed to the C/ObjC layer where in WailsContext.m:208-211 it is used as:

if (!zoomable && resizable) {
    NSButton *button = [self.mainWindow standardWindowButton:NSWindowZoomButton];
    [button setEnabled: NO];
}

Since zoomable is 0 (false) and resizable is 1 (true), the condition evaluates to !false && true = true, and the green zoom button is explicitly disabled.

The semantics are inverted: the natural Go zero value of 0 should mean "zoom not disabled" (i.e., enabled), but the ObjC code treats 0 as "zoom is disabled".

To Reproduce
  1. Create or use an existing Wails v2 project.
  2. In main.go, call wails.Run() without setting Mac:
    err = wails.Run(&options.App{
        Title:  "Test",
        Width:  1024,
        Height: 768,
        // Mac: &mac.Options{},   // <-- NOT set
    })
    
  3. Build and run on macOS.
  4. Observe the window's traffic light buttons in the top-left corner.
Expected behaviour

The green zoom/fullscreen button should be enabled by default. When mac.Options is not explicitly configured, DisableZoom logically defaults to false (zoom enabled), so the button should work.

Screenshots

Nil mac.Options:

Image

With &mac.Options{}:

Image
Attempted Fixes

Set an empty mac.Options in the app config:

import "github.com/wailsapp/wails/v2/pkg/options/mac"

err = wails.Run(&options.App{
    // ...
    Mac: &mac.Options{},
})

This triggers the non-nil branch, DisableZoom defaults to Go's false, so zoomable = 1 and the button works correctly.

System Details
$ wails doctor

# Wails
Version | v2.12.0


# System
┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
| OS           | MacOS                                                                                                                       |
| Version      | 26.5                                                                                                                        |
| ID           | 25F71                                                                                                                       |
| Branding     |                                                                                                                             |
| Go Version   | go1.26.3                                                                                                                    |
| Platform     | darwin                                                                                                                      |
| Architecture | arm64                                                                                                                       |
| CPU 1        | Apple M4 Pro                                                                                                                |
| CPU 2        | Apple M4 Pro                                                                                                                |
| GPU          | Chipset Model: Apple M4 Pro Type: GPU Bus: Built-In Total Number of Cores: 16 Vendor: Apple (0x106b) Metal Support: Metal 4 |
| Memory       | 24GB                                                                                                                        |
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

# Dependencies
┌────────────────────────────────────────────────────────────────┐
| Dependency                | Package Name | Status    | Version |
| Xcode command line tools  | N/A          | Installed | 2416    |
| Nodejs                    | N/A          | Installed | 26.0.0  |
| npm                       | N/A          | Installed | 11.12.1 |
| *Xcode                    | N/A          | Available |         |
| *upx                      | N/A          | Available |         |
| *nsis                     | N/A          | Available |         |
|                                                                |
└─────────────────── * - Optional Dependency ────────────────────┘

# Diagnosis
Optional package(s) installation details:
  - Xcode: Available at https://apps.apple.com/us/app/xcode/id497799835
  - upx : Available at https://upx.github.io/
  - nsis : More info at https://wails.io/docs/guides/windows-installer/

 SUCCESS  Your system is ready for Wails development!

 ♥   If Wails is useful to you or your company, please consider sponsoring the project:
https://github.com/sponsors/leaanthony
Additional context

This is a regression introduced by PR #3289 (from two years ago), which added the DisableZoom field to mac.Options.

Dominant language
Go
Stars
36.3k
Forks
1.9k
Avg merge
2d 12h
Merged PRs (30d)
33

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from wailsapp/wails

All issues in wailsapp/wails

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.