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.
PiP close pauses, command bar glow on the bar, Little Window copy toast and Shift-click like Arc (#165)
Victor Kildahlfdfbfe9c3265
diff --git a/Sources/Cra/Services/BrowserManager.swift b/Sources/Cra/Services/BrowserManager.swiftindex fe72c38..507426d 100644--- a/Sources/Cra/Services/BrowserManager.swift+++ b/Sources/Cra/Services/BrowserManager.swift@@ -718,7 +718,7 @@ final class BrowserManager: NSObject, @preconcurrency CraBrowserDelegate {backToTab: { [weak self] in self?.bringToFront(id) },togglePlayback: { [weak browser] in browser?.togglePictureInPicturePlayback() },skip: { [weak browser] s in browser?.skipPictureInPicture(by: s) },- close: { [weak browser] in browser?.exitPictureInPicture() })+ close: { [weak browser] in browser?.closePictureInPicture() })PictureInPictureChrome.shared.isPlaying = browser.isPictureInPicturePlayingPictureInPictureChrome.shared.videoEntered()} else {diff --git a/Sources/Cra/UI/CommandBar/CommandBarView.swift b/Sources/Cra/UI/CommandBar/CommandBarView.swiftindex fddd88a..97bbc3c 100644--- a/Sources/Cra/UI/CommandBar/CommandBarView.swift+++ b/Sources/Cra/UI/CommandBar/CommandBarView.swift@@ -188,6 +188,9 @@ final class CommandBarView: NSView {override func layout() {super.layout()let b = bounds+ // Tab into a scope empties the list and the panel shrinks to the field after the glow+ // started: the glow follows, or it stays centred on the old list below the bar.+ if let splash, let window { splash.setFrame(window.frame.insetBy(dx: -Self.splashMargin, dy: -Self.splashMargin), display: false) }material.frame = btint.frame = blet top: CGFloat = attached ? 10 : 14@@ -288,7 +291,7 @@ final class CommandBarView: NSView {inner.layer?.add(fade, forKey: "splash")addSubview(inner, positioned: .above, relativeTo: material)innerSplash = inner- let margin: CGFloat = 420+ let margin = Self.splashMarginlet panel = NSPanel(contentRect: window.frame.insetBy(dx: -margin, dy: -margin), styleMask: [.borderless, .nonactivatingPanel],backing: .buffered, defer: false)panel.backgroundColor = .clear@@ -296,7 +299,7 @@ final class CommandBarView: NSView {panel.hasShadow = falsepanel.ignoresMouseEvents = truepanel.collectionBehavior = window.collectionBehavior- panel.contentView = NSHostingView(rootView: CommandBarSplash(color: Color(nsColor: color), size: window.frame.size))+ panel.contentView = NSHostingView(rootView: CommandBarSplash(color: Color(nsColor: color), margin: margin))window.addChildWindow(panel, ordered: .below)splash = panelDispatchQueue.main.asyncAfter(deadline: .now() + 1.3) { [weak self, weak panel] in@@ -309,6 +312,9 @@ final class CommandBarView: NSView {}}+ /// Room around the bar for the glow's blur.+ private static let splashMargin: CGFloat = 420+/// How much of the site's colour shows inside Arc's bar after Tab, relative to the start (red/// over green, sampled off a 100 fps recording of Arc 1.171).private static let innerSplashCurve: [(time: Double, level: Double)] = [@@ -338,18 +344,18 @@ final class CommandBarView: NSView {/// faded by one ease-out animation of 1.2 s that starts as it appears.private struct CommandBarSplash: View {let color: Color- let size: CGSize+ /// The bar is the panel less this on every side.+ let margin: CGFloat@State private var blurRadius: CGFloat = 0@State private var opacity: Double = 1var body: some View {color.clipShape(RoundedRectangle(cornerRadius: 12, style: .continuous))- .frame(width: size.width, height: size.height)+ .padding(margin).blur(radius: blurRadius, opaque: false).opacity(opacity).animation(.easeOut(duration: 1.2), value: blurRadius)- .frame(maxWidth: .infinity, maxHeight: .infinity).onAppear {blurRadius = 150opacity = 0diff --git a/Sources/Cra/UI/Windows/LittleWindowController.swift b/Sources/Cra/UI/Windows/LittleWindowController.swiftindex b365b99..6074058 100644--- a/Sources/Cra/UI/Windows/LittleWindowController.swift+++ b/Sources/Cra/UI/Windows/LittleWindowController.swift@@ -95,6 +95,11 @@ enum LittlePalette {static let tooltipBorder = Color(red: 34 / 255, green: 37 / 255, blue: 93 / 255)static let tooltipCap = Color(red: 211 / 255, green: 212 / 255, blue: 253 / 255)static let tooltipCapGlyph = Color(red: 40 / 255, green: 46 / 255, blue: 252 / 255)+ /// Arc's toast in a Little Arc ("Copied Current URL", 1.171, 3 Nov 2026, sRGB): deeper than the+ /// default dark theme's in a browser window, the same in every space.+ static let toast: ShinyToast.Colors = (NSColor(srgbRed: 41 / 255, green: 18 / 255, blue: 77 / 255, alpha: 1),+ NSColor(srgbRed: 33 / 255, green: 16 / 255, blue: 61 / 255, alpha: 1),+ NSColor(srgbRed: 33 / 255, green: 14 / 255, blue: 66 / 255, alpha: 1), .white)static let barNS = NSColor(red: 12 / 255, green: 9 / 255, blue: 28 / 255, alpha: 1)static let buttonNS = NSColor(red: 5 / 255, green: 6 / 255, blue: 37 / 255, alpha: 1)@@ -132,6 +137,7 @@ final class LittleWindowController: NSWindowController, NSWindowDelegate, @precoprivate var popup: LittlePopupPanel?private var tooltip: LittleTooltipPanel?private var tooltipTimer: Timer?+ private let toast = ShinyToast()var store: SidebarStore { app.store }var currentURL: String { browser?.currentURL ?? state.url }@@ -186,7 +192,7 @@ final class LittleWindowController: NSWindowController, NSWindowDelegate, @preco}actions.openCommandBar = { [weak self] in self?.openCommandBar() }- actions.copyURL = { [weak self] in self?.copy(self?.currentURL ?? "") }+ actions.copyURL = { [weak self] in self?.copyURL() }actions.promote = { [weak self] sid in self?.promote(to: sid) }actions.togglePopup = { [weak self] in self?.togglePopup() }actions.closePopup = { [weak self] in self?.closePopup() }@@ -592,8 +598,10 @@ final class LittleWindowController: NSWindowController, NSWindowDelegate, @precocase "zoomIn": if let b = browser { b.setZoomLevel(b.zoomLevel() + 0.5) }case "zoomOut": if let b = browser { b.setZoomLevel(b.zoomLevel() - 0.5) }case "resetZoom": browser?.setZoomLevel(0)- case "copyURL": copy(currentURL)- case "copyURLMarkdown": copy("[\(browser?.currentTitle ?? state.title)](\(currentURL))")+ case "copyURL": copyURL()+ case "copyURLMarkdown":+ copy("[\(browser?.currentTitle ?? state.title)](\(currentURL))")+ showToast("Copied URL as Markdown")case "viewSource": browser?.viewSource()case "devTools", "jsConsole", "inspectElement":browser?.devToolsAction = ["jsConsole": "console", "inspectElement": "inspect"][id]@@ -617,6 +625,18 @@ final class LittleWindowController: NSWindowController, NSWindowDelegate, @precoNSPasteboard.general.setString(s, forType: .string)}+ /// ⇧⌘C and the link button: Arc's toast over the window's top-right corner, as in a browser window.+ private func copyURL() {+ copy(currentURL)+ showToast("Copied Current URL")+ }++ /// The toast sits 8 pt under the window's top, over the toolbar (Arc's Little Arc).+ private func showToast(_ text: String) {+ guard let window, let content = window.contentView else { return }+ toast.show(text, page: content.convert(content.bounds, to: nil), in: window, colors: LittlePalette.toast)+ }+/// ⌘W / Close Window: the same path as the close button. (performClose is/// skipped: it refuses to act while the standard buttons are dimmed.)func closeWindow() {@@ -744,6 +764,14 @@ final class LittleWindowController: NSWindowController, NSWindowDelegate, @precoif fullscreen != window.styleMask.contains(.fullScreen) { window.toggleFullScreen(nil) }}+ /// A Shift-clicked link opens in this window: Arc's Little Arc has no Peek of its own, so its+ /// Shift-click is a plain click (1.171, 3 Nov 2026).+ func browser(_ browser: CraBrowser, opensPeekForURL url: String, shiftClick: Bool) -> Bool {+ guard shiftClick, !url.lowercased().hasPrefix("cra:") else { return false }+ browser.loadURL(url)+ return true+ }+/// Links that want a new tab open another little window (Arc does the same).func browser(_ browser: CraBrowser, requestsNewTabWithURL url: String, inBackground background: Bool) {// cra:// is Cra's scripting scheme; a page must not drive it.diff --git a/Sources/Cra/UI/Windows/ShinyToast.swift b/Sources/Cra/UI/Windows/ShinyToast.swiftindex f53d84b..a22dced 100644--- a/Sources/Cra/UI/Windows/ShinyToast.swift+++ b/Sources/Cra/UI/Windows/ShinyToast.swift@@ -79,7 +79,13 @@ final class ShinyToast {var isShown: Bool { panel.parent != nil }/// Shows `text` at the top right of `page` (window coordinates) over `window`'s pages.+ typealias Colors = (top: NSColor, bottom: NSColor, outline: NSColor, text: NSColor)+func show(_ text: String, action: Action? = nil, page: NSRect, in window: NSWindow, theme: SpaceTheme) {+ show(text, action: action, page: page, in: window, colors: Self.colors(theme))+ }++ func show(_ text: String, action: Action? = nil, page: NSRect, in window: NSWindow, colors: Colors) {self.action = actionlet textWidth = ceil((text as NSString).size(withAttributes: [.font: Self.font]).width)let buttonWidth = action.map { ceil(($0.title as NSString).size(withAttributes: [.font: Self.buttonFont]).width) + 2 * Self.buttonPadding }@@ -88,7 +94,6 @@ final class ShinyToast {width: width, height: Self.height)panel.setFrame(window.convertToScreen(local.insetBy(dx: -Self.margin, dy: -Self.margin)), display: false)let scale = window.backingScaleFactor- let colors = Self.colors(theme)CATransaction.begin()CATransaction.setDisableActions(true)// Anchored at the top centre, where Arc's toast grows from.@@ -231,7 +236,7 @@ final class ShinyToast {/// at the bottom, outlined darker still. Fitted to one Arc theme of each kind (2 Nov 2026, sRGB):/// light (Victor's yellow/green) 220/226/184 → 208/218/163, outline 151/157/124; dark (the/// default theme in dark mode) 43/24/102 → 33/19/79, outline 26/15/62, white text.- static func colors(_ theme: SpaceTheme) -> (top: NSColor, bottom: NSColor, outline: NSColor, text: NSColor) {+ static func colors(_ theme: SpaceTheme) -> Colors {let theme = theme.shownlet comps = theme.colors.compactMap(HexColor.components)let n = Double(max(comps.count, 1))diff --git a/Sources/CraCEF/CraCEF.mm b/Sources/CraCEF/CraCEF.mmindex 4a9d337..24247ea 100644--- a/Sources/CraCEF/CraCEF.mm+++ b/Sources/CraCEF/CraCEF.mm@@ -2308,16 +2308,19 @@ static NSView* FindRenderWidgetHostView(NSView* root) {}}-- (void)exitPictureInPicture {+- (void)exitPictureInPicture { [self exitPictureInPicturePausing:NO]; }+- (void)closePictureInPicture { [self exitPictureInPicturePausing:YES]; }++- (void)exitPictureInPicturePausing:(BOOL)pause {if (!_browser) return;+ CefString js = pause ? "(function(){var v=document.pictureInPictureElement;if(!v)return;v.pause();"+ "document.exitPictureInPicture().catch(function(){});})();"+ : "if(document.pictureInPictureElement){document.exitPictureInPicture().catch(function(){});}";std::vector<CefString> ids;_browser->GetFrameIdentifiers(ids);for (const auto& id : ids) {CefRefPtr<CefFrame> f = _browser->GetFrameByIdentifier(id);- if (f && f->IsValid()) {- f->ExecuteJavaScript("if(document.pictureInPictureElement){document.exitPictureInPicture().catch(function(){});}",- f->GetURL(), 0);- }+ if (f && f->IsValid()) f->ExecuteJavaScript(js, f->GetURL(), 0);}}- (void)print { if (_browser) _browser->GetHost()->Print(); }diff --git a/Sources/CraCEF/include/CraCEF.h b/Sources/CraCEF/include/CraCEF.hindex 522939d..bfc70d3 100644--- a/Sources/CraCEF/include/CraCEF.h+++ b/Sources/CraCEF/include/CraCEF.h@@ -184,6 +184,9 @@ typedef NS_ENUM(NSInteger, CraDownloadState) {/// size qualifies, and nothing happens when there is none.- (void)requestPictureInPictureAutomatic:(BOOL)automatic NS_SWIFT_NAME(requestPictureInPicture(automatic:));- (void)exitPictureInPicture;+/// Picture in Picture's close button: the video pauses and goes back to the page, as in Arc+/// and Chrome (back to tab and returning to the tab keep it playing).+- (void)closePictureInPicture;/// YES while a video of this page is in the Picture in Picture window.@property (nonatomic, readonly) BOOL isInPictureInPicture;/// YES while that video is playing.diff --git a/Tests/BrowserManagerLifecycleTests.swift b/Tests/BrowserManagerLifecycleTests.swiftindex 26b577e..fee4acf 100644--- a/Tests/BrowserManagerLifecycleTests.swift+++ b/Tests/BrowserManagerLifecycleTests.swift@@ -640,6 +640,9 @@ enum BrowserManagerLifecycleTests {expect(!ra.browser.replies.contains { $0.method == "Runtime.evaluate" }, "a page already in Picture in Picture isn't asked again")manager.windowVisibilityChanged(covered: false)expect(ra.browser.isInPictureInPicture, "Picture in Picture the user opened stays when the window shows again")+ PictureInPictureChrome.shared.actions?.close()+ expect(ra.browser.pictureInPictureCloses == 1 && !ra.browser.isInPictureInPicture,+ "the window's close button pauses the video as it comes home (Arc)")manager.closeAll()}diff --git a/Tests/BrowserManagerSupport/CraCEF.swift b/Tests/BrowserManagerSupport/CraCEF.swiftindex 3ce18d6..230754c 100644--- a/Tests/BrowserManagerSupport/CraCEF.swift+++ b/Tests/BrowserManagerSupport/CraCEF.swift@@ -62,6 +62,8 @@ public final class CraBrowser {if automatic { automaticPictureInPictureRequests += 1 }}public func exitPictureInPicture() { isInPictureInPicture = false }+ public private(set) var pictureInPictureCloses = 0+ public func closePictureInPicture() { pictureInPictureCloses += 1; isInPictureInPicture = false }public func togglePictureInPicturePlayback() {}public func skipPictureInPicture(by seconds: Double) {}public private(set) var lastParams = ""diff --git a/docs/arc-reverse-engineering.md b/docs/arc-reverse-engineering.mdindex cd78b78..06442c2 100644--- a/docs/arc-reverse-engineering.md+++ b/docs/arc-reverse-engineering.md@@ -2692,3 +2692,16 @@ that waits 3 s before answering and then serves a page whose image takes 5 s.Auto theme saved before keeps its colours on the side they suit and derives the other.- [?] Not worked out: how Arc's editor maps a picked colour to its halves (the pad's `lightnessRange` and the biasvalue). Cra's halves are fitted to Arc's default theme only.++## Little Arc: Copy URL and Shift-click (Arc 1.171, 3 Nov 2026, X DM, offline Arc)++An offline Arc (fake home, no network) with a Little Arc on a file:// page, ⇧⌘C and a Shift-click sent as HID+events, the window recorded with `screencapture -V`.+- [O] ⇧⌘C shows Arc's toast, "Copied Current URL" with a share glyph button, springing in from the top over the+ "Open in" button and settling 8 pt under the window's top and ~8 pt in from its right edge, 42 pt tall, over the+ toolbar. The link glyph itself doesn't change. Fill (sRGB, from Display P3) 41/18/77 at the top → 33/16/61, outline+ 33/14/66, white text, darker than the default dark theme's toast in a browser window. Cra: the same ShinyToast,+ `LittlePalette.toast`. The share button isn't reproduced (not checked whether a browser window's copy toast has it).+- [O] A Shift-click on a link in the Little Arc's page opened it in that Little Arc: no Peek, no second window+ (AX and CG window lists before and after). Cra used to open another Little Window. A Shift-clicked link in a+ browser window still opens a Peek (`shiftClickModalEntryPointEnabled`).