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) {