Skip to content

armgit / cra

Public Imported from GitHub
0

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.

Collapsed space headers keep their icon, and the command bar has Check for Updates

Victore39cc6900647
diff --git a/Sources/Cra/App/AppDelegate.swift b/Sources/Cra/App/AppDelegate.swift
index 4de69db..52cf224 100644
--- a/Sources/Cra/App/AppDelegate.swift
+++ b/Sources/Cra/App/AppDelegate.swift
@@ -743,6 +743,12 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {
store.setExpanded(id, f[1] == "1")
return
}
+ // collapsePinned=1 collapses the focused space's pinned tabs, 0 expands them (a header click).
+ if let v = dict["collapsePinned"] {
+ let sid = store.focusedSpaceID
+ if store.isPinnedCollapsed(sid) != (v == "1") { store.togglePinnedCollapsed(sid) }
+ return
+ }
// Settings ▸ Advanced's search engine picker, by keyword.
if let keyword = dict["searchEngine"] {
if let e = SearchEngines.shared.keywords(profilePath: nil).first(where: { $0.keyword == keyword }) {
@@ -813,6 +819,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {
case "pictureInPicture":
item.title = main.currentBrowser?.isInPictureInPicture == true ? "Exit Picture in Picture" : "Picture in Picture"
case "promoteLittleWindow": return keyLittleWindow?.hasPage ?? false
+ case "checkForUpdates": return SoftwareUpdater.shared.validateMenuItem(item)
case "closeSplitPane", "separateFromSplit", "flipSplitOrientation":
return store.selectedTabID.flatMap { store.splitContaining($0) } != nil
case "addSplitView": return store.selectedTabID != nil
@@ -1032,6 +1039,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {
case "importData": main.showImport()
case "rebuildArcProfiles": ArcProfileRebuilder.run(store: store) { [weak self] in self?.relaunch() }
case "setDefaultBrowser": Task { await SystemIntegration.shared.makeDefaultBrowser() }
+ case "checkForUpdates": SoftwareUpdater.shared.checkForUpdates(nil)
case "clearBrowsingData":
// Chrome's dialog, in a normal window: what it deletes from history leaves the command bar too.
let normal = useNormalWindow()
@@ -1130,9 +1138,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {
appMenu.addItem(item("clearBrowsingData"))
appMenu.addItem(.separator())
appMenu.addItem(item("importData"))
- let update = NSMenuItem(title: "Check for Updates…", action: #selector(SoftwareUpdater.checkForUpdates(_:)), keyEquivalent: "")
- update.target = SoftwareUpdater.shared
- appMenu.addItem(update)
+ appMenu.addItem(item("checkForUpdates"))
appMenu.addItem(.separator())
appMenu.addItem(std("Hide Cra", #selector(NSApplication.hide(_:)), "h"))
appMenu.addItem(std("Hide Others", #selector(NSApplication.hideOtherApplications(_:)), "h", [.command, .option]))
diff --git a/Sources/Cra/App/KeyBindings.swift b/Sources/Cra/App/KeyBindings.swift
index ec15b18..8168ae1 100644
--- a/Sources/Cra/App/KeyBindings.swift
+++ b/Sources/Cra/App/KeyBindings.swift
@@ -220,6 +220,8 @@ final class KeyBindingRegistry {
// Chrome's app menu item and key; Arc has neither, only Settings ▸ Profiles ▸ Clear Browsing Data.
KeyAction(id: "clearBrowsingData", name: "Clear Browsing Data…", section: .app, shortcuts: [Shortcut(Shortcut.delete, cmdShift)],
triggers: ["clear history", "delete history", "clear browsing data", "delete browsing data"], symbol: "trash"),
+ KeyAction(id: "checkForUpdates", name: "Check for Updates…", section: .app, shortcuts: [],
+ triggers: ["update", "upgrade", "new version"], symbol: "arrow.down.circle"),
]
for n in 1...9 {
list.append(KeyAction(id: "item\(n)", name: "Go to Tab \(n)", section: .tabs,
diff --git a/Sources/Cra/UI/Settings/ShortcutsPane.swift b/Sources/Cra/UI/Settings/ShortcutsPane.swift
index 6795d27..84cb0cd 100644
--- a/Sources/Cra/UI/Settings/ShortcutsPane.swift
+++ b/Sources/Cra/UI/Settings/ShortcutsPane.swift
@@ -314,5 +314,6 @@ enum ShortcutDescriptions {
"importData": "Bring tabs, spaces and extensions over from Arc or Dia.",
"rebuildArcProfiles": "Put spaces imported from Arc back on their Arc profiles, with their sign-ins and extensions.",
"clearBrowsingData": "Delete history, cookies and cached files with Chrome’s dialog.",
+ "checkForUpdates": "Look for a newer version of Cra.",
]
}
diff --git a/Sources/Cra/UI/Sidebar/List/SpaceColumnView.swift b/Sources/Cra/UI/Sidebar/List/SpaceColumnView.swift
index f97f7f0..1edc23f 100644
--- a/Sources/Cra/UI/Sidebar/List/SpaceColumnView.swift
+++ b/Sources/Cra/UI/Sidebar/List/SpaceColumnView.swift
@@ -92,7 +92,9 @@ final class SpaceColumnView: NSView {
/// The space's emoji and name. Arc 1.171 (live, 1 Nov): a click collapses or expands the pinned
/// tabs; on hover the fill comes in, the chevron takes the icon's place and the ••• button
/// (sidebarSpaceEditButton) shows at the trailing edge, all in one frame. The ••• and a
-/// right-click open the same space menu at the pointer. Collapsed, the chevron stays and points right.
+/// right-click open the same space menu at the pointer. Collapsed, the chevron points right. Arc keeps
+/// it in the icon's place while collapsed; Cra shows the icon at rest and the chevron only on hover
+/// (X DM, 4 Nov), except for a space without an icon, where the chevron is all that shows the state.
final class SpaceHeaderView: NSView, NSTextFieldDelegate {
private let spaceID: UUID
private let store: SidebarStore
@@ -181,7 +183,8 @@ final class SpaceHeaderView: NSView, NSTextFieldDelegate {
done.textColor = colors.textTertiary
chevron.contentTintColor = colors.textSecondary
more.tint = colors.textSecondary
- let showsChevron = lit || collapsed
+ let hasIcon = !(emoji.stringValue.isEmpty && symbol.image == nil)
+ let showsChevron = lit || (collapsed && !hasIcon)
chevron.alphaValue = showsChevron ? 1 : 0
emoji.alphaValue = showsChevron ? 0 : 1
symbol.alphaValue = showsChevron ? 0 : 1
diff --git a/Tests/Scenarios/component-snapshots.scenario b/Tests/Scenarios/component-snapshots.scenario
index 54010fe..d55bebb 100644
--- a/Tests/Scenarios/component-snapshots.scenario
+++ b/Tests/Scenarios/component-snapshots.scenario
@@ -14,6 +14,15 @@ snapshot FolderRowView pinned-folder
snapshot TabRowView today-tab-row
snapshot NewTabRowView new-tab-row
snapshot SpaceDockView space-dock
+# Collapsed, Cra keeps the space icon at rest (Arc shows the chevron; X DM, 4 Nov).
+cra://debug?collapsePinned=1
+wait 1
+snapshot SpaceHeaderView space-header-collapsed
+cra://debug?collapsePinned=0
+wait 1
+# The command bar lists Check for Updates (X DM, 4 Nov).
+cra://debug?suggest=check%20for%20up
+expect-log Cra suggest check for up .*command\("checkForUpdates"\) Check for Updates
cra://open?url=${PAGE}?n=snap
wait 3
snapshot SidebarURLPill url-pill
diff --git a/Tests/Snapshots/space-header-collapsed.png b/Tests/Snapshots/space-header-collapsed.png
new file mode 100644
index 0000000..3bb7e6c
Binary files /dev/null and b/Tests/Snapshots/space-header-collapsed.png differ
diff --git a/docs/arc-reverse-engineering.md b/docs/arc-reverse-engineering.md
index 1f64a98..a95e55b 100644
--- a/docs/arc-reverse-engineering.md
+++ b/docs/arc-reverse-engineering.md
@@ -935,6 +935,8 @@ Observed live on a throwaway Today split (example.com | example.org), archived a
without the fill).
- Cra: SpaceHeaderView matches all four states (rest, hover, collapsed, collapsed + hover) to within
1 px at 2x; the ••• square sits 0.5 pt off so its dots land on Arc's.
+- Cra deviation (4 Nov, X DM): collapsed, Cra keeps the space icon at rest and shows the right-pointing
+ chevron only on hover, so the icon is always visible. A space without an icon keeps Arc's resting chevron.
### DevTools docking, Arc's way (25 Oct)