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
- Create or use an existing Wails v2 project.
- 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
})
- Build and run on macOS.
- 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:
With &mac.Options{}:
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.
Description
When
options.Macisnil(not set) inwails.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.goAt line 65,
zoomableis declared as aC.int— Go initializes it to0(the zero value):At lines 92-129, the assignment that sets
zoomableis inside anif frontendOptions.Mac != nilguard:When
Macisnil,zoomablestays at0.This value is then passed to the C/ObjC layer where in
WailsContext.m:208-211it is used as:Since
zoomableis0(false) andresizableis1(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
0should mean "zoom not disabled" (i.e., enabled), but the ObjC code treats0as "zoom is disabled".To Reproduce
main.go, callwails.Run()without settingMac:Expected behaviour
The green zoom/fullscreen button should be enabled by default. When
mac.Optionsis not explicitly configured,DisableZoomlogically defaults tofalse(zoom enabled), so the button should work.Screenshots
Nil
mac.Options:With
&mac.Options{}:Attempted Fixes
Set an empty
mac.Optionsin the app config:This triggers the non-nil branch,
DisableZoomdefaults to Go'sfalse, sozoomable = 1and the button works correctly.System Details
Additional context
This is a regression introduced by PR #3289 (from two years ago), which added the
DisableZoomfield tomac.Options.