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.
Tidy Downloads' card stays while hovered and has room under the old name
Victord177d963318e
diff --git a/Sources/Cra/Services/TidyDownloadsService.swift b/Sources/Cra/Services/TidyDownloadsService.swiftindex c2c0af2..e3a3337 100644--- a/Sources/Cra/Services/TidyDownloadsService.swift+++ b/Sources/Cra/Services/TidyDownloadsService.swift@@ -66,18 +66,51 @@ final class TidyDownloadsService {}}+ /// When the card goes by itself, and the timer that takes it.+ @ObservationIgnored private var dismissAt = Date.distantFuture+ @ObservationIgnored private var dismissal: Task<Void, Never>?+ /// After the pointer leaves, the card stays at least this long (Victor, 5 Nov 2026: it went while+ /// he was deciding whether to revert; Arc's hover behaviour wasn't seen).+ static let afterHover: TimeInterval = 3+private func show(_ r: Rename) {card = r- DispatchQueue.main.asyncAfter(deadline: .now() + Self.cardShown) { [weak self] in- if self?.card?.id == r.id { self?.card = nil }+ schedule(after: Self.cardShown)+ }++ private func schedule(after delay: TimeInterval) {+ dismissal?.cancel()+ dismissAt = Date().addingTimeInterval(delay)+ let id = card?.id+ dismissal = Task { @MainActor [weak self] in+ try? await Task.sleep(for: .seconds(delay))+ guard !Task.isCancelled, let self, self.card?.id == id else { return }+ self.card = nil}}- func dismiss() { card = nil }+ /// The pointer is on the card: it stays until the pointer leaves, then for what was left of its+ /// time, but at least `afterHover`.+ func hold(_ hovering: Bool) {+ guard card != nil else { return }+ if hovering {+ let left = dismissAt.timeIntervalSinceNow+ dismissal?.cancel()+ dismissal = nil+ dismissAt = Date().addingTimeInterval(max(left, 0))+ } else {+ schedule(after: max(dismissAt.timeIntervalSinceNow, Self.afterHover))+ }+ }++ func dismiss() {+ dismissal?.cancel()+ card = nil+ }/// Arc's "Revert to original name": the file takes its old name back (or the next free one).func revert(_ r: Rename, moved: (String, String) -> Void) -> Bool {- card = nil+ dismiss()let fm = FileManager.defaultguard fm.fileExists(atPath: r.newPath) else { return false }let folder = (r.oldPath as NSString).deletingLastPathComponentdiff --git a/Sources/Cra/UI/Sidebar/DownloadRenameCard.swift b/Sources/Cra/UI/Sidebar/DownloadRenameCard.swiftindex a9c4a30..f45dbae 100644--- a/Sources/Cra/UI/Sidebar/DownloadRenameCard.swift+++ b/Sources/Cra/UI/Sidebar/DownloadRenameCard.swift@@ -2,13 +2,14 @@ import AppKit/// Arc's Tidy Downloads card (SidebarBanner, "Download renamed to:"), over the sidebar's foot with/// its tail on the download bin. Measured on Arc 1.171, 4 Nov 2026 (60 fps, a dark space, 347 pt-/// sidebar): 8 pt from either side, 65 pt tall plus a 9 pt tail; "Download renamed to:" 12 pt in+/// sidebar): 8 pt from either side, 65 pt tall plus a 9 pt tail (Cra: 71, so the old name's baseline sits as+/// far from the bottom as the label's cap top from the top; Victor, 5 Nov 2026); "Download renamed to:" 12 pt in/// blue, the new name 14 pt semibold, the old name 12 pt in blue, struck through; revert ↶ and close/// ✕ at the top right; four-point sparkles twinkling round it. It springs out of the bin (0.55× to/// 1.05× at 0.29 s, settled by 0.55 s), the strike draws in 0.5 s later over 0.15 s, and it shrinks/// back into the bin in 0.12 s after 8 s.final class DownloadRenameCard: NSView {- static let bodyHeight: CGFloat = 65+ static let bodyHeight: CGFloat = 71static let tail: CGFloat = 9static var height: CGFloat { bodyHeight + tail }@@ -16,6 +17,8 @@ final class DownloadRenameCard: NSView {var onRevert: () -> Void = {}var onClose: () -> Void = {}var onOpen: () -> Void = {}+ /// The pointer came onto the card or left it: it stays while hovered.+ var onHover: (Bool) -> Void = { _ in }/// Where the tail points, in the card's coordinates (the bin's top centre).var tailX: CGFloat = 33 { didSet { needsLayout = true } }@@ -167,6 +170,11 @@ final class DownloadRenameCard: NSView {func appear() {layoutSubtreeIfNeeded()anchorOnTail()+ // Under a resting pointer no mouseEntered comes: hold it from the start.+ if let w = window {+ let p = convert(w.mouseLocationOutsideOfEventStream, from: nil)+ if p.y >= 0, p.y <= Self.bodyHeight, p.x >= 0, p.x <= bounds.width { onHover(true) }+ }let spring = CASpringAnimation(keyPath: "transform.scale")spring.fromValue = 0.55spring.toValue = 1@@ -209,6 +217,15 @@ final class DownloadRenameCard: NSView {CATransaction.commit()}+ override func updateTrackingAreas() {+ super.updateTrackingAreas()+ for t in trackingAreas where t.owner === self { removeTrackingArea(t) }+ addTrackingArea(NSTrackingArea(rect: NSRect(x: 0, y: 0, width: bounds.width, height: Self.bodyHeight),+ options: [.mouseEnteredAndExited, .activeAlways], owner: self, userInfo: nil))+ }+ override func mouseEntered(with event: NSEvent) { onHover(true) }+ override func mouseExited(with event: NSEvent) { onHover(false) }+override var mouseDownCanMoveWindow: Bool { false }override func mouseDown(with event: NSEvent) {}override func mouseUp(with event: NSEvent) {diff --git a/Sources/Cra/UI/Sidebar/List/SidebarView.swift b/Sources/Cra/UI/Sidebar/List/SidebarView.swiftindex c5da62c..e763dd5 100644--- a/Sources/Cra/UI/Sidebar/List/SidebarView.swift+++ b/Sources/Cra/UI/Sidebar/List/SidebarView.swift@@ -71,6 +71,7 @@ final class SidebarView: NSView {let toast = actions.showToastlet ui = self.uiv.onClose = { service.dismiss() }+ v.onHover = { service.hold($0) }v.onOpen = { NSWorkspace.shared.activateFileViewerSelecting([URL(fileURLWithPath: r.newPath)]) }v.onRevert = {let ok = service.revert(r) { _, back indiff --git a/docs/arc-reverse-engineering.md b/docs/arc-reverse-engineering.mdindex a249e39..83eb287 100644--- a/docs/arc-reverse-engineering.md+++ b/docs/arc-reverse-engineering.md@@ -3119,7 +3119,9 @@ Arc Max's renameDownloads: a finished download is renamed on disk and a card abowhether hovering holds it.- Cra: TidyDownloads (CraCore: prompt with Cra's own examples, the name's checks, a free name), TidyDownloadsService(FoundationModels, renames the file, DownloadHistory.move, revert), DownloadRenameCard (SidebarView, over the bin).- Settings ▸ Max ▸ Tidy Downloads, off by default.+ Settings ▸ Max ▸ Tidy Downloads, off by default. Deviations Victor asked for (5 Nov 2026): the body is 71 pt+ (the old name's baseline as far from the bottom as the label's cap top from the top), and the card stays while the+ pointer is on it, then for what was left of its 8 s but at least 3 s.## Little Arc over a full-screen app (Arc 1.171, 5 Nov 2026, issue #186, Victor's Arc + a test full-screen app)