From 7b50f99f5aeddb9a56df545457bde66b00190542 Mon Sep 17 00:00:00 2001 From: Kihron Date: Wed, 16 Oct 2024 14:13:58 -0400 Subject: [PATCH 1/2] - When clicking on the app icon in the dock, if no other windows are not miniturized, it will now deminiturize a window - This addition aligns with the current behavior used in Xcode --- CodeEdit/AppDelegate.swift | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CodeEdit/AppDelegate.swift b/CodeEdit/AppDelegate.swift index 37c4991ff4..d78835b0ec 100644 --- a/CodeEdit/AppDelegate.swift +++ b/CodeEdit/AppDelegate.swift @@ -69,12 +69,13 @@ final class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject { } func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool { - if flag { + guard flag else { + handleOpen() return false } - handleOpen() - + guard sender.windows.allSatisfy({ $0.isMiniaturized || !$0.isVisible }) else { return false } + sender.windows.first(where: { $0.isMiniaturized })?.deminiaturize(sender) return false } From 1e57b5fbca2ac30a43ccfb6391851c3850824eab Mon Sep 17 00:00:00 2001 From: Kihron Date: Wed, 16 Oct 2024 14:26:32 -0400 Subject: [PATCH 2/2] - Added documentation --- CodeEdit/AppDelegate.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CodeEdit/AppDelegate.swift b/CodeEdit/AppDelegate.swift index d78835b0ec..6c77d134b3 100644 --- a/CodeEdit/AppDelegate.swift +++ b/CodeEdit/AppDelegate.swift @@ -74,6 +74,8 @@ final class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject { return false } + /// Check if all windows are either miniaturized or not visible. + /// If so, attempt to find the first miniaturized window and deminiaturize it. guard sender.windows.allSatisfy({ $0.isMiniaturized || !$0.isVisible }) else { return false } sender.windows.first(where: { $0.isMiniaturized })?.deminiaturize(sender) return false