From 26d2e1971c8ce7c2223ef7f878a4cc4feef3d154 Mon Sep 17 00:00:00 2001 From: Julian Storer Date: Thu, 25 Jun 2026 20:19:36 +0100 Subject: [PATCH] feat(macos): bounce the Dock icon on Window.Flash Flash was Windows-only (it flashes the taskbar button) and a no-op on macOS. Wire it up on darwin via [NSApp requestUserAttention:NSInformationalRequest], which bounces the app's Dock icon once to draw the user back to a window that needs attention. The request completes on its own, so disabling is a no-op. The Flash doc comment is updated to describe the per-platform behaviour: taskbar button on Windows, Dock bounce on macOS, no-op on Linux. --- v3/pkg/application/webview_window.go | 3 ++- v3/pkg/application/webview_window_darwin.go | 13 +++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/v3/pkg/application/webview_window.go b/v3/pkg/application/webview_window.go index 51ef265edd9..28a715a2fe2 100644 --- a/v3/pkg/application/webview_window.go +++ b/v3/pkg/application/webview_window.go @@ -700,7 +700,8 @@ func (w *WebviewWindow) SetFullscreenButtonState(state ButtonState) Window { } // Flash flashes the window's taskbar button/icon. -// Useful to indicate that attention is required. Windows only. +// Useful to indicate that attention is required. On Windows this flashes the +// taskbar button; on macOS it bounces the app's Dock icon (Linux: no-op). func (w *WebviewWindow) Flash(enabled bool) { if w.impl == nil || w.isDestroyed() { return diff --git a/v3/pkg/application/webview_window_darwin.go b/v3/pkg/application/webview_window_darwin.go index 9986aa9bb4c..a3a551c2fba 100644 --- a/v3/pkg/application/webview_window_darwin.go +++ b/v3/pkg/application/webview_window_darwin.go @@ -810,6 +810,15 @@ static void windowMinimise(void *window) { [(WebviewWindow*)window miniaturize:nil]; } +// windowFlash requests user attention so the app's Dock icon bounces, drawing +// the user back to a window that needs them. NSInformationalRequest bounces the +// icon once; the request completes on its own, so disabling is a no-op. +static void windowFlash(void *window, bool enabled) { + if (enabled) { + [NSApp requestUserAttention:NSInformationalRequest]; + } +} + // zoom maximizes the window to the screen dimensions static void windowMaximise(void *window) { [(WebviewWindow*)window zoom:nil]; @@ -1335,8 +1344,8 @@ func (w *macosWebviewWindow) setTitle(title string) { } } -func (w *macosWebviewWindow) flash(_ bool) { - // Not supported on macOS +func (w *macosWebviewWindow) flash(enabled bool) { + C.windowFlash(w.nsWindow, C.bool(enabled)) } func (w *macosWebviewWindow) setSize(width, height int) {