30 lines
977 B
Swift
30 lines
977 B
Swift
import AppKit
|
|
import SwiftUI
|
|
|
|
@MainActor
|
|
final class SettingsWindowController {
|
|
private var window: NSWindow?
|
|
|
|
func show() {
|
|
if let window = window {
|
|
window.makeKeyAndOrderFront(nil)
|
|
NSApp.activate(ignoringOtherApps: true)
|
|
return
|
|
}
|
|
let hosting = NSHostingController(rootView: SettingsView())
|
|
let win = NSWindow(contentViewController: hosting)
|
|
win.title = "OpenLess 设置"
|
|
win.styleMask = [.titled, .closable, .miniaturizable, .resizable, .fullSizeContentView]
|
|
win.titlebarAppearsTransparent = false
|
|
win.toolbarStyle = .unified
|
|
win.setContentSize(NSSize(width: 760, height: 520))
|
|
win.contentMinSize = NSSize(width: 720, height: 480)
|
|
win.tabbingMode = .disallowed
|
|
win.center()
|
|
win.isReleasedWhenClosed = false
|
|
self.window = win
|
|
win.makeKeyAndOrderFront(nil)
|
|
NSApp.activate(ignoringOtherApps: true)
|
|
}
|
|
}
|