diff --git a/macos/Sources/Features/Command Palette/TerminalCommandPalette.swift b/macos/Sources/Features/Command Palette/TerminalCommandPalette.swift index 70d1273a2..09e369d4a 100644 --- a/macos/Sources/Features/Command Palette/TerminalCommandPalette.swift +++ b/macos/Sources/Features/Command Palette/TerminalCommandPalette.swift @@ -143,8 +143,15 @@ struct TerminalCommandPaletteView: View { let displayColor = color != TerminalTabColor.none ? color : nil return controller.surfaceTree.map { surface in - let title = surface.title.isEmpty ? window.title : surface.title - let displayTitle = title.isEmpty ? "Untitled" : title + let terminalTitle = surface.title.isEmpty ? window.title : surface.title + let displayTitle: String + if let override = controller.titleOverride, !override.isEmpty { + displayTitle = override + } else if !terminalTitle.isEmpty { + displayTitle = terminalTitle + } else { + displayTitle = "Untitled" + } let pwd = surface.pwd?.abbreviatedPath let subtitle: String? = if let pwd, !displayTitle.contains(pwd) { pwd diff --git a/src/apprt/gtk/class/command_palette.zig b/src/apprt/gtk/class/command_palette.zig index 0d91c43b2..4a3e799c2 100644 --- a/src/apprt/gtk/class/command_palette.zig +++ b/src/apprt/gtk/class/command_palette.zig @@ -691,12 +691,12 @@ const Command = extern struct { defer surface.unref(); const alloc = priv.arena.allocator(); - const surface_title = surface.getTitle() orelse "Untitled"; + const effective_title = surface.getTitleOverride() orelse surface.getTitle() orelse "Untitled"; j.title = std.fmt.allocPrintSentinel( alloc, "Focus: {s}", - .{surface_title}, + .{effective_title}, 0, ) catch null; @@ -717,8 +717,7 @@ const Command = extern struct { defer surface.unref(); const alloc = priv.arena.allocator(); - - const title = surface.getTitle() orelse "Untitled"; + const title = surface.getTitleOverride() orelse surface.getTitle() orelse "Untitled"; const pwd = surface.getPwd(); if (pwd) |p| {