diff --git a/swift/exhale.xcodeproj/project.pbxproj b/swift/exhale.xcodeproj/project.pbxproj index 3567d85..9c0bf76 100644 --- a/swift/exhale.xcodeproj/project.pbxproj +++ b/swift/exhale.xcodeproj/project.pbxproj @@ -18,6 +18,7 @@ 020C89FA29C2B59A00720231 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 020C89F929C2B59A00720231 /* AppDelegate.swift */; }; 020C8A0229C3307100720231 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 020C8A0129C3307100720231 /* SettingsView.swift */; }; 020C8A0429C3323F00720231 /* SettingsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 020C8A0329C3323F00720231 /* SettingsModel.swift */; }; + 023F8D3C2CBC110900809D87 /* EmptyClosingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 023F8D3B2CBC110800809D87 /* EmptyClosingView.swift */; }; 02775BB629C6311E00584F4B /* CustomMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02775BB529C6311E00584F4B /* CustomMenu.swift */; }; /* End PBXBuildFile section */ @@ -54,6 +55,7 @@ 020C89F929C2B59A00720231 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 020C8A0129C3307100720231 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = ""; }; 020C8A0329C3323F00720231 /* SettingsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsModel.swift; sourceTree = ""; }; + 023F8D3B2CBC110800809D87 /* EmptyClosingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmptyClosingView.swift; sourceTree = ""; }; 02775BB529C6311E00584F4B /* CustomMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomMenu.swift; sourceTree = ""; }; /* End PBXFileReference section */ @@ -107,6 +109,7 @@ children = ( 020C89CC29C2B05500720231 /* exhaleApp.swift */, 020C89CE29C2B05500720231 /* ContentView.swift */, + 023F8D3B2CBC110800809D87 /* EmptyClosingView.swift */, 020C89D029C2B05700720231 /* Assets.xcassets */, 020C89D529C2B05700720231 /* exhale.entitlements */, 020C89D229C2B05700720231 /* Preview Content */, @@ -276,6 +279,7 @@ files = ( 020C89FA29C2B59A00720231 /* AppDelegate.swift in Sources */, 020C8A0429C3323F00720231 /* SettingsModel.swift in Sources */, + 023F8D3C2CBC110900809D87 /* EmptyClosingView.swift in Sources */, 020C8A0229C3307100720231 /* SettingsView.swift in Sources */, 02775BB629C6311E00584F4B /* CustomMenu.swift in Sources */, 020C89CF29C2B05500720231 /* ContentView.swift in Sources */, @@ -446,7 +450,7 @@ CODE_SIGN_ENTITLEMENTS = exhale/exhale.entitlements; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 156; + CURRENT_PROJECT_VERSION = 157; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = "\"exhale/Preview Content\""; DEVELOPMENT_TEAM = VZCHHV7VNW; @@ -460,7 +464,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 11.0; - MARKETING_VERSION = 1.5.6; + MARKETING_VERSION = 1.5.7; PRODUCT_BUNDLE_IDENTIFIER = peterklingelhofer.exhale; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = macosx; @@ -479,7 +483,7 @@ CODE_SIGN_ENTITLEMENTS = exhale/exhale.entitlements; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 156; + CURRENT_PROJECT_VERSION = 157; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = "\"exhale/Preview Content\""; DEVELOPMENT_TEAM = VZCHHV7VNW; @@ -493,7 +497,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 11.0; - MARKETING_VERSION = 1.5.6; + MARKETING_VERSION = 1.5.7; PRODUCT_BUNDLE_IDENTIFIER = peterklingelhofer.exhale; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = macosx; diff --git a/swift/exhale/AppDelegate.swift b/swift/exhale/AppDelegate.swift index cc1b691..7130716 100644 --- a/swift/exhale/AppDelegate.swift +++ b/swift/exhale/AppDelegate.swift @@ -58,6 +58,11 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate { @objc func stopAnimating(_ sender: Any?) { settingsModel.stop() + + for window in windows { + window.close() + } + windows.removeAll() } @objc func pauseAnimating(_ sender: Any?) { diff --git a/swift/exhale/EmptyClosingView.swift b/swift/exhale/EmptyClosingView.swift new file mode 100644 index 0000000..c6a089f --- /dev/null +++ b/swift/exhale/EmptyClosingView.swift @@ -0,0 +1,22 @@ +// EmptyClosingView.swift +import SwiftUI + +struct EmptyClosingView: NSViewRepresentable { + func makeNSView(context: Context) -> NSView { + let view = SelfClosingView() + return view + } + + func updateNSView(_ nsView: NSView, context: Context) {} + + class SelfClosingView: NSView { + override func viewDidMoveToWindow() { + super.viewDidMoveToWindow() + DispatchQueue.main.async { + if let window = self.window { + window.close() + } + } + } + } +} diff --git a/swift/exhale/exhaleApp.swift b/swift/exhale/exhaleApp.swift index c6644d8..4e02f6d 100644 --- a/swift/exhale/exhaleApp.swift +++ b/swift/exhale/exhaleApp.swift @@ -11,7 +11,9 @@ struct exhaleApp: App { } var body: some Scene { - Settings {} + WindowGroup { + EmptyClosingView() + } .commands { CommandGroup(replacing: .appSettings) { Button("Preferences...") {