* fix: improve darwin build commands to accommodate spaces in APP_NAME
* fix: improve android build commands to accommodate spaces in APP_NAME
* fix: improve ios build commands to accommodate spaces in APP_NAME
* fix: improve linux build commands to accommodate spaces in APP_NAME
* fix: improve windows build commands to accommodate spaces in APP_NAME
* docs: update `v3/UNRELEASED_CHANGELOG.md`
* fix(docs): correct changelog
* fix: remove quotes around GO_CACHE_MOUNT and REPLACE_MOUNTS
---------
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
* perf(v3): optimize JSON processing and reduce allocations in hot paths
- Switch to goccy/go-json for method binding, events, and HTTP transport
(21-63% faster, 40-60% less memory for method calls)
- Optimize BoundMethod struct layout to reduce padding (144 -> 136 bytes)
- Cache isVariadic flag at registration to avoid reflect call per invocation
- Use stack-allocated buffer for method arguments (<=8 args)
- Optimize result collection to avoid slice allocation for single return values
- Use sync.Map for MIME cache to improve concurrent read performance
- Use buffer pool for HTTP transport request body reading
- Lazily allocate CloseNotify channel in content type sniffer
- Remove debug CSS logging from asset server
- Add comprehensive benchmark tests (build tag: bench)
Performance improvements for BoundMethod.Call:
- SimpleCall: 1290ns -> 930ns (28% faster), 240B -> 80B (67% less memory)
- ComplexCall: 10500ns -> 3900ns (63% faster), 1192B -> 1020B (14% less)
- VariadicCall: 3460ns -> 1600ns (54% faster), 512B -> 289B (44% less)
* perf(v3): add max size limit to buffer pool to prevent memory bloat
Buffers larger than 512KB are not returned to the pool, allowing GC
to reclaim memory after large requests (e.g., base64 encoded images).
* perf(v3): remove mimetype library dependency, saving ~208KB binary size
- Replace github.com/wailsapp/mimetype with expanded extension map + stdlib
- Expand MIME type map from 16 to 50+ common web formats (fonts, audio, video, etc.)
- Add comprehensive test suite validating MIME detection for all web formats
- Use http.DetectContentType as fallback for unknown extensions
- Actual binary size reduction: 1.2MB (11MB -> 9.8MB in test app)
* perf(v3): migrate all runtime code to goccy/go-json
Migrate remaining encoding/json usages to goccy/go-json in:
- pkg/application (android, darwin, ios, single_instance, webview_window)
- pkg/services (kvstore, notifications on all platforms)
- internal/assetserver/webview (request/response handling)
- internal/runtime and internal/capabilities
Note: encoding/json (110KB) remains in binary because:
1. goccy/go-json imports it for interface compatibility (json.Marshaler, etc.)
2. log/slog (stdlib) uses it for JSON output
The performance benefit is in the hot paths which now use the faster library.
* perf(v3): replace gopkg.in/ini.v1 with minimal .desktop file parser
Replace the gopkg.in/ini.v1 dependency with a purpose-built minimal parser
for Linux .desktop files.
The new parser:
- Only extracts the Exec key from [Desktop Entry] section (all we need)
- Follows the Desktop Entry Specification
- Has comprehensive test coverage (40 tests) including:
- All major file managers (Nautilus, Dolphin, Thunar, PCManFM, Caja, Nemo)
- Edge cases (UTF-8, special chars, comments, empty files, etc.)
- Buffer limit handling
Binary size reduction: 45KB (10.22MB -> 10.18MB)
* perf(v3): remove samber/lo from runtime code, saving ~310KB binary size
Replace samber/lo with Go 1.21+ stdlib slices package and minimal internal
helpers in all runtime code paths. This removes 80 transitive dependencies
from the production binary.
Changes:
- Create internal/sliceutil package with Unique and FindMapKey helpers
- Replace lo.Without with slices.DeleteFunc in event handling
- Replace lo.Ternary with inline if/else in Windows code
- Replace lo.Uniq with sliceutil.Unique for feature flags
- Replace lo.FindKey with sliceutil.FindMapKey for method aliases
- Replace lo.Filter with slices.DeleteFunc in event listeners
- Replace lo.Must with inline panic in w32 package
Binary size: 10.18MB -> 9.87MB (~310KB / 3% reduction)
Note: CLI tools still use samber/lo since they don't affect
production binary size. The application_debug.go file also
retains lo usage as it has //go:build !production tag.
* fix: address CodeRabbit review comments
- Use application/x-typescript MIME type (not IANA-registered text/typescript)
- Fix potential panic in mimetype_stdlib_test.go for short MIME strings
- Use cached isVariadic flag in bindings_optimized_bench_test.go
* fix: initialize goccy/go-json decoder early to fix Windows test failure
On Windows, goccy/go-json's type address calculation can fail if the
decoder is first invoked during test execution rather than at init time.
Force early initialization by unmarshaling a []int during package init.
See: https://github.com/goccy/go-json/issues/474
* 📝 Add docstrings to `v3/performance-improvements` (#4844)
* fix: initialize goccy/go-json decoder early to fix Windows test failure
On Windows, goccy/go-json's type address calculation can fail if the
decoder is first invoked during test execution rather than at init time.
Force early initialization by unmarshaling a []int during package init.
See: https://github.com/goccy/go-json/issues/474
* 📝 Add docstrings to `v3/performance-improvements`
Docstrings generation was requested by @leaanthony.
* https://github.com/wailsapp/wails/pull/4843#issuecomment-3703472562
The following files were modified:
* `v3/internal/assetserver/common.go`
* `v3/internal/assetserver/content_type_sniffer.go`
* `v3/internal/assetserver/mimecache.go`
* `v3/internal/fileexplorer/desktopfile.go`
* `v3/internal/fileexplorer/fileexplorer_linux.go`
* `v3/internal/sliceutil/sliceutil.go`
* `v3/pkg/application/application_ios.go`
* `v3/pkg/application/bindings.go`
* `v3/pkg/application/ios_runtime_ios.go`
* `v3/pkg/w32/window.go`
---------
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
---------
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* feat(macos): add CollectionBehavior option to MacWindow (#4756)
Add configurable NSWindowCollectionBehavior support for macOS windows,
allowing control over window behavior across Spaces and fullscreen.
New options include:
- MacWindowCollectionBehaviorCanJoinAllSpaces
- MacWindowCollectionBehaviorFullScreenAuxiliary
- MacWindowCollectionBehaviorMoveToActiveSpace
- And more...
This enables building Spotlight-like apps that appear on all Spaces
or overlay fullscreen applications.
Closes#4756🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Potential fix for code scanning alert no. 140: Workflow does not contain permissions
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
* Potential fix for code scanning alert no. 139: Workflow does not contain permissions
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
* feat(examples): add spotlight example for CollectionBehavior
Demonstrates creating a Spotlight-like launcher window that:
- Appears on all macOS Spaces
- Floats above other windows
- Uses accessory activation policy (no Dock icon)
- Has frameless translucent design
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat(macos): support bitwise OR for CollectionBehavior options
Update CollectionBehavior to use actual NSWindowCollectionBehavior
bitmask values, allowing multiple behaviors to be combined:
```go
CollectionBehavior: application.MacWindowCollectionBehaviorCanJoinAllSpaces |
application.MacWindowCollectionBehaviorFullScreenAuxiliary,
```
Changes:
- Update Go constants to use actual bitmask values (1<<0, 1<<1, etc.)
- Simplify C function to pass through combined bitmask directly
- Add ParticipatesInCycle, IgnoresCycle, FullScreenDisallowsTiling options
- Update documentation with combined behavior examples
- Update spotlight example to demonstrate combining behaviors
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
* Clean up debug output in webView URL scheme handler
Removed debug print statements for CSS requests in web view.
* Add changelog entry for #4834
* Fix Changelog
---------
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
* test(v3): add comprehensive unit tests for pkg/application
Add 11 new test files to improve test coverage of the pkg/application
package from 13.6% to 17.7%.
New test files:
- context_test.go: Context struct operations
- services_test.go: Service management and lifecycle
- parameter_test.go: Parameter and CallError types
- dialogs_test.go: Dialog utilities and button methods
- webview_window_options_test.go: Window options and constants
- application_options_test.go: ChainMiddleware and app config
- keys_test.go: Keyboard accelerator parsing
- single_instance_test.go: Single instance management and encryption
- menuitem_internal_test.go: Menu item internal functions
- menu_internal_test.go: Menu internal functions
- screenmanager_internal_test.go: Screen geometry and transformations
The 40% target was not fully achievable because ~50% of the codebase
is platform-specific code that can only be tested on respective
platforms. Tests focus on pure Go logic, utility functions, and
data structures that can be tested cross-platform.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: address CodeRabbit review comments
- dialogs_test.go: improve ID recycling test to verify either recycled
ID (id3 == id1) or new unique ID (id3 > id2)
- keys_test.go: make accelerator String() tests platform-agnostic by
checking suffix patterns rather than exact platform-specific strings
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: normalize temp dir path for macOS compatibility in test
os.TempDir() returns a trailing slash on macOS, causing path comparison
to fail. Use filepath.Clean() to normalize both paths.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* chore: remove REVIEW.md
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* chore: simplify changelog entry
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* docs: fix custom protocol association documentation
The documentation was incorrectly referencing `wails.json` with JSON format
when the actual configuration file is `build/config.yml` using YAML format.
Changes:
- Update config file reference from `wails.json` to `build/config.yml`
- Change format from JSON to YAML in code examples
- Fix structure: `protocols` is at root level, not nested under `info`
- Correct template variable references from `{{.Info.Protocols}}` to `{{.Protocols}}`
- Update Info.plist example to show actual generated format (`wails.com.scheme`)
- Add note about running `wails3 task common:update:build-assets` after changes
- Clean up redundant file path references in platform-specific sections
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* docs: consolidate custom protocol docs and add Universal Links
- Remove duplicate custom-protocol-association.mdx
- Add Universal Links section to macOS tab
- Add Web-to-App Linking section to Windows tab
- Keep the more comprehensive distribution/custom-protocols.mdx
Addresses review comment about duplicate documentation.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat(windows): add custom protocol support to MSIX packaging
- Add uap3 namespace and protocol extension to MSIX template
- Protocols defined in build/config.yml are now automatically
registered when building MSIX packages
- Update docs with MSIX section and clarify Web-to-App linking
requires manual manifest configuration
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
Add guard against concurrent TrackPopupMenuEx calls using atomic.Bool
to prevent race condition when user clicks systray icon repeatedly.
Change TrackPopupMenuEx failure from fatal to debug log with early
return so the application gracefully handles failed menu display
attempts instead of crashing.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Vibe Kanban <noreply@vibekanban.com>
Co-authored-by: Claude <noreply@anthropic.com>
* Enhance bindings generation documentation
Added TypeScript option and help command for bindings generation.
* Update UNRELEASED_CHANGELOG with new events and docs
Updated the changelog to include new WebKit2 load-change events and additional documentation for frontend bindings.
---------
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
* Refactor asset-server documentation for clarity
Updated references from 'frontend/Taskfile.yml' to 'build/Taskfile.yml' and adjusted environment variable names for clarity. Enhanced the explanation of how the dev proxy works and clarified the roles of the tasks in the templates.
* Update changelog
* Apply suggestion from @coderabbitai[bot]
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
---------
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* All the documentation files have been updated. Here's a summary of the changes I made:
## Summary of Documentation Updates
### Key API Corrections Made:
1. **Dialog Creation**:
- Changed `app.InfoDialog()` → `application.InfoDialog()` (package-level functions)
- Also documented `app.Dialog.Info()` via DialogManager
2. **Question Dialog Buttons**:
- Removed non-existent `SetButtons("Save", "Don't Save", "Cancel")` method
- Now uses `AddButton("label")` which returns a `*Button`
- Button callbacks via `button.OnClick(func() { ... })`
3. **Default/Cancel Buttons**:
- Changed `SetDefaultButton("Cancel")` (string) → `SetDefaultButton(cancelBtn)` (`*Button`)
- Changed `SetCancelButton("Cancel")` (string) → `SetCancelButton(cancelBtn)` (`*Button`)
- Also documented fluent `SetAsDefault()` and `SetAsCancel()` methods on Button
4. **File Dialog Filters**:
- Changed `SetFilters([]application.FileFilter{...})` → `AddFilter("Display Name", "*.ext;*.ext2")`
5. **Save Dialog Filename**:
- Changed `SetDefaultFilename()` → `SetFilename()`
6. **Folder Selection**:
- Removed non-existent `app.SelectFolderDialog()`
- Now uses `application.OpenFileDialog().CanChooseDirectories(true).CanChooseFiles(false)`
7. **Show() Return Value**:
- Removed incorrect `result, err := dialog.Show()` pattern
- `Show()` returns nothing - responses are handled via button callbacks
### Files Modified:
- `docs/src/content/docs/features/dialogs/message.mdx` - Complete rewrite of question dialog examples
- `docs/src/content/docs/features/dialogs/overview.mdx` - Updated all code examples
- `docs/src/content/docs/features/dialogs/file.mdx` - Updated file dialog examples
- `v3/UNRELEASED_CHANGELOG.md` - Added changelog entry
* All changes are complete. Here's a summary of what was updated:
## Summary
I've updated the Wails v3 dialogs documentation to match the actual API. The documentation now consistently uses:
### DialogManager Pattern (Recommended)
- `app.Dialog.Info()`, `app.Dialog.Question()`, `app.Dialog.Warning()`, `app.Dialog.Error()`
- `app.Dialog.OpenFile()`, `app.Dialog.SaveFile()`
This is consistent with other runtime features like `app.Window`, `app.Event`, etc.
### Key API Corrections
1. **Dialog Creation**: Both `app.Dialog.*()` (DialogManager) and `application.*Dialog()` (package-level) are documented
2. **Question Dialog Buttons**: Use `AddButton("label")` which returns `*Button`, then `button.OnClick(callback)`
3. **Default/Cancel Buttons**: `SetDefaultButton(button)` and `SetCancelButton(button)` take `*Button` pointers
4. **File Filters**: Use `AddFilter("Display Name", "*.ext")` instead of `SetFilters()`
5. **Save Dialog Filename**: Use `SetFilename()` instead of `SetDefaultFilename()`
6. **Folder Selection**: Use `app.Dialog.OpenFile().CanChooseDirectories(true).CanChooseFiles(false)`
### Files Modified
- `docs/src/content/docs/features/dialogs/overview.mdx`
- `docs/src/content/docs/features/dialogs/message.mdx`
- `docs/src/content/docs/features/dialogs/file.mdx`
- `v3/UNRELEASED_CHANGELOG.md`
* Audit complete! All documentation files now consistently use `app.Dialog.*` for all code examples. Here's the summary:
## Audit Complete
All dialog documentation has been updated to consistently use the `app.Dialog.*` pattern:
### Changes Made:
**message.mdx:**
- All examples now use `app.Dialog.Info()`, `app.Dialog.Question()`, `app.Dialog.Warning()`, `app.Dialog.Error()`
- Function signatures updated to accept `app *application.App` parameter
- Nested dialog calls within callbacks also updated
**file.mdx:**
- All examples now use `app.Dialog.OpenFile()`, `app.Dialog.SaveFile()`
- Function signatures updated to accept `app *application.App` parameter
- All error/info dialogs within file operations also updated
**overview.mdx:**
- Already consistent from earlier edits
### Documentation Structure:
Each file now properly documents both approaches in a dedicated section:
```go
// Via DialogManager (recommended when you have an app instance):
app.Dialog.Info()
app.Dialog.OpenFile()
// Package-level functions (useful in callbacks or when app isn't in scope):
application.InfoDialog()
application.OpenFileDialog()
```
But all code examples use the `app.Dialog.*` pattern for consistency with other runtime features like `app.Window`, `app.Event`, etc.
* docs: Fix reference/dialogs.mdx and reference/application.mdx API documentation
Updated docs to match actual Wails v3 Dialogs API:
- reference/dialogs.mdx: Complete rewrite with correct API
- Use `app.Dialog.OpenFile()` and `app.Dialog.SaveFile()` instead of `app.OpenFileDialog()`
- Use `AddFilter("name", "pattern")` instead of `SetFilters([]FileFilter{...})`
- Use `SetFilename()` instead of `SetDefaultFilename()`
- Use `SetDirectory()` instead of `SetDefaultDirectory()`
- Remove non-existent `SelectFolderDialog()` - use `OpenFile().CanChooseDirectories(true).CanChooseFiles(false)`
- Use `AddButton()` with callbacks instead of `SetButtons()`
- Use `SetDefaultButton(*Button)` instead of `SetDefaultButton(int)`
- Document that `Show()` returns nothing, use callbacks
- reference/application.mdx: Fix Dialog Methods section
- Use `app.Dialog.*` manager pattern
- Show correct Question dialog with button callbacks
- Fix file dialog examples with `AddFilter()`
- Remove `SelectFolderDialog()` reference
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* docs: Remove package-level dialog function references
Remove all references to package-level dialog functions
(application.InfoDialog(), application.OpenFileDialog(), etc.)
from documentation. Only the app.Dialog manager pattern
should be used.
Updated files:
- reference/dialogs.mdx
- features/dialogs/overview.mdx
- features/dialogs/message.mdx
- features/dialogs/file.mdx
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* refactor: Remove package-level dialog functions in favor of app.Dialog manager
BREAKING CHANGE: Remove package-level dialog functions. Use app.Dialog manager instead.
Removed functions:
- application.InfoDialog()
- application.QuestionDialog()
- application.WarningDialog()
- application.ErrorDialog()
- application.OpenFileDialog()
- application.SaveFileDialog()
Use the Dialog manager pattern instead:
- app.Dialog.Info()
- app.Dialog.Question()
- app.Dialog.Warning()
- app.Dialog.Error()
- app.Dialog.OpenFile()
- app.Dialog.SaveFile()
This aligns dialogs with other runtime managers like app.Window and app.Event.
Updated files:
- v3/pkg/application/application.go - Remove exported dialog functions
- v3/pkg/application/dialog_manager.go - Use internal newMessageDialog/newOpenFileDialog
- v3/pkg/application/messageprocessor_dialog.go - Use internal dialog constructors
- v3/examples/* - Update all examples to use app.Dialog pattern
- v3/internal/commands/appimage_testfiles/main.go - Update test file
- v3/UNRELEASED_CHANGELOG.md - Document breaking change
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: Use application.Get() in dialogs-basic example and correct filter docs
- Update dialogs-basic helper functions to use application.Get() instead
of passing app through function parameters
- Fix incorrect documentation claiming space/comma delimiters work for
filter patterns (only semicolons are supported)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
* ## Summary
I've verified and fixed the bug reported in GitHub issue #4389. Here's what was done:
### Root Cause Analysis
The crash occurred on macOS when using `Hide()` and `Show()` to toggle window visibility via a system tray. The sequence was:
1. `Hide()` calls `orderOut:nil` which removes the window from screen
2. With `ApplicationShouldTerminateAfterLastWindowClosed = true` (default), macOS considers the app to have no visible windows
3. macOS triggers `windowShouldClose:` which emits `EventWindowShouldClose`
4. The event mapping translates this to `Common.WindowClosing`
5. The `WindowClosing` handler destroys the window and removes it from the window map
6. When `Show()` is called later, the window doesn't exist anymore → crash
### Fix Implementation
**File: `v3/pkg/application/webview_window_close_darwin.go`**
- Added new exported function `windowIsHidden()` that checks if a window is marked as hidden via `window.options.Hidden`
**File: `v3/pkg/application/webview_window_darwin.m`**
- Added extern declaration for `windowIsHidden`
- Modified `windowShouldClose:` delegate method to return `false` early (without emitting close events) if the window is hidden
The fix ensures that when a window is intentionally hidden (not closed), the close event sequence is not triggered, preserving the window for later re-showing.
### Test Case Created
Created `v3/tests/systray-hide-show-test/` - a test application that:
- Creates a window and system tray
- Clicking the tray toggles window visibility
- Previously crashed after hide→show→hide sequence; now works correctly
### Files Modified
1. `v3/pkg/application/webview_window_close_darwin.go` - Added `windowIsHidden()` function
2. `v3/pkg/application/webview_window_darwin.m` - Check hidden state in `windowShouldClose:`
3. `v3/UNRELEASED_CHANGELOG.md` - Added fix entry
### Files Added
1. `v3/tests/systray-hide-show-test/main.go` - Test case
2. `v3/tests/systray-hide-show-test/icon.png` - Icon for test
All existing tests pass. The fix is minimal and targeted, only affecting the specific scenario where a hidden window receives a close query.
* Done. The redundant test case has been removed. The fix is covered by the existing `v3/examples/hide-window/` example.
Current staged changes:
- Deleted `v3/tests/systray-hide-show-test/` (test case, icon, and binary)
The fix itself (in `webview_window_close_darwin.go` and `webview_window_darwin.m`) and the changelog entry were already committed in the previous commit.
All tests pass. Let me provide a summary of the changes.
## Summary
This issue (#4012) is about **Dynamic Context Menu** support, labeled as a Bug affecting macOS.
### Root Cause Analysis
I identified two related issues:
1. **macOS Memory Leak**: In `webview_window_darwin.go`, the `openContextMenu` function created a **new** `macosMenu` and `NSMenu` every time a context menu was displayed, ignoring any existing `menu.impl`. This caused:
- Memory leaks (NSMenu objects never released)
- Wasted CPU cycles rebuilding the native menu each time
- Inconsistent behavior with other platforms
2. **Windows Memory Leak**: In `webview_window_windows.go`, the `openContextMenu` function created a new `Win32Menu` each time without destroying the previous one, leaking Windows menu handles.
### Fixes Applied
**1. macOS (`v3/pkg/application/webview_window_darwin.go:889-897`):**
```go
func (w *macosWebviewWindow) openContextMenu(menu *Menu, data *ContextMenuData) {
// Reuse existing impl if available, otherwise create new one
if menu.impl == nil {
menu.impl = newMenuImpl(menu)
}
thisMenu := menu.impl.(*macosMenu)
thisMenu.update()
C.windowShowMenu(w.nsWindow, thisMenu.nsMenu, C.int(data.X), C.int(data.Y))
}
```
This now:
- Reuses existing `menu.impl` if available (consistent with Linux)
- Only creates new impl on first display
- The `update()` call still rebuilds native items from current Go state for dynamic updates
**2. Windows (`v3/pkg/application/webview_window_windows.go:1174-1184`):**
```go
func (w *windowsWebviewWindow) openContextMenu(menu *Menu, _ *ContextMenuData) {
// Destroy previous context menu if it exists to prevent memory leak
if w.currentlyOpenContextMenu != nil {
w.currentlyOpenContextMenu.Destroy()
}
// Create the menu from current Go-side menu state
thisMenu := NewPopupMenu(w.hwnd, menu)
thisMenu.Update()
w.currentlyOpenContextMenu = thisMenu
thisMenu.ShowAtCursor()
}
```
This now properly destroys the old `Win32Menu` before creating a new one.
**3. Updated `v3/UNRELEASED_CHANGELOG.md`** with fix entries.
### Files Changed
- `v3/pkg/application/webview_window_darwin.go`
- `v3/pkg/application/webview_window_windows.go`
- `v3/UNRELEASED_CHANGELOG.md`
### Testing
- Build passes ✓
- All existing tests pass ✓
- Manual testing recommended using `v3/examples/contextmenus` app
When an application starts with Hidden: true, clicking the dock icon
now correctly shows the window. This matches standard macOS UX where
clicking the dock icon should bring up the app's windows.
The fix adds a default handler for ApplicationShouldHandleReopen that
automatically shows all hidden windows when there are no visible windows.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <noreply@anthropic.com>
fix(macos): fix print dialog not opening and add Window.Print() to runtime (#4290)
The print dialog was not opening on macOS because the CGO windowPrint function was passing the wrong pointer type to NSPrintOperation's runOperationModalForWindow method. It was passing the raw void* window instead of the properly cast WebviewWindow* nsWindow.
This also adds a Window.Print() method to the JavaScript runtime, allowing frontend code to trigger the print dialog directly without needing a Go binding.
Changes:
- Fix webview_window_darwin.go to use nsWindow instead of window
- Add WindowPrint constant (51) and handler to messageprocessor_window.go
- Add Print() method to window.ts in the runtime
- Rebuild bundled runtime (runtime.js and runtime.debug.js)
- Add print example in v3/examples/print to demonstrate both Go API and JS runtime methods
- Update API documentation for Window.Print() in both Go and JavaScript references
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <noreply@anthropic.com>
Remove the setup.Action that runs the wizard when calling `wails setup`.
The signing and entitlements subcommands are retained.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* All changes are complete. Here's a summary of what was implemented for issue #3896:
## Summary
Added four new WebKit2 load-change events for Linux to match WebKitGTK's documented load-change signals:
### New Events
| Event | ID | WebKit Signal | Description |
|-------|-----|---------------|-------------|
| `WindowLoadStarted` | 1059 | `WEBKIT_LOAD_STARTED` | Fired when page load begins |
| `WindowLoadRedirected` | 1060 | `WEBKIT_LOAD_REDIRECTED` | Fired when a redirect occurs |
| `WindowLoadCommitted` | 1061 | `WEBKIT_LOAD_COMMITTED` | Fired when load is committed |
| `WindowLoadFinished` | 1062 | `WEBKIT_LOAD_FINISHED` | Fired when load completes |
### Files Modified
1. **`v3/pkg/events/events.go`** - Added new event types to `linuxEvents` struct and updated all platform event IDs (Mac, Windows, iOS shifted by +4 to accommodate new Linux events)
2. **`v3/pkg/events/events_linux.h`** - Added C defines for new events
3. **`v3/pkg/application/linux_cgo.go`** - Updated `handleLoadChanged()` to dispatch all four load events
4. **`v3/UNRELEASED_CHANGELOG.md`** - Documented the new feature
### Backward Compatibility
- The existing `WindowLoadChanged` event (1058) continues to fire on `WEBKIT_LOAD_FINISHED` for backward compatibility
- `WindowLoadFinished` also fires on `WEBKIT_LOAD_FINISHED` for consistent naming with the new events
Would you like me to commit these changes?
* These are the remaining changes that need to be committed - the generator properly updated:
1. `events.txt` - source of truth for events
2. `event_types.ts` - TypeScript runtime types for JS/TS clients
3. `events_darwin.h` - Mac C header with updated event IDs
4. `events_ios.h` - iOS C header with updated event IDs
These are the final changes needed on top of the previous commit. Would you like me to commit these changes?
* chore: add new Linux WebKit2 load events to known_events.go
Add WindowLoadStarted, WindowLoadRedirected, WindowLoadCommitted,
and WindowLoadFinished to the known events registry.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* docs: add Linux WebKit2 load events to events-reference guide
Document the new WindowLoadStarted, WindowLoadRedirected,
WindowLoadCommitted, and WindowLoadFinished events in the
Linux Events section of the events reference guide.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Update UNRELEASED_CHANGELOG
* refactor(linux): remove deprecated WindowLoadChanged event
Remove the legacy WindowLoadChanged event and replace all internal
references with WindowLoadFinished. This simplifies the event system
by having granular events (LoadStarted, LoadRedirected, LoadCommitted,
LoadFinished) rather than a generic LoadChanged that fired on any state.
- Remove WindowLoadChanged from events.go and event_types.ts
- Update linux_cgo.go to only fire WindowLoadFinished
- Update webview_window_linux.go hooks to use WindowLoadFinished
- Regenerate runtime bundles and known_events
- Update events documentation
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs: add breaking change note for WindowLoadChanged removal
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
* ## Summary
I've implemented the fix for issue #4575. Here's what was changed:
### Changes Made
**File: `v3/internal/commands/build_assets/linux/Taskfile.yml`**
1. Added `generate:dotdesktop` as a dependency to `build:native` task (line 45)
2. Added `generate:dotdesktop` as a dependency to `build:docker` task (line 63)
This ensures that the `.desktop` file is generated during every Linux build (both native and Docker-based), not just during packaging operations.
### How it works
- When running `wails build` or `wails dev` on Linux, the build process now automatically generates a `.desktop` file at `build/linux/<app-name>.desktop`
- The `.desktop` file contains:
- Application name
- Executable path
- Icon reference
- Categories (defaulting to "Development")
- This allows Linux desktop environments to properly display the application icon and metadata even during development
### Testing
To test the changes:
1. Create a new Wails v3 project: `wails3 init -n testapp`
2. Build it: `cd testapp && wails3 build`
3. Verify the `.desktop` file exists: `cat build/linux/testapp.desktop`
Would you like me to run a test or make any additional changes?
* feat(linux): generate .desktop file during build (#4575)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
Add documentation for:
- Runtime dependencies table for different Linux distributions
- WebKit2GTK ABI version differences (4.0 vs 4.1)
- Build tags for targeting different ABI versions
- nfpm configuration examples for packaging
Based on community contribution in #4339.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Add documentation for:
- Runtime dependencies table for different Linux distributions
- WebKit2GTK ABI version differences (4.0 vs 4.1)
- Build tags for targeting different ABI versions
- nfpm configuration examples for packaging
Based on community contribution in #4339.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The pathToURI function was using url.PathEscape which incorrectly
escapes forward slashes (/ -> %2F). This caused file URIs like:
/home/angaz -> file://%2Fhome%2Fangaz (broken)
File managers couldn't parse these malformed URIs correctly, causing
them to open the wrong directory (often a parent directory).
Fixed by using url.URL struct to properly construct file URIs:
/home/angaz -> file:///home/angaz (correct)
Spaces and other special characters are still properly escaped.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Modern Linux distributions (Arch, Fedora 39+, Ubuntu 24.04+) compile
libraries with .relr.dyn ELF sections. The bundled strip binary in
linuxdeploy cannot process these sections, causing AppImage builds to fail.
This commit:
- Adds hasRelrDynSections() to proactively detect modern toolchains
- Automatically disables stripping (NO_STRIP=1) when detected
- Fixes error output to properly display as string
- Adds documentation explaining the issue and workaround
Fixes#4642🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Modern Linux distributions (Arch, Fedora 39+, Ubuntu 24.04+) compile
libraries with .relr.dyn ELF sections. The bundled strip binary in
linuxdeploy cannot process these sections, causing AppImage builds to fail.
This commit:
- Adds hasRelrDynSections() to proactively detect modern toolchains
- Automatically disables stripping (NO_STRIP=1) when detected
- Fixes error output to properly display as string
- Adds documentation explaining the issue and workaround
Fixes#4642🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fix not enough memory error when initialising drag and drop on windows
Co-authored-by: Andraz Vrhovec <andraz@koofr.net>
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
* fix: prevent window menu crash on Wayland by realizing window before showing
On Wayland with GTK3, the appmenu-gtk-module tries to set DBus properties
for global menu integration before the window is fully realized, causing
a crash with the error "GDK_IS_WAYLAND_WINDOW (window) assertion failed".
The fix calls gtk_widget_realize() before gtk_widget_show_all() to ensure
the window has a valid GdkWindow when the menu system accesses it.
This fix is applied to both the CGO and purego implementations.
Fixeswailsapp/wails#4769🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add Wayland detection to wails3 doctor and test for #4769
- Add Wayland session detection row to `wails3 doctor` output on Linux
- Create test project v3/test/4769-menu to manually verify the menu fix
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: sanitize GTK application name to prevent crashes with invalid characters
Application names containing spaces, parentheses, hash symbols, or other
invalid characters would cause GTK to fail with an assertion error.
Added sanitizeAppName() function that:
- Replaces invalid characters with underscores
- Handles leading digits
- Removes consecutive underscores
- Defaults to "wailsapp" if empty
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* fix: use structured logging for debug/info methods
The debug() and info() methods were using fmt.Sprintf() which expects
printf-style format directives, but callers were using slog-style
key-value pairs. Changed to pass args directly to Logger.Debug/Info
which properly handles structured logging.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* docs: add changelog entries for build fixes
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* chore: remove temporary debug print statements from mobile merge
Remove emoji debug logs (🔴, 🟢, 🟠, 🔵, 🔥) that were accidentally left in
from the iOS/Android mobile platform support merge. These were development
debugging statements that should not have been included in the final code.
Files cleaned:
- application.go
- application_debug.go
- init_android.go
- init_ios.go
- mainthread_android.go
- mainthread_ios.go
- webview_window.go
- webview_window_ios.go
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs: add changelog entries for debug cleanup and breaking change
- Add breaking change note: production builds are now default
- Add entry for debug print statement removal
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: convert remaining printf-style debug calls to slog-style
Convert three debug() calls that were still using printf-style format
strings to slog-style structured logging (key-value pairs):
- systemtray_windows.go: ShellNotifyIcon show/hide failures
- application_darwin.go: window lookup failure
This addresses CodeRabbit review feedback and ensures consistency
with the refactored debug() method.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: convert all printf-style info() calls to slog-style
Convert remaining info() calls that were using printf-style format
strings to slog-style structured logging (key-value pairs):
- application_ios.go: iOS log messages and HandleJSMessage calls
- webview_window_windows.go: WM_SYSKEYDOWN logging
- application.go: handleWindowMessage and handleWebViewRequest logging
Also removed debug fmt.Printf statements from handleWebViewRequest.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: add build tag to main.m to prevent Go from compiling it on non-iOS platforms
Go's toolchain tries to process .m (Objective-C) files when they're in a
directory with Go files. Adding a //go:build ios tag tells Go to only
process this file when building for iOS, matching how darwin .m files
handle this (e.g., //go:build darwin && !ios).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* chore: remove orphaned wails-mimetype-migration submodule reference
The iOS merge added a submodule reference without a corresponding
.gitmodules file, causing Cloudflare and other CI systems to fail
with "No url found for submodule path" errors.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: auto-disable DMA-BUF renderer on Wayland with NVIDIA to prevent crashes
WebKitGTK has a known issue with the DMA-BUF renderer on NVIDIA proprietary
drivers running Wayland, causing "Error 71 (Protocol error)" crashes.
This fix automatically detects NVIDIA GPUs (via /sys/module/nvidia) and sets
WEBKIT_DISABLE_DMABUF_RENDERER=1 when running on Wayland.
Also removes leftover debug print statements from mobile platform merge.
See: https://bugs.webkit.org/show_bug.cgi?id=262607🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add NVIDIA driver info to wails3 doctor on Linux
Shows NVIDIA driver version and srcversion in doctor output to help
diagnose Wayland/NVIDIA compatibility issues.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>