Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
glushchenko committed Nov 22, 2023
1 parent cbd290d commit 3fe7751
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions FSNotes/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,19 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
let event = NSApp.currentEvent!

if event.type == NSEvent.EventType.leftMouseUp {

// Hide active not hidden and not miniaturized
if !NSApp.isHidden && NSApp.isActive {
if let mainWindow = AppDelegate.mainWindowController?.window, !mainWindow.isMiniaturized {
NSApp.hide(nil)
return
}
}

NSApp.unhide(nil)
NSApp.activate(ignoringOtherApps: true)

AppDelegate.mainWindowController?.window?.makeKeyAndOrderFront(nil)
AppDelegate.mainWindowController?.window?.resignKey()

ViewController.shared()?.search.becomeFirstResponder()

return
Expand Down

0 comments on commit 3fe7751

Please sign in to comment.