fix: 修复设置窗口无法置前的问题
This commit is contained in:
parent
71e56f8d2b
commit
244da37318
|
|
@ -4,6 +4,7 @@ import SwiftUI
|
|||
struct BugListPopover: View {
|
||||
@State private var bugStore = BugStore.shared
|
||||
@State private var tokenManager = TokenManager.shared
|
||||
@Environment(\.openSettings) private var openSettings
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 0) {
|
||||
|
|
@ -90,7 +91,16 @@ struct BugListPopover: View {
|
|||
Button("Refresh") {
|
||||
Task { await PollerService.shared.fetchNow() }
|
||||
}
|
||||
SettingsLink {
|
||||
Button {
|
||||
openSettings()
|
||||
// Bugger runs as an accessory (no Dock icon), so the Settings
|
||||
// window would otherwise open behind whatever is frontmost.
|
||||
// Activate on the next runloop pass, once the window exists,
|
||||
// to bring it on top.
|
||||
DispatchQueue.main.async {
|
||||
NSRunningApplication.current.activate(options: [.activateAllWindows])
|
||||
}
|
||||
} label: {
|
||||
Label("Settings", systemImage: "gear")
|
||||
}
|
||||
Button(action: { NSApp.terminate(nil) }) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue