mirror of
https://github.com/dscyrescotti/Memola.git
synced 2026-03-25 10:51:41 +01:00
42 lines
1.0 KiB
Swift
42 lines
1.0 KiB
Swift
//
|
|
// FileCommands.swift
|
|
// Memola
|
|
//
|
|
// Created by Dscyre Scotti on 7/12/24.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct FileCommands: Commands {
|
|
@FocusedValue(\.activeSceneKey) private var appScene
|
|
|
|
@ObservedObject private var application: Application
|
|
|
|
init(application: Application) {
|
|
self.application = application
|
|
}
|
|
|
|
var body: some Commands {
|
|
CommandGroup(replacing: .newItem) {
|
|
#if os(macOS)
|
|
if appScene == nil {
|
|
Button {
|
|
application.openWindow(for: .dashboard)
|
|
} label: {
|
|
Text("Open Dashboard")
|
|
}
|
|
.keyboardShortcut("m", modifiers: [.command])
|
|
}
|
|
#endif
|
|
if appScene == .memos {
|
|
Button {
|
|
application.newMemoPublisher.send()
|
|
} label: {
|
|
Text("New Memo")
|
|
}
|
|
.keyboardShortcut("n", modifiers: [.command])
|
|
}
|
|
}
|
|
}
|
|
}
|