From 1fd3f27e26ca17ac3f299ade8f534f099d43f0e5 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 17 Dec 2025 09:44:01 -0800 Subject: [PATCH] macos: show pwd for jump options --- .../Command Palette/CommandPalette.swift | 20 ++++++++++++++++--- .../TerminalCommandPalette.swift | 8 +++++++- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/macos/Sources/Features/Command Palette/CommandPalette.swift b/macos/Sources/Features/Command Palette/CommandPalette.swift index 70b444827..3cb4e3480 100644 --- a/macos/Sources/Features/Command Palette/CommandPalette.swift +++ b/macos/Sources/Features/Command Palette/CommandPalette.swift @@ -3,6 +3,7 @@ import SwiftUI struct CommandOption: Identifiable, Hashable { let id = UUID() let title: String + let subtitle: String? let description: String? let symbols: [String]? let leadingIcon: String? @@ -13,6 +14,7 @@ struct CommandOption: Identifiable, Hashable { init( title: String, + subtitle: String? = nil, description: String? = nil, symbols: [String]? = nil, leadingIcon: String? = nil, @@ -22,6 +24,7 @@ struct CommandOption: Identifiable, Hashable { action: @escaping () -> Void ) { self.title = title + self.subtitle = subtitle self.description = description self.symbols = symbols self.leadingIcon = leadingIcon @@ -55,7 +58,10 @@ struct CommandPaletteView: View { if query.isEmpty { return options } else { - return options.filter { $0.title.localizedCaseInsensitiveContains(query) } + return options.filter { + $0.title.localizedCaseInsensitiveContains(query) || + ($0.subtitle?.localizedCaseInsensitiveContains(query) ?? false) + } } } @@ -298,8 +304,16 @@ fileprivate struct CommandRow: View { .font(.system(size: 14, weight: .medium)) } - Text(option.title) - .fontWeight(option.emphasis ? .medium : .regular) + VStack(alignment: .leading, spacing: 2) { + Text(option.title) + .fontWeight(option.emphasis ? .medium : .regular) + + if let subtitle = option.subtitle { + Text(subtitle) + .font(.caption) + .foregroundStyle(.secondary) + } + } Spacer() diff --git a/macos/Sources/Features/Command Palette/TerminalCommandPalette.swift b/macos/Sources/Features/Command Palette/TerminalCommandPalette.swift index 6d6a89162..ecd301208 100644 --- a/macos/Sources/Features/Command Palette/TerminalCommandPalette.swift +++ b/macos/Sources/Features/Command Palette/TerminalCommandPalette.swift @@ -142,10 +142,16 @@ struct TerminalCommandPaletteView: View { return controller.surfaceTree.map { surface in let title = surface.title.isEmpty ? window.title : surface.title let displayTitle = title.isEmpty ? "Untitled" : title + let pwd = surface.pwd?.abbreviatedPath + let subtitle: String? = if let pwd, !displayTitle.contains(pwd) { + pwd + } else { + nil + } return CommandOption( title: "Focus: \(displayTitle)", - description: surface.pwd?.abbreviatedPath, + subtitle: subtitle, leadingIcon: "rectangle.on.rectangle", leadingColor: displayColor?.displayColor.map { Color($0) } ) {