Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
1ed9caa
docs(split-view): probe Arc's drop UI and pinned split panes
itsjoshpark Nov 26, 2026
4e97dd9
feat(split-view): add splits to the engine and the contract
itsjoshpark Nov 26, 2026
6ac3f3a
fix(split-view): find a tab's strip through its window
itsjoshpark Nov 26, 2026
42a8912
feat(split-view): show splits in the window and the sidebar
itsjoshpark Nov 26, 2026
645c56a
feat(split-view): add the menus, runtime tests, docs and release note
itsjoshpark Nov 26, 2026
48ea6a3
test(split-view): fix the runtime tests' menus, clicks and time limits
itsjoshpark Nov 26, 2026
62519b5
test(split-view): step off the split and back with Ctrl+Tab
itsjoshpark Nov 26, 2026
fa16ece
test(split-view): make the pane visibilities constants
itsjoshpark Nov 26, 2026
e627250
fix(split-view): disable Tab › Split with Tab while split
itsjoshpark Nov 26, 2026
c6c3344
fix(split-view): load URLs in a favorited split's pane
itsjoshpark Nov 26, 2026
8c3eb63
fix(split-view): close panes from their chips, snap the divider, fade…
itsjoshpark Nov 26, 2026
77b59be
docs(split-view): describe closing a pane from its chip
itsjoshpark Nov 26, 2026
eafbf03
fix(split-view): align the split menu and track the hovered chip from…
itsjoshpark Nov 26, 2026
d3fa6b3
fix(split-view): show both chips' close buttons while the row is hovered
itsjoshpark Nov 26, 2026
ce7ad04
fix(split-view): show favicons in Split with Tab menus and resize the…
itsjoshpark Nov 26, 2026
7e28058
fix(split-view): keep a split row's chips in place when it's selected
itsjoshpark Nov 26, 2026
c22c690
fix(split-view): keep splits whole across profiles, moves, unpins and…
itsjoshpark Nov 26, 2026
02f0789
fix(split-view): act on each pane's own tab and keep the page layout …
itsjoshpark Nov 26, 2026
ffb29f7
fix(split-view): keep a split's pane order when Reopen Closed Window …
itsjoshpark Nov 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changes/unreleased/New-20261126-023925.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kind: New
body: 'Split view, as in Arc: two tabs side by side, made by dragging a tab onto the page, Option+clicking a link or the split button, shown as one row in the sidebar, and pinned or favorited as one item.'
time: 2026-11-26T02:39:25.583442-05:00
19 changes: 17 additions & 2 deletions docs/native-window.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ The `native-quit-confirmation` change's `design.md` (`openspec/changes/archive/2
The `add-pinned-tabs-and-favorites` change's `design.md` (`openspec/changes/add-pinned-tabs-and-favorites/`) has the reasoning (D1–D12).

