SPB Git

spb/zyquo-atlas Public License

The AI-native macOS web browser — every surface, intelligent.

Swift 75.2% JavaScript 22% Shell 2% Makefile 0.9%
2.7 KB · 66 lines swift
Raw Blame History
1//2//  AtlasCommands.swift3//  Zyquo Atlas4//5//  Author: Simon-Pierre Boucher6//  Mail: contact@spboucher.ai7//8//  The app menu + keyboard shortcuts (Phase 6). Each command routes to the9//  focused window's WindowState (a focused-scene value), so shortcuts act on10//  the front window. ⌘⇧N opens a private window via the private scene.11//1213import SwiftUI1415struct AtlasCommands: Commands {16    @FocusedValue(\.windowState) private var ws17    @Environment(\.openWindow) private var openWindow1819    var body: some Commands {20        // File21        CommandGroup(replacing: .newItem) {22            Button("New Tab") { ws?.newTab() }.keyboardShortcut("t")23            Button("New Private Window") { openWindow(id: "private") }24                .keyboardShortcut("n", modifiers: [.command, .shift])25            Button("Close Tab") { ws?.closeActiveTab() }.keyboardShortcut("w")26            Divider()27            Button("Find in Page…") { ws?.toggleFind() }.keyboardShortcut("f")28            Button("Bookmark This Page") { ws?.toggleBookmarkActiveTab() }.keyboardShortcut("d")29        }3031        // Edit — add AI quick ask32        CommandGroup(after: .pasteboard) {33            Divider()34            Button("Quick AI Ask") { ws?.quickAsk() }35                .keyboardShortcut(.space, modifiers: [.option])36        }3738        // Atlas — navigation, reload, panels (distinct from the system View menu)39        CommandMenu("Atlas") {40            Button("Focus Address Bar") { ws?.focusOmnibox() }.keyboardShortcut("l")41            Button("Reload Page") { ws?.reload() }.keyboardShortcut("r")42            Button("Back") { ws?.goBack() }.keyboardShortcut("[")43            Button("Forward") { ws?.goForward() }.keyboardShortcut("]")44            Divider()45            Button("Toggle AI Sidebar") { ws?.toggleAISidebar() }46                .keyboardShortcut("a", modifiers: [.command, .shift])47            Button("History…") { ws?.showHistory = true }.keyboardShortcut("y")48            Button("Bookmarks Manager…") { ws?.showBookmarksManager = true }49                .keyboardShortcut("b", modifiers: [.command, .option])50            Button("Downloads") { ws?.showDownloads.toggle() }51                .keyboardShortcut("j", modifiers: [.command, .shift])52            Button("Customize…") { ws?.showCustomize = true }53                .keyboardShortcut(",")54        }5556        // Tab switching ⌘1–957        CommandMenu("Tabs") {58            ForEach(1...8, id: \.self) { n in59                Button("Show Tab \(n)") { ws?.selectTab(n - 1) }60                    .keyboardShortcut(KeyEquivalent(Character("\(n)")))61            }62            Button("Show Last Tab") { ws?.selectLastTab() }.keyboardShortcut("9")63        }64    }65}66