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.
sidebar space collapse
Victor1f7cf3a96ce2
diff --git a/Sources/Cra/Services/SidebarStore.swift b/Sources/Cra/Services/SidebarStore.swiftindex fb2726b..cd73bb8 100644--- a/Sources/Cra/Services/SidebarStore.swift+++ b/Sources/Cra/Services/SidebarStore.swift@@ -696,6 +696,12 @@ final class SidebarStore {if expanded { prefs.expandedFolders.insert(id) } else { prefs.expandedFolders.remove(id) }}+ /// Arc's spacesWithCollapsedPinnedSections: clicking the space name hides its pinned tabs.+ func isPinnedCollapsed(_ spaceID: UUID) -> Bool { prefs.collapsedPinnedSpaces.contains(spaceID) }+ func togglePinnedCollapsed(_ spaceID: UUID) {+ if prefs.collapsedPinnedSpaces.remove(spaceID) == nil { prefs.collapsedPinnedSpaces.insert(spaceID) }+ }+// MARK: Archivefunc archiveTab(_ id: UUID, reason: ArchiveReason) {diff --git a/Sources/Cra/UI/Sidebar/SidebarRootView.swift b/Sources/Cra/UI/Sidebar/SidebarRootView.swiftindex 721f2b6..9ffdc20 100644--- a/Sources/Cra/UI/Sidebar/SidebarRootView.swift+++ b/Sources/Cra/UI/Sidebar/SidebarRootView.swift@@ -366,7 +366,12 @@ struct SpaceSectionView: View {private var rows: some View {let todayItems = store.children(of: space.todayContainerID)- let pinnedItems = store.children(of: space.pinnedContainerID)+ var pinnedItems = store.children(of: space.pinnedContainerID)+ // Collapsed, only the pinned tab you are on stays in the list.+ if store.isPinnedCollapsed(space.id) {+ let selected = store.selectedTabID(in: space.id).flatMap { store.splitContaining($0) ?? store.item($0) }+ pinnedItems = selected.flatMap { store.rootContainer(of: $0.id) == .pinned(spaceID: space.id) ? [$0] : nil } ?? []+ }return VStack(alignment: .leading, spacing: 0) {VStack(spacing: CraMetrics.rowSpacing) {ForEach(pinnedItems) { item in@@ -418,16 +423,15 @@ struct SpaceHeader: View {@Environment(\.sidebarActions) private var actions@State private var hover = false+ private var collapsed: Bool { store.isPinnedCollapsed(space.id) }++ private func toggle() {+ withAnimation(.easeInOut(duration: 0.25)) { store.togglePinnedCollapsed(space.id) }+ }++ // Arc: a click on the space name collapses or expands the pinned tabs; the menu is on right-click.var body: some View {- Menu {- Button("Edit Space…") { actions.editSpace(space) }- Button("New Folder") { actions.performAction("newFolder") }- Divider()- Button("Clear Today") { store.clearToday(space.id) }- Divider()- Button("New Space…") { actions.editSpace(nil) }- Button("Delete Space…") { actions.performAction("deleteSpace") }- } label: {+ Button(action: toggle) {HStack(spacing: 8) {Text(space.emoji).font(.system(size: 12))Text(space.title)@@ -437,6 +441,7 @@ struct SpaceHeader: View {Image(systemName: "chevron.down").font(.system(size: 8, weight: .bold)).foregroundStyle(palette.textTertiary)+ .rotationEffect(.degrees(collapsed ? -90 : 0)).opacity(hover ? 1 : 0)Spacer()}@@ -445,10 +450,19 @@ struct SpaceHeader: View {.background(RoundedRectangle(cornerRadius: 8).fill(hover ? palette.hoverFill : .clear)).contentShape(Rectangle())}- .menuStyle(.button).buttonStyle(.plain)- .menuIndicator(.hidden).onHover { hover = $0 }+ .contextMenu {+ Button(collapsed ? "Expand Pinned Tabs" : "Collapse Pinned Tabs", action: toggle)+ Divider()+ Button("Edit Space…") { actions.editSpace(space) }+ Button("New Folder") { actions.performAction("newFolder") }+ Divider()+ Button("Clear Today") { store.clearToday(space.id) }+ Divider()+ Button("New Space…") { actions.editSpace(nil) }+ Button("Delete Space…") { actions.performAction("deleteSpace") }+ }}}diff --git a/Sources/CraCEF/CraCEF.mm b/Sources/CraCEF/CraCEF.mmindex 61235c2..3a54008 100644--- a/Sources/CraCEF/CraCEF.mm+++ b/Sources/CraCEF/CraCEF.mm@@ -262,6 +262,16 @@ public:}}+ // Chromium copies --remote-debugging-pipe to renderers, where it turns on+ // navigator.webdriver ("automation controlled"). Google sign-in then refuses+ // with "This browser or app may not be secure". The copy happens after this+ // hook, so removing the switch here does nothing; switch the feature off.+ void OnBeforeChildProcessLaunch(CefRefPtr<CefCommandLine> command_line) override {+ if (command_line->GetSwitchValue("type") == "renderer") {+ command_line->AppendSwitchWithValue("disable-blink-features", "AutomationControlled");+ }+ }+// Another Cra process started (LaunchServices, `open -n`). Chromium's// process singleton hands its command line to us. Without this CEF opens// a stock Chrome-style window.diff --git a/docs/arc-reverse-engineering.md b/docs/arc-reverse-engineering.mdindex f50fa80..5da38e2 100644--- a/docs/arc-reverse-engineering.md+++ b/docs/arc-reverse-engineering.md@@ -33,6 +33,12 @@ Legend: [O] observed in shipped artifact or data file, [I] inference, [U] unknow- [O] Section chrome: UnpinnedSectionDivider/Header (the line between pinned and Today), SidebarClearButton,SidebarTidyButton, SidebarPlusButton (new tab button with menu: newTab/newFolder/newEasel/newNote/newSpace),PinnedSectionExpansionState, spacesWithCollapsedPinnedSections.+- [O strings] Pinned-section collapse (Arc 1.170): actions collapsePinnedSection/expandPinnedSection, menu titles+ "Collapse Pinned Tabs"/"Expand Pinned Tabs" (not in the main menu bar, so they live on the space header),+ a separate spaceHeaderContextMenu, analytics event pinnedSectionToggled, onResetVisiblePinnedTabsRequested.+ StorableWindows.json keeps windows[].spacesWithCollapsedPinnedSections (per window). [I] Clicking the space+ name toggles it and the active pinned tab stays visible; not observed live (Arc's window sat on another+ macOS Space and ignored synthetic input, 26 Oct). Cra: WindowPrefs.collapsedPinnedSpaces, SpaceHeader.## Window state (StorableWindows.json)- [O] sidebarWidth 328, sidebarMode "anchored" (binary also has floating, hidden, collapsed), focusedSpaceID, lastFocusedSpaceID,