Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
0794542
Let users jump from a workspace row to its Finder folder
austinywang May 6, 2026
7cab494
Keep Finder menu wiring within the sidebar row
austinywang May 6, 2026
0980b72
Resolve tilde workspace paths before Finder validation
austinywang May 6, 2026
8722e9b
Avoid file stats while building workspace context menus
austinywang May 6, 2026
aa4809e
Disable Finder menu for missing workspace folders
austinywang May 6, 2026
fab1c74
Keep Finder directory checks outside the sidebar row
austinywang May 6, 2026
9a98c02
Refresh Finder directory cache per menu request
austinywang May 6, 2026
3a54642
Keep Finder reveal scoped to local workspace directories
austinywang May 6, 2026
3200922
Keep the local Finder guard within the Workspace budget
austinywang May 6, 2026
71ab98a
Avoid redundant Finder cache writes while opening menus
austinywang May 6, 2026
81a45fe
Retry transient CI dependency download
austinywang May 6, 2026
0843b21
Keep Finder directory probes off the UI actor
austinywang May 6, 2026
d6d80fa
Let SwiftUI own Finder reveal requests
austinywang May 6, 2026
5f8c4b2
Retry transient macOS dependency bootstrap
austinywang May 6, 2026
2b8a0e0
Keep macOS CI out of Homebrew auto-update
austinywang May 6, 2026
134f24a
Retry transient Zig downloads in macOS CI
austinywang May 6, 2026
7dbf586
Keep Finder directory probing structurally cancellable
austinywang May 6, 2026
b2dd7ea
Use Swift 5-compatible Finder directory probing
austinywang May 6, 2026
79ebf6f
Avoid Finder error feedback after cancellation
austinywang May 6, 2026
ba8a24c
Keep ended remote panels out of Finder targets
austinywang May 6, 2026
e8f6971
Keep Zig bootstrap independent of Homebrew
austinywang May 6, 2026
45a2d58
Bound Zig download attempts in macOS CI
austinywang May 6, 2026
6e4a768
Tolerate slow Zig archive downloads in CI
austinywang May 6, 2026
11b5be5
Merge current main before PR iteration
austinywang May 10, 2026
85e468f
Keep window-drag tests on current suppression API
austinywang May 10, 2026
32a4ab4
Keep Finder menu cache stable while opening
austinywang May 10, 2026
9402465
Merge current main after PR review fix
austinywang May 10, 2026
49f28f0
Place Finder action beside workspace copy menu item
austinywang May 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ All notable changes to cmux are documented here.
## [0.64.3] - 2026-05-05

