- Restructure project into three targets: - AppleIntelligenceCore: Shared gRPC service code - AppleIntelligenceServer: CLI server - AppleIntelligenceApp: Menu bar app - Menu bar app features: - Toggle server on/off from menu bar - Chat window with streaming AI responses - Settings: host, port, API key, auto-start, launch at login - Proper window focus handling for menu bar apps - Add build scripts for distribution: - build-app.sh: Creates signed .app bundle - create-dmg.sh: Creates distributable DMG 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
59 lines
1.8 KiB
Swift
59 lines
1.8 KiB
Swift
import SwiftUI
|
|
|
|
struct SettingsView: View {
|
|
@Bindable var settings: AppSettings
|
|
@Environment(\.dismiss) private var dismiss
|
|
|
|
var body: some View {
|
|
Form {
|
|
Section("Server Configuration") {
|
|
TextField("Host", text: $settings.host)
|
|
.textFieldStyle(.roundedBorder)
|
|
|
|
TextField("Port", value: $settings.port, format: .number)
|
|
.textFieldStyle(.roundedBorder)
|
|
|
|
SecureField("API Key (optional)", text: $settings.apiKey)
|
|
.textFieldStyle(.roundedBorder)
|
|
}
|
|
|
|
Section("Behavior") {
|
|
Toggle("Launch at login", isOn: $settings.launchAtLogin)
|
|
Toggle("Auto-start server on launch", isOn: $settings.autoStartServer)
|
|
}
|
|
|
|
Section {
|
|
HStack {
|
|
Button("Reset to Defaults") {
|
|
settings.resetToDefaults()
|
|
}
|
|
|
|
Spacer()
|
|
|
|
Button("Done") {
|
|
dismiss()
|
|
}
|
|
.keyboardShortcut(.defaultAction)
|
|
}
|
|
}
|
|
}
|
|
.formStyle(.grouped)
|
|
.frame(width: 400, height: 310)
|
|
.fixedSize()
|
|
.onAppear {
|
|
NSApp.setActivationPolicy(.regular)
|
|
NSApp.activate(ignoringOtherApps: true)
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
|
if let window = NSApp.windows.first(where: { $0.title == "Settings" }) {
|
|
window.makeKeyAndOrderFront(nil)
|
|
}
|
|
}
|
|
}
|
|
.onDisappear {
|
|
if NSApp.windows.filter({ $0.isVisible && $0.title != "" }).isEmpty {
|
|
NSApp.setActivationPolicy(.accessory)
|
|
}
|
|
}
|
|
}
|
|
}
|