Skip to content

Commit

Permalink
make it so if click the app icon in the dock, open a window
Browse files Browse the repository at this point in the history
  • Loading branch information
rosedalerk committed Apr 27, 2023
1 parent 85fc33b commit ef0cc56
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Mathboard/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,21 @@ class AppDelegate: NSObject, NSApplicationDelegate {
func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool {
return true
}

func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool {
if !flag {
for window: NSWindow in sender.windows {
if let windowController = window.windowController {
// Check if the window is an instance of your main window controller
if windowController is HelloWindowController {
window.makeKeyAndOrderFront(self)
break
}
}
}
}
return true
}

}

0 comments on commit ef0cc56

Please sign in to comment.