restores Helder in all its glory
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import AppKit
|
||||
import SwiftUI
|
||||
|
||||
/// The root view of one window: owns the WorkspaceModel and wires it to the NSWindow and the menus.
|
||||
public struct WorkspaceWindow: View {
|
||||
@State private var model: WorkspaceModel
|
||||
|
||||
public init(root: URL?) {
|
||||
_model = State(initialValue: WorkspaceModel(root: root, app: .live))
|
||||
}
|
||||
|
||||
public var body: some View {
|
||||
WorkspaceView(model: model)
|
||||
.frame(minWidth: Metrics.minimumWindow.width, minHeight: Metrics.minimumWindow.height)
|
||||
.background(Palette.editor)
|
||||
.background(WindowBridge(model: model, title: model.title, hasProject: model.root != nil))
|
||||
.preferredColorScheme(.dark)
|
||||
.focusedSceneValue(\.workspace, model)
|
||||
.task { await model.start() }
|
||||
}
|
||||
}
|
||||
|
||||
struct WorkspaceFocusKey: FocusedValueKey {
|
||||
typealias Value = WorkspaceModel
|
||||
}
|
||||
|
||||
extension FocusedValues {
|
||||
/// The key window's workspace, for menu commands.
|
||||
var workspace: WorkspaceModel? {
|
||||
get { self[WorkspaceFocusKey.self] }
|
||||
set { self[WorkspaceFocusKey.self] = newValue }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user