Skip to content

Commit

Permalink
Remove unnecessary options. Bump to version 1.5.
Browse files Browse the repository at this point in the history
  • Loading branch information
onebadidea committed Mar 13, 2023
1 parent 6142f8c commit 39746ba
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 290 deletions.
6 changes: 4 additions & 2 deletions Swift Quit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@
ENABLE_HARDENED_RUNTIME = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "Swift-Quit-Info.plist";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.productivity";
INFOPLIST_KEY_NSHumanReadableCopyright = "";
INFOPLIST_KEY_NSMainStoryboardFile = Main;
INFOPLIST_KEY_NSPrincipalClass = NSApplication;
Expand All @@ -335,7 +336,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = 1.4;
MARKETING_VERSION = 1.5;
PRODUCT_BUNDLE_IDENTIFIER = "onebadidea.Swift-Quit";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand All @@ -357,6 +358,7 @@
ENABLE_HARDENED_RUNTIME = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "Swift-Quit-Info.plist";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.productivity";
INFOPLIST_KEY_NSHumanReadableCopyright = "";
INFOPLIST_KEY_NSMainStoryboardFile = Main;
INFOPLIST_KEY_NSPrincipalClass = NSApplication;
Expand All @@ -365,7 +367,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = 1.4;
MARKETING_VERSION = 1.5;
PRODUCT_BUNDLE_IDENTIFIER = "onebadidea.Swift-Quit";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down
Binary file not shown.
44 changes: 24 additions & 20 deletions Swift Quit/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,38 +26,29 @@ class AppDelegate: NSObject, NSApplicationDelegate {

func applicationDidFinishLaunching(_ aNotification: Notification) {


guard AXSwift.checkIsProcessTrusted(prompt: true) else {
print("Not trusted as an AX process; please authorize and re-launch")
NSApp.terminate(self)
return
}


Swindler.initialize().done { state in
swindler = state

SwiftQuit.activateAutomaticAppClosing()

self.loadMenu()

if(swiftQuitSettings["menubarIconEnabled"] == "false"){
self.openSettings();
SwiftQuit.hideMenu()
}

}.catch { error in
print("Fatal error: failed to initialize Swindler: \(error)")
NSApp.terminate(self)
}

SwiftQuit.loadMenu()

if(swiftQuitSettings["menubarIconEnabled"] == "true"){

}
else{
openSettings();
SwiftQuit.hideMenu()
}



}

func applicationWillEnterForeground(_ aNotification: Notification) {
//openSettings();
}

func applicationWillTerminate(_ aNotification: Notification) {
Expand All @@ -72,13 +63,26 @@ class AppDelegate: NSObject, NSApplicationDelegate {
return true
}

@objc func loadMenu(){
statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)
if let button = statusItem.button {
button.image = #imageLiteral(resourceName: "MenuIcon")
button.image?.size = NSSize(width: 18.0, height: 18.0)
button.image?.isTemplate = true
}
statusItem.isVisible = true
let openSettings = NSMenuItem(title: "Settings...", action: #selector(openSettings) , keyEquivalent: ",")
menu.addItem(openSettings)
menu.addItem(NSMenuItem(title: "Quit", action: #selector(NSApplication.terminate(_:)), keyEquivalent: "q"))
statusItem.menu = menu
}

@objc func openSettings() {
settingsWindow.showWindow(self)
settingsWindow.shouldCloseDocument = true
NSApp.activate(ignoringOtherApps: true)
}


}

Loading

0 comments on commit 39746ba

Please sign in to comment.