- **The pin store (D1; `add-tab-folders` D1, D3).** `ClairPinStore` keeps every pinned tab, favorite and folder in Local State (`clair.pins`), one record each under `items`: a folder (`"kind": "folder"`) names its Space and its name; a pinned tab (`"kind": "pin"`) its Space and, in a folder, the folder; a favorite its profile, by the ID of `clair.profiles`; a pin also its URL, title and custom name. Each record carries its sort key, `order`, a fractional index from `clair_order_key.{h,mm}` (`OrderKeyBetween`: base-62 keys, "a0" first, between two neighbours or before the first or after the last), and a container's children are sorted by key, then by ID, so a move rewrites only the record that moved; a folder moving to another Space rewrites its pins' `space` too. The store keeps one index of children per container (`ChildrenOf`), rebuilt on load and on each write, and turns the contract's indices into keys between neighbours (`KeyAt`, which gives the whole container new keys only when two share one). Folders hold pinned tabs only, one level deep; on load, a pin whose folder is missing lists at its own Space's top level, and a record whose Space or profile is gone is dropped. Whether a folder is closed is this Mac's, apart from the records: `clair.closed_folders`. Icons are PNG files in `<user data dir>/Clair Pin Icons/`, written and read on a background sequence; at start-up it reads them and deletes those whose pin is gone. It remembers the last 25 pins and folders removed this session for Restore Last Closed Tab: a removed folder is one removal, with its pins and whether it was closed.
- **Pinned and favorited splits (`add-split-view` D10).** A split record (`"kind": "split"`) has the place a pin has, in a Space's pinned section, a folder or a profile's favorites, its sort key and its `ratio`; each of its two pins names it (`"split"`) and its pane (`"index"`, 0 or 1) instead of a place of its own, so moving the split rewrites only its record. A folder holds pins and splits, still one level deep. On load, a split without both its panes is dropped, its pins taking its place (`RepairSplits`). Removing either pin removes the split with both, as one removal for Restore Last Closed Tab; Separate Tabs (`SeparateSplit`) gives the leading pin the split's key and the trailing one the next; closing one pane of a shown pinned split takes its pin out (`TakeOutOfSplit`), the other keeping the split's place. `ClairHost.h` shows a split as a `ClairPinnedSplit` item, folders as lists of items, and the favorites as items too.
- **Binding (D2).** A tab showing a pin's page is bound to it: `ClairSpaceTabs::bound_` maps the pin to the tab, and the tab's tag carries the pin. A bound tab, and its Peek, are in no Today list; a pinned tab's Space is its pin's, and a favorite's tab has none, so the window keeps its Space while it shows one (`IntendedSpaceOf`). The pin's title and icon follow its tab only while the tab is at the pinned URL (its committed or originally requested URL, without the query and fragment). A Today tab's custom name is its tag's; a bound tab's is its pin's. The host pushes each Space's pinned items, pins and folders (`pinnedItemsDidChange:inSpace:`, with `ClairPinnedItem` and `ClairFolder` snapshots), and each profile's favorites (`favoritesDidChange:ofProfile:`), after the tab lists, once per run-loop turn.
- **The session tags (D2, D3).** `clair_pin` and `clair_name` ride beside `clair_space` and `clair_order` through the same three hooks of `space-session.patch`. A restored or reopened tab binds to its pin if the pin has no tab; otherwise it joins its Space's Today tabs.
- **Restore and removed pins (D3, D12).** `always-restore.patch` ends `SessionStartupPref::GetStartupPref` with `clair::ApplyStartupPref`, which makes it "continue where you left off" except in headless mode, and `chrome://settings` has no On startup section. Restore Last Closed Tab (`IDC_RESTORE_TAB`, run first by `ExecuteTabCommand`) puts back the newest removed pin or folder of the window's profile when that's newer than Chromium's newest recently closed entry, at its key, or at the end when its folder is gone or its key taken; a removed pin's tab closing carries `clair_pin`, so restoring that tab brings the pin back first, with its whole folder when the folder was deleted (`RestorePin`, `add-tab-folders` D7).
Expand Down Expand Up @@ -101,6 +102,18 @@ The archived `add-bookmarks-menu` change's `design.md` (`openspec/changes/archiv
- **One list, and the notice (D6).** `ClairBookmarkBarDrain`, one per original profile (the profile's user data), started by `ClairBrowserWindow` for each window, keeps the Bookmarks Bar empty: when the bookmarks load, when a node lands directly in the bar, and when an import's extensive changes end, it moves the bar's children to the top of Other Bookmarks, in order, in a task of its own. The first drain that moves something asks the profile's most recently active normal window, or the first one to open, to show `BookmarksBarNotice`, and sets the Local State pref `clair.bookmarks_bar_notice_shown`, so it shows once for the whole app.
- **Suggestions (D8).** `ClairChromiumAutocomplete` runs every omnibox provider, bookmarks included, and shows a match's title first when Chromium marks it `swap_contents_and_description`, as the omnibox does. A row for a bookmarked page that isn't a search or an open tab is `ClairSuggestionKindBookmark`, with no icon, so `SuggestionRow` draws the `bookmark` symbol and VoiceOver reads "Bookmark".

## Split view

The `add-split-view` change's `design.md` (`openspec/changes/add-split-view/`) has the reasoning (D1–D13). A split is Chromium's own: two adjacent tabs of a `TabStripModel` in a split collection, with its `SplitTabId`, its ratio, and its pane order as the tabs' order. Session restore and tab restore keep splits without help.

- **`ClairSplits` (D1, D4, D5, D12).** One per native window, beside `ClairPeeks`, in `clair_splits.{h,mm}`. It makes splits from two tabs (`Make`, after `ClairBrowserWindow::BringHere` has brought both into the window), from a tab and a new tab page (`MakeWithNewTab`), replaces a pane (`Replace`: Chromium's `kReplace` closes the replaced tab, so it ends the split and restores it with the same ID), swaps, separates and resizes, and observes `OnSplitTabChanged` to push the change to `ClairSpaceTabs` and `ClairPeeks`. A `FocusWatcher` on each pane activates it when its contents take focus, so a click in the other pane focuses it; the active tab's partner is marked visible with it (`UpdateVisibility`). When a pane closes, the other is activated. A split Chromium makes itself, as Open Link in Split View does, gets the clicked tab back in the leading pane (`LeadWith`), except while a session restores.
- **Rows and commands.** A split is one row: `ClairBrowserWindow::RowOf` maps a pane to the split's row tab, the leading pane in Today, the tab commands (Ctrl+Tab, Cmd+1…9, Close Tabs Below) count it once, and `ActivateRow` shows the pane focused last (`LastFocusedPane`). Cmd+W, a pane's × and a Today split chip's × close one pane (`CloseTab`); a pinned split's − closes both through `ExecuteCloseTabsCommand`, so tab restore records one split entry. A favorite's page in a split loads another site's URL from the command bar in its pane, not in a new Today tab (`clair::LeavesFavorite`).
- **Peeks (D3, D11).** A pane's Peek sits after the whole split in the strip, since a tab inserted inside a split ends it (`ClairPeeks::PeekIndexFor`); focusing the other pane closes it. Open in Split View expands the Peek and splits it with its parent (`OpenPeekInSplit`).
- **Option+click (D6).** `split-on-option-click.patch` makes Option without Shift give `NEW_SPLIT_VIEW` in Blink's `NavigationPolicyFromEventModifiers` and `ui::DispositionFromClick`, so a link isn't downloaded. `clair::MaybeOpenLink` (`clair_window_hooks.mm`, formerly `MaybeOpenPeek`) hands it to `ClairSplits::OpenLink`: a new background tab after the source and a split with it on a single page, the other pane on a split, the Peek itself in a Peek. The page's context menu keeps Chromium's Open Link in Split View.
- **Across windows and Spaces (D7).** `ClairSpaceTabs` keeps a split's tabs together in the Space's list (`KeepSplitsTogether`, run for every changed list), and Move to Space moves both. Taking a split's row from another window moves the split collection whole (`MoveFamilyHere`, with `DetachSplitTabForInsertion` and `InsertDetachedSplitTabAt`), its Peeks with it.
- **Pins (D10).** `clair::PinTab` pins a split as one item (`PinSplit`), and `OpenPin` on either of its pins opens the closed pages and shows them as a split with the saved ratio (`ShowPinnedSplit`). A restored split whose two tabs bind to one pinned split's pins is made again (`JoinPinnedSplit`). A ratio change of a pinned split is saved (`KeepPinnedRatio`).
- **`ClairUI` (D2, D3, D8, D9, D13).** `ClairTab` carries `splitPartnerID`, `isLeadingPane` and `splitRatio`; `TabListLogic.rows` folds the trailing pane into its leading pane's row, and `SplitLogic.shownSplit` gives the model's `shownSplit` (and `paneCount`). `BrowserRootView` lays out two `PageCardView`s with `SplitDividerView` between them, `PageDropView` over the page takes tabs dragged from the sidebar, and the overlays follow the focused pane. `PageToolbar` shows pane headers (`PageHeaderContent.pane`) and the split button (`SplitButton`), the sidebar shows `SplitRow` and the favorites `FavoriteSplitTile`, and `SplitMenu` adds Tabs › Split with Tab › and View › Add Split View (⌃⇧=), Close Split Pane (⌃⇧−) and Separate Tabs. The link status names a split or a Peek while Option or Shift is held (`SplitLogic.linkStatus`).

## Where each piece lives

| Piece | File |
Expand All @@ -119,7 +132,8 @@ The archived `add-bookmarks-menu` change's `design.md` (`openspec/changes/archiv
| A Peek moving with its tab | `engine/overlay/chrome/browser/clair/window/clair_peeks.{h,mm}` (`Release`, `Adopt`) |
| The still in the card | `native/ClairUI/PageCardView.swift` (`StillView`) |
| Tabs' Spaces, windows' groups, pins and names in saved sessions, new tab pages left out | `engine/overlay/chrome/browser/clair/window/clair_space_session.{h,mm}`, `engine/patches/clair/space-session.patch` |
| The pin store, folders and icons | `engine/overlay/chrome/browser/clair/clair_pin_store.{h,mm}` |
| The pin store, folders, pinned splits and icons | `engine/overlay/chrome/browser/clair/clair_pin_store.{h,mm}` |
| Split view: making, changing and closing splits, focus and visibility, Option+click | `engine/overlay/chrome/browser/clair/window/clair_splits.{h,mm}`, `engine/patches/clair/split-on-option-click.patch` |
| Sort keys | `engine/overlay/chrome/browser/clair/clair_order_key.{h,mm}` |
| Binding tabs to pins, pin snapshots, the host's pin calls, Restore Last Closed Tab for pins | `engine/overlay/chrome/browser/clair/clair_space_tabs.{h,mm}` |
| The link rule store and the matcher | `engine/overlay/chrome/browser/clair/clair_link_rule_store.{h,mm}` |
Expand All @@ -146,10 +160,11 @@ The archived `add-bookmarks-menu` change's `design.md` (`openspec/changes/archiv
| Spaces: the model, header, switcher, New Space form, icon field, Spaces menu and Manage Spaces | `native/ClairUI/SpacesModel.swift`, `SpacesLogic.swift`, `SpaceHeaderView.swift`, `SpaceSwitcher.swift`, `NewSpaceForm.swift`, `SpaceIconField.swift`, `SpacesMenu.swift`, `ManageSpacesDialog.swift` |
| Profiles: the dialogs, Settings › Profiles, the Advanced toggles | `native/ClairUI/ProfileDialogs.swift`, `ProfilesSettingsView.swift`, `SettingsWindow.swift` |
| Link rules: Settings › Links' card, the dialog and its checks | `native/ClairUI/SettingsWindow.swift`, `LinkRulesDialog.swift`, `LinkRulesLogic.swift` |
| Split view: panes, divider, drops on the page, split row and tile, split button and menus | `native/ClairUI/SplitLogic.swift`, `SplitViews.swift`, `SplitMenu.swift`, `BrowserWindowController+Split.swift` |
| Command bar | `native/ClairUI/CommandBarModel.swift`, `OverlayViews.swift` |
| The bookmark dialog, the Bookmarks Bar notice, Manage Bookmarks' title | `native/ClairUI/BookmarkDialog.swift`, `BookmarksBarNotice.swift`, `MainMenuTitles.swift` |
| Unit tests against a fake Chromium | `native/ClairUITests/` (`FakeBrowser.swift`, `FakeHost.swift`) |
| Runtime tests on a packaged Clair | `tests/runtime/ClairRuntimeTests/NativeWindowTests.swift`, `SpacesTests.swift`, `SharedTabsTests.swift`, `ProfilesTests.swift`, `PinsTests.swift`, `LinkRulesTests.swift`, `BookmarksTests.swift` |
| Runtime tests on a packaged Clair | `tests/runtime/ClairRuntimeTests/NativeWindowTests.swift`, `SpacesTests.swift`, `SharedTabsTests.swift`, `ProfilesTests.swift`, `PinsTests.swift`, `LinkRulesTests.swift`, `BookmarksTests.swift`, `SplitViewTests.swift` |

## Working on it

Expand Down
13 changes: 10 additions & 3 deletions engine/overlay/chrome/browser/clair/clair_native_layer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,17 @@ - (void)moveTab:(ClairTabID)tabID toSpace:(ClairSpaceID)spaceID {
return clair::PinnedItemSnapshots(base::SysNSStringToUTF8(spaceID ?: @""));
}

- (NSArray<id<ClairPin>>*)favoritesOfProfile:(ClairProfileID)profileID {
- (NSArray<id<ClairPinnedItem>>*)favoritesOfProfile:(ClairProfileID)profileID {
CHECK([NSThread isMainThread]);
return clair::PinSnapshots(clair::PinContainer::OfProfile(
base::SysNSStringToUTF8(profileID ?: @"")));
// add-split-view D10: favorites and favorited splits.
return clair::FavoriteItemSnapshots(base::SysNSStringToUTF8(profileID ?: @""));
}

- (void)separatePinnedSplit:(ClairPinnedSplitID)splitID {
CHECK([NSThread isMainThread]);
if (splitID) {
clair::SeparatePinnedSplit(base::SysNSStringToUTF8(splitID));
}
}

- (void)pinTab:(ClairTabID)tabID
Expand Down
Loading
Loading