// // AtlasCommands.swift // Zyquo Atlas // // Author: Simon-Pierre Boucher // Mail: contact@spboucher.ai // // The app menu + keyboard shortcuts (Phase 6). Each command routes to the // focused window's WindowState (a focused-scene value), so shortcuts act on // the front window. ⌘⇧N opens a private window via the private scene. // import SwiftUI struct AtlasCommands: Commands { @FocusedValue(\.windowState) private var ws @Environment(\.openWindow) private var openWindow var body: some Commands { // File CommandGroup(replacing: .newItem) { Button("New Tab") { ws?.newTab() }.keyboardShortcut("t") Button("New Private Window") { openWindow(id: "private") } .keyboardShortcut("n", modifiers: [.command, .shift]) Button("Close Tab") { ws?.closeActiveTab() }.keyboardShortcut("w") Divider() Button("Find in Page…") { ws?.toggleFind() }.keyboardShortcut("f") Button("Bookmark This Page") { ws?.toggleBookmarkActiveTab() }.keyboardShortcut("d") } // Edit — add AI quick ask CommandGroup(after: .pasteboard) { Divider() Button("Quick AI Ask") { ws?.quickAsk() } .keyboardShortcut(.space, modifiers: [.option]) } // Atlas — navigation, reload, panels (distinct from the system View menu) CommandMenu("Atlas") { Button("Focus Address Bar") { ws?.focusOmnibox() }.keyboardShortcut("l") Button("Reload Page") { ws?.reload() }.keyboardShortcut("r") Button("Back") { ws?.goBack() }.keyboardShortcut("[") Button("Forward") { ws?.goForward() }.keyboardShortcut("]") Divider() Button("Toggle AI Sidebar") { ws?.toggleAISidebar() } .keyboardShortcut("a", modifiers: [.command, .shift]) Button("History…") { ws?.showHistory = true }.keyboardShortcut("y") Button("Bookmarks Manager…") { ws?.showBookmarksManager = true } .keyboardShortcut("b", modifiers: [.command, .option]) Button("Downloads") { ws?.showDownloads.toggle() } .keyboardShortcut("j", modifiers: [.command, .shift]) Button("Customize…") { ws?.showCustomize = true } .keyboardShortcut(",") } // Tab switching ⌘1–9 CommandMenu("Tabs") { ForEach(1...8, id: \.self) { n in Button("Show Tab \(n)") { ws?.selectTab(n - 1) } .keyboardShortcut(KeyEquivalent(Character("\(n)"))) } Button("Show Last Tab") { ws?.selectLastTab() }.keyboardShortcut("9") } } }