Skip to content

Commit

Permalink
Close app after last window is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
milanvarady committed Jan 1, 2025
1 parent 96c893a commit 3f2296e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Applite.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
419256A82D25D10F00D9EF10 /* ExportFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 419256A72D25D10F00D9EF10 /* ExportFile.swift */; };
419256AB2D25E19B00D9EF10 /* BrewManagementView+ActionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 419256AA2D25E19B00D9EF10 /* BrewManagementView+ActionsView.swift */; };
419256AD2D25E1F100D9EF10 /* BrewManagementView+InfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 419256AC2D25E1F100D9EF10 /* BrewManagementView+InfoView.swift */; };
419256AF2D25F68700D9EF10 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 419256AE2D25F68700D9EF10 /* AppDelegate.swift */; };
419506A42964A27F00FE5802 /* SetupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 419506A32964A27F00FE5802 /* SetupView.swift */; };
419506A62964A5EF00FE5802 /* BrewPathSelectorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 419506A52964A5EF00FE5802 /* BrewPathSelectorView.swift */; };
4196C8F528F9CB2600EADDDA /* DiscoverView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4196C8F428F9CB2600EADDDA /* DiscoverView.swift */; };
Expand Down Expand Up @@ -218,6 +219,7 @@
419256A72D25D10F00D9EF10 /* ExportFile.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExportFile.swift; sourceTree = "<group>"; };
419256AA2D25E19B00D9EF10 /* BrewManagementView+ActionsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "BrewManagementView+ActionsView.swift"; sourceTree = "<group>"; };
419256AC2D25E1F100D9EF10 /* BrewManagementView+InfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "BrewManagementView+InfoView.swift"; sourceTree = "<group>"; };
419256AE2D25F68700D9EF10 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
419506A32964A27F00FE5802 /* SetupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SetupView.swift; sourceTree = "<group>"; };
419506A52964A5EF00FE5802 /* BrewPathSelectorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrewPathSelectorView.swift; sourceTree = "<group>"; };
419506A729696A5300FE5802 /* Applite-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Applite-Info.plist"; sourceTree = SOURCE_ROOT; };
Expand Down Expand Up @@ -335,15 +337,16 @@
414074F328DF53E80073EB22 /* Applite */ = {
isa = PBXGroup;
children = (
419506A729696A5300FE5802 /* Applite-Info.plist */,
414074F428DF53E80073EB22 /* AppliteApp.swift */,
414074F828DF53EB0073EB22 /* Assets.xcassets */,
419256AE2D25F68700D9EF10 /* AppDelegate.swift */,
4140750328DF5ED00073EB22 /* Views */,
418F332228EC8B120023D76F /* Model */,
4191393129269FD600F1D75D /* Utilities */,
412635402A77F99F00155034 /* Extensions */,
41483CC9290F047A00BB10C2 /* Resources */,
414074FA28DF53EB0073EB22 /* Preview Content */,
419506A729696A5300FE5802 /* Applite-Info.plist */,
414074F828DF53EB0073EB22 /* Assets.xcassets */,
414074FD28DF53EB0073EB22 /* Applite.entitlements */,
4196C90128FAF57A00EADDDA /* AppliteDebug.entitlements */,
);
Expand Down Expand Up @@ -759,6 +762,7 @@
419256682D1E18D100D9EF10 /* AlertManagerViewModifier.swift in Sources */,
414074F728DF53E80073EB22 /* ContentView.swift in Sources */,
419256392D1DF35C00D9EF10 /* SettingsView+Uninstaller.swift in Sources */,
419256AF2D25F68700D9EF10 /* AppDelegate.swift in Sources */,
419256472D1E0B0900D9EF10 /* BrewPathSelectorView+GetPathDescription.swift in Sources */,
41DF006429EAA094004EB7AE /* SendNotification.swift in Sources */,
419256622D1E15EA00D9EF10 /* UpdateView+UpdateUnavailable.swift in Sources */,
Expand Down
16 changes: 16 additions & 0 deletions Applite/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// AppDelegate.swift
// Applite
//
// Created by Milán Várady on 2025.01.01.
//

import Foundation
import AppKit

class ApplicationDelegate: NSObject, NSApplicationDelegate {
// Close app after last window closed
func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
return true
}
}
2 changes: 2 additions & 0 deletions Applite/AppliteApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import Kingfisher

@main
struct AppliteApp: App {
@NSApplicationDelegateAdaptor(ApplicationDelegate.self) var appDelegate

@StateObject var caskManager = CaskManager()

@AppStorage(Preferences.colorSchemePreference.rawValue) var colorSchemePreference: ColorSchemePreference = .system
Expand Down

0 comments on commit 3f2296e

Please sign in to comment.