Skip to content

Commit ec76020

Browse files
committed
Fix settings window focus
1 parent defabd4 commit ec76020

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

nutcracker/MenuBarView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ struct MenuBarView: View {
5050
.disabled(filterListStore.isLoading)
5151

5252
Button("Settings…") {
53+
NSApp.setActivationPolicy(.regular)
5354
NSApp.activate()
5455
openSettings()
5556
}

nutcracker/SettingsView.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ struct SettingsView: View {
1414
}
1515
.padding()
1616
.frame(minWidth: 520, idealWidth: 520, maxWidth: 520, minHeight: 440, idealHeight: 500)
17+
.onReceive(NotificationCenter.default.publisher(for: NSWindow.willCloseNotification)) { notification in
18+
guard let window = notification.object as? NSWindow,
19+
window.identifier?.rawValue == "com_apple_SwiftUI_Settings_window" else { return }
20+
NSApp.setActivationPolicy(.accessory)
21+
}
1722
}
1823
}
1924

0 commit comments

Comments
 (0)