SPB Git

spb/zyquo-agent Public MIT

The autonomous agent that actually operates your Mac — plans, runs real commands, verifies its own work.

Swift 94.7% Shell 4.1% Python 0.7% Makefile 0.5%
2.1 KB · 60 lines swift
Raw Blame History
1//2//  SettingsView.swift3//  Zyquo Agent4//5//  Author: Simon-Pierre Boucher6//  Mail: contact@spboucher.ai7//8//  Settings window (760×560, native toolbar-style tabs): Providers & Keys,9//  Models, Safety, Agent, Appearance, Shortcuts, Advanced — same structure10//  and DNA as Zyquo Cloud's Settings, extended with the Agent tabs.11//1213import AppKit14import SwiftUI1516struct SettingsView: View {17    @EnvironmentObject private var appearance: AppearanceStore1819    var body: some View {20        TabView {21            ProvidersSettingsTab()22                .tabItem { Label("Providers & Keys", systemImage: "key") }23            ModelsSettingsTab()24                .tabItem { Label("Models", systemImage: "cpu") }25            SafetySettingsTab()26                .tabItem { Label("Safety", systemImage: "shield.lefthalf.filled") }27            AgentSettingsTab()28                .tabItem { Label("Agent", systemImage: "gearshape.arrow.triangle.2.circlepath") }29            AppearanceSettingsTab()30                .tabItem { Label("Appearance", systemImage: "paintbrush") }31            ShortcutsSettingsTab()32                .tabItem { Label("Shortcuts", systemImage: "keyboard") }33            AdvancedSettingsTab()34                .tabItem { Label("Advanced", systemImage: "gearshape.2") }35        }36        .frame(width: ZyquoMetrics.settingsWidth, height: ZyquoMetrics.settingsHeight)37        .preferredColorScheme(appearance.themeMode.colorScheme)38        .tint(appearance.accentColor)39        .id(appearance.accent)40    }41}4243/// Opens the SwiftUI Settings scene from anywhere (gear buttons, palette).44/// macOS 14+ exposes `showSettingsWindow:`; macOS 13 kept the old45/// `showPreferencesWindow:` selector — try both.46@MainActor47enum SettingsOpener {48    static func open() {49        NSApp.activate(ignoringOtherApps: true)50        let selectors = ["showSettingsWindow:", "showPreferencesWindow:"]51        for name in selectors {52            let selector = Selector(name)53            if NSApp.responds(to: selector) || NSApp.sendAction(selector, to: nil, from: nil) {54                NSApp.sendAction(selector, to: nil, from: nil)55                return56            }57        }58    }59}60