The open-source Arc replacement for macOS. Spaces, pinned tabs, split view, Little Windows and Arc's shortcuts on Chromium, with your Arc sidebar imported in one go.
Apple notarization, Auto updater, Fixed sidebar, Fixed extensions
Victorbdd579a95257
diff --git a/Sources/Cra/App/AppDelegate.swift b/Sources/Cra/App/AppDelegate.swiftindex bda8522..19b0356 100644--- a/Sources/Cra/App/AppDelegate.swift+++ b/Sources/Cra/App/AppDelegate.swift@@ -326,6 +326,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {for item in comps?.queryItems ?? [] { if let v = item.value { dict[item.name] = v } }if let js = dict["devtoolsjs"] { main.debugRunInDevTools(js) }if let id = dict["extensionAction"] { main.runExtensionAction(id); return }+ if let f = dict["floatingSidebar"] { if f == "1" { main.floatingSidebar?.show() } else { main.floatingSidebar?.hide(animated: true) }; return }if let method = dict["bcdp"] {CraCEFRuntime.sendBrowserDevToolsMethod(method, params: dict["params"] ?? "{}") { result, error inNSLog("Cra bcdp %@ → %@", method, result ?? "error: \(error ?? "?")")diff --git a/Sources/Cra/App/main.swift b/Sources/Cra/App/main.swiftindex eae0cec..2da54bd 100644--- a/Sources/Cra/App/main.swift+++ b/Sources/Cra/App/main.swift@@ -16,6 +16,8 @@ MainActor.assumeIsolated {CredentialImport.applyPending(profileDir: AppPaths.chromiumCache.appendingPathComponent("Default", isDirectory: true))}+ NativeMessagingHosts.link(into: AppPaths.chromiumCache)+let useChromeStyle = ProcessInfo.processInfo.environment["CRA_CHROME_STYLE"] == "1"let started = CraCEFRuntime.initialize(withCachePath: AppPaths.chromiumCache.path,userAgentProduct: "",diff --git a/Sources/Cra/Model/SidebarModel.swift b/Sources/Cra/Model/SidebarModel.swiftindex c696aeb..8099eaf 100644--- a/Sources/Cra/Model/SidebarModel.swift+++ b/Sources/Cra/Model/SidebarModel.swift@@ -303,8 +303,12 @@ struct AppSettings: Codable, Equatable {var searchEngine: SearchEngine = .googlevar newTabsAtTop: Bool = truevar showStatusBar: Bool = true- /// Arc's toolbar above the page (URL, copy link, DevTools). ⇧⌘D toggles.- var showToolbar: Bool = true+ /// Arc's toolbar above the page (URL, copy link, DevTools). ⇧⌘D toggles. Off by+ /// default like Arc, which keeps the URL at the top of the sidebar.+ var showToolbar: Bool = false+ /// Cra 0.1.0 saved `showToolbar` as on for everyone; settings without this mark+ /// take the toolbar from Arc's own preference once (off without Arc).+ var toolbarDefaultMigrated: Bool = truevar hasSeenImportPrompt: Bool = false/// Arc's per-site Developer Mode (⌃D): the toolbar shows the full URL in/// monospace with the developer icons, and the nav buttons move to the sidebar.@@ -377,7 +381,11 @@ extension AppSettings {searchEngine = try c.decodeIfPresent(SearchEngine.self, forKey: .searchEngine) ?? .googlenewTabsAtTop = try c.decodeIfPresent(Bool.self, forKey: .newTabsAtTop) ?? trueshowStatusBar = try c.decodeIfPresent(Bool.self, forKey: .showStatusBar) ?? true- showToolbar = try c.decodeIfPresent(Bool.self, forKey: .showToolbar) ?? true+ if try c.decodeIfPresent(Bool.self, forKey: .toolbarDefaultMigrated) == true {+ showToolbar = try c.decodeIfPresent(Bool.self, forKey: .showToolbar) ?? false+ } else {+ showToolbar = ArcImporter.showsToolbar ?? false+ }hasSeenImportPrompt = try c.decodeIfPresent(Bool.self, forKey: .hasSeenImportPrompt) ?? falsedeveloperHosts = try c.decodeIfPresent(Set<String>.self, forKey: .developerHosts) ?? []chromeEngine = try c.decodeIfPresent(Bool.self, forKey: .chromeEngine) ?? truediff --git a/Sources/Cra/Services/Import/Importers.swift b/Sources/Cra/Services/Import/Importers.swiftindex ed87fda..28dfba4 100644--- a/Sources/Cra/Services/Import/Importers.swift+++ b/Sources/Cra/Services/Import/Importers.swift@@ -36,6 +36,9 @@ struct ImportedArchiveEntry {struct ImportedSettings {var autoArchive: AutoArchiveThreshold?var sidebarWidth: Double?+ var showToolbar: Bool?++ var isEmpty: Bool { autoArchive == nil && sidebarWidth == nil && showToolbar == nil }}struct ImportPlan {@@ -91,6 +94,11 @@ enum ArcImporter {static var isAvailable: Bool { FileManager.default.fileExists(atPath: supportDir.appendingPathComponent("StorableSidebar.json").path) }+ /// Arc's View ▸ Show Toolbar (topBarURLEnabled, off by default); nil when Arc never stored it.+ static var showsToolbar: Bool? {+ UserDefaults(suiteName: "company.thebrowser.Browser")?.object(forKey: "topBarURLEnabled") as? Bool+ }+static func plan() throws -> ImportPlan {let url = supportDir.appendingPathComponent("StorableSidebar.json")guard let data = try? Data(contentsOf: url) else { throw ImportError.notFound("Arc") }@@ -181,6 +189,7 @@ enum ArcImporter {if let threshold = UserDefaults(suiteName: "company.thebrowser.Browser")?.string(forKey: "autoArchiveTimeThreshold") {plan.settings.autoArchive = AutoArchiveThreshold(rawValue: threshold)}+ plan.settings.showToolbar = showsToolbarreturn plan}@@ -447,6 +456,7 @@ extension SidebarStore {if includeSettings {if let a = plan.settings.autoArchive { settings.autoArchive = a }if let w = plan.settings.sidebarWidth { prefs.sidebarWidth = min(max(w, 220), 520) }+ if let t = plan.settings.showToolbar { settings.showToolbar = t }}touchAfterImport()return resultdiff --git a/Sources/Cra/Services/NativeMessagingHosts.swift b/Sources/Cra/Services/NativeMessagingHosts.swiftnew file mode 100644index 0000000..92dcc91--- /dev/null+++ b/Sources/Cra/Services/NativeMessagingHosts.swift@@ -0,0 +1,47 @@+import Foundation++/// Extensions that talk to a desktop app (1Password, Bitwarden, Claude, Notion…)+/// find it through a native messaging host manifest. Apps install those into the+/// browsers they know, never into Cra's profile, so Chromium logs "Can't find+/// manifest for native messaging host" and the extension stays disconnected.+/// Before Chromium starts, Cra links every manifest the other browsers have into+/// its own NativeMessagingHosts folder. Links, not copies: an app that rewrites+/// its manifest on update is picked up without Cra noticing.+enum NativeMessagingHosts {+ static func link(into profileRoot: URL) {+ let fm = FileManager.default+ let dest = profileRoot.appendingPathComponent("NativeMessagingHosts", isDirectory: true)+ try? fm.createDirectory(at: dest, withIntermediateDirectories: true)++ // Rebuilt every launch, so hosts that were uninstalled go away. Plain+ // files are someone's own manifests and stay.+ for name in (try? fm.contentsOfDirectory(atPath: dest.path)) ?? [] {+ let url = dest.appendingPathComponent(name)+ if (try? url.resourceValues(forKeys: [.isSymbolicLinkKey]))?.isSymbolicLink == true {+ try? fm.removeItem(at: url)+ }+ }++ // First source wins: Chrome is where every app installs, the rest fill gaps.+ for dir in sources {+ for name in (try? fm.contentsOfDirectory(atPath: dir.path)) ?? [] where name.hasSuffix(".json") {+ let link = dest.appendingPathComponent(name)+ if (try? link.checkResourceIsReachable()) == true { continue }+ try? fm.createSymbolicLink(at: link, withDestinationURL: dir.appendingPathComponent(name))+ }+ }+ }++ private static var sources: [URL] {+ let browsers = ImportSource.allCases.filter { [.chromium, .arc, .dia].contains($0.kind) }+ let user = (browsers.filter { $0.id == "chrome" } + browsers.filter { $0.id != "chrome" }).map { $0.dataDir.appendingPathComponent("NativeMessagingHosts", isDirectory: true) }+ // System-wide installs (all users), per browser.+ let system = [+ "/Library/Google/Chrome/NativeMessagingHosts",+ "/Library/Application Support/Chromium/NativeMessagingHosts",+ "/Library/Microsoft/Edge/NativeMessagingHosts",+ "/Library/Application Support/BraveSoftware/Brave-Browser/NativeMessagingHosts",+ ].map { URL(fileURLWithPath: $0, isDirectory: true) }+ return user + system+ }+}diff --git a/Sources/Cra/UI/Onboarding/ImportFlow.swift b/Sources/Cra/UI/Onboarding/ImportFlow.swiftindex e6d2abf..11abfad 100644--- a/Sources/Cra/UI/Onboarding/ImportFlow.swift+++ b/Sources/Cra/UI/Onboarding/ImportFlow.swift@@ -242,7 +242,7 @@ final class ImportFlowModel {previewSpace = p.spaces.isEmpty ? nil : 0includeFavorites = !p.favorites.isEmptyincludeArchive = !p.archive.isEmpty- includeSettings = p.settings.autoArchive != nil || p.settings.sidebarWidth != nil+ includeSettings = !p.settings.isEmpty}var canContinueFromSource: Bool { source != nil && (plan != nil || source?.needsExportedFile == true) }@@ -423,7 +423,7 @@ final class ImportFlowModel {if !chosen.isEmpty {cats.append(ImportCategory(id: "extensions", title: "Extensions", symbol: "puzzlepiece.extension.fill", detail: count(chosen.count, "extension")))}- if includeSettings && (plan.settings.autoArchive != nil || plan.settings.sidebarWidth != nil) {+ if includeSettings && !plan.settings.isEmpty {cats.append(ImportCategory(id: "settings", title: "Settings", symbol: "gearshape.fill", detail: "Auto-archive"))}categories = catsdiff --git a/Sources/Cra/UI/Onboarding/ImportFlowArt.swift b/Sources/Cra/UI/Onboarding/ImportFlowArt.swiftindex 7c686d0..ecf4fe1 100644--- a/Sources/Cra/UI/Onboarding/ImportFlowArt.swift+++ b/Sources/Cra/UI/Onboarding/ImportFlowArt.swift@@ -42,11 +42,24 @@ struct ImportArtPanel: View {// Cover and privacy show only the painted backdrop.EmptyView()case .personalization:- // A live preview of a Cra window in the picked theme colour.- WindowMock(theme: theme, colors: colors) {- PlaceholderSidebar(theme: theme)- } pane: { EmptyView() }+ // A live preview of a Cra window in the picked theme colour and layout.+ WindowMock(theme: theme, colors: colors, origin: CGPoint(x: 90, y: 80), sidebarWidth: 210,+ headerControls: !model.classicLayout) {+ VStack(alignment: .leading, spacing: 8) {+ if !model.classicLayout {+ AddressPreview(theme: theme, inSidebar: true)+ .transition(.opacity.combined(with: .move(edge: .top)))+ }+ PlaceholderSidebar(theme: theme)+ }+ } pane: {+ if model.classicLayout {+ AddressPreview(theme: theme, inSidebar: false)+ .transition(.opacity.combined(with: .move(edge: .top)))+ }+ }.animation(.easeInOut(duration: 0.3), value: theme)+ .animation(.spring(response: 0.35, dampingFraction: 0.85), value: model.classicLayout)case .unlock, .safariExport, .passwordsFile, .credentialsResult:KeyArt(colors: colors, accent: accent(model.previewTheme))case .pinnedTabs:@@ -264,6 +277,8 @@ private struct WindowMock<Sidebar: View, Pane: View>: View {/// Dia's window enters at (124, 80) of its 448 pt artwork, sidebar 243 pt wide.var origin = CGPoint(x: 132, y: 80)var sidebarWidth: CGFloat = 236+ /// The toolbar-hidden title row: sidebar toggle after the traffic lights, ← → ↻ at the right.+ var headerControls = false@ViewBuilder let sidebar: () -> Sidebar@ViewBuilder let pane: () -> Pane@@ -280,6 +295,19 @@ private struct WindowMock<Sidebar: View, Pane: View>: View {ForEach(["#FF5F57", "#FEBC2E", "#28C840"], id: \.self) { Circle().fill(Color(hex: $0)).frame(width: 13, height: 13) }}.offset(x: 19, y: 20)+ if headerControls {+ let tone: Color = palette.isDark ? .white.opacity(0.55) : .black.opacity(0.45)+ HStack(spacing: 2) {+ Image(systemName: "sidebar.left").frame(width: 24)+ Spacer()+ ForEach(["arrow.left", "arrow.right", "arrow.clockwise"], id: \.self) { Image(systemName: $0).frame(width: 24) }+ }+ .font(.system(size: 13, weight: .regular))+ .foregroundStyle(tone)+ .frame(width: sidebarWidth - 86, height: 26)+ .offset(x: 80, y: 13.5)+ .transition(.opacity)+ }RoundedRectangle(cornerRadius: 10, style: .continuous).fill(palette.isDark ? Color(white: 0.12) : .white).shadow(color: .black.opacity(0.12), radius: 3, y: 1)@@ -393,6 +421,46 @@ private struct PlaceholderSidebar: View {}}+/// The address bar of the personalization preview: Arc's second sidebar row+/// (nav buttons and a URL pill), or the toolbar strip above the page.+private struct AddressPreview: View {+ let theme: SpaceTheme+ let inSidebar: Bool+ var body: some View {+ let p = theme.palette+ if inSidebar {+ // Arc's toolbar-hidden URL pill: the sidebar's width less 8 pt a side, the bare host.+ RoundedRectangle(cornerRadius: 9, style: .continuous).fill(p.pillFill)+ .frame(height: 34)+ .overlay(alignment: .leading) {+ Text("crabrowser.app").font(.system(size: 12.5)).foregroundStyle(p.textPrimary).padding(.leading, 11)+ }+ .padding(.horizontal, 8)+ } else {+ let ink: Color = p.isDark ? .white : .black+ VStack(spacing: 0) {+ HStack(spacing: 8) {+ Image(systemName: "sidebar.left").font(.system(size: 11)).foregroundStyle(ink.opacity(0.45))+ navButtons(p, ink: ink)+ Text("crabrowser.app").font(.system(size: 10.5)).foregroundStyle(ink.opacity(0.6))+ Spacer()+ }+ .padding(.horizontal, 10)+ .frame(height: 30)+ Rectangle().fill(ink.opacity(0.08)).frame(height: 1)+ }+ }+ }++ private func navButtons(_ p: SpacePalette, ink: Color? = nil) -> some View {+ HStack(spacing: 7) {+ ForEach(["arrow.left", "arrow.right", "arrow.clockwise"], id: \.self) {+ Image(systemName: $0).font(.system(size: 10, weight: .medium)).foregroundStyle(ink.map { $0.opacity(0.45) } ?? p.textTertiary)+ }+ }+ }+}+/// The content pane on the extensions step: a toolbar pill of the picked/// extensions (Dia's screenshot puts its Chat pill there) and their icons.private struct ExtensionsPreview: View {diff --git a/Sources/Cra/UI/Onboarding/ImportFlowViews.swift b/Sources/Cra/UI/Onboarding/ImportFlowViews.swiftindex 16778d2..39dcc37 100644--- a/Sources/Cra/UI/Onboarding/ImportFlowViews.swift+++ b/Sources/Cra/UI/Onboarding/ImportFlowViews.swift@@ -255,10 +255,10 @@ private struct SpacesStep: View {RowTitle(title: "Archived Tabs", caption: "\(plan.archive.count) tabs", c: c)}}- if plan.settings.autoArchive != nil || plan.settings.sidebarWidth != nil {+ if !plan.settings.isEmpty {SelectableRow(c: c, checked: model.includeSettings, toggle: { model.includeSettings.toggle() }) {RowSymbol(name: "gearshape.fill", c: c)- RowTitle(title: "Settings", caption: "Auto-archive and sidebar width", c: c)+ RowTitle(title: "Settings", caption: "Auto-archive, sidebar width and toolbar", c: c)}}}@@ -331,26 +331,32 @@ private struct ProgressStep: View {}.frame(height: 22).offset(y: ImportMetrics.subtitleTop)+ // Up to eight tiles: a fourth row only fits above the notes and the button when the+ // tiles are shorter.+ let compact = model.categories.count > 6+ let gap: CGFloat = compact ? 8 : ImportMetrics.gaplet cols = [GridItem(.fixed(ImportMetrics.card.width), spacing: ImportMetrics.gap),GridItem(.fixed(ImportMetrics.card.width))]- LazyVGrid(columns: cols, alignment: .leading, spacing: ImportMetrics.gap) {- ForEach(model.categories) { CategoryTile(category: $0, c: c) }- }- .frame(width: ImportMetrics.columnWidth, alignment: .topLeading)- .offset(y: ImportMetrics.listTop - 8)- if model.finished {- VStack(alignment: .leading, spacing: 4) {- ForEach(model.failures, id: \.self) { Text($0) }- if model.importedExtensionCount > 0 {- Text("Cra restarts once to load your extensions. Their settings and sign-ins stay in \(model.source?.rawValue ?? "Arc").")- } else if model.credentialsStaged {- Text("Cra restarts once to bring in your passwords and sign-ins.")+ VStack(alignment: .leading, spacing: 12) {+ LazyVGrid(columns: cols, alignment: .leading, spacing: gap) {+ ForEach(model.categories) { CategoryTile(category: $0, c: c, height: compact ? 52 : 64) }+ }+ // The notes follow the grid, so they never run into the tiles.+ if model.finished {+ VStack(alignment: .leading, spacing: 4) {+ ForEach(model.failures, id: \.self) { Text($0).lineLimit(2) }+ if model.importedExtensionCount > 0 {+ Text("Cra restarts once to load your extensions. Their settings and sign-ins stay in \(model.source?.rawValue ?? "Arc").")+ } else if model.credentialsStaged {+ Text("Cra restarts once to bring in your passwords and sign-ins.")+ }}+ .font(.system(size: 12)).foregroundStyle(c.caption)+ .fixedSize(horizontal: false, vertical: true)}- .font(.system(size: 12)).foregroundStyle(c.caption)- .frame(width: ImportMetrics.columnWidth, alignment: .leading)- .offset(y: ImportMetrics.buttonTop - 44)}+ .frame(width: ImportMetrics.columnWidth, alignment: .topLeading)+ .offset(y: ImportMetrics.listTop - 8)PrimaryButton(title: model.needsRelaunch && !model.firstRun && !model.credentialsAttempted ? "Restart Cra" : "Continue",c: c, enabled: model.finished) { model.continueFromProgress() }.offset(x: -1, y: ImportMetrics.buttonTop)@@ -514,6 +520,7 @@ struct ExtensionIcon: View {struct CategoryTile: View {let category: ImportCategorylet c: ImportColors+ var height: CGFloat = 64var body: some View {let shape = RoundedRectangle(cornerRadius: 16, style: .continuous)HStack(spacing: 12) {@@ -535,7 +542,7 @@ struct CategoryTile: View {.transition(.scale.combined(with: .opacity))}.padding(.horizontal, 14)- .frame(width: ImportMetrics.card.width, height: 64)+ .frame(width: ImportMetrics.card.width, height: height).overlay(shape.strokeBorder(c.tileBorder, lineWidth: 1)).animation(.easeOut(duration: 0.2), value: category.state)}diff --git a/Sources/Cra/UI/Onboarding/OnboardingSteps.swift b/Sources/Cra/UI/Onboarding/OnboardingSteps.swiftindex 2cf5c33..efd416c 100644--- a/Sources/Cra/UI/Onboarding/OnboardingSteps.swift+++ b/Sources/Cra/UI/Onboarding/OnboardingSteps.swift@@ -348,26 +348,118 @@ private struct PinCard: View {// MARK: - Personalization (Dia's PersonalizationView)+/// Dia 1.54's PersonalizationView: the colour swatches in one row, then "Choose how you would like+/// to view your tabs:" over two PersonalizationTabLayoutButtons (window illustrations, Dia's+/// TabLayout/* artwork, with a ring around the picked one and its name underneath). Dia picks a+/// tab layout; Cra's two layouts place the address bar (Arc's View ▸ Show Toolbar).struct PersonalizationStep: View {@Bindable var model: ImportFlowModellet c: ImportColors- private let cols = Array(repeating: GridItem(.fixed(44), spacing: 14), count: 6)var body: some View {ZStack(alignment: .topLeading) {StepHeader(title: "Make it yours",- subtitle: "Pick the theme color that feels right for you.", c: c)- LazyVGrid(columns: cols, alignment: .leading, spacing: 14) {+ subtitle: "Pick the theme color and layout that feel right for you.", c: c)+ HStack(spacing: (ImportMetrics.columnWidth - 34 * CGFloat(SpaceTheme.presets.count)) / CGFloat(SpaceTheme.presets.count - 1)) {ForEach(SpaceTheme.presets.indices, id: \.self) { i inThemeSwatch(theme: SpaceTheme.presets[i], on: model.chosenTheme == i, c: c) { model.chooseTheme(i) }}}- .frame(width: ImportMetrics.columnWidth, alignment: .topLeading)+ .frame(width: ImportMetrics.columnWidth, alignment: .leading).offset(y: ImportMetrics.listTop)+ Text("Choose where the address bar goes:")+ .font(.system(size: 13))+ .foregroundStyle(c.body)+ .offset(y: 228)+ HStack(spacing: 12) {+ LayoutTile(toolbar: false, title: "Sidebar", model: model, c: c)+ LayoutTile(toolbar: true, title: "Toolbar", model: model, c: c)+ }+ .offset(y: 252)PrimaryButton(title: "Continue", c: c, enabled: true) { model.continueFromPersonalization() }.offset(x: -1, y: ImportMetrics.buttonTop)}- // Toolbar is Cra's only layout, so there is nothing to pick but the colour.- .onAppear { model.classicLayout = true }+ }+}++/// Dia's PersonalizationTabLayoutButton: the illustration at its 230×180 artwork size scaled to+/// the column, a 3 pt ring when picked, the name in TabLayoutLabelText underneath.+private struct LayoutTile: View {+ let toolbar: Bool+ let title: String+ @Bindable var model: ImportFlowModel+ let c: ImportColors++ private static let width: CGFloat = (ImportMetrics.columnWidth - 12) / 2++ var body: some View {+ let selected = model.classicLayout == toolbar+ let k = Self.width / 230+ VStack(spacing: 7) {+ LayoutArt(toolbar: toolbar, selected: selected, dark: c.dark)+ .frame(width: 230, height: 180)+ .scaleEffect(k, anchor: .topLeading)+ .frame(width: 230 * k, height: 180 * k, alignment: .topLeading)+ // TabLayoutLabelText: black 53% / white 60%.+ Text(title)+ .font(.system(size: 13))+ .foregroundStyle(c.dark ? Color.white.opacity(0.6) : Color.black.opacity(0.53))+ }+ .contentShape(Rectangle())+ .onTapGesture { withAnimation(.easeOut(duration: 0.15)) { model.classicLayout = toolbar } }+ .accessibilityElement(children: .ignore)+ .accessibilityLabel(toolbar ? "Toolbar: the address bar above the page" : "Sidebar: the address bar at the top of the sidebar")+ .accessibilityAddTraits(selected ? [.isButton, .isSelected] : .isButton)+ .accessibilityAction { model.classicLayout = toolbar }+ }+}++/// Drawn after Dia's TabLayout/SidebarSelected and friends (230×180 pt): a 3 pt ring, a 2 pt gap,+/// the window inset 5 pt (radius 10), 5 pt traffic lights, 54×14 pt sidebar rows on a 19 pt pitch+/// and the page pane from x 70. Cra's version marks where the address bar sits: the first sidebar+/// row, or a strip across the top of the page.+private struct LayoutArt: View {+ let toolbar: Bool+ let selected: Bool+ let dark: Bool+ var body: some View {+ let window: Color = dark ? Color(white: 0.2) : Color.black.opacity(0.05)+ let row: Color = dark ? Color(white: 0.36) : Color.black.opacity(0.19)+ let pane: Color = dark ? Color(white: 0.12) : .white+ let accent: Color = dark ? Color(white: 0.62) : Color.black.opacity(0.42)+ ZStack(alignment: .topLeading) {+ RoundedRectangle(cornerRadius: 15, style: .continuous)+ .strokeBorder(dark ? Color(white: 0.8) : Color.black.opacity(0.8), lineWidth: 3)+ .opacity(selected ? 1 : 0)+ RoundedRectangle(cornerRadius: 10, style: .continuous).fill(window)+ .frame(width: 220, height: 170)+ .offset(x: 5, y: 5)+ ForEach(Array(["#FF5F57", "#FEBC2E", "#28C840"].enumerated()), id: \.offset) { i, hex in+ Circle().fill(Color(hex: hex)).frame(width: 5, height: 5)+ .offset(x: 13 + CGFloat(i) * 8.5, y: 14)+ }+ ForEach(0..<3) { i in+ RoundedRectangle(cornerRadius: 4.5, style: .continuous)+ .fill(i == 0 && !toolbar ? accent : row)+ .frame(width: 54, height: 14)+ .offset(x: 10, y: 27 + CGFloat(i) * 19)+ }+ RoundedRectangle(cornerRadius: 6, style: .continuous).fill(pane)+ .frame(width: 150, height: 160)+ .overlay(alignment: .top) {+ if toolbar {+ VStack(spacing: 0) {+ RoundedRectangle(cornerRadius: 3, style: .continuous).fill(accent)+ .frame(width: 70, height: 7)+ .frame(maxWidth: .infinity, alignment: .leading)+ .padding(.horizontal, 8)+ .frame(height: 18)+ Rectangle().fill(dark ? Color.white.opacity(0.08) : Color.black.opacity(0.08)).frame(height: 1)+ }+ }+ }+ .offset(x: 70, y: 10)+ }+ .frame(width: 230, height: 180, alignment: .topLeading)}}@@ -381,9 +473,9 @@ private struct ThemeSwatch: View {Circle().fill(LinearGradient(colors: colors.count > 1 ? colors : [colors.first ?? .gray, colors.first ?? .gray],startPoint: .topLeading, endPoint: .bottomTrailing))- .frame(width: 44, height: 44)+ .frame(width: 34, height: 34).overlay(Circle().strokeBorder(c.ink.opacity(on ? 0.95 : 0), lineWidth: 2).padding(-3))- .overlay(on ? Image(systemName: "checkmark").font(.system(size: 14, weight: .bold)).foregroundStyle(.white).shadow(radius: 1) : nil)+ .overlay(on ? Image(systemName: "checkmark").font(.system(size: 12, weight: .bold)).foregroundStyle(.white).shadow(radius: 1) : nil).contentShape(Circle()).onTapGesture { withAnimation(.easeOut(duration: 0.12)) { tap() } }}diff --git a/Sources/Cra/UI/Sidebar/SidebarRootView.swift b/Sources/Cra/UI/Sidebar/SidebarRootView.swiftindex 56894ac..721f2b6 100644--- a/Sources/Cra/UI/Sidebar/SidebarRootView.swift+++ b/Sources/Cra/UI/Sidebar/SidebarRootView.swift@@ -51,41 +51,64 @@ struct SidebarRootView: View {/// Row 1: traffic lights, the sidebar toggle right after them, nav buttons/// right-aligned (Arc puts them here when the toolbar shows the URL). When the/// toolbar is hidden the URL pill moves into the sidebar on a second row.+///+/// Toolbar hidden, measured on Arc 1.170 (window capture and AX tree, 26 Oct): toggle and+/// ← → ↻ are 32 pt buttons centred 1 pt above the traffic lights, the nav buttons 2 pt apart+/// and 6 pt from the sidebar edge, no ⌄ menu. The URL pill spans the sidebar 8 pt in from+/// each side, 36 pt tall, 2 pt under the title area, radius 10, the bare host in 13 pt at+/// 12 pt in. Its accessories (pinned extensions, copy link, site controls) are absent from+/// the AX tree while the header isn't hovered.struct SidebarTopBar: View {let palette: SpacePalette@Environment(SidebarStore.self) private var store@Environment(SidebarUIState.self) private var ui@Environment(\.sidebarActions) private var actions@State private var hoverPill = false+ @State private var hoverHeader = falsevar body: some View {- VStack(spacing: 4) {+ let compact = !store.settings.showToolbar+ VStack(spacing: 0) {HStack(spacing: 2) {- Spacer().frame(width: 72)+ Spacer().frame(width: compact ? 71 : 72)// The toolbar carries the sidebar toggle; this one only stands in while the toolbar is hidden.- if !store.settings.showToolbar {- SidebarIconButton(symbol: "sidebar.left", palette: palette, help: "Hide Sidebar (⌘S)", iconSize: 15.5, weight: .regular) { actions.toggleSidebar() }+ if compact {+ SidebarIconButton(symbol: "sidebar.left", palette: palette, help: "Hide Sidebar (⌘S)", size: 32, height: 32,+ iconSize: 15.5, weight: .regular, active: ui.appActive) { actions.toggleSidebar() }}Spacer()- if store.settings.showToolbar, let t = store.selectedTab?.tab, store.settings.isDeveloperMode(url: t.url) {+ if compact {+ headerNavButtons+ } else if let t = store.selectedTab?.tab, store.settings.isDeveloperMode(url: t.url) {navButtons}}- .frame(height: 28)- .padding(.top, CraMetrics.titleRowCenter - 14)- .padding(.bottom, CraMetrics.titleAreaHeight - CraMetrics.titleRowCenter - 14)+ .frame(height: compact ? 32 : 28)+ .padding(.top, compact ? CraMetrics.titleRowCenter - 17 : CraMetrics.titleRowCenter - 14)+ .padding(.bottom, compact ? CraMetrics.titleAreaHeight - CraMetrics.titleRowCenter - 15 : CraMetrics.titleAreaHeight - CraMetrics.titleRowCenter - 14).padding(.horizontal, 6).contentShape(Rectangle()).onTapGesture(count: 2) { actions.titleBarDoubleClick() }- if !store.settings.showToolbar {- HStack(spacing: 2) {- navButtons- urlPill- }- .padding(.horizontal, 8)- .padding(.bottom, 4)+ if compact {+ urlPill+ .padding(.horizontal, 8)+ .padding(.top, 2)+ .padding(.bottom, 8)}}+ .onHover { hoverHeader = $0 }+ }++ /// Arc's row-1 ← → ↻ with the toolbar hidden (no ⌄ menu there).+ private var headerNavButtons: some View {+ HStack(spacing: 2) {+ SidebarIconButton(symbol: "arrow.left", palette: palette, help: "Go Back (⌘[)", enabled: ui.canGoBack, size: 32, height: 32,+ iconSize: 15, weight: .regular, active: ui.appActive) { actions.goBack() }+ SidebarIconButton(symbol: "arrow.right", palette: palette, help: "Go Forward (⌘])", enabled: ui.canGoForward, size: 32, height: 32,+ iconSize: 15, weight: .regular, active: ui.appActive) { actions.goForward() }+ SidebarIconButton(symbol: ui.isLoading ? "xmark" : "arrow.clockwise", palette: palette, help: "Refresh (⌘R)", size: 32, height: 32,+ iconSize: 15, weight: .regular, active: ui.appActive) { actions.reload() }+ }}private var navButtons: some View {@@ -115,39 +138,92 @@ struct SidebarTopBar: View {let tab = store.selectedTablet url = tab?.tab?.url ?? ""let host = URL(string: url)?.host ?? ""- let secure = url.hasPrefix("https://")- return Button {- actions.openCommandBar(tab == nil ? .newTab : .editURL)- } label: {- HStack(spacing: 6) {- // Without the toolbar, the nav-bar status ("Copied Current URL") shows here.- if let status = ui.toolbarStatus {- Image(systemName: status.symbol).font(.system(size: 10, weight: .semibold)).foregroundStyle(palette.textSecondary)- Text(status.text)- .font(.system(size: 12.5, weight: .medium))- .foregroundStyle(palette.textSecondary)- .lineLimit(1)- } else {- if tab != nil {- Image(systemName: secure ? "lock.fill" : "globe").font(.system(size: 10, weight: .semibold)).foregroundStyle(palette.textSecondary)+ let shape = RoundedRectangle(cornerRadius: 10, style: .continuous)+ return HStack(spacing: 0) {+ Button {+ actions.openCommandBar(tab == nil ? .newTab : .editURL)+ } label: {+ HStack(spacing: 6) {+ // Without the toolbar, the nav-bar status ("Copied Current URL") shows here.+ if let status = ui.toolbarStatus {+ Image(systemName: status.symbol).font(.system(size: 10, weight: .semibold)).foregroundStyle(palette.textSecondary)+ Text(status.text)+ .font(.system(size: 13))+ .foregroundStyle(palette.textSecondary)+ .lineLimit(1)+ } else {+ Text(tab == nil ? "Search or Enter URL…" : (host.isEmpty ? SuggestionEngine.humanURL(url) : host.replacingOccurrences(of: "www.", with: "")))+ .font(.system(size: 13))+ .foregroundStyle(tab == nil ? palette.textTertiary : palette.textPrimary)+ .lineLimit(1).truncationMode(.middle)}- Text(tab == nil ? "Search or Enter URL…" : (host.isEmpty ? SuggestionEngine.humanURL(url) : host.replacingOccurrences(of: "www.", with: "")))- .font(.system(size: 12.5, weight: .medium))- .foregroundStyle(tab == nil ? palette.textTertiary : palette.textPrimary)- .lineLimit(1).truncationMode(.middle)+ Spacer(minLength: 0)}- Spacer(minLength: 0)+ .id(ui.toolbarStatus?.id)+ .transition(.opacity)+ .padding(.leading, 12)+ .frame(maxHeight: .infinity)+ .contentShape(Rectangle())+ }+ .buttonStyle(.plain)+ if hoverHeader && tab != nil {+ pillAccessories+ .padding(.trailing, 5)+ .transition(.opacity)}- .id(ui.toolbarStatus?.id)- .transition(.opacity)- .padding(.horizontal, 10)- .frame(height: 30)- .background(RoundedRectangle(cornerRadius: 8, style: .continuous).fill(hoverPill ? palette.selectedFill : palette.pillFill))}- .buttonStyle(.plain)+ .frame(height: 36)+ .background(shape.fill(hoverPill ? palette.selectedFill : palette.pillFill))+ .contentShape(shape).onHover { hoverPill = $0 }+ .animation(.easeOut(duration: 0.15), value: hoverHeader).help(url)}++ /// Arc's URL-bar accessories: pinned extensions, Copy Link, then the site controls+ /// (Cra's Extensions menu, the same button as the toolbar's).+ private var pillAccessories: some View {+ let extensions = ExtensionStore.shared+ return HStack(spacing: 1) {+ ForEach(extensions.pinnedIDs, id: \.self) { id in+ if let e = extensions.entries.first(where: { $0.extensionID == id }) {+ PillImageButton(image: e.icon, palette: palette, help: e.name) { actions.runExtension(id) }+ }+ }+ SidebarIconButton(symbol: "link", palette: palette, help: "Copy URL (⇧⌘C)", size: 28, height: 28,+ iconSize: 14, weight: .regular, active: ui.appActive) { actions.performAction("copyURL") }+ if !extensions.entries.isEmpty {+ SidebarIconButton(symbol: "slider.horizontal.2.square", palette: palette, help: "Extensions", size: 28, height: 28,+ iconSize: 15, weight: .regular, active: ui.appActive) { actions.showExtensionsMenu() }+ }+ }+ }+}++/// A pinned extension in the sidebar's URL pill: its icon at 16 pt.+private struct PillImageButton: View {+ let image: NSImage?+ let palette: SpacePalette+ var help: String = ""+ let action: () -> Void+ @State private var hover = false+ var body: some View {+ Button(action: action) {+ Group {+ if let image {+ Image(nsImage: image).resizable().interpolation(.high).aspectRatio(contentMode: .fit)+ } else {+ Image(systemName: "puzzlepiece.extension").resizable().aspectRatio(contentMode: .fit)+ }+ }+ .frame(width: 16, height: 16)+ .frame(width: 28, height: 28)+ .background(RoundedRectangle(cornerRadius: 7, style: .continuous).fill(hover ? palette.hoverFill : .clear))+ }+ .buttonStyle(.plain)+ .onHover { hover = $0 }+ .help(help)+ }}struct SidebarIconButton: View {@@ -156,18 +232,29 @@ struct SidebarIconButton: View {var help: String = ""var enabled: Bool = truevar size: CGFloat = 28+ var height: CGFloat? = nilvar iconSize: CGFloat = 13var weight: Font.Weight = .medium+ /// Header buttons follow the app's active state (nil: the plain sidebar tone).+ var active: Bool? = nillet action: () -> Void@State private var hover = false+ /// Arc 1.170 draws these glyphs at roughly 26% black (sidebar toggle, library, +) while the+ /// app is in the background. With the app active its header glyphs darken to ~59% black;+ /// disabled ones stay at ~24% (light theme, 26 Oct; the dark theme was not measured).+ private var tint: Color {+ if palette.isDark { return enabled ? Color.white.opacity(0.55) : palette.textTertiary.opacity(0.55) }+ guard let active else { return enabled ? Color.black.opacity(0.26) : palette.textTertiary.opacity(0.55) }+ return Color.black.opacity(enabled && active ? 0.59 : 0.24)+ }+var body: some View {Button(action: action) {Image(systemName: symbol).font(.system(size: iconSize, weight: weight))- // Arc 1.170 draws these glyphs at roughly 26% black (sidebar toggle, library, +).- .foregroundStyle(enabled ? (palette.isDark ? Color.white.opacity(0.55) : Color.black.opacity(0.26)) : palette.textTertiary.opacity(0.55))- .frame(width: size, height: min(size, 28))+ .foregroundStyle(tint)+ .frame(width: size, height: height ?? min(size, 28)).background(RoundedRectangle(cornerRadius: 7, style: .continuous).fill(hover && enabled ? palette.hoverFill : .clear))}.buttonStyle(.plain)diff --git a/Sources/Cra/UI/SidebarUIState.swift b/Sources/Cra/UI/SidebarUIState.swiftindex 51fcc46..8b0053d 100644--- a/Sources/Cra/UI/SidebarUIState.swift+++ b/Sources/Cra/UI/SidebarUIState.swift@@ -17,6 +17,8 @@ final class SidebarUIState {var canGoForward = falsevar isLoading = falsevar isCompact = false+ /// Cra is the frontmost app (Arc darkens the sidebar header's glyphs then).+ var appActive = true/// Page theme colour of the visible tab ("#RRGGBB" or "").var pageThemeColor = ""/// Tab chosen from the keyboard; Arc draws its yellow/black dashed ringdiff --git a/Sources/Cra/UI/Windows/FloatingSidebar.swift b/Sources/Cra/UI/Windows/FloatingSidebar.swiftindex e6cdc1c..580751a 100644--- a/Sources/Cra/UI/Windows/FloatingSidebar.swift+++ b/Sources/Cra/UI/Windows/FloatingSidebar.swift@@ -21,9 +21,12 @@ final class FloatingSidebarController {private(set) var isShown = falseprivate var panel: FloatingSidebarPanel?+ /// The sidebar's rounded body; it slides inside the panel (see `panelFrame`).+ private let slider = NSView()private let blur = NSVisualEffectView()private let lift = NSView()private var gradientHost: NSHostingView<SpaceBackground>?+ private var trafficLights: FloatingTrafficLights?enum Metrics {static let edge: CGFloat = 2@@ -76,6 +79,20 @@ final class FloatingSidebarController {return window.convertToScreen(shell.convert(f, to: nil))}+ /// The panel reaches from the window's left edge to the sidebar's right edge, so the+ /// sidebar slides in from the window edge and is clipped there (Arc draws it inside+ /// its window), instead of sliding across whatever lies left of the window.+ private var panelFrame: NSRect {+ let t = targetFrame+ return NSRect(x: window.frame.minX, y: t.minY, width: t.maxX - window.frame.minX, height: t.height)+ }++ /// The sidebar inside the panel: in place, or tucked out past the window edge.+ private func slideFrame(shown: Bool) -> NSRect {+ let t = targetFrame+ return NSRect(x: shown ? t.minX - window.frame.minX : -t.width, y: 0, width: t.width, height: t.height)+ }+private func makePanel() -> FloatingSidebarPanel {let p = FloatingSidebarPanel(contentRect: NSRect(x: 0, y: 0, width: 300, height: 600),styleMask: [.borderless, .nonactivatingPanel], backing: .buffered, defer: false)@@ -87,30 +104,35 @@ final class FloatingSidebarController {p.becomesKeyOnlyIfNeeded = truelet content = NSView(frame: p.contentRect(forFrameRect: p.frame))content.wantsLayer = true- content.layer?.cornerRadius = Metrics.cornerRadius- content.layer?.cornerCurve = .continuous- content.layer?.masksToBounds = truep.contentView = content+ slider.wantsLayer = true+ slider.layer?.cornerRadius = Metrics.cornerRadius+ slider.layer?.cornerCurve = .continuous+ slider.layer?.masksToBounds = true+ content.addSubview(slider)blur.blendingMode = .behindWindowblur.state = .activeblur.autoresizingMask = [.width, .height]- content.addSubview(blur)+ slider.addSubview(blur)lift.wantsLayer = truelift.autoresizingMask = [.width, .height]- content.addSubview(lift)+ slider.addSubview(lift)let g = NSHostingView(rootView: SpaceBackground(palette: palette()))g.sizingOptions = []g.autoresizingMask = [.width, .height]- content.addSubview(g)+ slider.addSubview(g)gradientHost = g+ let lights = FloatingTrafficLights(browserWindow: window)+ lights.willAct = { [weak self] in self?.hide(animated: false) }+ trafficLights = lightsreturn p}private func refreshBackdrop() {- guard let content = panel?.contentView else { return }+ guard panel != nil else { return }let pal = palette()let t = CraTuning.shared- for v in [blur, lift, gradientHost as NSView?].compactMap({ $0 }) { v.frame = content.bounds }+ for v in [blur, lift, gradientHost as NSView?].compactMap({ $0 }) { v.frame = slider.bounds }gradientHost?.rootView = SpaceBackground(palette: pal)blur.isHidden = !pal.vibrantlift.isHidden = !pal.vibrant@@ -124,15 +146,24 @@ final class FloatingSidebarController {isShown = truelet p = panel ?? makePanel()panel = p- let target = targetFrame- p.setFrame(target.offsetBy(dx: -target.width - 20, dy: 0), display: false)+ // The window shadow is traced from the panel's pixels once; it comes on when the+ // sidebar has landed and goes off before it leaves, so no shadow is left behind.+ p.hasShadow = false+ p.setFrame(panelFrame, display: false)+ slider.frame = slideFrame(shown: false)refreshBackdrop()let host = shell.sidebarHosthost.removeFromSuperview()- host.frame = p.contentView!.bounds+ host.frame = slider.boundshost.autoresizingMask = [.width, .height]host.layer?.cornerRadius = 0- p.contentView!.addSubview(host)+ slider.addSubview(host)+ // The window's own traffic lights hide with the sidebar; these stand in at the+ // same spot in the sidebar's top row.+ if let lights = trafficLights {+ lights.setFrameOrigin(NSPoint(x: 13, y: slider.bounds.height - CraMetrics.titleRowCenter - lights.frame.height / 2))+ slider.addSubview(lights, positioned: .above, relativeTo: host)+ }shell.sidebarDetached = trueshell.floatingSidebar = trueif p.parent !== window { window.addChildWindow(p, ordered: .above) }@@ -141,13 +172,18 @@ final class FloatingSidebarController {NSAnimationContext.runAnimationGroup { ctx inctx.duration = Metrics.durationctx.timingFunction = CAMediaTimingFunction(controlPoints: 0.15, 0.7, 0.3, 1)- p.animator().setFrame(target, display: true)+ slider.animator().frame = slideFrame(shown: true)+ } completionHandler: { [weak self] in+ guard let self, self.isShown else { return }+ p.hasShadow = true+ p.invalidateShadow()}}func hide(animated: Bool) {guard isShown, let p = panel else { return }isShown = false+ p.hasShadow = falselet finish = { [weak self] inguard let self else { return }self.window.removeChildWindow(p)@@ -158,7 +194,7 @@ final class FloatingSidebarController {NSAnimationContext.runAnimationGroup { ctx inctx.duration = Metrics.durationctx.timingFunction = CAMediaTimingFunction(controlPoints: 0.15, 0.7, 0.3, 1)- p.animator().setFrame(p.frame.offsetBy(dx: -p.frame.width - 20, dy: 0), display: true)+ slider.animator().frame = slideFrame(shown: false)} completionHandler: { finish() }}@@ -186,11 +222,71 @@ final class FloatingSidebarController {/// Window moved or resized while floating.func reposition() {guard isShown, let p = panel else { return }- p.setFrame(targetFrame, display: true)+ p.setFrame(panelFrame, display: true)+ slider.frame = slideFrame(shown: true)+ p.invalidateShadow()}}final class FloatingSidebarPanel: NSPanel {override var canBecomeKey: Bool { true }override var canBecomeMain: Bool { false }+ /// Keep the stand-in traffic lights in colour, like the window's (CraWindow).+ @objc(_hasActiveAppearanceForStandardWindowButton:)+ func hasActiveAppearance(forStandardWindowButton type: UInt) -> Bool { true }+}++/// Real standard window buttons for the floating sidebar, acting on the browser+/// window rather than on the panel they sit in. AppKit draws the ×/−/+ glyphs+/// only while the buttons' superview answers `_mouseInGroup:` with true.+final class FloatingTrafficLights: NSView {+ unowned let browserWindow: NSWindow+ /// Runs before a button acts (the sidebar gets out of the way first).+ var willAct: () -> Void = {}+ private var mouseInside = false {+ didSet { for b in subviews { b.needsDisplay = true } }+ }+ private var tracking: NSTrackingArea?++ init(browserWindow: NSWindow) {+ self.browserWindow = browserWindow+ super.init(frame: .zero)+ let actions = [#selector(closeWindow), #selector(minimizeWindow), #selector(zoomWindow)]+ var height: CGFloat = 0+ for (i, type) in [NSWindow.ButtonType.closeButton, .miniaturizeButton, .zoomButton].enumerated() {+ guard let b = NSWindow.standardWindowButton(type, for: browserWindow.styleMask) else { continue }+ b.setFrameOrigin(NSPoint(x: CGFloat(i) * 24, y: 0))+ b.target = self+ b.action = actions[i]+ addSubview(b)+ height = max(height, b.frame.height)+ setFrameSize(NSSize(width: b.frame.maxX, height: height))+ }+ autoresizingMask = [.maxXMargin, .minYMargin]+ }++ required init?(coder: NSCoder) { fatalError() }++ @objc(_mouseInGroup:)+ func mouseInGroup(_ button: NSButton) -> Bool { mouseInside }++ override func updateTrackingAreas() {+ super.updateTrackingAreas()+ if let tracking { removeTrackingArea(tracking) }+ let t = NSTrackingArea(rect: bounds, options: [.mouseEnteredAndExited, .activeAlways, .inVisibleRect], owner: self, userInfo: nil)+ addTrackingArea(t)+ tracking = t+ }++ override func mouseEntered(with event: NSEvent) { mouseInside = true }+ override func mouseExited(with event: NSEvent) { mouseInside = false }+ override func viewDidMoveToWindow() { mouseInside = false }++ @objc private func closeWindow() { willAct(); browserWindow.performClose(nil) }+ @objc private func minimizeWindow() { willAct(); browserWindow.performMiniaturize(nil) }+ /// The green button's click: full screen, or zoom with ⌥ held.+ @objc private func zoomWindow() {+ willAct()+ if NSApp.currentEvent?.modifierFlags.contains(.option) == true { browserWindow.zoom(nil) } else { browserWindow.toggleFullScreen(nil) }+ }}diff --git a/Sources/Cra/UI/Windows/MainWindowController.swift b/Sources/Cra/UI/Windows/MainWindowController.swiftindex 40c03e3..f7fea2a 100644--- a/Sources/Cra/UI/Windows/MainWindowController.swift+++ b/Sources/Cra/UI/Windows/MainWindowController.swift@@ -70,6 +70,7 @@ final class MainWindowController: NSWindowController, NSWindowDelegate, BrowserMshell.sidebarVisible = store.prefs.sidebarVisibleshell.showToolbar = store.settings.showToolbarlastSidebarVisible = store.prefs.sidebarVisible+ window.trafficLightsHidden = !store.prefs.sidebarVisiblelastSidebarWidth = CGFloat(store.prefs.sidebarWidth)window.contentView = shellwindow.backgroundColor = NSColor(palette.gradientColors.first ?? .gray)@@ -120,10 +121,10 @@ final class MainWindowController: NSWindowController, NSWindowDelegate, BrowserMshell.onPaneFrames = { [weak self] frames in self?.positionPageWindows(frames) }shell.onAnimatePaneFrames = { [weak self] frames, d in self?.animatePageWindows(to: frames, duration: d) }NotificationCenter.default.addObserver(forName: NSApplication.didBecomeActiveNotification, object: nil, queue: .main) { [weak self] _ in- Task { @MainActor in self?.shell.windowActive = true }+ Task { @MainActor in self?.shell.windowActive = true; self?.sidebarUI.appActive = true }}NotificationCenter.default.addObserver(forName: NSApplication.didResignActiveNotification, object: nil, queue: .main) { [weak self] _ in- Task { @MainActor in self?.shell.windowActive = false }+ Task { @MainActor in self?.shell.windowActive = false; self?.sidebarUI.appActive = false }}}@@ -240,6 +241,7 @@ final class MainWindowController: NSWindowController, NSWindowDelegate, BrowserMif store.prefs.sidebarVisible != lastSidebarVisible {lastSidebarVisible = store.prefs.sidebarVisible+ (window as? CraWindow)?.trafficLightsHidden = !lastSidebarVisible// Anchoring while the sidebar floats: bring it home first so it slides from there.if lastSidebarVisible { floatingSidebar?.prepareForAnchoring() }shell.animateSidebar(visible: lastSidebarVisible, floating: false, fullscreen: shell.contentFullscreen, width: shell.sidebarWidth)@@ -949,12 +951,24 @@ final class MainWindowController: NSWindowController, NSWindowDelegate, BrowserMreturn (onScreen.maxY - (store.settings.showToolbar ? CraMetrics.toolbarHeight : 0), onScreen.maxX)}+ /// Where a popup from a URL-bar button hangs: under the toolbar, or, with the toolbar+ /// hidden, under the sidebar's URL pill (also while the sidebar floats in its panel).+ private func urlBarBottomOnScreen() -> CGFloat? {+ guard !store.settings.showToolbar else { return toolbarBottomOnScreen()?.y }+ let host = shell.sidebarHost+ guard let w = host.window else { return nil }+ let rect = w.convertToScreen(host.convert(host.bounds, to: nil))+ // SidebarTopBar: title area, 2 pt, then the 36 pt pill.+ return rect.maxY - CraMetrics.titleAreaHeight - 2 - 36+ }+/// Runs an extension's toolbar action on the focused page, like Arc's toolbar buttons and/// Dia's Extensions menu. The popup hangs under the toolbar, its right edge at `buttonRightX`/// (screen x; nil = the card's right end, for the menu bar).func runExtensionAction(_ id: String, buttonRightX: CGFloat? = nil) {guard let bar = toolbarBottomOnScreen(), let browser = currentBrowser else { openExtensionPopupPage(id); return }- let anchor = NSPoint(x: buttonRightX ?? bar.cardMaxX - 8, y: bar.y)+ let y = buttonRightX != nil ? (urlBarBottomOnScreen() ?? bar.y) : bar.y+ let anchor = NSPoint(x: buttonRightX ?? bar.cardMaxX - 8, y: y)Task {if await !ExtensionActions.shared.run(id, on: browser, anchor: anchor) { self.openExtensionPopupPage(id) }}@@ -975,9 +989,9 @@ final class MainWindowController: NSWindowController, NSWindowDelegate, BrowserM/// Arc's toolbar Extensions button: the same menu as the menu bar's Extensions menu,/// dropped just under the button.private func showToolbarExtensionsMenu() {- guard let window, let content = window.contentView, let bar = toolbarBottomOnScreen() else { return }+ guard let window, let content = window.contentView, let y = urlBarBottomOnScreen() else { return }let menu = toolbarExtensionsMenu.makeMenu()- let point = window.convertPoint(fromScreen: NSPoint(x: NSEvent.mouseLocation.x - 14, y: bar.y - 2))+ let point = window.convertPoint(fromScreen: NSPoint(x: NSEvent.mouseLocation.x - 14, y: y - 2))menu.popUp(positioning: nil, at: content.convert(point, from: nil), in: content)}@@ -1251,9 +1265,66 @@ final class CraWindow: NSWindow {}}+ /// The strip above the content card (the window's inset margin) stands in for the+ /// title bar there. It reaches 4 pt into the toolbar card, above its buttons, so a+ /// press just past the card's edge still counts. Movable-by-background only drags,+ /// and the toolbar takes a click as "edit URL", so the strip's presses are handled+ /// here: a double-click runs the title bar action, anything else drags the window.+ private static let titleStripHeight = CraMetrics.contentInset + 4++ override func sendEvent(_ event: NSEvent) {+ if event.type == .leftMouseDown, !styleMask.contains(.fullScreen),+ let content = contentView, event.locationInWindow.y >= content.bounds.height - Self.titleStripHeight,+ isTitleStrip(content.hitTest(content.convert(event.locationInWindow, from: nil))) {+ if event.clickCount == 2 { performTitleDoubleClickAction() } else { performDrag(with: event) }+ return+ }+ super.sendEvent(event)+ }++ /// False over the sidebar (its header handles its own clicks) and while the page+ /// fills the window (no margin, no toolbar).+ private func isTitleStrip(_ view: NSView?) -> Bool {+ var v = view+ while let current = v {+ if current is SidebarHostingView { return false }+ if let shell = current as? ShellView, shell.contentFullscreen { return false }+ v = current.superview+ }+ return view != nil+ }++ /// Arc hides the traffic lights with the sidebar; the floating sidebar carries its+ /// own set (FloatingSidebarController). Full screen keeps them in the revealed title bar.+ var trafficLightsHidden = false {+ didSet { if trafficLightsHidden != oldValue { updateTrafficLights(animated: isVisible) } }+ }+ private var appliedTrafficLightsHidden = false++ private func updateTrafficLights(animated: Bool) {+ let hide = trafficLightsHidden && !styleMask.contains(.fullScreen)+ guard hide != appliedTrafficLightsHidden else { return }+ appliedTrafficLightsHidden = hide+ let buttons = [NSWindow.ButtonType.closeButton, .miniaturizeButton, .zoomButton].compactMap { standardWindowButton($0) }+ guard animated else {+ for b in buttons { b.alphaValue = hide ? 0 : 1; b.isHidden = hide }+ return+ }+ if !hide { for b in buttons { b.isHidden = false } }+ // Same timing as the sidebar's slide (ShellView.animateSidebar).+ NSAnimationContext.runAnimationGroup { ctx in+ ctx.duration = 0.085+ for b in buttons { b.animator().alphaValue = hide ? 0 : 1 }+ } completionHandler: { [weak self] in+ guard let self, self.appliedTrafficLightsHidden == hide else { return }+ for b in buttons { b.isHidden = hide }+ }+ }+override func layoutIfNeeded() {super.layoutIfNeeded()positionTrafficLights()+ updateTrafficLights(animated: false)}override func makeKeyAndOrderFront(_ sender: Any?) {diff --git a/Sources/CraCEF/CraCEF.mm b/Sources/CraCEF/CraCEF.mmindex 789c510..03a9e32 100644--- a/Sources/CraCEF/CraCEF.mm+++ b/Sources/CraCEF/CraCEF.mm@@ -1631,6 +1631,20 @@ static void MarkProfileExitedCleanly(NSString* cachePath) {[super sendEvent:event];}+// Pages, DevTools and panels are child windows docked over the main window, and+// the page is usually key. Window managers (Rectangle, Magnet, Raycast) move+// the AX focused window, which tore the page off its dock instead of moving+// Cra; hand them the top-level window the child belongs to.+static id CraTopLevelWindow(id element) {+ if (![element isKindOfClass:[NSWindow class]]) return element;+ NSWindow* w = element;+ while (w.parentWindow) w = w.parentWindow;+ return w;+}++- (id)accessibilityFocusedWindow { return CraTopLevelWindow([super accessibilityFocusedWindow]); }+- (id)accessibilityMainWindow { return CraTopLevelWindow([super accessibilityMainWindow]); }+// Cmd-Q, the Dock, logout: give the delegate a say, then tear Chromium down// in order (browsers first, then the message loop, then CefShutdown in main).- (void)terminate:(id)sender {diff --git a/docs/arc-reverse-engineering.md b/docs/arc-reverse-engineering.mdindex 0b1317d..e290bd7 100644--- a/docs/arc-reverse-engineering.md+++ b/docs/arc-reverse-engineering.md@@ -1100,6 +1100,44 @@ Dark mode only; light mode was not observed.- [U] Light-mode colours, the popup option lists, the Shortcuts details pane, hover states(the source list has none), and the "Advanced Settings" ad-block dialog were not opened.+## Sidebar header with the toolbar hidden (Arc 1.170, 26 Oct 2026)++Sources: a 1x window capture of the running Arc (light "Victor" space, sidebarWidth 347, app in the+background, pointer elsewhere), its AX tree, Victor's screenshot of the active window, and strings in+the arm64 slice. [O] = observed, [I] = inferred.++- [O] Arc's preference is `topBarURLEnabled` in company.thebrowser.Browser (View ▸ Show Toolbar).+- [O] Row 1 (AX): traffic lights 16×16 at x 12/35/58, y 16. Sidebar toggle 32×32 at x 77, y 7. Go back, Go forward+ and Reload are 32×32 at x 241/275/309 (2 pt apart, ending 6 pt from the sidebar edge), y 7. No ⌄ menu.+- [O] Row 2: the URL pill spans x 8…338 (8 pt in from both sides of a 347 pt sidebar), y 46…81 (36 pt), corner+ radius ≈10, fill ≈5% black over the light theme. It shows only the host ("youtube.com", no lock or globe):+ AX static text at x 20, 13 pt regular (ink 77 pt wide, the width of SF 13 regular). Favorites start at y 90.+- [O] Glyph tones, light theme: app in the background, every header glyph ≈22% black. App active (Victor's+ screenshot), enabled glyphs ≈59% black, disabled ← → ≈24%, host text ≈87%.+- [O] Victor's screenshot of the active window shows accessories at the pill's right end: pinned extensions+ (1Password, a purple "D"), a link glyph and a slider-square glyph, about 29 pt apart, the last ~19 pt from the+ pill's edge. In the background capture none of them exist in the AX tree.+- [I] They appear while the header is hovered: the binary has `isHeaderViewHovered`, `isSidebarHovered`,+ `CopyLinkContentView` and `SiteControlCenter*` types (`Arc.SidebarHeaderView`, `URLField`,+ `shouldDisplayURLField`). Their show/hide timing was not recorded, and the dark theme was not measured.++## Dia personalization tab-layout picker (Dia 1.54.2, 26 Oct 2026, static)++- [O] Strings: title "Make it yours" (Cra's), subtitle "Pick the theme color and layout that feel right for you.",+ section "Choose how you would like to view your tabs:", plus a classic-layout title and qualifier (short+ literals inlined in code, not recovered). Views: `Onboarding.PersonalizationView`, `PersonalizationContentView`,+ `PersonalizationColorButton`, `PersonalizationTabLayoutButton`.+- [O] Assets (BoostBrowser_Onboarding.bundle): `TabLayout/SidebarSelected|Unselected`,+ `TabLayout/TopOfWindowSelected|Unselected`, 230×180 pt PDFs with light and dark variants; `TabLayoutLabelText`+ black 53% / white 60%. Settings ▸ Tabs reuses the same art at 142×135 ("Top of Window" / "Sidebar").+- [O] Art geometry (pt): selected ring 3 pt (black 80% / #CCCCCC), 2 pt gap, window inset 5 pt with radius 10+ (black 5% / #333333), traffic lights 5 pt, sidebar rows 54×14 at x 10, y 27 + 19n (black 19% / #5C5C5C), page+ pane x 70…220, y 10…170 (white / #1F1F1F). The top-of-window variant has a 19 pt tab strip at black 10%.+- [O] The art panel swaps whole screenshots per colour and layout: `RebrandPersonalization<Colour>Sidebar|TopBar`+ (448×544) in BoostBrowser_Unboxing.bundle.+- Cra draws its own tiles to these measurements (no Dia artwork): the first sidebar row or a strip across the+ page marks where the address bar sits.+## Software updates (Arc 1.170, 26 Oct 2026, static + one live check)- [O] Arc bundles Sparkle 2.9.4 (Frameworks/Sparkle.framework, CFBundleShortVersionString 2.9.4). Info.plist:`SUFeedURL` https://releases.arc.net/updates.xml, `SUPublicEDKey` (EdDSA-signed archives), `SUEnableAutomaticChecks`,