Skip to content

Commit

Permalink
Merge pull request #35 from peterklingelhofer/bugfix/Sequoia_close_in…
Browse files Browse the repository at this point in the history
…itial_extra_settings_window

Initial view with key commands closes immediately
  • Loading branch information
peterklingelhofer authored Oct 13, 2024
2 parents bc5ae71 + ceda13f commit c080f0c
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 5 deletions.
12 changes: 8 additions & 4 deletions swift/exhale.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down Expand Up @@ -54,6 +55,7 @@
020C89F929C2B59A00720231 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
020C8A0129C3307100720231 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
020C8A0329C3323F00720231 /* SettingsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsModel.swift; sourceTree = "<group>"; };
023F8D3B2CBC110800809D87 /* EmptyClosingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmptyClosingView.swift; sourceTree = "<group>"; };
02775BB529C6311E00584F4B /* CustomMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomMenu.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -107,6 +109,7 @@
children = (
020C89CC29C2B05500720231 /* exhaleApp.swift */,
020C89CE29C2B05500720231 /* ContentView.swift */,
023F8D3B2CBC110800809D87 /* EmptyClosingView.swift */,
020C89D029C2B05700720231 /* Assets.xcassets */,
020C89D529C2B05700720231 /* exhale.entitlements */,
020C89D229C2B05700720231 /* Preview Content */,
Expand Down Expand Up @@ -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 */,
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions swift/exhale/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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?) {
Expand Down
22 changes: 22 additions & 0 deletions swift/exhale/EmptyClosingView.swift
Original file line number Diff line number Diff line change
@@ -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()
}
}
}
}
}
4 changes: 3 additions & 1 deletion swift/exhale/exhaleApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ struct exhaleApp: App {
}

var body: some Scene {
Settings {}
WindowGroup {
EmptyClosingView()
}
.commands {
CommandGroup(replacing: .appSettings) {
Button("Preferences...") {
Expand Down

0 comments on commit c080f0c

Please sign in to comment.