-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathApp.swift
28 lines (26 loc) · 885 Bytes
/
App.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import SwiftUI
@main
struct App: SwiftUI.App {
@StateObject private var serverController = ServerController()
@AppStorage("isEnabled") private var isEnabled = true
@State private var isMenuPresented = false
var body: some Scene {
MenuBarExtra("iMCP", image: #"MenuIcon-\#(isEnabled ? "On" : "Off")"#) {
ContentView(
serverManager: serverController,
isEnabled: $isEnabled,
isMenuPresented: $isMenuPresented
)
}
.menuBarExtraStyle(.window)
.menuBarExtraAccess(isPresented: $isMenuPresented)
.commands {
CommandGroup(replacing: .appTermination) {
Button("Quit") {
NSApplication.shared.terminate(nil)
}
.keyboardShortcut("q", modifiers: .command)
}
}
}
}