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.
Too many pinned extensions no longer push the address out, as in Arc
Victor15c53fe01c63
diff --git a/Packages/CraCore/Sources/CraCore/PinnedExtensionGrid.swift b/Packages/CraCore/Sources/CraCore/PinnedExtensionGrid.swiftnew file mode 100644index 0000000..e7cdd89--- /dev/null+++ b/Packages/CraCore/Sources/CraCore/PinnedExtensionGrid.swift@@ -0,0 +1,62 @@+import CoreGraphics++/// Where pinned extensions go while the toolbar is hidden: Arc 1.171 takes them out of the URL+/// field (which keeps only Copy Link and Site Control Center on hover) and puts them in a grid+/// of their own over the favorites, the first section of `sidebarFavoritesCollectionView`, shown+/// all the time. Measured live on 4 Nov (AX frames, 11 pins at sidebar widths 200–347): cells+/// 28 pt tall, 8 pt apart both ways, spread over the grid's width (the sidebar less 8 pt each+/// side); like the favorites, as many columns as keep a cell at least `minCellWidth` wide, then+/// the fewest that need no more rows: 11 go 4 + 4 + 3 at 200 pt and 6 + 5 from 240 pt, 7 take+/// one row at 300 pt, 5 one row at 200 pt. The favorites start 8 pt under the last row.+public struct PinnedExtensionGrid: Equatable {+ public static let cellHeight: CGFloat = 28+ public static let gap: CGFloat = 8+ public static let minCellWidth: CGFloat = 28++ /// A pin's button in the URL field.+ public static let fieldButtonWidth: CGFloat = 28+ /// What the URL field keeps for the address and its Copy Link and Site Control Center buttons+ /// (Arc: in the field with 124 pt left, 4 pins at 252 pt; in the grid with 117, 4 at 245).+ public static let fieldReserve: CGFloat = 120++ /// Whether `count` pins go in the URL field `fieldWidth` wide (shown on hover, as before)+ /// rather than in the grid: they do while they leave the address its room.+ public static func fitsInURLField(count: Int, fieldWidth: CGFloat) -> Bool {+ fieldWidth - CGFloat(count) * fieldButtonWidth >= fieldReserve+ }++ public let count: Int+ public let width: CGFloat++ public init(count: Int, width: CGFloat) {+ self.count = count+ self.width = width+ }++ public var columns: Int {+ // n cells of at least minCellWidth with n − 1 gaps.+ let widest = max(1, Int((width + Self.gap) / (Self.minCellWidth + Self.gap)))+ guard count > 0 else { return widest }+ let rows = (count + widest - 1) / widest+ return (count + rows - 1) / rows+ }++ public var rows: Int { (count + columns - 1) / columns }++ public var cellWidth: CGFloat { (width - CGFloat(columns - 1) * Self.gap) / CGFloat(columns) }++ /// The grid's height, 0 with nothing pinned.+ public var height: CGFloat {+ rows == 0 ? 0 : CGFloat(rows) * Self.cellHeight + CGFloat(rows - 1) * Self.gap+ }++ /// How far the favorites sit below the grid's top: its height and the 8 pt under it, or+ /// nothing with nothing pinned.+ public var favoritesOffset: CGFloat { count == 0 ? 0 : height + Self.gap }++ public func frame(at index: Int) -> CGRect {+ let n = columns, cw = cellWidth+ let r = index / n, c = index % n+ return CGRect(x: CGFloat(c) * (cw + Self.gap), y: CGFloat(r) * (Self.cellHeight + Self.gap), width: cw, height: Self.cellHeight)+ }+}diff --git a/Packages/CraCore/Sources/CraCore/ToolbarExtensionFit.swift b/Packages/CraCore/Sources/CraCore/ToolbarExtensionFit.swiftnew file mode 100644index 0000000..b322d4d--- /dev/null+++ b/Packages/CraCore/Sources/CraCore/ToolbarExtensionFit.swift@@ -0,0 +1,19 @@+import CoreGraphics++/// How many pinned extensions the toolbar hides so the address keeps its whole width. Arc+/// 1.171's toolbar works out `numberOfExtensionsThatFit` (with `urlDomainHasRoom`) and drops+/// pins from the front of the list, the ones farthest from its right end: with ten pins it+/// showed the last seven in a 1100 pt window and the last two at 800 pt, the URL whole and+/// centred both times (live, 4 Nov 2026). The hidden ones stay in the Extensions menu.+public enum ToolbarExtensionFit {+ /// `widths`: the pinned buttons, in pin order. `room(hiddenWidth)`: the space the address+ /// gets once that much of the pins' width is gone. `needed`: the address's whole width.+ public static func hiddenCount(widths: [CGFloat], needed: CGFloat, room: (CGFloat) -> CGFloat) -> Int {+ var hidden = 0, freed: CGFloat = 0+ while hidden < widths.count, room(freed) < needed {+ freed += widths[hidden]+ hidden += 1+ }+ return hidden+ }+}diff --git a/Packages/CraCore/Tests/CraCoreTests/PinnedExtensionGridTests.swift b/Packages/CraCore/Tests/CraCoreTests/PinnedExtensionGridTests.swiftnew file mode 100644index 0000000..560a6af--- /dev/null+++ b/Packages/CraCore/Tests/CraCoreTests/PinnedExtensionGridTests.swift@@ -0,0 +1,48 @@+import CoreGraphics+import CraCore+import Testing++/// Arc 1.171's pinned extension grid in the sidebar, as measured live on 4 Nov 2026 (AX frames,+/// URL field in the sidebar; docs/arc-reverse-engineering.md, "Pinned extensions with the+/// toolbar hidden"). Widths are the sidebar's; the grid is 16 pt narrower.+struct PinnedExtensionGridTests {+ /// Eleven pins: 4 + 4 + 3 at 200 pt, 6 + 5 from 240 pt; five at 200 pt in one row.+ @Test(arguments: [+ (200, 11, 4, 3, 40.0), (240, 11, 6, 2, 30.67), (300, 11, 6, 2, 40.67), (347, 11, 6, 2, 48.5),+ (200, 5, 5, 1, 30.4), (300, 7, 7, 1, 33.71),+ ] as [(Int, Int, Int, Int, Double)])+ func columnsMatchArc(sidebarWidth: Int, count: Int, columns: Int, rows: Int, cellWidth: Double) {+ let grid = PinnedExtensionGrid(count: count, width: CGFloat(sidebarWidth - 16))+ #expect(grid.columns == columns)+ #expect(grid.rows == rows)+ #expect(abs(Double(grid.cellWidth) - cellWidth) < 0.01)+ }++ /// Arc's AX frames at 240 pt (sidebar-relative, from the grid's top-left 8 pt in): x 8, 46,+ /// 85, 124, 162, 201; rows 36 pt apart; cells 28 pt tall.+ @Test func framesMatchArc() {+ let grid = PinnedExtensionGrid(count: 11, width: 224)+ let xs = (0..<6).map { Int(8 + grid.frame(at: $0).minX) }+ #expect(xs == [8, 46, 85, 124, 162, 201])+ #expect(grid.frame(at: 6) == CGRect(x: 0, y: 36, width: grid.cellWidth, height: 28))+ #expect(grid.height == 64)+ // The favorites start 8 pt under the last row (Arc: grid 123–187, tiles from 195).+ #expect(grid.favoritesOffset == 72)+ }++ /// Field (sidebar − 16) less 28 pt a pin: Arc kept them in the URL field with 124 pt or more+ /// left and moved them to the grid with 117 or less (live, 4 Nov 2026, github.com).+ @Test(arguments: [+ (240, 3, true), (252, 4, true), (262, 4, true), (300, 5, true), (347, 7, true),+ (240, 4, false), (245, 4, false), (200, 5, false), (270, 7, false), (300, 7, false), (320, 7, false),+ (347, 8, false), (240, 11, false), (347, 11, false),+ ] as [(Int, Int, Bool)])+ func fieldOrGridMatchesArc(sidebarWidth: Int, pins: Int, inField: Bool) {+ #expect(PinnedExtensionGrid.fitsInURLField(count: pins, fieldWidth: CGFloat(sidebarWidth - 16)) == inField)+ }++ @Test func nothingPinnedTakesNoRoom() {+ let grid = PinnedExtensionGrid(count: 0, width: 224)+ #expect(grid.rows == 0 && grid.height == 0 && grid.favoritesOffset == 0)+ }+}diff --git a/Packages/CraCore/Tests/CraCoreTests/ToolbarExtensionFitTests.swift b/Packages/CraCore/Tests/CraCoreTests/ToolbarExtensionFitTests.swiftnew file mode 100644index 0000000..750a9ab--- /dev/null+++ b/Packages/CraCore/Tests/CraCoreTests/ToolbarExtensionFitTests.swift@@ -0,0 +1,31 @@+import CoreGraphics+import CraCore+import Testing++/// Arc 1.171 drops pinned extensions from the front of the list until the address fits whole+/// (live, 4 Nov 2026: ten pins, the last seven at a 1100 pt window, the last two at 800 pt).+struct ToolbarExtensionFitTests {+ /// A bar with `space` points for the address and the pins, each pin 36 pt.+ private func hidden(pins: Int, space: CGFloat, address: CGFloat) -> Int {+ let widths = Array(repeating: CGFloat(36), count: pins)+ let all = widths.reduce(0, +)+ return ToolbarExtensionFit.hiddenCount(widths: widths, needed: address) { freed in space - (all - freed) }+ }++ @Test func everyPinShowsWhileTheAddressFits() {+ #expect(hidden(pins: 10, space: 600, address: 200) == 0)+ }++ @Test func hidesFromTheFrontUntilTheAddressFits() {+ // 10 × 36 = 360 of 500 leaves 140; the address needs 210: two pins go, leaving 212.+ #expect(hidden(pins: 10, space: 500, address: 210) == 2)+ }++ @Test func allPinsGoWhenEvenThatIsNotEnough() {+ #expect(hidden(pins: 4, space: 100, address: 200) == 4)+ }++ @Test func noPinsNothingHidden() {+ #expect(hidden(pins: 0, space: 10, address: 200) == 0)+ }+}diff --git a/Sources/Cra/UI/PaneToolbarView.swift b/Sources/Cra/UI/PaneToolbarView.swiftindex 46b0370..7f3f10f 100644--- a/Sources/Cra/UI/PaneToolbarView.swift+++ b/Sources/Cra/UI/PaneToolbarView.swift@@ -347,6 +347,21 @@ final class PaneToolbarView: NSView {devGroup = Array(trailing[(i - 1)...end])trailing.removeSubrange((i - 1)...end)}+ // Arc hides pins from the front until the address fits whole (ToolbarExtensionFit); the+ // Extensions menu still has them.+ let pins = trailing.filter { v in m.pinned.contains { buttons["ext:" + $0.id] === v } }+ var hidden = 0+ if m.kind == .normal, !pins.isEmpty {+ let widthOf = { (v: NSView) in (v as? ToolbarGlyphButton)?.width ?? 26 }+ let allRight = trailing.reduce(0) { $0 + widthOf($1) }+ let a = leftEnd + (left.isEmpty ? 0 : 6)+ hidden = ToolbarExtensionFit.hiddenCount(widths: pins.map(widthOf), needed: urlButton.idealWidth) { freed in+ rx - (allRight - freed) - 6 - a - 2 * (8 + 6)+ }+ }+ for (i, v) in pins.enumerated() { v.isHidden = i < hidden }+ let dropped = pins.prefix(hidden)+ trailing.removeAll { v in dropped.contains { $0 === v } }for v in trailing.reversed() {let bw = (v as? ToolbarGlyphButton)?.width ?? 26rx -= bw@@ -501,6 +516,8 @@ final class ToolbarGlyphButton: NSView {private var hover = NSColor.white.withAlphaComponent(0.1)private var iconBox: NSSize?var cornerRadius: CGFloat = 7 { didSet { layer?.cornerRadius = cornerRadius } }+ /// The fill while not hovered (the sidebar's pinned extension grid draws its cells like tiles).+ var restFill: NSColor = .clear { didSet { refreshFill() } }/// The height an extension icon is centred in, from the bottom (the toolbar sets its button height;/// the sidebar pill keeps the 26 pt it was laid out with).var iconRowHeight: CGFloat = 26 { didSet { needsLayout = true } }@@ -554,12 +571,12 @@ final class ToolbarGlyphButton: NSView {override func layout() {super.layout()let h = bounds.height- imageView.frame = iconBox.map { NSRect(x: (width - $0.width) / 2, y: (iconRowHeight - $0.height) / 2, width: $0.width, height: $0.height) }+ imageView.frame = iconBox.map { NSRect(x: (bounds.width - $0.width) / 2, y: (iconRowHeight - $0.height) / 2, width: $0.width, height: $0.height) }?? NSRect(x: 0, y: 0, width: width, height: h)}private func refreshFill() {- layer?.backgroundColor = (hovering && enabled ? hover : .clear).cgColor+ layer?.backgroundColor = (hovering && enabled ? hover : restFill).cgColor}override var mouseDownCanMoveWindow: Bool { false }diff --git a/Sources/Cra/UI/Sidebar/List/SidebarView.swift b/Sources/Cra/UI/Sidebar/List/SidebarView.swiftindex 9232ddf..71db5e5 100644--- a/Sources/Cra/UI/Sidebar/List/SidebarView.swift+++ b/Sources/Cra/UI/Sidebar/List/SidebarView.swift@@ -236,6 +236,8 @@ final class FlippedView: NSView {/// 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) show while the header is hovered.+/// Pins that would crowd the address out move to a grid over the favorites instead, as in Arc+/// 1.171 (PinnedExtensionGrid.fitsInURLField, FavoritesGridView; 4 Nov).final class SidebarTopBarView: NSView {private let store: SidebarStoreprivate let ui: SidebarUIState@@ -499,12 +501,17 @@ final class SidebarURLPill: NSView {layer?.backgroundColor = (hovering ? colors.selectedFill : colors.pillFill).cgColor}- /// Arc's URL-bar accessories: pinned extensions, Copy Link, then the site controls.+ /// Whether the pins go in this field (else in the grid over the favorites), for its width.+ private var pinsInField = true++ /// Arc's URL-bar accessories: pinned extensions (while they leave the address room), Copy+ /// Link, then the site controls.private func refreshAccessories(animated: Bool) {accessories.forEach { $0.removeFromSuperview() }accessories = []guard showAccessories, hasTab, let m = model, let actions else { needsLayout = true; return }- for (id, _, icon) in m.pinned {+ pinsInField = PinnedExtensionGrid.fitsInURLField(count: m.pinned.count, fieldWidth: bounds.width)+ for (id, _, icon) in pinsInField ? m.pinned : [] {let b = ToolbarGlyphButton()// Arc's pinned extension buttons have no tooltip (#106).b.configure(symbol: nil, image: icon, help: "", enabled: true, width: 28, iconSize: 16, tint: colors.textSecondary)@@ -536,12 +543,15 @@ final class SidebarURLPill: NSView {/// The accessories' hover fill is the sidebar's, not the toolbar's.override func layout() {super.layout()+ if let m = model, showAccessories, PinnedExtensionGrid.fitsInURLField(count: m.pinned.count, fieldWidth: bounds.width) != pinsInField {+ refreshAccessories(animated: false)+ }let h = bounds.height+ // Arc 1.171 (4 Nov): one every 28 pt, the last centred 19 pt in from the end.var right = bounds.width - 5for v in accessories.reversed() {right -= 28v.frame = NSRect(x: right, y: (h - 28) / 2, width: 28, height: 28)- right -= 1}let x: CGFloat = 12let lh = label.intrinsicContentSize.heightdiff --git a/Sources/Cra/UI/Sidebar/List/SpaceColumnView.swift b/Sources/Cra/UI/Sidebar/List/SpaceColumnView.swiftindex faa6c84..6743ac7 100644--- a/Sources/Cra/UI/Sidebar/List/SpaceColumnView.swift+++ b/Sources/Cra/UI/Sidebar/List/SpaceColumnView.swift@@ -434,7 +434,8 @@ enum MenuItems {/// Arc's "top apps": a 4-wide grid of favorite tiles, 8 pt apart, and under it a strip that/// opens into "Add to Favorites" while a tab is dragged over it. With none, Arc's empty-state/// card stands in for the tiles until its × closes it. Arc shares them between spaces; in Cra-/// every space has its own.+/// every space has its own. While the toolbar is hidden the profile's pinned extensions sit+/// over the tiles in a grid of their own (PinnedExtensionGrid), as in Arc.final class FavoritesGridView: NSView {private let spaceID: UUIDlet store: SidebarStore@@ -446,6 +447,8 @@ final class FavoritesGridView: NSView {private var order: [UUID] = []private let strip = FavoritesDropStrip()private let card = FavoritesEmptyCard()+ private var extensionButtons: [String: ToolbarGlyphButton] = [:]+ private var extensionOrder: [String] = []private var favoritesID: UUID?private(set) var palette: SpacePalette?private var syncQueued = false@@ -483,9 +486,23 @@ final class FavoritesGridView: NSView {var models: [(UUID, FavoriteTileModel)] = []var palette: SpacePalette?var dismissed = true+ var pins: [Pin] = []withObservationTracking {guard let space = store.space(spaceID) else { return }palette = space.theme.palette+ // Arc (4 Nov): with the URL field in the sidebar, the pins leave it for this grid.+ if !store.settings.showToolbar, !store.isIncognito(space: spaceID) {+ let ext = ExtensionStore.shared+ let profile = store.profileDirectoryName(space: spaceID)+ let entries = ext.entries(inProfile: profile)+ let tab = store.selectedTabID(in: spaceID, window: ui.windowID)+ pins = ext.pinnedIDs(inProfile: profile).compactMap { id in+ entries.first { $0.extensionID == id }.map {+ Pin(id: id, name: $0.name, icon: ext.toolbarIcon(for: $0, profile: profile, tab: tab),+ badge: ext.badge(for: $0, profile: profile, tab: tab))+ }+ }+ }favoritesID = space.favoritesContainerIDdismissed = store.isIncognito(space: spaceID) || store.isFavoritesEmptyStateDismissed(space.favoritesContainerID)// A favorite split is one tile with a cell per pane (Arc: AppItem.childItems).@@ -515,7 +532,8 @@ final class FavoritesGridView: NSView {let ids = models.map(\.0)let showsCard = ids.isEmpty && !dismissed// Arc drops the card and moves the list up in one frame, like a first tile coming in.- let countChanged = ids.count != order.count || showsCard == card.isHidden+ let countChanged = ids.count != order.count || showsCard == card.isHidden || pins.count != extensionOrder.count+ showExtensions(pins, palette: palette)for (id, t) in tiles where !ids.contains(id) {t.removeFromSuperview()tiles[id] = nil@@ -539,21 +557,65 @@ final class FavoritesGridView: NSView {if countChanged { onHeightChange(false) }}+ private struct Pin { let id: String; let name: String; let icon: NSImage?; let badge: ExtensionBadge? }++ /// The pinned extensions' buttons, in pin order; none while the toolbar shows them. Arc 1.171+ /// (4 Nov) draws each cell like a favorite tile, the tile's fill at rest and its hover fill,+ /// the 18 pt icon centred, and names it in a tooltip (its toolbar pins have none, #106).+ private func showExtensions(_ pins: [Pin], palette: SpacePalette?) {+ let colors = palette.map(SidebarColors.init) ?? SidebarColors()+ let dark = palette?.isDark ?? false+ let ids = pins.map(\.id)+ for (id, b) in extensionButtons where !ids.contains(id) {+ b.removeFromSuperview()+ extensionButtons[id] = nil+ }+ let ext = ExtensionStore.shared+ for p in pins {+ let b = extensionButtons[p.id] ?? {+ let b = ToolbarGlyphButton()+ extensionButtons[p.id] = b+ addSubview(b)+ return b+ }()+ b.configure(symbol: nil, image: ext.badged(p.icon, p.badge, tint: colors.textSecondary), help: p.name, enabled: true,+ width: 28, iconSize: 18, tint: colors.textSecondary,+ hover: dark ? NSColor.white.withAlphaComponent(0.15) : NSColor.black.withAlphaComponent(0.09))+ b.restFill = palette.map { NSColor($0.pillFill) } ?? .clear+ b.cornerRadius = 10+ b.iconRowHeight = PinnedExtensionGrid.cellHeight+ let id = p.id+ b.action = { [weak self] in self?.actions.runExtension(id) }+ b.menuProvider = { ExtensionStore.shared.entries.first { $0.extensionID == id }.map(ExtensionsMenu.iconMenu) }+ }+ extensionOrder = ids+ }++ /// None while they all fit in the URL field (`w` is its width too).+ private func extensionGrid(forWidth w: CGFloat) -> PinnedExtensionGrid {+ let n = extensionOrder.count+ return PinnedExtensionGrid(count: PinnedExtensionGrid.fitsInURLField(count: n, fieldWidth: w) ? 0 : n, width: w)+ }+/// Arc's columns and tile frames (FavoritesLayout, #29).private func grid(forWidth w: CGFloat) -> FavoritesLayout { FavoritesLayout(count: order.count, width: w) }func height(forWidth w: CGFloat) -> CGFloat {- if !card.isHidden { return FavoritesEmptyCard.height }- return grid(forWidth: w).gridHeight + (order.isEmpty ? 0 : 4) + strip.height+ let top = extensionGrid(forWidth: w).favoritesOffset+ if !card.isHidden { return top + FavoritesEmptyCard.height }+ return top + grid(forWidth: w).gridHeight + (order.isEmpty ? 0 : 4) + strip.height}/// Where the header and list are placed from: the tiles' bottom (the empty-state card's/// while it stands in for them), the open "Add to Favorites" strip's while a tab is dragged- /// over it, nil with no favorites.+ /// over it, the pinned extensions' with no favorites, nil with neither.func tilesBottom(forWidth w: CGFloat) -> CGFloat? {- if !card.isHidden { return FavoritesEmptyCard.height }+ let ext = extensionGrid(forWidth: w)+ let top = ext.favoritesOffset+ if !card.isHidden { return top + FavoritesEmptyCard.height }if strip.targeted { return height(forWidth: w) }- return order.isEmpty ? nil : grid(forWidth: w).gridHeight+ if order.isEmpty { return ext.count == 0 ? nil : ext.height }+ return top + grid(forWidth: w).gridHeight}/// The resting strip only takes drops (AppKit finds drop targets apart from hitTest). With@@ -566,10 +628,16 @@ final class FavoritesGridView: NSView {override func layout() {super.layout()let w = bounds.width+ let ext = extensionGrid(forWidth: w)+ for (i, id) in extensionOrder.enumerated() {+ extensionButtons[id]?.isHidden = ext.count == 0+ if ext.count > 0 { extensionButtons[id]?.frame = ext.frame(at: i) }+ }+ let top = ext.favoritesOffsetlet grid = grid(forWidth: w)- for (i, id) in order.enumerated() { tiles[id]?.frame = grid.frame(at: i) }- strip.frame = NSRect(x: 0, y: grid.gridHeight + (order.isEmpty ? 0 : 4), width: w, height: strip.height)- card.frame = NSRect(x: 0, y: 0, width: w, height: FavoritesEmptyCard.height)+ for (i, id) in order.enumerated() { tiles[id]?.frame = grid.frame(at: i).offsetBy(dx: 0, dy: top) }+ strip.frame = NSRect(x: 0, y: top + grid.gridHeight + (order.isEmpty ? 0 : 4), width: w, height: strip.height)+ card.frame = NSRect(x: 0, y: top, width: w, height: FavoritesEmptyCard.height)}func moveFavorite(_ dragged: UUID, before target: UUID, after: Bool) {diff --git a/Sources/Cra/UI/Windows/MainWindowController.swift b/Sources/Cra/UI/Windows/MainWindowController.swiftindex 796f1b6..b61b1ce 100644--- a/Sources/Cra/UI/Windows/MainWindowController.swift+++ b/Sources/Cra/UI/Windows/MainWindowController.swift@@ -272,7 +272,12 @@ final class MainWindowController: NSWindowController, NSWindowDelegate, BrowserM}// Toolbar buttons are ~34 pt wide and the click lands near the middle: the popup's// right edge lines up with the button's (Chrome anchors popups that way).- sidebarActions.runExtension = { [weak self] id in self?.runExtensionAction(id, buttonRightX: Self.extensionButtonRightX()) }+ sidebarActions.runExtension = { [weak self] id in+ let button = Self.extensionButtonUnderPointer()+ // A pin in the sidebar's grid (toolbar hidden) hangs its popup under its own button.+ self?.runExtensionAction(id, buttonRightX: button?.maxX ?? NSEvent.mouseLocation.x + 17,+ buttonBottomY: self?.store.settings.showToolbar == false ? button?.minY : nil)+ }sidebarActions.showExtensionsMenu = { [weak self] in self?.showToolbarExtensionsMenu() }// Popups from an extension's shortcut or chrome.action.openPopup() hang where the// menu bar's do: under the extension's toolbar button, else at the card's right end.@@ -2065,12 +2070,14 @@ final class MainWindowController: NSWindowController, NSWindowDelegate, BrowserM/// 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 of the clicked button; nil = the extension's toolbar button or the card's right end).- func runExtensionAction(_ id: String, buttonRightX: CGFloat? = nil) {+ /// (screen x of the clicked button; nil = the extension's toolbar button or the card's right end),+ /// its top at `buttonBottomY` (nil = under the URL bar).+ func runExtensionAction(_ id: String, buttonRightX: CGFloat? = nil, buttonBottomY: CGFloat? = nil) {let bar = toolbarBottomOnScreen()let browser = currentBrowserlet anchor = bar.map { bar in- buttonRightX.map { NSPoint(x: $0, y: urlBarBottomOnScreen() ?? bar.y) } ?? extensionPopupAnchor(id) ?? NSPoint(x: bar.cardMaxX - 8, y: bar.y)+ // Under the URL bar, or under a grid pin lower down.+ buttonRightX.map { x in NSPoint(x: x, y: min(buttonBottomY ?? .infinity, urlBarBottomOnScreen() ?? bar.y)) } ?? extensionPopupAnchor(id) ?? NSPoint(x: bar.cardMaxX - 8, y: bar.y)}let available = profileExtensionsswitch ExtensionLaunch.decide(id, available: available, hasPage: bar != nil && browser != nil) {@@ -2102,11 +2109,11 @@ final class MainWindowController: NSWindowController, NSWindowDelegate, BrowserM/// The extensions installed in the focused page's profile.var extensionEntries: [ExtensionStore.Entry] { ExtensionStore.shared.entries(inProfile: profileDirectoryName) }- /// The right edge (screen x) of the pinned-extension button under the pointer, in the- /// toolbar or the sidebar's URL pill (also in the floating sidebar's panel), so a popup- /// hangs from the same place wherever the button was clicked (GitHub #8).- private static func extensionButtonRightX() -> CGFloat {- buttonFrameUnderPointer { $0 is ToolbarGlyphButton }?.maxX ?? NSEvent.mouseLocation.x + 17+ /// The pinned-extension button under the pointer (screen rect), in the toolbar or the+ /// sidebar's grid (also in the floating sidebar's panel), so a popup hangs from the same+ /// place wherever the button was clicked (GitHub #8).+ private static func extensionButtonUnderPointer() -> NSRect? {+ buttonFrameUnderPointer { $0 is ToolbarGlyphButton }}/// The button under the pointer (screen rect): the one just clicked.diff --git a/docs/arc-reverse-engineering.md b/docs/arc-reverse-engineering.mdindex 8567ad9..b7d854b 100644--- a/docs/arc-reverse-engineering.md+++ b/docs/arc-reverse-engineering.md@@ -2842,3 +2842,40 @@ event with `shiftClickModalEntryPointEnabled` set for the run, AX frames and 60- Cra (CaptureOverlay, ContentCapture in CraCore): the same mode over a Page.captureScreenshot picture in a panel overthe page; picker run in Cra's isolated world; Copy / Save… / Send via iMessage… / Retake (no Easels, Library Media orEdit in Cra); Copy shows "Screenshot Copied to Clipboard"; the macOS screenshot sound plays when a capture is taken.++## Pinned extensions with the toolbar hidden, and in a narrow toolbar (Arc 1.171, 4 Nov 2026, X report, offline Arc)++Offline Arc as in "One space", with 11 of Victor's extensions copied into the fake home's Default profile+(`Extensions/<id>` plus his `Secure Preferences` wholesale, so the MACs stay valid) and+`extensions.pinned_extensions` set in its Preferences. Traps: the space must be on the profile that holds+the extensions (the fixture's "Side" space was on Profile 1 and showed none); ModHeader never loaded.+Sidebar width via StorableWindows' `sidebarWidth`, window size over AX. Frames from AX dumps.++- [O] URL field in the sidebar (`topBarURLEnabled` NO). While the pins leave the address room they go in+ the URL field, shown on hover after the address and before Copy Link and Site Control Center: 30 pt boxes,+ one every 28 pt, Site Control Center's box ending 4 pt in from the field's end (240 pt sidebar, 3 pins:+ 1Password, JSON Formatter, Lighthouse at x 86, 114, 142, Copy 170, Site Control Center 198). The host+ truncates under them (7 pins at 347 pt: "github.co").+- [O] With more, they leave the field (which keeps Copy Link and Site Control Center only) for a grid of+ their own, shown all the time: the first section of `sidebarFavoritesCollectionView`, 8 pt in from both+ sides and 8 pt under the URL field, the favorites 8 pt under its last row. Cells 28 pt tall, 8 pt apart+ both ways, spread over the width: like the favorites grid, as many columns as keep a cell at least+ ~28 pt wide (no cap seen: 7 in one row at 270 and 300 pt), then the fewest that need no more rows.+ 11 pins: 4 + 4 + 3 at 200 pt (cells 40 wide), 6 + 5 at 240 (30.67), 300 (40.67) and 347 (48.5).+ 5 at 200 pt: one row of 30.4. Icons 18 pt, centred.+- [O] Field or grid (github.com in the field), by field width (sidebar − 16) less 28 pt per pin:+ in the field 3 @ 240 (140 left), 4 @ 252 (124), 4 @ 262, 5 @ 300 (144), 7 @ 347 (135);+ grid 4 @ 240 (112), 4 @ 245 (117), 5 @ 200, 7 @ 270, 300, 320 (108), 8 @ 347 (107), 11 everywhere measured.+ The cut is between 117 and 124 pt; Cra keeps the pins in the field while that leaves at least 120+ (PinnedExtensionGrid.fieldReserve).+- [O] The field's Copy Link and Site Control Center show while the pointer is anywhere over the sidebar+ (a point 600 pt down the tab list showed them), not only over the field. Cra still shows them for the+ header only.+- [O] Toolbar on (`topBarURLEnabled` YES): every pin in the toolbar at 1728 pt and no grid. Narrow windows+ keep the address whole and centred and hide pins from the front of the list: ten pins, the last seven+ at 1100 pt, the last two at 800 pt (`numberOfExtensionsThatFit`, `urlDomainHasRoom` in the content+ toolbar's layout). Cra: ToolbarExtensionFit in PaneToolbarView.layout, against Cra's own address+ room (centred between the button groups, not in the card as Arc's), so the cut can be a pin off Arc's.+- [?] Not measured: whether the switch depends on the host's width (only github.com was tried), the grid+ cells' hover and pressed fills, where a grid pin's popup opens (Cra: under the cell), a space with+ pins but no favorites (Cra: the header follows the grid as it follows tiles).