### Added
- Added Show in Finder to the workspace sidebar right-click menu.
- `cmux config` CLI with `cmux config doctor` for validating `cmux.json` without a socket, plus `cmux config path`, `cmux config docs`, and `cmux config reload` aliases ([#3454](https://github.com/manaflow-ai/cmux/pull/3454))

### Fixed
Expand Down
4 changes: 4 additions & 0 deletions GhosttyTabs.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
B37A00000000000000000001 /* BetaFeaturesSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B37A00000000000000000002 /* BetaFeaturesSettingsView.swift */; };
B37A00000000000000000007 /* SettingsCardNote.swift in Sources */ = {isa = PBXBuildFile; fileRef = B37A00000000000000000008 /* SettingsCardNote.swift */; };
A5001002 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5001012 /* ContentView.swift */; };
C0DE36230000000000000001 /* WorkspaceFinderDirectoryResolver.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0DE36230000000000000002 /* WorkspaceFinderDirectoryResolver.swift */; };
C0DE35010000000000000001 /* SidebarScrim.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0DE35010000000000000002 /* SidebarScrim.swift */; };
62270F3DCECB4787D789CCE3 /* SidebarWorkspaceSnapshotRefreshPolicyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F016B5C09357B3226FA2E014 /* SidebarWorkspaceSnapshotRefreshPolicyTests.swift */; };
C3408A000000000000000001 /* ContentView+RightSidebarCommandPalette.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3408A000000000000000002 /* ContentView+RightSidebarCommandPalette.swift */; };
Expand Down Expand Up @@ -525,6 +526,7 @@
B37A00000000000000000002 /* BetaFeaturesSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BetaFeaturesSettingsView.swift; sourceTree = "<group>"; };
B37A00000000000000000008 /* SettingsCardNote.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsCardNote.swift; sourceTree = "<group>"; };
A5001012 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
C0DE36230000000000000002 /* WorkspaceFinderDirectoryResolver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WorkspaceFinderDirectoryResolver.swift; sourceTree = "<group>"; };
C0DE35010000000000000002 /* SidebarScrim.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarScrim.swift; sourceTree = "<group>"; };
C3408A000000000000000002 /* ContentView+RightSidebarCommandPalette.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ContentView+RightSidebarCommandPalette.swift"; sourceTree = "<group>"; };
C3408A000000000000000006 /* ContentView+ViewCommandPalette.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ContentView+ViewCommandPalette.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -980,6 +982,7 @@
B37A00000000000000000002 /* BetaFeaturesSettingsView.swift */,
B37A00000000000000000008 /* SettingsCardNote.swift */,
A5001012 /* ContentView.swift */,
C0DE36230000000000000002 /* WorkspaceFinderDirectoryResolver.swift */,
C0DE35010000000000000002 /* SidebarScrim.swift */,
D0B10015A1B2C3D4E5F60001 /* DragOverlayRoutingPolicy.swift */,
C3408A000000000000000002 /* ContentView+RightSidebarCommandPalette.swift */,
Expand Down Expand Up @@ -1559,6 +1562,7 @@
B37A00000000000000000001 /* BetaFeaturesSettingsView.swift in Sources */,
B37A00000000000000000007 /* SettingsCardNote.swift in Sources */,
A5001002 /* ContentView.swift in Sources */,
C0DE36230000000000000001 /* WorkspaceFinderDirectoryResolver.swift in Sources */,
C0DE35010000000000000001 /* SidebarScrim.swift in Sources */,
C3408A000000000000000001 /* ContentView+RightSidebarCommandPalette.swift in Sources */,
C3408A000000000000000005 /* ContentView+ViewCommandPalette.swift in Sources */,
Expand Down
17 changes: 17 additions & 0 deletions Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -105146,6 +105146,23 @@
}
}
},
"contextMenu.showWorkspaceInFinder": {
"extractionState": "manual",
"localizations": {
"en": {
"stringUnit": {
"state": "translated",
"value": "Show in Finder"
}
},
"ja": {
"stringUnit": {
"state": "translated",
"value": "Finderで表示"
}
}
}
},
"contextMenu.workspaceSettings": {
"extractionState": "manual",
"localizations": {
Expand Down
20 changes: 20 additions & 0 deletions Sources/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12686,6 +12686,8 @@ private struct TabItemView: View, Equatable {
@StateObject private var contextMenuState = SidebarTabItemContextMenuState()
@State private var rowInteractionState = SidebarWorkspaceRowInteractionState()
@State private var rowHeight: CGFloat = 1
@State private var workspaceFinderDirectoryCache = WorkspaceFinderDirectoryCache()
@State private var workspaceFinderDirectoryRefreshID: UInt64 = 0

var isMultiSelected: Bool {
selectedTabIds.contains(tab.id)
Expand Down Expand Up @@ -12926,6 +12928,8 @@ private struct TabItemView: View, Equatable {
let accessibilityHintText = String(localized: "sidebar.workspace.accessibilityHint", defaultValue: "Activate to focus this workspace. Drag to reorder, or use Move Up and Move Down actions.")
let moveUpActionText = String(localized: "sidebar.workspace.moveUpAction", defaultValue: "Move Up")
let moveDownActionText = String(localized: "sidebar.workspace.moveDownAction", defaultValue: "Move Down")
let finderDirectoryPath = WorkspaceFinderDirectoryResolver.path(for: tab)
let finderDirectoryCacheKey = WorkspaceFinderDirectoryCacheKey(path: finderDirectoryPath, refreshID: workspaceFinderDirectoryRefreshID)
let latestNotificationSubtitle = latestNotificationText
let submittedMessageSubtitle = settings.iMessageModeEnabled
? workspaceSnapshot.latestSubmittedMessage?
Expand Down Expand Up @@ -13234,6 +13238,11 @@ private struct TabItemView: View, Equatable {
.onAppear {
refreshWorkspaceSnapshot(force: true)
}
.task(id: finderDirectoryCacheKey) {
let cache = await WorkspaceFinderDirectoryResolver.cache(for: finderDirectoryCacheKey)
guard !Task.isCancelled else { return }
workspaceFinderDirectoryCache = cache
}
.onReceive(
tab.sidebarImmediateObservationPublisher
.receive(on: RunLoop.main)
Expand Down Expand Up @@ -13314,6 +13323,7 @@ private struct TabItemView: View, Equatable {
.contextMenu {
workspaceContextMenu
.onAppear {
workspaceFinderDirectoryRefreshID &+= 1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Refresh increment immediately invalidates pre-populated cache

workspaceFinderDirectoryRefreshID &+= 1 fires inside onAppear, which runs after SwiftUI has already rendered the context menu with the old refreshID. On macOS, SwiftUI context menus back onto NSMenu and do re-evaluate their @ViewBuilder content reactively when state changes. The result is: the menu appears with the button enabled (pre-populated cache key matches refreshID 0), then onAppear fires → refreshID becomes 1 → SwiftUI re-evaluates workspaceContextMenu → cache.url(for: {path, refreshID: 1}) returns nil (cache still holds refreshID 0) → button becomes disabled → the async task completes and re-enables it. Every context menu open produces this transient disabled flash.

WorkspaceFinderDirectoryOpener.openInFinder already calls existingDirectoryURL before invoking activateFileViewerSelecting and beeps on failure, so the deleted-directory safety case is fully covered without the onAppear refresh. Removing the workspaceFinderDirectoryRefreshID &+= 1 line (or replacing it with a non-invalidating "kick a background check without changing the key") would keep the button enabled during the check while still protecting against stale URLs at click time.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 32a4ab4 by removing the context-menu refresh id from the Finder directory cache key. The menu now stays on the path-keyed cached state while the opener still revalidates the directory immediately before revealing it in Finder.

— Claude Code

rowInteractionState.contextMenuDidAppear()
contextMenuState.hasDeferredWorkspaceObservationInvalidation = false
contextMenuState.pendingWorkspaceSnapshot = nil
Expand Down Expand Up @@ -13413,6 +13423,11 @@ private struct TabItemView: View, Equatable {
let renameWorkspaceShortcut = KeyboardShortcutSettings.shortcut(for: .renameWorkspace)
let editWorkspaceDescriptionShortcut = KeyboardShortcutSettings.shortcut(for: .editWorkspaceDescription)
let closeWorkspaceShortcut = KeyboardShortcutSettings.shortcut(for: .closeWorkspace)
let finderDirectoryCacheKey = WorkspaceFinderDirectoryCacheKey(
path: isMulti ? nil : WorkspaceFinderDirectoryResolver.path(for: tab),
refreshID: workspaceFinderDirectoryRefreshID
)
let finderDirectoryURL = workspaceFinderDirectoryCache.url(for: finderDirectoryCacheKey)
Button(pinLabel) {
guard let contextMenuPinState else {
NSSound.beep()
Expand Down Expand Up @@ -13460,6 +13475,11 @@ private struct TabItemView: View, Equatable {
tabManager.clearCustomDescription(tabId: tab.id)
}
}

Button(String(localized: "contextMenu.showWorkspaceInFinder", defaultValue: "Show in Finder")) {
WorkspaceFinderDirectoryOpener.openInFinder(finderDirectoryURL)
}
.disabled(finderDirectoryURL == nil)
}

if !remoteContextMenuWorkspaceIds.isEmpty {
Expand Down
10 changes: 8 additions & 2 deletions Sources/Workspace.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8874,7 +8874,7 @@ final class Workspace: Identifiable, ObservableObject {
return resolved
}

func sidebarDirectoriesInDisplayOrder(orderedPanelIds: [UUID]) -> [String] {
func sidebarDirectoriesInDisplayOrder(orderedPanelIds: [UUID], includeFallback: Bool = true) -> [String] {
let resolvedDirectories = sidebarResolvedPanelDirectories(orderedPanelIds: orderedPanelIds)
let homeDirectoryForCanonicalization = sidebarHomeDirectoryForCanonicalization(
resolvedPanelDirectories: resolvedDirectories
Expand All @@ -8893,7 +8893,7 @@ final class Workspace: Identifiable, ObservableObject {
}
}

if ordered.isEmpty, let fallbackDirectory = normalizedSidebarDirectory(currentDirectory) {
if includeFallback, ordered.isEmpty, let fallbackDirectory = normalizedSidebarDirectory(currentDirectory) {
return [fallbackDirectory]
}

Expand All @@ -8903,6 +8903,12 @@ final class Workspace: Identifiable, ObservableObject {
func sidebarDirectoriesInDisplayOrder() -> [String] {
sidebarDirectoriesInDisplayOrder(orderedPanelIds: sidebarOrderedPanelIds())
}
func sidebarFinderDirectory() -> String? {
guard !isRemoteWorkspace else { return nil }
let panelIds = sidebarOrderedPanelIds()
let localPanelIds = panelIds.filter { !remoteDetectedSurfaceIds.contains($0) && !isRemoteTerminalSurface($0) }
return sidebarDirectoriesInDisplayOrder(orderedPanelIds: localPanelIds, includeFallback: panelIds.isEmpty || localPanelIds.count == panelIds.count).first
Comment thread
lawrencecchen marked this conversation as resolved.
Resolved
}

func sidebarGitBranchesInDisplayOrder(orderedPanelIds: [UUID]) -> [SidebarGitBranchState] {
SidebarBranchOrdering
Expand Down
64 changes: 64 additions & 0 deletions Sources/WorkspaceFinderDirectoryResolver.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import AppKit
import Foundation

struct WorkspaceFinderDirectoryCacheKey: Equatable, Sendable {
var path: String?
var refreshID: UInt64
}

struct WorkspaceFinderDirectoryCache: Equatable, Sendable {
var key: WorkspaceFinderDirectoryCacheKey? = nil
var directoryURL: URL? = nil

func url(for currentKey: WorkspaceFinderDirectoryCacheKey) -> URL? {
guard key == currentKey else { return nil }
return directoryURL
}
}

enum WorkspaceFinderDirectoryResolver {
@MainActor
static func path(for workspace: Workspace) -> String? {
guard let directory = workspace.sidebarFinderDirectory() else { return nil }
let path = NSString(string: directory).expandingTildeInPath
return path.isEmpty ? nil : path
}

static func cache(for key: WorkspaceFinderDirectoryCacheKey) async -> WorkspaceFinderDirectoryCache {
guard let path = key.path else { return WorkspaceFinderDirectoryCache(key: key) }
let directoryURL = await existingDirectoryURL(for: path)
return WorkspaceFinderDirectoryCache(key: key, directoryURL: directoryURL)
}

static func existingDirectoryURL(for path: String) async -> URL? {
await Task.detached(priority: .utility) {
existingDirectoryURLUnchecked(for: path)
}.value
}

private nonisolated static func existingDirectoryURLUnchecked(for path: String) -> URL? {
var isDirectory: ObjCBool = false
guard FileManager.default.fileExists(atPath: path, isDirectory: &isDirectory),
isDirectory.boolValue else {
return nil
}
return URL(fileURLWithPath: path, isDirectory: true).standardizedFileURL
}
}

enum WorkspaceFinderDirectoryOpener {
@MainActor
static func openInFinder(_ directoryURL: URL?) {
guard let directoryURL else {
NSSound.beep()
return
}
Task { @MainActor in
if let refreshedURL = await WorkspaceFinderDirectoryResolver.existingDirectoryURL(for: directoryURL.path) {
NSWorkspace.shared.activateFileViewerSelecting([refreshedURL])
} else {
NSSound.beep()
}
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
}
}
Loading