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.
Move Tab to Space N (⌃⌘1–9) follows the tab, like Arc's command bar (#95)
Victor Kildahl2021ad69d6d3
diff --git a/Sources/Cra/App/AppDelegate.swift b/Sources/Cra/App/AppDelegate.swiftindex caf3906..98514a6 100644--- a/Sources/Cra/App/AppDelegate.swift+++ b/Sources/Cra/App/AppDelegate.swift@@ -33,7 +33,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {"nextTab", "previousTab", "recentTab", "recentTabBackward", "nextSpace", "previousSpace", "devTools", "jsConsole", "inspectElement","viewArchive", "openLibrary", "settings", "clearToday", "newLittleWindow", "promoteLittleWindow","addSplitView", "closeSplitPane",- ] + (1...9).flatMap { ["item\($0)", "space\($0)"] })+ ] + (1...9).flatMap { ["item\($0)", "space\($0)", "moveTabToSpace\($0)"] })// MARK: Lifecycle@@ -646,6 +646,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {case "addSplitView": return store.selectedTabID != nilcase "editSpace", "deleteSpace", "nextSpace", "previousSpace", "manageSpaces": return !main.isIncognitocase "closeLittleWindows": return !littleWindows.isEmpty+ case let id? where id.hasPrefix("moveTabToSpace"): return store.selectedTabID != nil && !main.isIncognitodefault: break}return true@@ -849,6 +850,8 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {if n - 1 < tabs.count { store.selectTab(tabs[n - 1].id) }} else if id.hasPrefix("space"), let n = Int(id.dropFirst(5)) {if n - 1 < store.spaceOrder.count { store.focusSpace(store.spaceOrder[n - 1]) }+ } else if id.hasPrefix("moveTabToSpace"), let n = Int(id.dropFirst(14)) {+ if let c = current, n - 1 < store.spaceOrder.count { store.moveTabAndFollow(c, toSpace: store.spaceOrder[n - 1]) }}}}@@ -991,6 +994,8 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {spaces.addItem(item("editSpace")); spaces.addItem(item("deleteSpace")); spaces.addItem(item("manageSpaces"))spaces.addItem(.separator())for n in 1...9 { spaces.addItem(item("space\(n)")) }+ spaces.addItem(.separator())+ for n in 1...9 { spaces.addItem(item("moveTabToSpace\(n)")) }menubar.addItem(submenu: spaces, title: "Spaces")let tabs = NSMenu(title: "Tabs")diff --git a/Sources/Cra/App/KeyBindings.swift b/Sources/Cra/App/KeyBindings.swiftindex cd0602c..d122eee 100644--- a/Sources/Cra/App/KeyBindings.swift+++ b/Sources/Cra/App/KeyBindings.swift@@ -219,6 +219,12 @@ final class KeyBindingRegistry {list.append(KeyAction(id: "space\(n)", name: "Go to Space \(n)", section: .spaces,shortcuts: [Shortcut("\(n)", .control)], inCommandBar: false))}+ // Arc has no default for this (its command bar's "Move to Today in <space>" has no key);+ // ⌃⌘N adds ⌘ to Go to Space N (#86). Neither Arc nor macOS binds ⌃⌘1–9.+ for n in 1...9 {+ list.append(KeyAction(id: "moveTabToSpace\(n)", name: "Move Tab to Space \(n)", section: .spaces,+ shortcuts: [Shortcut("\(n)", [.command, .control])], inCommandBar: false))+ }return list}()}diff --git a/Sources/Cra/Services/SidebarStore.swift b/Sources/Cra/Services/SidebarStore.swiftindex 1a5c406..ec5a841 100644--- a/Sources/Cra/Services/SidebarStore.swift+++ b/Sources/Cra/Services/SidebarStore.swift@@ -940,10 +940,33 @@ final class SidebarStore {}func moveTab(_ id: UUID, toSpace sid: UUID) {- guard let space = spaces[sid] else { return }- if isFavorite(id) { return moveItem(id, to: space.favoritesContainerID, index: nil) }- let pinned = isPinned(id)- moveItem(id, to: pinned ? space.pinnedContainerID : space.todayContainerID, index: pinned ? nil : 0)+ guard let space = spaces[sid], let it = items[id] else { return }+ let from = spaceID(ofItem: id)+ let moved = Set([id] + it.children)+ if isFavorite(id) {+ moveItem(id, to: space.favoritesContainerID, index: nil)+ } else {+ let pinned = isPinned(id)+ moveItem(id, to: pinned ? space.pinnedContainerID : space.todayContainerID, index: pinned ? nil : 0)+ }+ // A window that had it open in the old space picks the next tab there, as on close.+ guard let from, from != sid, spaceID(ofItem: id) == sid else { return }+ for w in prefs.windows {+ guard let sel = w.selectedTabPerSpace[from], moved.contains(sel) else { continue }+ updateWindow(w.id) { $0.selectedTabPerSpace[from] = nextSelection(after: it, in: from) }+ }+ }++ /// Arc's command bar "Move to Today in <space>": the tab goes to that space and the+ /// window follows it there with the tab still selected. A pane brings its split along.+ @discardableResult+ func moveTabAndFollow(_ id: UUID, toSpace sid: UUID, window: UUID? = nil) -> Bool {+ let moving = splitContaining(id)?.id ?? id+ guard items[id]?.isTab == true, spaces[sid] != nil, spaceID(ofItem: moving) != sid else { return false }+ moveTab(moving, toSpace: sid)+ guard spaceID(ofItem: moving) == sid else { return false }+ selectTab(id, window: window)+ return true}// MARK: Foldersdiff --git a/Sources/Cra/UI/Settings/ShortcutsPane.swift b/Sources/Cra/UI/Settings/ShortcutsPane.swiftindex 24a1e1a..879c555 100644--- a/Sources/Cra/UI/Settings/ShortcutsPane.swift+++ b/Sources/Cra/UI/Settings/ShortcutsPane.swift@@ -240,6 +240,7 @@ enum ShortcutDescriptions {if let t = table[a.id] { return t }if a.id.hasPrefix("item"), let n = a.id.dropFirst(4).first { return "Switch to the \(n). tab in the sidebar." }if a.id.hasPrefix("space"), let n = a.id.dropFirst(5).first { return "Switch to the \(n). space." }+ if a.id.hasPrefix("moveTabToSpace"), let n = a.id.dropFirst(14).first { return "Move the current tab to the \(n). space and switch to it." }return a.name + "."}diff --git a/Sources/Cra/UI/Windows/MainWindowController.swift b/Sources/Cra/UI/Windows/MainWindowController.swiftindex 9083f2e..44fdb4d 100644--- a/Sources/Cra/UI/Windows/MainWindowController.swift+++ b/Sources/Cra/UI/Windows/MainWindowController.swift@@ -2152,7 +2152,7 @@ final class MainWindowController: NSWindowController, NSWindowDelegate, BrowserMcase .switchSpace(let id):store.focusSpace(id, window: windowID)case .moveToSpace(let id):- if let t = selectedTabID { store.moveTab(t, toSpace: id) }+ if let t = selectedTabID { store.moveTabAndFollow(t, toSpace: id, window: windowID) }case .moveToFolder(let id):if let t = selectedTabID { store.moveItem(t, to: id, index: nil) }}diff --git a/Tests/StoreTests.swift b/Tests/StoreTests.swiftindex 735989c..0db08dc 100644--- a/Tests/StoreTests.swift+++ b/Tests/StoreTests.swift@@ -27,6 +27,7 @@ enum StoreTests {persistenceFaults()incognitoStaysOffDisk()pinnedURL()+ moveTabToSpace()print("Store: \(checks) checks passed")}@@ -333,6 +334,54 @@ enum StoreTests {expect(store.integrityProblems().isEmpty, "and the sidebar stays sound")}+ /// Move Tab to Space N (#86) and the command bar's Move Tab to <space>, like Arc's "Move to+ /// Today in <space>": the tab goes to the top of the other space's Today, the window follows+ /// it there with the tab selected, and the space it left opens another tab.+ @MainActor+ private static func moveTabToSpace() {+ let store = AppComposition(clock: ManualScheduler()).store+ let home = store.focusedSpaceID+ let work = store.createSpace(title: "Work", emoji: "💼", focus: false).id+ _ = store.createTab(url: "https://example.com/work", in: work, select: false)+ let stay = store.createTab(url: "https://example.com/stay")+ let tab = store.createTab(url: "https://example.com/move")+ let other = store.addWindow(spaceID: home, frame: nil)+ store.selectTab(tab.id, window: other.id)+ expect(store.moveTabAndFollow(tab.id, toSpace: work), "a tab moves to another space")+ expect(store.focusedSpaceID == work && store.selectedTabID == tab.id, "the window follows it there with the tab selected")+ expect(store.children(of: store.space(work)!.todayContainerID).first?.id == tab.id, "it lands at the top of Today")+ expect(store.selectedTabID(in: home) == stay.id, "the space it left goes back to the tab it came from")+ expect(store.focusedSpaceID(window: other.id) == home && store.selectedTabID(in: home, window: other.id) == stay.id,+ "another window that had it open stays in its space and opens the next tab")+ expect(!store.moveTabAndFollow(tab.id, toSpace: work) && store.focusedSpaceID == work, "moving to its own space does nothing")+ expect(!store.moveTabAndFollow(tab.id, toSpace: UUID()) && store.spaceID(ofItem: tab.id) == work, "nor does a space that isn't there")++ let pinned = store.createTab(url: "https://example.com/pinned", pinned: true)+ expect(store.moveTabAndFollow(pinned.id, toSpace: home) && store.isPinned(pinned.id) && store.spaceID(ofItem: pinned.id) == home,+ "a pinned tab stays pinned in the new space")+ expect(store.selectedTabID(in: work) != pinned.id, "and leaves no selection behind")++ let left = store.createTab(url: "https://example.com/left")+ let right = store.createTab(url: "https://example.com/right", select: false)+ let split = store.createSplit(with: [left.id, right.id])!+ store.selectTab(right.id)+ expect(store.moveTabAndFollow(right.id, toSpace: work) && store.spaceID(ofItem: split.id) == work+ && store.children(of: split.id).map(\.id) == [left.id, right.id], "a pane brings its whole split")+ expect(store.focusedSpaceID == work && store.selectedTabID == right.id, "with the same pane focused")++ store.selectTab(stay.id)+ store.moveTab(stay.id, toSpace: work)+ expect(store.focusedSpaceID == home && store.selectedTabID(in: home) != stay.id,+ "the context menu's move stays in the space and opens another tab there")++ let incognito = store.addIncognitoWindow(frame: nil)+ let secret = store.createTab(url: "https://example.com/secret", window: incognito.id)+ expect(!store.moveTabAndFollow(secret.id, toSpace: home, window: incognito.id)+ && store.isIncognito(item: secret.id) && store.focusedSpaceID(window: incognito.id) != home,+ "an incognito tab never leaves its window")+ expect(store.integrityProblems().isEmpty, "the sidebar stays sound")+ }+private static func expect(_ condition: @autoclosure () -> Bool, _ message: String) {guard condition() else {FileHandle.standardError.write(Data("FAIL: \(message)\n".utf8))diff --git a/docs/arc-reverse-engineering.md b/docs/arc-reverse-engineering.mdindex 117276e..3558a47 100644--- a/docs/arc-reverse-engineering.md+++ b/docs/arc-reverse-engineering.md@@ -2114,3 +2114,19 @@ Two new Arc windows, both with View ▸ Hide Sidebar and a tab selected, capture- [U] An inactive Arc (another app frontmost); hidden-sidebar windows of other apps over Arc's edge.- Cra: `FloatingSidebarController.isKey` gates both reveal paths (the 30 Hz poll and the shell's trackingarea): this window, or one of its child windows (page, DevTools, the floating panel), must be key.++## Moving a tab to another space (Arc 1.171, 2 Nov 2026, issue #86)+- [O AX] No key binding: Arc's menu bar has no move-to-space item (Spaces: New Space…, Edit Theme…, Rename Space,+ Change Profile, Next/Previous Space ⌥⌘→/←, one item per space ⌃1…, Manage Spaces…; Tabs has none either), and+ the binary's `moveToSpace` / `moveToSpaceTabContextMenuOption` are analytics names, not key-binding actions.+- [O] Command bar: typing "move" on a Today tab lists "Move to Today in <space chip>" for each other space, with no+ shortcut glyph (strings also have "Move to Pinned in <space>"). Choosing it closes the bar, takes the row out of+ the old list, then plays the ordinary space switch (list slides, theme cross-fades, ~300 ms): the window follows+ the tab, which sits at the top of the new space's Today, selected, page unchanged. Recording `arc-move.mov`+ (scratch, 40 fps), not kept.+- [U] What the space the tab left selects afterwards, and whether the sidebar's Move to ▸ also follows: other+ sessions were driving Arc at the time and a posted ⌃2 never reached the window.+- Cra: `SidebarStore.moveTabAndFollow` for the command bar's Move Tab to <space> and the new Move Tab to Space N+ (⌃⌘1–9, Cra's own: ⌘ added to Go to Space N; neither Arc nor macOS binds ⌃⌘ + a digit). A pane brings its split.+ The sidebar menu's Move to Space keeps the window where it is. Whatever moves, a window that had it open in the+ old space opens the next tab there, picked as on close.