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 Tab Titles as Arc's, on Apple Intelligence, and Arc's tidy titles for every tab
Victor09a1ee758507
diff --git a/Packages/CraCore/Sources/CraCore/SidebarModel.swift b/Packages/CraCore/Sources/CraCore/SidebarModel.swiftindex ebae93b..32ac97c 100644--- a/Packages/CraCore/Sources/CraCore/SidebarModel.swift+++ b/Packages/CraCore/Sources/CraCore/SidebarModel.swift@@ -521,6 +521,9 @@ public struct AppSettings: Codable, Equatable {/// Arc Max's Tidy Tabs (tidyTabsEnabled), done by the Mac's Apple Intelligence model: the Today/// divider's Tidy button. On by default; the button only shows while Apple Intelligence is on.public var tidyTabs: Bool = true+ /// Arc Max's Tidy Tab Titles (renamePinnedTabsEnabled): a tab you pin gets a shorter name from the+ /// Mac's Apple Intelligence model. Off by default: it renames, where Tidy waits for a click.+ public var tidyTabTitles: Bool = falsepublic init() {}@@ -684,6 +687,7 @@ extension AppSettings {perfRecording = try c.decodeIfPresent(Bool.self, forKey: .perfRecording) ?? Self.perfRecordingDefaultperfHidesSiteNames = try c.decodeIfPresent(Bool.self, forKey: .perfHidesSiteNames) ?? falsetidyTabs = try c.decodeIfPresent(Bool.self, forKey: .tidyTabs) ?? true+ tidyTabTitles = try c.decodeIfPresent(Bool.self, forKey: .tidyTabTitles) ?? false}}diff --git a/Packages/CraCore/Sources/CraCore/TidyTitleRules+Data.swift b/Packages/CraCore/Sources/CraCore/TidyTitleRules+Data.swiftnew file mode 100644index 0000000..9cd8ced--- /dev/null+++ b/Packages/CraCore/Sources/CraCore/TidyTitleRules+Data.swift@@ -0,0 +1,61 @@+// Arc 1.171's tidy titles (web_content_behavior.json, "tidyTitles"; the copy Arc ships, which+// content.arc.net also served on 4 Nov 2026 less app.notion.com): per site, rules tried in order,+// the first whose `match` fits the URL setting the sidebar's title. Data only; TidyTitleRules reads it.+extension TidyTitleRules {+ static let arcRulesJSON = #"""+{+ "aa.com": {"siteName": "American Airlines", "rules": [{"match": {"pathEquals": "^/homePage.do"}, "title": {"always": "American Airlines"}}, {"title": {"removingPattern": " -.+"}}]},+ "admin.typeform.com": {"siteName": "Typeform", "rules": [{"title": {"removingPattern": "^Typeform - "}}]},+ "airtable.com": {"siteName": "Airtable", "rules": [{"match": {"pathEquals": "/"}, "title": {"always": "Airtable"}}, {"title": {"removingPatterns": ["^Airtable - ", " - Airtable$"]}}]},+ "amazon.com": {"siteName": "Amazon", "rules": [{"match": {"pathEquals": "/"}, "title": {"always": "Amazon"}}, {"match": {"pathContainsRegex": "/.+"}, "title": {"removingPattern": "^(Amazon.com[\\s]?:?[\\.]?[\\s])?"}}, {"title": {"removingPattern": "^Amazon.com\\.? ?:? ?"}}]},+ "app.front.com": {"siteName": "Front", "rules": [{"match": {"pathEquals": "/"}, "title": {"always": "Front"}}]},+ "app.mode.com": {"siteName": "Mode", "rules": [{"title": {"removingPattern": " \\| Mode$"}}]},+ "app.notion.com": {"siteName": "Notion", "rules": [{"match": {"pathEquals": "/"}, "title": {"always": "Notion"}}, {"title": {"removingPatterns": ["^\\([0-9]+\\+?\\)\\s", " \\| Notion$", " – The all-in-one workspace for your notes, tasks, wikis, and databases."]}}]},+ "app.slack.com": {"siteName": "Slack", "rules": [{"title": {"removingPatterns": ["^Slack \\| ", " \\| [0-9]+ new items?"]}}]},+ "aws.amazon.com": {"siteName": "Amazon Web Services", "rules": [{"match": {"pathEquals": "/"}, "title": {"always": "Amazon Web Services"}}]},+ "booooooom.com": {"siteName": "BOOOOOOOOM", "rules": [{"match": {"pathEquals": "/blog/art"}, "title": {"always": "Art – BOOOOOOOM!"}}]},+ "browserinc.notion.site": {"siteName": "Notion", "rules": [{"match": {"pathEquals": "/Arc-Resources-e5dfd3226b2544b0816f6778b32fc6a4"}, "title": {"always": "Arc Resources"}}, {"match": {"pathEquals": "/Shortcuts-500ec3b2118b4824986427c32d2aba7e"}, "title": {"always": "Shortcuts"}}]},+ "calendar.google.com": {"siteName": "Calendar", "rules": [{"match": {"pathContainsRegex": "/r/eventedit"}, "title": {"removingPattern": ".+Calendar - "}}, {"match": {"pathContainsRegex": "/r/agenda"}, "title": {"always": "Schedule"}}, {"match": {"pathContainsRegex": "/r/."}, "title": {"removingPattern": ".+Calendar - "}}, {"match": {"pathContainsRegex": "^/calendar/u/[0-9]+"}, "title": {"always": "Calendar"}}]},+ "console.cloud.google.com": {"siteName": "Google Cloud console", "rules": [{"title": {"removingPattern": " \\– Google Cloud console$"}}]},+ "cooking.nytimes.com": {"siteName": "NYT Cooking", "rules": [{"match": {"pathContainsRegex": "^/.+"}, "title": {"removingPattern": " - NYT Cooking"}}, {"match": {"pathContainsRegex": "/"}, "title": {"always": "NYT Cooking"}}]},+ "disneyplus.com": {"siteName": "Disney+", "rules": [{"match": {"pathContainsRegex": "/(home/)?"}, "title": {"always": "Disney+"}}]},+ "docs.github.com": {"siteName": "GitHub Docs", "rules": [{"title": {"removingPattern": " - GitHub Docs$"}}]},+ "docs.google.com": {"siteName": "Google Docs", "rules": [{"match": {"pathContainsRegex": "^/spreadsheets/d/.+"}, "title": {"removingPattern": " - Google Sheets$"}}, {"match": {"pathContainsRegex": "^/document/d/.+"}, "title": {"removingPattern": " - Google Docs$"}}, {"match": {"pathContainsRegex": "^/presentation/d/.+"}, "title": {"removingPattern": " - Google Slides$"}}, {"match": {"pathContainsRegex": "^/forms/d/.+"}, "title": {"removingPattern": " - Google Forms$"}}]},+ "docusign.com": {"siteName": "DocuSign", "rules": [{"match": {"pathEquals": "/"}, "title": {"always": "DocuSign"}}]},+ "drive.google.com": {"siteName": "Google Drive", "rules": [{"match": {"pathContainsRegex": "^/drive/u/"}, "title": {"removingPattern": " - Google Drive$"}}]},+ "dropbox.com": {"siteName": "Dropbox", "rules": [{"title": {"removingPattern": " - Dropbox$"}}]},+ "en.wikipedia.org": {"siteName": "Wikipedia", "rules": [{"match": {"pathContainsRegex": "^/wiki/Main_Page"}, "title": {"always": "Wikipedia"}}, {"match": {"pathContainsRegex": "^/wiki/.+"}, "title": {"removingPattern": " - Wikipedia$"}}]},+ "figma.com": {"siteName": "Figma", "rules": [{"match": {"pathEquals": "/files/recent"}, "title": {"always": "Recently Viewed"}}, {"match": {"pathContainsRegex": "^/files/.+"}, "title": {"removingPattern": " – Figma$"}}, {"match": {"pathContainsRegex": "^/file/.+"}, "title": {"removingPattern": " – Figma$"}}, {"match": {"pathEquals": "/"}, "title": {"always": "Figma"}}]},+ "ft.com": {"siteName": "Financial Times", "rules": [{"title": {"removingPattern": " \\| Financial Times"}}]},+ "github.com": {"siteName": "GitHub", "rules": [{"match": {"pathContainsRegex": "^/.+/pull/[0-9]+"}, "title": {"removingPattern": "\\s+by\\s+[a-zA-Z0-9_.-]+\\s+·.*"}}]},+ "gmail.com": {"siteName": "Gmail", "rules": [{"title": {"always": "Gmail"}}]},+ "google.com": {"siteName": "Google Search", "rules": [{"match": {"pathContainsRegex": "^/search"}, "title": {"removingPattern": " - Google Search$"}}, {"match": {"pathContainsRegex": "^/gmail/about"}, "title": {"always": "Gmail"}}, {"match": {"pathContainsRegex": "^/maps/place"}, "title": {"removingPattern": " - Google Maps$"}}]},+ "hire.lever.co": {"siteName": "Lever Hire", "rules": [{"title": {"removingPattern": " – Lever Hire"}}]},+ "hulu.com": {"siteName": "Hulu", "rules": [{"match": {"pathEquals": "/"}, "title": {"always": "Hulu"}}, {"match": {"pathEquals": "/hub/home"}, "title": {"always": "Hulu"}}, {"title": {"removingPattern": "^Hulu \\| "}}]},+ "justworks.com": {"siteName": "Justworks", "rules": [{"match": {"pathEquals": "/"}, "title": {"always": "Justworks"}}]},+ "lever.co": {"siteName": "Lever", "rules": [{"match": {"pathEquals": "/"}, "title": {"always": "Lever"}}, {"title": {"removingPattern": " \\|.+$"}}]},+ "linkedin.com": {"siteName": "LinkedIn", "rules": [{"match": {"pathEquals": "/"}, "title": {"always": "LinkedIn"}}, {"match": {"pathEquals": "/feed"}, "title": {"always": "LinkedIn"}}, {"match": {"pathContainsRegex": "^/.+"}, "title": {"removingPatterns": [" [\\|] LinkedIn$", "^\\([0-9]+\\+?\\)\\s"]}}]},+ "mail.google.com": {"siteName": "Gmail", "rules": [{"match": {"fragmentEquals": "inbox"}, "title": {"always": "Gmail"}}, {"match": {"fragmentEquals": "starred"}, "title": {"always": "Starred"}}, {"match": {"fragmentEquals": "snoozed"}, "title": {"always": "Snoozed"}}, {"match": {"fragmentEquals": "sent"}, "title": {"always": "Sent"}}, {"match": {"fragmentEquals": "drafts"}, "title": {"always": "Drafts"}}, {"match": {"fragmentEquals": "imp"}, "title": {"always": "Important"}}, {"match": {"fragmentEquals": "scheduled"}, "title": {"always": "Scheduled"}}, {"match": {"fragmentEquals": "all"}, "title": {"always": "All"}}, {"match": {"fragmentEquals": "spam"}, "title": {"always": "Spam"}}, {"match": {"fragmentEquals": "trash"}, "title": {"always": "Trash"}}, {"match": {"fragmentContainsRegex": "^label/.+"}, "title": {"removingPattern": " - .+$"}}]},+ "maps.google.com": {"siteName": "Google Maps", "rules": [{"title": {"removingPattern": " - Google Maps$"}}]},+ "meet.google.com": {"siteName": "Google Meet", "rules": [{"match": {"pathContainsRegex": "^/[a-z]+-[a-z]+-[a-z]+$"}, "title": {"removingPattern": "^Meet - "}}]},+ "miro.com": {"siteName": "Miro", "rules": [{"match": {"pathEquals": "/"}, "title": {"always": "Miro"}}, {"title": {"removingPattern": " ?(,|\\|) Online Whiteboard for Visual Collaboration"}}]},+ "netflix.com": {"siteName": "Netflix", "rules": [{"title": {"removingPattern": " - Netflix$"}}]},+ "news.ycombinator.com": {"siteName": "Hacker News", "rules": [{"title": {"removingPattern": " \\| Hacker News$"}}]},+ "notion.so": {"siteName": "Notion", "rules": [{"match": {"pathEquals": "/"}, "title": {"always": "Notion"}}, {"title": {"removingPatterns": ["^\\([0-9]+\\+?\\)\\s", " \\| Notion$", " – The all-in-one workspace for your notes, tasks, wikis, and databases."]}}]},+ "npr.org": {"siteName": "NPR", "rules": [{"match": {"pathEquals": "/"}, "title": {"always": "NPR"}}]},+ "nytimes.com": {"siteName": "The New York Times", "rules": [{"match": {"pathContainsRegex": "^/(live/)?[0-9]{4}/.+"}, "title": {"removingPattern": " - The New York Times$"}}, {"match": {"pathContainsRegex": "/crosswords(/.+)?"}, "title": {"removingPattern": " ?- The New York Times$"}}, {"match": {"pathEquals": "/"}, "title": {"removingPattern": " - Breaking News, US News, World News and Videos$"}}, {"match": {"pathContainsRegex": "^/(puzzles|games)/.+"}, "title": {"removingPatterns": [" ?- The New York Times", " - New York Times Number Puzzles"]}}, {"match": {"pathEquals": "/crosswords"}, "title": {"removingPattern": "- The New York Times.+$"}}]},+ "open.spotify.com": {"siteName": "Spotify", "rules": [{"match": {"pathEquals": "/"}, "title": {"always": "Spotify"}}, {"title": {"removingPatterns": [" – Web Player$", "^Spotify – "]}}]},+ "reddit.com": {"siteName": "Reddit", "rules": [{"match": {"pathEquals": "/"}, "title": {"always": "Reddit"}}, {"match": {"pathContainsRegex": "^/.+"}, "title": {"removingPattern": "\\([0-9]+\\) "}}]},+ "robinhood.com": {"siteName": "Robinhood", "rules": [{"title": {"removingPattern": " \\| Robinhood$"}}]},+ "secure.justworks.com": {"siteName": "Justworks", "rules": [{"match": {"pathEquals": "/directory/org_chart"}, "title": {"always": "Org Chart"}}, {"match": {"pathEquals": "/directory"}, "title": {"always": "Directory"}}, {"match": {"pathEquals": "/calendar"}, "title": {"always": "Calendar"}}, {"match": {"pathEquals": "/vouchers"}, "title": {"always": "Paystubs"}}, {"match": {"pathEquals": "/my_benefits"}, "title": {"always": "Benefits"}}, {"match": {"pathEquals": "/documents"}, "title": {"always": "Documents"}}, {"match": {"pathEquals": "/training"}, "title": {"always": "Training"}}, {"match": {"pathContainsRegex": "^/account_settings"}, "title": {"always": "Settings"}}]},+ "spreadsheets.google.com": {"siteName": "Google Sheets", "rules": [{"match": {"pathContainsRegex": "^/spreadsheets/d/.+"}, "title": {"removingPattern": " - Google Sheets$"}}, {"match": {"pathContainsRegex": "^/forms/d/.+"}, "title": {"removingPattern": " - Google Forms$"}}]},+ "twitter.com": {"siteName": "Twitter", "rules": [{"match": {"pathEquals": "/"}, "title": {"always": "Twitter"}}, {"match": {"pathEquals": "/home"}, "title": {"always": "Twitter"}}, {"title": {"removingPatterns": [" / Twitter$", "^\\([0-9]+\\+?\\)\\s", " on Twitter", " - Twitter Search$"]}}]},+ "typeform.com": {"siteName": "Typeform", "rules": [{"match": {"pathEquals": "/"}, "title": {"always": "Typeform"}}]},+ "us02web.zoom.us": {"siteName": "Zoom", "rules": [{"match": {"pathContainsRegex": "^/.+"}, "title": {"always": "Launch Meeting"}}]},+ "weather.com": {"siteName": "Weather.com", "rules": [{"match": {"pathEquals": "/"}, "title": {"always": "Weather.com"}}]},+ "web.whatsapp.com": {"siteName": "WhatsApp", "rules": [{"title": {"always": "WhatsApp"}}]},+ "youtube.com": {"siteName": "YouTube", "rules": [{"title": {"removingPattern": " - YouTube"}}]},+ "zillow.com": {"siteName": "Zillow", "rules": [{"match": {"pathEquals": "/"}, "title": {"always": "Zillow"}}]}+}+"""#+}diff --git a/Packages/CraCore/Sources/CraCore/TidyTitleRules.swift b/Packages/CraCore/Sources/CraCore/TidyTitleRules.swiftnew file mode 100644index 0000000..cec529d--- /dev/null+++ b/Packages/CraCore/Sources/CraCore/TidyTitleRules.swift@@ -0,0 +1,95 @@+import Foundation++/// Arc's tidy titles: the sidebar shows "Jupiter" for a tab whose page is "Jupiter - Wikipedia",+/// "Gmail" for the inbox, a Figma file without " – Figma". Per-site rules from Arc 1.171+/// (TidyTabTitles' TidyTitleConfiguration: siteName, rules of `match` + `title`), applied to every+/// tab's displayed title whatever Arc Max says (checked live 4 Nov 2026 with renamePinnedTabsEnabled+/// off), never to a name the user gave. The stored page title stays as it is.+public struct TidyTitleRules: Sendable {+ public struct Site: Decodable, Sendable {+ public var siteName: String+ public var rules: [Rule]+ }++ public struct Rule: Decodable, Sendable {+ public var match: Match?+ public var title: Title+ }++ /// Where on the site a rule applies; no match applies everywhere (Arc's PathMatchType).+ public struct Match: Decodable, Sendable {+ public var pathEquals: String?+ public var pathContainsRegex: String?+ public var fragmentEquals: String?+ public var fragmentContainsRegex: String?+ }++ /// What the title becomes (Arc's TitleModifier).+ public struct Title: Decodable, Sendable {+ public var always: String?+ public var removingPattern: String?+ public var removingPatterns: [String]?+ }++ public let sites: [String: Site]++ public init(sites: [String: Site]) { self.sites = sites }++ /// Arc's own rules.+ public static let arc: TidyTitleRules = {+ let sites = (try? JSONDecoder().decode([String: Site].self, from: Data(arcRulesJSON.utf8))) ?? [:]+ return TidyTitleRules(sites: sites)+ }()++ /// The rules' site for a host: an exact match, "www." ignored ("amazon.com" is not+ /// "aws.amazon.com", which has its own).+ public func site(forHost host: String) -> Site? {+ let h = host.lowercased()+ return sites[h] ?? (h.hasPrefix("www.") ? sites[String(h.dropFirst(4))] : nil)+ }++ /// The title the sidebar shows for a page: the first rule that fits the URL, or the page's own+ /// title. A rule that would leave nothing keeps the page's title.+ public func tidy(_ title: String, url: String) -> String {+ guard !title.isEmpty, let u = URLComponents(string: url), let host = u.host, let site = site(forHost: host) else { return title }+ let path = u.path.isEmpty ? "/" : u.path+ let fragment = u.fragment ?? ""+ for rule in site.rules where Self.fits(rule.match, path: path, fragment: fragment) {+ let out = Self.apply(rule.title, to: title)+ return out.isEmpty ? title : out+ }+ return title+ }++ static func fits(_ m: Match?, path: String, fragment: String) -> Bool {+ guard let m else { return true }+ if let p = m.pathEquals, path != p { return false }+ if let r = m.pathContainsRegex, !contains(path, r) { return false }+ if let f = m.fragmentEquals, fragment != f { return false }+ if let r = m.fragmentContainsRegex, !contains(fragment, r) { return false }+ return true+ }++ static func apply(_ t: Title, to title: String) -> String {+ if let a = t.always { return a }+ var out = title+ for p in (t.removingPattern.map { [$0] } ?? []) + (t.removingPatterns ?? []) {+ guard let re = regex(p) else { continue }+ out = re.stringByReplacingMatches(in: out, range: NSRange(out.startIndex..., in: out), withTemplate: "")+ }+ return out.trimmingCharacters(in: .whitespacesAndNewlines)+ }++ static func contains(_ s: String, _ pattern: String) -> Bool {+ regex(pattern)?.firstMatch(in: s, range: NSRange(s.startIndex..., in: s)) != nil+ }++ private static let cache = NSCache<NSString, NSRegularExpression>()++ static func regex(_ p: String) -> NSRegularExpression? {+ if let r = cache.object(forKey: p as NSString) { return r }+ guard let r = try? NSRegularExpression(pattern: p) else { return nil }+ cache.setObject(r, forKey: p as NSString)+ return r+ }+}diff --git a/Packages/CraCore/Sources/CraCore/TidyTitles.swift b/Packages/CraCore/Sources/CraCore/TidyTitles.swiftnew file mode 100644index 0000000..a6b8e67--- /dev/null+++ b/Packages/CraCore/Sources/CraCore/TidyTitles.swift@@ -0,0 +1,57 @@+import Foundation++/// Arc Max's Tidy Tab Titles (renamePinnedTabs), done by the Mac's own Apple Intelligence model:+/// a tab pinned without a name of its own gets a short one ("Climate - BBC News" became "Climate+/// News", "Foundation Models | Apple Developer Documentation" "Foundation Models", live in Arc 1.171,+/// 4 Nov 2026). Arc keeps it as the tab's custom title. This decides what the model is asked and+/// which answers become names; the model call and the animation are the app's.+public enum TidyTitles {+ static let maximumLength = 40++ public static let instructions = """+ You rename browser tabs in a sidebar so they are short and tidy, the way a person renames a \+ bookmark. Keep what the page is about and drop the website's name, slogans, unread counts and \+ separators. Use one to four words in the page title's own language, no quotes and no emoji. \+ For a site's home page, dashboard or inbox, use the site's name.+ """++ /// Pairs Arc's own renames made (Victor's Arc, 4 Nov 2026): the model copies their style.+ public static let examples: [(page: String, site: String, title: String)] = [+ ("IT Career Paths - IT General - Confluence", "atlassian.net", "IT Career Paths"),+ ("Personal apps | Heroku", "dashboard.heroku.com", "Heroku"),+ ("Climate - BBC News", "bbc.com", "Climate News"),+ ("Convert SVG to PNG - SVG Viewer", "svgviewer.dev", "SVG to PNG"),+ ("Deltagere ‹ Grønne tanker — WordPress", "groenne.dk", "Grønne tanker"),+ ("Free Backlink Checker by Ahrefs: Check Backlinks to Any Site", "ahrefs.com", "Ahrefs"),+ ]++ /// The request: the page's title and site.+ public static func prompt(title: String, url: String) -> String {+ var lines = ["Examples:"]+ for e in examples { lines.append("\"\(e.page)\" (\(e.site)) → \(e.title)") }+ lines.append("")+ lines.append("Rename this tab: \"\(clip(title, 200))\" (\(host(url)))")+ return lines.joined(separator: "\n")+ }++ /// The model's answer as a name, or nil when it isn't one worth using: empty, no shorter than+ /// the title shown now, or the same words.+ public static func clean(_ answer: String, shown: String) -> String? {+ var s = answer.split(whereSeparator: \.isNewline).first.map(String.init) ?? ""+ s = s.trimmingCharacters(in: .whitespaces.union(CharacterSet(charactersIn: "\"'“”‘’«»`.")))+ s = s.split(whereSeparator: \.isWhitespace).joined(separator: " ")+ guard !s.isEmpty, s.count <= maximumLength else { return nil }+ let a = s.lowercased(), b = shown.trimmingCharacters(in: .whitespaces).lowercased()+ guard a != b, s.count < shown.count else { return nil }+ return s+ }++ static func host(_ url: String) -> String {+ guard let h = URL(string: url)?.host?.lowercased() else { return "" }+ return h.hasPrefix("www.") ? String(h.dropFirst(4)) : h+ }++ static func clip(_ s: String, _ n: Int) -> String {+ s.count <= n ? s : String(s.prefix(n))+ }+}diff --git a/Packages/CraCore/Tests/CraCoreTests/TidyTitlesTests.swift b/Packages/CraCore/Tests/CraCoreTests/TidyTitlesTests.swiftnew file mode 100644index 0000000..cd27899--- /dev/null+++ b/Packages/CraCore/Tests/CraCoreTests/TidyTitlesTests.swift@@ -0,0 +1,64 @@+import CraCore+import Foundation+import Testing++/// Arc's tidy titles (per-site rules, always on) and Tidy Tab Titles (the model's names on pin).+struct TidyTitleRulesTests {+ let rules = TidyTitleRules.arc++ @Test func arcsRulesLoad() {+ #expect(rules.sites.count == 52)+ #expect(rules.site(forHost: "en.wikipedia.org")?.siteName == "Wikipedia")+ }++ @Test func titlesSeenInArc() {+ // Arc 1.171's sidebar, 4 Nov 2026.+ #expect(rules.tidy("Jupiter - Wikipedia", url: "https://en.wikipedia.org/wiki/Jupiter") == "Jupiter")+ #expect(rules.tidy("Y Combinator | Hacker News", url: "https://news.ycombinator.com/item?id=1") == "Y Combinator")+ // No rules for the BBC: the page's own title.+ #expect(rules.tidy("Climate - BBC News", url: "https://www.bbc.com/news/topics/x") == "Climate - BBC News")+ }++ @Test func pathAndFragmentRules() {+ #expect(rules.tidy("Wikipedia, the free encyclopedia", url: "https://en.wikipedia.org/wiki/Main_Page") == "Wikipedia")+ #expect(rules.tidy("Inbox (3) - [email protected] - Gmail", url: "https://mail.google.com/mail/u/0/#inbox") == "Gmail")+ #expect(rules.tidy("Starred - [email protected] - Gmail", url: "https://mail.google.com/mail/u/0/#starred") == "Starred")+ #expect(rules.tidy("Receipts - [email protected] - Gmail", url: "https://mail.google.com/mail/u/0/#label/Receipts") == "Receipts")+ #expect(rules.tidy("Amazon.com", url: "https://www.amazon.com/") == "Amazon")+ }++ @Test func removingPatternsAndHosts() {+ // removingPatterns: LinkedIn's counter and suffix both go.+ #expect(rules.tidy("(3) Jane Doe | LinkedIn", url: "https://www.linkedin.com/in/jane") == "Jane Doe")+ // www. is ignored, other subdomains aren't the site.+ #expect(rules.site(forHost: "WWW.Amazon.com") != nil)+ #expect(rules.site(forHost: "music.youtube.com") == nil)+ #expect(rules.tidy("x", url: "not a url") == "x")+ #expect(rules.tidy("", url: "https://en.wikipedia.org/wiki/X") == "")+ }++ @Test func aRuleLeavingNothingKeepsTheTitle() throws {+ let json = #"{"a.com": {"siteName": "A", "rules": [{"title": {"removingPattern": ".*"}}]}}"#+ let r = TidyTitleRules(sites: try JSONDecoder().decode([String: TidyTitleRules.Site].self, from: Data(json.utf8)))+ #expect(r.tidy("Anything", url: "https://a.com/") == "Anything")+ }+}++struct TidyTitlesTests {+ @Test func promptGivesExamplesTitleAndSite() {+ let p = TidyTitles.prompt(title: "Foundation Models | Apple Developer Documentation", url: "https://developer.apple.com/documentation/foundationmodels")+ #expect(p.hasPrefix("Examples:\n\"IT Career Paths - IT General - Confluence\" (atlassian.net) → IT Career Paths"))+ #expect(p.hasSuffix("Rename this tab: \"Foundation Models | Apple Developer Documentation\" (developer.apple.com)"))+ #expect(TidyTitles.prompt(title: "x", url: "https://www.bbc.com/").hasSuffix("(bbc.com)"))+ }++ @Test func cleanKeepsShorterNames() {+ #expect(TidyTitles.clean("\"Climate News\"", shown: "Climate - BBC News") == "Climate News")+ #expect(TidyTitles.clean(" Foundation Models.\nextra", shown: "Foundation Models | Apple Developer Documentation") == "Foundation Models")+ // Nothing to gain: empty, the same, or no shorter.+ #expect(TidyTitles.clean("", shown: "Jupiter") == nil)+ #expect(TidyTitles.clean("jupiter", shown: "Jupiter") == nil)+ #expect(TidyTitles.clean("Jupiter the planet", shown: "Jupiter") == nil)+ #expect(TidyTitles.clean(String(repeating: "a", count: 41), shown: String(repeating: "b", count: 90)) == nil)+ }+}diff --git a/Sources/Cra/App/AppDelegate.swift b/Sources/Cra/App/AppDelegate.swiftindex 80415db..3d9d398 100644--- a/Sources/Cra/App/AppDelegate.swift+++ b/Sources/Cra/App/AppDelegate.swift@@ -53,6 +53,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {SoftwareUpdater.shared.start(app: self)buildMenus()store.hasPage = { [unowned self] in self.runtime(for: $0).map { !$0.discarded } ?? false }+ store.tabPinned = { [unowned self] in TidyTitlesService.shared.tabPinned($0, store: self.store) }// A tip takes the tones of the space its browser window is in (the sidebar may be a// floating panel, a child of that window).ArcTooltipController.shared.tones = { [unowned self] window indiff --git a/Sources/Cra/Services/SidebarStore.swift b/Sources/Cra/Services/SidebarStore.swiftindex c5579b8..7f9b118 100644--- a/Sources/Cra/Services/SidebarStore.swift+++ b/Sources/Cra/Services/SidebarStore.swift@@ -50,6 +50,9 @@ final class SidebarStore {@ObservationIgnored private var previousTab: [UUID: UUID] = [:]/// Whether a tab's page is loaded; AppDelegate asks the windows' browser managers.@ObservationIgnored var hasPage: (UUID) -> Bool = { _ in true }+ /// A tab came into a space's pinned tabs from elsewhere (⌘D, a drag, a menu): Tidy Tab Titles+ /// may give it a shorter name (TidyTitlesService).+ @ObservationIgnored var tabPinned: (UUID) -> Void = { _ in }// MARK: Persistence@@ -686,6 +689,7 @@ final class SidebarStore {if it.isLiveFolder, case .today? = rootContainerKind(newParent) { return }if fromParent != newParent, let from = fromParent, items[from]?.isLiveFolder == true { hideLiveItem(id, in: from) }let oldIndex = fromParent.flatMap { items[$0]?.children.firstIndex(of: id) }+ let wasPinned = fromParent.map { if case .pinned? = rootContainerKind($0) { return true } else { return false } } ?? falseif it.isFolder, !it.isTabGroup, case .today? = rootContainerKind(newParent) {// Unpack: move the folder's tabs instead.let kids = it.children@@ -729,6 +733,7 @@ final class SidebarStore {}if let from = fromParent, from != newParent { collapseSplitIfNeeded(from) }touch()+ if !wasPinned, it.isTab, it.title == nil, !isIncognito(item: id), case .pinned? = rootContainerKind(newParent) { tabPinned(id) }}/// Moves several items so they end up next to each other, in the givendiff --git a/Sources/Cra/Services/TidyTitlesService.swift b/Sources/Cra/Services/TidyTitlesService.swiftnew file mode 100644index 0000000..00556f6--- /dev/null+++ b/Sources/Cra/Services/TidyTitlesService.swift@@ -0,0 +1,99 @@+import AppKit+import Foundation+import Observation+#if canImport(FoundationModels)+import FoundationModels+#endif++/// Tidy Tab Titles on the Mac's Apple Intelligence model: a tab you pin gets a short name (Arc Max's+/// renamePinnedTabs). The name becomes the tab's custom title, as in Arc, and the row plays Arc's+/// rename (TabRowView.playTidyRename): the old title sweeps into the new one with sparkles, and+/// "Double-click to rename" shows under it for a few seconds.+@MainActor @Observable+final class TidyTitlesService {+ static let shared = TidyTitlesService()++ /// A rename the row is showing: what it was called, and since when.+ struct Effect: Equatable {+ var token = UUID()+ var oldTitle: String+ var start: Date+ }++ /// Tabs renamed in the last few seconds: their rows show the subtitle and play the sweep once.+ private(set) var effects: [UUID: Effect] = [:]++ /// Arc 1.171, two 120 fps recordings (4 Nov 2026): the rename started ~1 s after the pin (its+ /// server's round trip; Cra's model answers in ~0.5 s, so it waits the rest), the sweep and+ /// sparkles ran 0.55 s, and the subtitle left 3.1 s after that.+ static let delayAfterPin: TimeInterval = 1.0+ static let sweep: TimeInterval = 0.55+ static let subtitleShown: TimeInterval = 3.65+ static let subtitle = "Double-click to rename"++ @ObservationIgnored private var pending: Set<UUID> = []++ private init() {}++ /// The store saw a tab pinned. Ask for a name if the setting is on and the model can run.+ func tabPinned(_ id: UUID, store: SidebarStore) {+ guard store.settings.tidyTabTitles, TidyTabsService.shared.modelAvailable, !pending.contains(id),+ let item = store.item(id), item.title == nil, let tab = item.tab, !item.isEmptyTab else { return }+ let shown = TidyTitleRules.arc.tidy(item.displayTitle, url: tab.url)+ let prompt = TidyTitles.prompt(title: item.displayTitle, url: tab.url)+ pending.insert(id)+ let started = Date()+ Task { @MainActor in+ defer { pending.remove(id) }+ let answer = await Self.ask(prompt)+ let rest = Self.delayAfterPin - Date().timeIntervalSince(started)+ if rest > 0 { try? await Task.sleep(for: .seconds(rest)) }+ // Only if nothing changed meanwhile: still pinned, still unnamed, same page title.+ guard let answer, let name = TidyTitles.clean(answer, shown: shown),+ let now = store.item(id), now.title == nil, store.isPinned(id),+ now.tab.map({ TidyTitleRules.arc.tidy(now.displayTitle, url: $0.url) }) == shown else { return }+ store.rename(id, to: name)+ let effect = Effect(oldTitle: shown, start: Date())+ effects[id] = effect+ CraLog.note("Tidy Tab Titles: renamed a pinned tab (\(shown.count) → \(name.count) characters)")+ try? await Task.sleep(for: .seconds(Self.subtitleShown))+ if effects[id]?.token == effect.token { effects[id] = nil }+ }+ }++ private static func ask(_ prompt: String) async -> String? {+ if let fake = fakeAnswer(prompt) { return fake }+ #if canImport(FoundationModels)+ if #available(macOS 26.0, *) {+ do {+ let session = LanguageModelSession(instructions: TidyTitles.instructions)+ let r = try await session.respond(to: prompt, generating: TidyTitleAnswer.self, options: GenerationOptions(sampling: .greedy))+ return r.content.title+ } catch {+ CraLog.note("Tidy Tab Titles: the model failed: \(error)")+ return nil+ }+ }+ #endif+ return nil+ }++ /// CRA_TIDY_FAKE_MODEL=1: the title up to its first separator, so a test copy renames without+ /// Apple Intelligence ("Climate - BBC News" → "Climate").+ private static func fakeAnswer(_ prompt: String) -> String? {+ guard TidyTabsService.fakeModel, let line = prompt.split(separator: "\n").last,+ let open = line.firstIndex(of: "\""), let close = line.lastIndex(of: "\""), open < close else { return nil }+ let title = String(line[line.index(after: open)..<close])+ let cut = title.components(separatedBy: CharacterSet(charactersIn: "|–—-·:‹")).first ?? title+ return cut.trimmingCharacters(in: .whitespaces)+ }+}++#if canImport(FoundationModels)+@available(macOS 26.0, *)+@Generable+struct TidyTitleAnswer {+ @Guide(description: "The tab's new name, one to four words")+ var title: String+}+#endifdiff --git a/Sources/Cra/UI/Settings/MaxPane.swift b/Sources/Cra/UI/Settings/MaxPane.swiftindex fa69f9b..c08d2dd 100644--- a/Sources/Cra/UI/Settings/MaxPane.swift+++ b/Sources/Cra/UI/Settings/MaxPane.swift@@ -19,6 +19,12 @@ struct MaxPane: View {} description: {Text("Press the \(Image(nsImage: BroomGlyph.image).renderingMode(.template)) icon to let your Sidebar organize itself whenever you have six or more Today Tabs.")}+ SettingsCardDivider()+ MaxFeatureRow(title: "Tidy Tab Titles", isOn: $store.settings.tidyTabTitles, enabled: available) {+ TidyTabTitlesPicture()+ } description: {+ Text("Have your tabs automatically renamed with tidier, shorter titles when you Pin them.")+ }}MaxFooter(status: service.status) { service.openSystemSettings() }.padding(.top, 14)@@ -111,6 +117,34 @@ private struct MaxFooter: View {}}+/// Arc's Tidy Tab Titles picture: a renamed tab, "Double-click to rename" under it, sparkles round+/// it, on mauve.+private struct TidyTabTitlesPicture: View {+ private let ink = Color(red: 0.42, green: 0.27, blue: 0.62)+ var body: some View {+ ZStack {+ Color(red: 0.61, green: 0.48, blue: 0.62)+ HStack(spacing: 4) {+ RoundedRectangle(cornerRadius: 1.5).fill(Color(red: 0.32, green: 0.12, blue: 0.36))+ .frame(width: 8, height: 6)+ VStack(alignment: .leading, spacing: 0) {+ Text("Interior Design Book").font(.system(size: 6, weight: .medium)).foregroundStyle(ink)+ .lineLimit(1).fixedSize()+ Text("Double-click to rename").font(.system(size: 4.5)).foregroundStyle(ink.opacity(0.8))+ .lineLimit(1).fixedSize()+ }+ }+ .padding(.horizontal, 5).padding(.vertical, 2.5)+ .background(Capsule().fill(Color.white))+ ForEach(0..<9, id: \.self) { i in+ Circle().fill(Color.white.opacity(i % 2 == 0 ? 0.9 : 0.6))+ .frame(width: i % 3 == 0 ? 1.6 : 1.1, height: i % 3 == 0 ? 1.6 : 1.1)+ .offset(x: [-33, -20, -6, 9, 22, 34, -26, 15, 30][i], y: [-12, 13, -14, 12, -13, 10, 9, -11, -6][i])+ }+ }+ }+}+/// Arc's Tidy Tabs picture: the squiggle, the broom and a ✕ on lavender.private struct TidyTabsPicture: View {private let ink = Color(red: 0.55, green: 0.52, blue: 0.72)diff --git a/Sources/Cra/UI/Sidebar/List/SidebarRowViews.swift b/Sources/Cra/UI/Sidebar/List/SidebarRowViews.swiftindex 834b5da..da09d87 100644--- a/Sources/Cra/UI/Sidebar/List/SidebarRowViews.swift+++ b/Sources/Cra/UI/Sidebar/List/SidebarRowViews.swift@@ -905,6 +905,8 @@ struct TabRowModel: Equatable {var homeFlipIcon: Bool/// The favicon of a Peek opened from this tab (Arc: modalIcon), in the close button's place.var peekIcon: NSImage?+ /// Tidy Tab Titles just renamed it: the row plays Arc's rename once.+ var tidyRename: TidyTitlesService.Effect? = nil}final class TabRowView: SidebarRowView, ArcTooltipTarget, NSTextFieldDelegate {@@ -924,6 +926,11 @@ final class TabRowView: SidebarRowView, ArcTooltipTarget, NSTextFieldDelegate {private var flagsMonitor: Any?/// Arc's regional hover background for a tab that can go back: the icon's square or the body.private let regionLayer = CALayer()+ /// The Tidy Tab Titles rename this row last played, and what it is drawing for it.+ private var playedRename: UUID?+ private var renameOld: NSTextField?+ private var renameSparkles: CALayer?+ private var renameBright = falseoverride init(key: SpaceListView.RowKey, list: SpaceListView, colors: SidebarColors) {super.init(key: key, list: list, colors: colors)@@ -971,6 +978,11 @@ final class TabRowView: SidebarRowView, ArcTooltipTarget, NSTextFieldDelegate {}rebuildAccessories()refreshBackground()+ // A rename that just happened plays once; a row rebuilt later shows only the subtitle.+ if let e = m.tidyRename, e.token != playedRename {+ playedRename = e.token+ if window != nil, Date().timeIntervalSince(e.start) < 0.3 { playTidyRename(from: e.oldTitle) }+ }}override func setColors(_ c: SidebarColors) {@@ -979,6 +991,112 @@ final class TabRowView: SidebarRowView, ArcTooltipTarget, NSTextFieldDelegate {if let m = model { model = nil; apply(m) }}+ /// Arc's rename (TabCellView: animatedGradientView over the old and new title, sparksView;+ /// measured at 120 fps on Arc 1.171, 4 Nov 2026): one soft front 72 pt wide crosses the row+ /// left to right at ~1,180 pt/s, fading the old title out and the new title and its "Double-click+ /// to rename" in, the subtitle bright meanwhile; sparkles rise along a band that crosses the row in+ /// 0.55 s, and everything stops at once when it has.+ private func playTidyRename(from old: String) {+ layoutSubtreeIfNeeded()+ let total = TidyTitlesService.sweep+ let fade: CGFloat = 72, speed: CGFloat = 1180+ let start = titleLabel.frame.minX + SidebarText.inset + 20+ let oldLabel = NSTextField.sidebarLabel(size: 14)+ oldLabel.stringValue = old+ oldLabel.textColor = colors.textPrimary+ oldLabel.lineBreakMode = .byClipping+ oldLabel.cell?.truncatesLastVisibleLine = false+ oldLabel.frame = NSRect(x: titleLabel.frame.minX, y: titleLabel.frame.minY,+ width: max(titleLabel.frame.width, bounds.width - 8 - titleLabel.frame.minX), height: titleLabel.frame.height)+ oldLabel.wantsLayer = true+ addSubview(oldLabel)+ renameOld = oldLabel+ titleLabel.wantsLayer = true+ subtitleLabel.wantsLayer = true+ let end = oldLabel.frame.maxX + fade / 2+ let sweep = min(total, Double((end - start) / speed))+ for (view, reveal) in [(titleLabel as NSView, true), (subtitleLabel, true), (oldLabel, false)] {+ view.layer?.mask = Self.frontMask(reveal: reveal, fade: fade, height: view.bounds.height,+ from: start - view.frame.minX, to: end - view.frame.minX, duration: sweep)+ }+ renameBright = true+ refreshSubtitle()+ let sparkles = Self.sparkles(in: bounds, dark: colors.isDark, duration: total)+ layer?.addSublayer(sparkles)+ renameSparkles = sparkles+ layer?.zPosition = 50+ DispatchQueue.main.asyncAfter(deadline: .now() + total) { [weak self] in self?.endTidyRename() }+ }++ private func endTidyRename() {+ renameOld?.removeFromSuperview()+ renameOld = nil+ renameSparkles?.removeFromSuperlayer()+ renameSparkles = nil+ titleLabel.layer?.mask = nil+ subtitleLabel.layer?.mask = nil+ layer?.zPosition = 0+ renameBright = false+ refreshSubtitle()+ }++ /// A horizontal mask whose soft edge (`fade` wide) travels `from` → `to`: opaque behind the front+ /// when it reveals, opaque ahead of it when it hides.+ private static func frontMask(reveal: Bool, fade: CGFloat, height: CGFloat, from: CGFloat, to: CGFloat, duration: Double) -> CALayer {+ let span: CGFloat = 4000+ let g = CAGradientLayer()+ g.startPoint = CGPoint(x: 0, y: 0.5)+ g.endPoint = CGPoint(x: 1, y: 0.5)+ let on = NSColor.black.cgColor, off = NSColor.clear.cgColor+ g.colors = reveal ? [on, on, off, off] : [off, off, on, on]+ let half = Double(fade / 2 / (2 * span))+ g.locations = [0, NSNumber(value: 0.5 - half), NSNumber(value: 0.5 + half), 1]+ g.bounds = CGRect(x: 0, y: 0, width: 2 * span, height: height + 40)+ g.position = CGPoint(x: to, y: height / 2)+ g.actions = ["position": NSNull(), "bounds": NSNull()]+ let move = CABasicAnimation(keyPath: "position.x")+ move.fromValue = from+ move.toValue = to+ move.duration = duration+ move.timingFunction = CAMediaTimingFunction(name: .linear)+ g.add(move, forKey: "front")+ return g+ }++ /// Arc's sparks: small dots that come up along a band crossing the row, scattered up to ~28 pt+ /// above and below it, most staying lit until the sweep ends, a few going out early.+ private static func sparkles(in rect: CGRect, dark: Bool, duration: Double) -> CALayer {+ let box = CALayer()+ box.frame = rect+ box.actions = ["sublayers": NSNull()]+ var rng = SystemRandomNumberGenerator()+ let count = 46+ let now = CACurrentMediaTime()+ for i in 0..<count {+ let born = duration * (Double(i) + Double.random(in: 0...1, using: &rng)) / Double(count)+ let x = rect.width * CGFloat(born / duration) + CGFloat.random(in: -14...14, using: &rng)+ let spread = CGFloat((0..<3).map { _ in Double.random(in: -1...1, using: &rng) }.reduce(0, +) / 3) * 28+ let r = CGFloat.random(in: 0.6...1.5, using: &rng)+ let dot = CALayer()+ dot.frame = CGRect(x: min(max(x, 2), rect.width - 2) - r, y: rect.midY + spread - r, width: 2 * r, height: 2 * r)+ dot.cornerRadius = r+ dot.backgroundColor = (dark ? NSColor.white : NSColor.black.withAlphaComponent(0.55)).cgColor+ dot.opacity = 0+ let life = Bool.random(using: &rng) && i % 3 == 0 ? Double.random(in: 0.15...0.3, using: &rng) : duration - born+ let blink = CAKeyframeAnimation(keyPath: "opacity")+ let peak = Float.random(in: 0.55...1, using: &rng)+ blink.values = [0, peak, peak * 0.6, peak, 0]+ blink.keyTimes = [0, 0.12, 0.5, 0.85, 1]+ blink.beginTime = now + born+ blink.duration = max(0.05, life)+ blink.fillMode = .both+ blink.isRemovedOnCompletion = false+ dot.add(blink, forKey: "spark")+ box.addSublayer(dot)+ }+ return box+ }+override var fillLeading: CGFloat { CGFloat(model?.depth ?? 0) * CraMetrics.indent }override func baseFill() -> NSColor {@@ -1092,7 +1210,8 @@ final class TabRowView: SidebarRowView, ArcTooltipTarget, NSTextFieldDelegate {private func refreshSubtitle() {subtitleLabel.stringValue = shownSubtitle ?? ""- subtitleLabel.textColor = colors.textTertiary+ // Arc draws the subtitle bright while the rename sweeps in.+ subtitleLabel.textColor = renameBright ? colors.textPrimary : colors.textTertiarysubtitleLabel.isHidden = shownSubtitle == nil || renameField != nil}diff --git a/Sources/Cra/UI/Sidebar/List/SpaceListView.swift b/Sources/Cra/UI/Sidebar/List/SpaceListView.swiftindex 0d73d51..6e3fd0a 100644--- a/Sources/Cra/UI/Sidebar/List/SpaceListView.swift+++ b/Sources/Cra/UI/Sidebar/List/SpaceListView.swift@@ -219,6 +219,7 @@ final class SpaceListView: NSView, NSDraggingSource {let capturing = ui.capturingTabIDslet audible = ui.audibleTabIDslet refreshing = LiveFolderManager.shared.refreshing+ let tidyEffects = TidyTitlesService.shared.effects// The ⌘T bar's New Tab row takes the selection's fill while it is open.let placeholder = showsNewTab && ui.newTabPlaceholderActive && store.focusedSpaceID(window: window) == spaceIDvar out: [Row] = []@@ -291,10 +292,14 @@ final class SpaceListView: NSView, NSDraggingSource {let (img, flip) = icon(tab.iconKey)let (homeImg, homeFlip) = navigatedAway ? icon(tab.customIconKey ?? FaviconKey.key(for: tab.savedURL)) : (img, flip)let developerMode = store.settings.isDeveloperMode(url: tab.url)- let subtitle = tab.sidebarSubtitle(developerMode: developerMode)+ // Tidy Tab Titles' rename: "Double-click to rename" under the new name for a few seconds.+ let tidyRename = tidyEffects[item.id]+ let subtitle = tidyRename != nil ? TidyTitlesService.subtitle : tab.sidebarSubtitle(developerMode: developerMode)+ // Arc's tidy titles: a known site's page shows a shorter title unless the tab has a name.+ let title = item.title == nil ? TidyTitleRules.arc.tidy(item.displayTitle, url: tab.url) : item.displayTitlerow.content = .tab(TabRowModel(- id: item.id, depth: depth, pinned: pinned, title: item.displayTitle, customTitle: item.title != nil,- renameText: item.title ?? item.displayTitle, subtitle: subtitle,+ id: item.id, depth: depth, pinned: pinned, title: title, customTitle: item.title != nil,+ renameText: item.title ?? title, subtitle: subtitle,icon: img, flipIcon: flip, githubMark: tab.liveItemURL != nil && tab.customIconKey == nil,editing: renaming == item.id, selected: selected,highlighted: picks.isEmpty ? selected && !placeholder : picks.contains(item.id),@@ -302,13 +307,15 @@ final class SpaceListView: NSView, NSDraggingSource {navigatedAway: navigatedAway,focusRing: focusID == item.id, developerMode: developerMode, peeked: peeked,homeIcon: homeImg, homeFlipIcon: homeFlip,- peekIcon: ui.peekBadge?.tabID == item.id ? icon(ui.peekBadge?.iconKey).0 : nil))+ peekIcon: ui.peekBadge?.tabID == item.id ? icon(ui.peekBadge?.iconKey).0 : nil,+ tidyRename: tidyRename))out.append(row)} else if item.isSplit {let children = store.children(of: item.id).filter(\.isTab)let cells = children.map { c -> SplitRowModel.Cell inlet (img, flip) = icon(c.tab?.iconKey)- return .init(id: c.id, title: c.displayTitle, icon: img, flipIcon: flip)+ let title = c.title == nil ? c.tab.map { TidyTitleRules.arc.tidy(c.displayTitle, url: $0.url) } ?? c.displayTitle : c.displayTitle+ return .init(id: c.id, title: title, icon: img, flipIcon: flip)}let selected = children.contains { store.isSelected($0.id, window: window) }row.content = .split(SplitRowModel(diff --git a/Tests/StoreTests.swift b/Tests/StoreTests.swiftindex 33a4523..1f5a322 100644--- a/Tests/StoreTests.swift+++ b/Tests/StoreTests.swift@@ -36,6 +36,7 @@ enum StoreTests {sharedFavorites()themePreview()tidyTabs()+ pinHook()print("Store: \(checks) checks passed")}@@ -927,6 +928,29 @@ enum StoreTests {expect(store.integrityProblems().isEmpty, "and the sidebar stays sound")}+ /// Tidy Tab Titles hears of a tab pinned from elsewhere, once, and only while it has no name.+ @MainActor+ private static func pinHook() {+ let store = AppComposition(clock: ManualScheduler()).store+ var heard: [UUID] = []+ store.tabPinned = { heard.append($0) }+ let sid = store.createSpace(title: "Pins", emoji: "📌").id+ let a = store.createTab(url: "https://example.org/a", in: sid, select: false)+ let b = store.createTab(url: "https://example.org/b", in: sid, select: false)+ store.rename(b.id, to: "Mine")+ store.pinTab(a.id)+ store.pinTab(b.id)+ expect(heard == [a.id], "pinning tells Tidy Tab Titles about an unnamed tab, not a named one")+ let pinned = store.focusedSpace.pinnedContainerID+ store.moveItem(a.id, to: pinned, index: 0)+ let folder = store.createFolder(named: "F", in: pinned)+ store.moveItem(a.id, to: folder.id, index: nil)+ expect(heard == [a.id], "moves inside the pinned tabs don't count")+ store.unpinTab(a.id)+ store.togglePinned(a.id)+ expect(heard == [a.id, a.id], "pinning it again does")+ }+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 4f3bcf8..2b7cd7b 100644--- a/docs/arc-reverse-engineering.md+++ b/docs/arc-reverse-engineering.md@@ -3060,3 +3060,38 @@ Apple Intelligence is on, so it's free and nothing leaves the Mac).ramps 0.38 s.- [?] Not seen: Arc's real grouping (the server is gone), what Arc does with a model answer naming an existinggroup, whether a header can be dragged, and the arrow Arc sometimes draws before "Clear" (offline copy).++## Tidy titles and Tidy Tab Titles (Arc 1.171, 4 Nov 2026, Swift metadata + strings, Victor's Arc, 60 fps recordings)++Two things share the name. Arc tidies every tab's displayed title by per-site rules, always; Arc Max's Tidy Tab+Titles (`renamePinnedTabsEnabled`, AI endpoint `renamePinnedTabs`) gives a tab a new name when it is pinned.+- [O] Rules: `tidyTitles` in web_content_behavior.json (ARC_WebContentBehaviorConfigurationClient.bundle, also+ served by content.arc.net): 52 sites (51 online, less app.notion.com), each `{siteName, rules: [{match?, title}]}`.+ `match`: pathEquals, pathContainsRegex, fragmentEquals, fragmentContainsRegex (none: everywhere); `title`:+ always, removingPattern, removingPatterns (decoder strings next to "Unable to decode TitleModifier"). Live:+ "Jupiter - Wikipedia" shows "Jupiter", "Y Combinator | Hacker News" "Y Combinator", "Climate - BBC News"+ unchanged (no rules), the same with renamePinnedTabsEnabled off. Stored savedTitle stays the page's.+- [O] Tidy Tab Titles, live (two pins, Tabs ▸ Pin Tab): "Foundation Models | Apple Developer Documentation" →+ "Foundation Models", "Climate - BBC News" → "Climate News". Stored as the item's custom `title`. Arc's server+ still answered on 4 Nov 2026 (Tidy Tabs' didn't).+- [O] Timeline (60 fps): the row moves into Pinned in ~0.12 s; the rename starts 0.95–1.07 s after the pin (the+ server's round trip). At once the row turns two-line: title up, "Double-click to rename" under it (Arc's+ TabCellState hint, also the hover tooltip's subtitle). One soft front (~72 pt from opaque to clear) crosses+ left to right at ~1,180 pt/s: the old title (drawn whole, clipped, no ellipsis) fades out behind it, the new title+ and the subtitle in; the subtitle is bright (white ~96 % on the dark space) until the end. Sparkles: white dots+ ~1.5–3 pt, ~28 at a time, rising along a band that crosses the whole row in 0.55 s, scattered up to ~30 pt above+ and below it, mostly lit until the end. At 0.55 s (0.525 and 0.55 measured) sparkles go at once and the+ subtitle drops to its usual tone; it leaves 3.1 s later (in ~0.07 s), the row back to one line.+- [O static] TabCellView: isAnimatingAiRename, animatedGradientView (AnimatedGradientView: oldView, newView,+ baseMaskLayer, overlayMaskLayer, animationDuration, animationDelay, fadeWidth, contentOffset), sparksView+ (sparkles, animationPeriod, animationDuration, sparkleColor), currentSubtitleAnimationUUID. Analytics+ `auto_renamed_pinned_tab` with old/new title length.+- Arc's earlier renames in Victor's sidebar (the model's examples): "IT Career Paths - IT General - Confluence" →+ "IT Career Paths", "Personal apps | Heroku" → "Heroku", "Deltagere ‹ Grønne tanker — WordPress" → "Grønne tanker".+- Cra: TidyTitleRules (Arc's rules data, every unnamed tab row and split cell), TidyTitles + TidyTitlesService+ (FoundationModels, ~0.5 s, held to ~1 s after the pin like Arc), TabRowView.playTidyRename (front masks on the+ old and new title and the subtitle, 46 sparkles). Measured on Cra: rename 1.08 s after the pin, 0.55 s sweep,+ "Climate - BBC News" → "Climate News" as Arc. Settings ▸ Max ▸ Tidy Tab Titles, off by default (Arc's Max is+ opt-in).+- [?] Not seen: whether a drag into Pinned renames (Cra does, every pin counts), a rename whose new name isn't a+ prefix of the old (Cra crossfades in the soft edge), undo.diff --git a/docs/development.md b/docs/development.mdindex c518874..1f417db 100644--- a/docs/development.md+++ b/docs/development.md@@ -157,7 +157,7 @@ Measure them with `sample <pid> 6 1` and compare the main thread's busy time betTidy Tabs needs Apple Intelligence. `CRA_TIDY_FAKE_MODEL=1` stands in a model that groups bysite (after a 1.6 s pause), so a test instance on any Mac shows the button, the squiggle and the-groups; `CRA_TIDY_FAKE_MODEL=off` (or `preparing`, `ineligible`) shows Settings ▸ Max as a Mac+groups, and Tidy Tab Titles names a pinned tab after its title's first part; `CRA_TIDY_FAKE_MODEL=off` (or `preparing`, `ineligible`) shows Settings ▸ Max as a Macwithout Apple Intelligence would. `cra://debug?tidy=1` runs Tidy on the window's space withouthovering the divider, `cra://debug?undoTidy=1` is ⌘Z's undo and `cra://debug?settingsPane=max`opens Settings on a pane.