10000 Debug and curse Apple · codeface-io/Codeface@53b6b82 · GitHub
[go: up one dir, main page]

Skip to content

Commit 53b6b82

Browse files
committed
Debug and curse Apple
1 parent 830b409 commit 53b6b82

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

Code/App/CodefaceApp.swift

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,26 @@ struct CodefaceApp: App
179179
if !moreWindowsThanTestingDashboardAreOpen()
180180
{
181181
log("🪟 gonna open document window because none is open")
182+
183+
/// we cannot use `newDocument` here because we can't capture `self` in the Task in the initializer ... there is simply no clean way to trigger `newDocument` on app launch 🤮
182184
NSDocumentController.shared.newDocument(nil)
183185
}
184186
}
185187

186188
private static func moreWindowsThanTestingDashboardAreOpen() -> Bool
187189
{
188-
if NSApp.windows.count > 1 { return true }
189-
if NSApp.window(forID: TestingDashboardWindow.id) != nil { return false }
190+
if NSApp.windows.count > 1
191+
{
192+
return true
193+
}
194+
195+
if NSApp.window(forID: TestingDashboardWindow.id) != nil
196+
{
197+
return false
198+
}
199+
200+
print(NSApp.windows.count)
201+
190202
return NSApp.windows.count == 1
191203
}
192204

0 commit comments

Comments
 (0)
0