diff --git a/macos/Runner/MainFlutterWindow.swift b/macos/Runner/MainFlutterWindow.swift index 2391ce465..62c176734 100644 --- a/macos/Runner/MainFlutterWindow.swift +++ b/macos/Runner/MainFlutterWindow.swift @@ -22,4 +22,23 @@ class MainFlutterWindow: NSWindow { super.awakeFromNib() } + + override func sendEvent(_ event: NSEvent) { + if event.type == .leftMouseDown, event.clickCount == 2, !styleMask.contains(.fullScreen) { + let titleBarHeight: CGFloat = 35 + if event.locationInWindow.y >= frame.height - titleBarHeight { + switch UserDefaults.standard.string(forKey: "AppleActionOnDoubleClick") { + case "Minimize": + performMiniaturize(nil) + return + case "None": + break + default: + performZoom(nil) + return + } + } + } + super.sendEvent(event) + } }