Skip to content

Commit

Permalink
Fix window close behavior (fixes #48)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxgoedjen committed Mar 15, 2020
1 parent bfb4f80 commit 12b920b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Secretive/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
window.makeKeyAndOrderFront(nil)
window.titleVisibility = .hidden
window.toolbar = toolbar
window.isReleasedWhenClosed = false
if storeList.modifiableStore?.isAvailable ?? false {
let plus = NSTitlebarAccessoryViewController()
plus.view = NSButton(image: NSImage(named: NSImage.addTemplateName)!, target: self, action: #selector(add(sender:)))
Expand All @@ -42,6 +43,12 @@ class AppDelegate: NSObject, NSApplicationDelegate {
agentStatusChecker.check()
}

func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool {
guard !flag else { return false }
window.makeKeyAndOrderFront(self)
return true
}

@IBAction func add(sender: AnyObject?) {
var addWindow: NSWindow!
let addView = CreateSecretView(store: storeList.modifiableStore!) {
Expand Down

0 comments on commit 12b920b

Please sign in to comment.