From ac517e68ed117b29f7c20ca7f1636b6553a9d6da Mon Sep 17 00:00:00 2001 From: austinpower1258 Date: Tue, 26 May 2026 11:43:10 -0700 Subject: [PATCH 01/16] test: cover quick terminal settings --- cmuxTests/WorkspaceUnitTests.swift | 54 ++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/cmuxTests/WorkspaceUnitTests.swift b/cmuxTests/WorkspaceUnitTests.swift index 0c0efb6c5a47..fed2cb4817a5 100644 --- a/cmuxTests/WorkspaceUnitTests.swift +++ b/cmuxTests/WorkspaceUnitTests.swift @@ -2455,6 +2455,60 @@ final class WorkspacePlacementSettingsTests: XCTestCase { } } +final class QuickTerminalSettingsTests: XCTestCase { + func testDefaultsClampAndResolveFromUserDefaults() { + let suiteName = "QuickTerminalSettingsTests.Default.\(UUID().uuidString)" + guard let defaults = UserDefaults(suiteName: suiteName) else { + XCTFail("Failed to create isolated UserDefaults suite") + return + } + defer { defaults.removePersistentDomain(forName: suiteName) } + + var settings = QuickTerminalSettings.resolved(defaults: defaults) + XCTAssertEqual(settings.position, .top) + XCTAssertEqual(settings.primarySizeRatio, 0.38, accuracy: 0.001) + XCTAssertEqual(settings.secondarySizeRatio, 1.0, accuracy: 0.001) + XCTAssertTrue(settings.autoHide) + + defaults.set(QuickTerminalPosition.left.rawValue, forKey: QuickTerminalSettings.positionKey) + defaults.set(0.05, forKey: QuickTerminalSettings.primarySizeRatioKey) + defaults.set(1.4, forKey: QuickTerminalSettings.secondarySizeRatioKey) + defaults.set(false, forKey: QuickTerminalSettings.autoHideKey) + + settings = QuickTerminalSettings.resolved(defaults: defaults) + XCTAssertEqual(settings.position, .left) + XCTAssertEqual(settings.primarySizeRatio, 0.2, accuracy: 0.001) + XCTAssertEqual(settings.secondarySizeRatio, 1.0, accuracy: 0.001) + XCTAssertFalse(settings.autoHide) + } + + func testEdgePositionsResolveVisibleAndHiddenFrames() { + let visibleFrame = NSRect(x: 100, y: 80, width: 1000, height: 800) + + let topFrame = QuickTerminalPosition.top.finalFrame( + in: visibleFrame, + primarySizeRatio: 0.25, + secondarySizeRatio: 0.8 + ) + XCTAssertEqual(topFrame, NSRect(x: 200, y: 680, width: 800, height: 200)) + XCTAssertEqual( + QuickTerminalPosition.top.hiddenFrame(from: topFrame, visibleFrame: visibleFrame), + NSRect(x: 200, y: 880, width: 800, height: 200) + ) + + let leftFrame = QuickTerminalPosition.left.finalFrame( + in: visibleFrame, + primarySizeRatio: 0.3, + secondarySizeRatio: 0.5 + ) + XCTAssertEqual(leftFrame, NSRect(x: 100, y: 280, width: 420, height: 400)) + XCTAssertEqual( + QuickTerminalPosition.left.hiddenFrame(from: leftFrame, visibleFrame: visibleFrame), + NSRect(x: -320, y: 280, width: 420, height: 400) + ) + } +} + final class WorkspaceWorkingDirectoryInheritanceSettingsTests: XCTestCase { func testDefaultsToEnabledWhenUnset() { let suiteName = "WorkspaceWorkingDirectoryInheritanceSettingsTests.Default.\(UUID().uuidString)" From d16496f86aeb2e11e6281a2807bb48e2b1f90f12 Mon Sep 17 00:00:00 2001 From: austinpower1258 Date: Tue, 26 May 2026 12:07:14 -0700 Subject: [PATCH 02/16] feat: add quick terminal --- CHANGELOG.md | 1 + CLI/cmux.swift | 90 ++++ README.md | 1 + Resources/Localizable.xcstrings | 19 + Sources/App/ShortcutBareStartRouting.swift | 2 +- Sources/AppDelegate.swift | 487 +++++++++++++++++- ...ntentView+RightSidebarCommandPalette.swift | 2 + Sources/ContentView.swift | 11 + Sources/KeyboardShortcutSettings.swift | 16 +- ...rdShortcutSettingsFileStore+Template.swift | 4 + .../KeyboardShortcutSettingsFileStore.swift | 28 + Sources/TerminalController.swift | 63 +++ Sources/cmuxApp.swift | 134 +++++ .../GlobalSearchShortcutSettingsTests.swift | 51 ++ web/app/[locale]/docs/configuration/page.tsx | 7 +- web/data/cmux-shortcuts.ts | 6 + web/data/cmux.schema.json | 26 + 17 files changed, 940 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d615c76bc312..e7762d115d9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ All notable changes to cmux are documented here. ## [0.64.10] - 2026-05-23 ### Added +- Quick Terminal panel with a configurable position/size, Option-Command-backtick shortcut, command palette action, and `cmux quick-terminal` CLI controls. - Copy on Select setting copies the active terminal selection to the clipboard as soon as the mouse is released ([#4011](https://github.com/manaflow-ai/cmux/pull/4011)) -- thanks @kallioaleksi for the report! - CmuxExtensionKit sidebar prototypes showcase the upcoming extension API for custom workspace sidebars ([#4309](https://github.com/manaflow-ai/cmux/pull/4309)) - Ghostty Settings command palette action opens the embedded Ghostty configuration directly ([#4654](https://github.com/manaflow-ai/cmux/pull/4654)) diff --git a/CLI/cmux.swift b/CLI/cmux.swift index fa9808d38191..c7277dd4cdd0 100644 --- a/CLI/cmux.swift +++ b/CLI/cmux.swift @@ -2860,6 +2860,20 @@ struct CMUXCLI { ) return } + if command == "quick-terminal" { + let client = try connectClient( + socketPath: resolvedSocketPath, + explicitPassword: socketPasswordArg, + launchIfNeeded: true + ) + defer { client.close() } + try runQuickTerminal( + commandArgs: commandArgs, + client: client, + jsonOutput: jsonOutput + ) + return + } if command == "open" { try runOpenCommand(commandArgs: commandArgs, socketPath: resolvedSocketPath, explicitPassword: socketPasswordArg, jsonOutput: jsonOutput, idFormat: try resolvedIDFormat(jsonOutput: jsonOutput, raw: idFormatArg)); return } if command == "restore-session" { try runRestoreSession( @@ -4700,6 +4714,63 @@ struct CMUXCLI { try activateApp() } + private func runQuickTerminal( + commandArgs: [String], + client: SocketClient, + jsonOutput: Bool + ) throws { + let normalizedArgs = Array(commandArgs.drop(while: { $0 == "--" })) + let subcommand = normalizedArgs.first?.lowercased() ?? "toggle" + let remaining = Array(normalizedArgs.dropFirst()).filter { $0 != "--" } + if let unknown = remaining.first { + throw CLIError(message: "quick-terminal \(subcommand): unexpected argument '\(unknown)'") + } + + let method: String + switch subcommand { + case "toggle": + method = "quick_terminal.toggle" + case "show": + method = "quick_terminal.show" + case "hide": + method = "quick_terminal.hide" + case "status": + method = "quick_terminal.status" + default: + throw CLIError(message: "quick-terminal requires one of: toggle, show, hide, status") + } + + let payload = try client.sendV2(method: method) + if jsonOutput { + print(jsonString(payload)) + return + } + + if subcommand == "status" { + print(formatQuickTerminalStatusPayload(payload)) + } else { + print("OK") + } + } + + private func formatQuickTerminalStatusPayload(_ payload: [String: Any]) -> String { + let available = (payload["available"] as? Bool) ?? false + let visible = (payload["visible"] as? Bool) ?? false + let position = (payload["position"] as? String) ?? "unknown" + let autoHide = (payload["auto_hide"] as? Bool) ?? false + let primarySizeRatio = (payload["primary_size_ratio"] as? Double) ?? 0 + let secondarySizeRatio = (payload["secondary_size_ratio"] as? Double) ?? 0 + + return """ + available: \(available ? "yes" : "no") + visible: \(visible ? "yes" : "no") + position: \(position) + auto_hide: \(autoHide ? "yes" : "no") + primary_size_ratio: \(String(format: "%.2f", primarySizeRatio)) + secondary_size_ratio: \(String(format: "%.2f", secondarySizeRatio)) + """ + } + private func runFeedback( commandArgs: [String], socketPath: String, @@ -11665,6 +11736,23 @@ struct CMUXCLI { Open the Settings window to Keyboard Shortcuts. """ + case "quick-terminal": + return """ + Usage: cmux quick-terminal [toggle|show|hide|status] + + Control the floating quick terminal panel. + + Subcommands: + toggle Toggle quick terminal visibility (default) + show Show quick terminal + hide Hide quick terminal + status Print quick terminal status + + Examples: + cmux quick-terminal + cmux quick-terminal show + cmux --json quick-terminal status + """ case "disable-browser": return """ Usage: cmux disable-browser [--json] @@ -29478,6 +29566,7 @@ export default function cmuxPiSessionExtension(pi: ExtensionAPI) { settings [open [target]|path|docs|] config shortcuts + quick-terminal [toggle|show|hide|status] disable-browser | enable-browser | browser-status restore-session open ... [--workspace ] [--surface ] [--pane ] [--window ] [--focus ] [--no-focus] @@ -29569,6 +29658,7 @@ export default function cmuxPiSessionExtension(pi: ExtensionAPI) { clear-log [--workspace ] [--window ] list-log [--workspace ] [--window ] [--limit ] sidebar-state [--workspace ] [--window ] + quick-terminal [toggle|show|hide|status] set-app-focus simulate-app-active diff --git a/README.md b/README.md index 2dd588da552d..25f9091c9f26 100644 --- a/README.md +++ b/README.md @@ -220,6 +220,7 @@ Command palette navigation shortcuts, including ⌃ P, are also customizable and | Shortcut | Action | |----------|--------| +| ⌥ ⌘ ` | Toggle quick terminal (system-wide) | | ⌘ K | Clear scrollback | | ⌘ C | Copy (with selection) | | ⌘ V | Paste | diff --git a/Resources/Localizable.xcstrings b/Resources/Localizable.xcstrings index 12e580643703..100327b41d32 100644 --- a/Resources/Localizable.xcstrings +++ b/Resources/Localizable.xcstrings @@ -117739,6 +117739,25 @@ "sidebar.tree.group.other.subtitle": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", "value": "No folder" } }, "ja": { "stringUnit": { "state": "translated", "value": "フォルダなし" } } } }, "sidebar.tree.group.pinned": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", "value": "Pinned" } }, "ja": { "stringUnit": { "state": "translated", "value": "ピン留め" } } } }, "sidebar.tree.group.remote.subtitle": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", "value": "SSH" } }, "ja": { "stringUnit": { "state": "translated", "value": "SSH" } } } }, + "command.toggleQuickTerminal.subtitle": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Terminal"}},"ja":{"stringUnit":{"state":"translated","value":"ターミナル"}}}}, + "command.toggleQuickTerminal.title": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Toggle Quick Terminal"}},"ja":{"stringUnit":{"state":"translated","value":"クイックターミナルを切り替え"}}}}, + "menu.view.toggleQuickTerminal": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Toggle Quick Terminal"}},"ja":{"stringUnit":{"state":"translated","value":"クイックターミナルを切り替え"}}}}, + "quickTerminal.window.title": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Quick Terminal"}},"ja":{"stringUnit":{"state":"translated","value":"クイックターミナル"}}}}, + "settings.quickTerminal.autoHide": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Quick Terminal Auto-Hide"}},"ja":{"stringUnit":{"state":"translated","value":"クイックターミナルを自動的に隠す"}}}}, + "settings.quickTerminal.autoHide.subtitleOff": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Keep visible when focus moves away."}},"ja":{"stringUnit":{"state":"translated","value":"フォーカスが移動しても表示したままにします。"}}}}, + "settings.quickTerminal.autoHide.subtitleOn": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Hide automatically when it loses focus."}},"ja":{"stringUnit":{"state":"translated","value":"フォーカスを失うと自動的に隠します。"}}}}, + "settings.quickTerminal.position": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Quick Terminal Position"}},"ja":{"stringUnit":{"state":"translated","value":"クイックターミナルの位置"}}}}, + "settings.quickTerminal.position.bottom": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Bottom"}},"ja":{"stringUnit":{"state":"translated","value":"下"}}}}, + "settings.quickTerminal.position.center": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Center"}},"ja":{"stringUnit":{"state":"translated","value":"中央"}}}}, + "settings.quickTerminal.position.left": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Left"}},"ja":{"stringUnit":{"state":"translated","value":"左"}}}}, + "settings.quickTerminal.position.right": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Right"}},"ja":{"stringUnit":{"state":"translated","value":"右"}}}}, + "settings.quickTerminal.position.subtitle": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Choose where the quick terminal slides in."}},"ja":{"stringUnit":{"state":"translated","value":"クイックターミナルがスライドインする位置を選びます。"}}}}, + "settings.quickTerminal.position.top": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Top"}},"ja":{"stringUnit":{"state":"translated","value":"上"}}}}, + "settings.quickTerminal.primarySize": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Quick Terminal Primary Size"}},"ja":{"stringUnit":{"state":"translated","value":"クイックターミナルの主サイズ"}}}}, + "settings.quickTerminal.primarySize.subtitle": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Size along the slide-in axis."}},"ja":{"stringUnit":{"state":"translated","value":"スライドイン方向のサイズです。"}}}}, + "settings.quickTerminal.secondarySize": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Quick Terminal Secondary Size"}},"ja":{"stringUnit":{"state":"translated","value":"クイックターミナルの副サイズ"}}}}, + "settings.quickTerminal.secondarySize.subtitle": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Size across the opposite axis."}},"ja":{"stringUnit":{"state":"translated","value":"反対方向のサイズです。"}}}}, + "shortcut.toggleQuickTerminal.label": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Toggle Quick Terminal"}},"ja":{"stringUnit":{"state":"translated","value":"クイックターミナルを切り替え"}}}}, "settings.terminal.textBoxMaxLines": {"extractionState":"manual","localizations":{"ar":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"bs":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"da":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"de":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"en":{"stringUnit":{"state":"translated","value":"TextBox Max Lines"}},"es":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"fr":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"it":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"ja":{"stringUnit":{"state":"translated","value":"TextBox の最大行数"}},"km":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"ko":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"nb":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"pl":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"pt-BR":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"ru":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"th":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"tr":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"uk":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"zh-Hans":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"zh-Hant":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}}}}, "settings.terminal.textBoxMaxLines.subtitle": {"extractionState":"manual","localizations":{"ar":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"bs":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"da":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"de":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"en":{"stringUnit":{"state":"translated","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"es":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"fr":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"it":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"ja":{"stringUnit":{"state":"translated","value":"リッチなターミナル入力欄がスクロールする前に広がれる最大の高さを制限します。"}},"km":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"ko":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"nb":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"pl":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"pt-BR":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"ru":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"th":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"tr":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"uk":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"zh-Hans":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"zh-Hant":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}}}}, "command.terminalToggleTextBoxInput.title": {"extractionState":"manual","localizations":{"ar":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"bs":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"da":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"de":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"en":{"stringUnit":{"state":"translated","value":"Toggle TextBox Input"}},"es":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"fr":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"it":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"ja":{"stringUnit":{"state":"translated","value":"TextBox入力を切り替え"}},"km":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"ko":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"nb":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"pl":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"pt-BR":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"ru":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"th":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"tr":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"uk":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"zh-Hans":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"zh-Hant":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}}}}, diff --git a/Sources/App/ShortcutBareStartRouting.swift b/Sources/App/ShortcutBareStartRouting.swift index ef13b7611482..f1e39ac61486 100644 --- a/Sources/App/ShortcutBareStartRouting.swift +++ b/Sources/App/ShortcutBareStartRouting.swift @@ -15,7 +15,7 @@ enum KeyboardShortcutBareStartCache { let resolvedKeys = Set( KeyboardShortcutSettings.Action.allCases.compactMap { action -> String? in - guard action != .showHideAllWindows else { return nil } + guard action != .showHideAllWindows && action != .globalSearch && action != .toggleQuickTerminal else { return nil } return KeyboardShortcutSettings.shortcut(for: action).bareShortcutStartKey } ) diff --git a/Sources/AppDelegate.swift b/Sources/AppDelegate.swift index fefd060ca08f..08e8e2990976 100644 --- a/Sources/AppDelegate.swift +++ b/Sources/AppDelegate.swift @@ -9,6 +9,7 @@ import WebKit import Combine import ObjectiveC.runtime import Darwin +import QuartzCore func cmuxJavaScriptStringLiteral(_ value: String?) -> String? { guard let value else { return nil } @@ -59,6 +60,454 @@ private func runMultiWindowRouteCLI( ) } +enum QuickTerminalSettings { + static let positionKey = "quickTerminal.position" + static let primarySizeRatioKey = "quickTerminal.primarySizeRatio" + static let secondarySizeRatioKey = "quickTerminal.secondarySizeRatio" + static let autoHideKey = "quickTerminal.autoHide" + + static let defaultPosition: QuickTerminalPosition = .top + static let defaultPrimarySizeRatio: Double = 0.38 + static let defaultSecondarySizeRatio: Double = 1.0 + static let defaultAutoHide = true + static let defaultAnimationDuration: TimeInterval = 0.16 + + static func resolved(defaults: UserDefaults = .standard) -> QuickTerminalResolvedSettings { + let rawPosition = defaults.string(forKey: positionKey) + let position = QuickTerminalPosition(rawValue: rawPosition ?? "") ?? defaultPosition + + let rawPrimary = defaults.double(forKey: primarySizeRatioKey) + let primarySizeRatio = clampRatio( + defaults.object(forKey: primarySizeRatioKey) == nil ? defaultPrimarySizeRatio : rawPrimary + ) + + let rawSecondary = defaults.double(forKey: secondarySizeRatioKey) + let secondarySizeRatio = clampRatio( + defaults.object(forKey: secondarySizeRatioKey) == nil ? defaultSecondarySizeRatio : rawSecondary + ) + + let autoHide = defaults.object(forKey: autoHideKey) == nil + ? defaultAutoHide + : defaults.bool(forKey: autoHideKey) + + return QuickTerminalResolvedSettings( + position: position, + primarySizeRatio: primarySizeRatio, + secondarySizeRatio: secondarySizeRatio, + autoHide: autoHide, + animationDuration: defaultAnimationDuration + ) + } + + static func clampRatio(_ value: Double) -> Double { + min(max(value, 0.2), 1.0) + } +} + +struct QuickTerminalResolvedSettings { + let position: QuickTerminalPosition + let primarySizeRatio: Double + let secondarySizeRatio: Double + let autoHide: Bool + let animationDuration: TimeInterval +} + +enum QuickTerminalPosition: String, CaseIterable, Identifiable { + case top + case bottom + case left + case right + case center + + var id: String { rawValue } + + func finalFrame( + in visibleFrame: NSRect, + primarySizeRatio: Double, + secondarySizeRatio: Double + ) -> NSRect { + let primary = CGFloat(QuickTerminalSettings.clampRatio(primarySizeRatio)) + let secondary = CGFloat(QuickTerminalSettings.clampRatio(secondarySizeRatio)) + let minWidth: CGFloat = 420 + let minHeight: CGFloat = 200 + + let size: NSSize = { + switch self { + case .top, .bottom: + return NSSize( + width: max(minWidth, visibleFrame.width * secondary), + height: max(minHeight, visibleFrame.height * primary) + ) + case .left, .right: + return NSSize( + width: max(minWidth, visibleFrame.width * primary), + height: max(minHeight, visibleFrame.height * secondary) + ) + case .center: + return NSSize( + width: max(minWidth, visibleFrame.width * primary), + height: max(minHeight, visibleFrame.height * secondary) + ) + } + }() + + let clamped = NSSize( + width: min(size.width, visibleFrame.width), + height: min(size.height, visibleFrame.height) + ) + + switch self { + case .top: + return NSRect( + x: round(visibleFrame.midX - clamped.width / 2), + y: visibleFrame.maxY - clamped.height, + width: clamped.width, + height: clamped.height + ) + case .bottom: + return NSRect( + x: round(visibleFrame.midX - clamped.width / 2), + y: visibleFrame.minY, + width: clamped.width, + height: clamped.height + ) + case .left: + return NSRect( + x: visibleFrame.minX, + y: round(visibleFrame.midY - clamped.height / 2), + width: clamped.width, + height: clamped.height + ) + case .right: + return NSRect( + x: visibleFrame.maxX - clamped.width, + y: round(visibleFrame.midY - clamped.height / 2), + width: clamped.width, + height: clamped.height + ) + case .center: + return NSRect( + x: round(visibleFrame.midX - clamped.width / 2), + y: round(visibleFrame.midY - clamped.height / 2), + width: clamped.width, + height: clamped.height + ) + } + } + + func hiddenFrame(from finalFrame: NSRect, visibleFrame: NSRect) -> NSRect { + switch self { + case .top: + return NSRect( + x: finalFrame.origin.x, + y: visibleFrame.maxY, + width: finalFrame.width, + height: finalFrame.height + ) + case .bottom: + return NSRect( + x: finalFrame.origin.x, + y: visibleFrame.minY - finalFrame.height, + width: finalFrame.width, + height: finalFrame.height + ) + case .left: + return NSRect( + x: visibleFrame.minX - finalFrame.width, + y: finalFrame.origin.y, + width: finalFrame.width, + height: finalFrame.height + ) + case .right: + return NSRect( + x: visibleFrame.maxX, + y: finalFrame.origin.y, + width: finalFrame.width, + height: finalFrame.height + ) + case .center: + return NSRect( + x: finalFrame.origin.x, + y: visibleFrame.maxY + 18, + width: finalFrame.width, + height: finalFrame.height + ) + } + } +} + +private final class QuickTerminalPanel: NSPanel { + override var canBecomeKey: Bool { true } + override var canBecomeMain: Bool { true } +} + +@MainActor +private final class QuickTerminalController: NSObject, NSWindowDelegate { + private enum VisibilityPhase { + case hidden + case showing + case visible + case hiding + + var reportsVisible: Bool { + switch self { + case .showing, .visible: + return true + case .hiding, .hidden: + return false + } + } + + var isTransitioning: Bool { + switch self { + case .showing, .hiding: + return true + case .visible, .hidden: + return false + } + } + } + + private enum PendingTransitionAction { + case show(activateApp: Bool) + case hide(restorePreviousApp: Bool) + } + + private var panel: QuickTerminalPanel? + private var terminalSurface: TerminalSurface? + private var previousFrontmostApp: NSRunningApplication? + private let workspaceId = UUID() + private var phase: VisibilityPhase = .hidden + private var pendingTransitionAction: PendingTransitionAction? + + private var isVisible: Bool { phase.reportsVisible } + + func toggle(activateApp: Bool = true) { + if isVisible { + hide(restorePreviousApp: activateApp) + } else { + show(activateApp: activateApp) + } + } + + func show(activateApp: Bool = true) { + if phase.isTransitioning { + pendingTransitionAction = .show(activateApp: activateApp) + return + } + guard !isVisible else { return } + + let settings = QuickTerminalSettings.resolved() + guard let panel = ensurePanel() else { return } + let visibleFrame = screen(for: panel).visibleFrame + let finalFrame = settings.position.finalFrame( + in: visibleFrame, + primarySizeRatio: settings.primarySizeRatio, + secondarySizeRatio: settings.secondarySizeRatio + ) + let hiddenFrame = settings.position.hiddenFrame(from: finalFrame, visibleFrame: visibleFrame) + + if activateApp, + !NSApp.isActive, + let frontmost = NSWorkspace.shared.frontmostApplication, + frontmost.bundleIdentifier != Bundle.main.bundleIdentifier { + previousFrontmostApp = frontmost + } + + phase = .showing + panel.alphaValue = 0 + panel.setFrame(hiddenFrame, display: false) + panel.level = .popUpMenu + if activateApp { + panel.orderFrontRegardless() + panel.makeKeyAndOrderFront(nil) + } else { + panel.orderFront(nil) + } + + terminalSurface?.hostedView.setVisibleInUI(true) + terminalSurface?.hostedView.setActive(activateApp) + + if activateApp, !NSApp.isActive { + NSApp.activate(ignoringOtherApps: true) + } + + NSAnimationContext.runAnimationGroup { context in + context.duration = settings.animationDuration + context.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut) + panel.animator().alphaValue = 1 + panel.animator().setFrame(finalFrame, display: true) + } completionHandler: { [weak self] in + Task { @MainActor [weak self] in + guard let self else { return } + self.phase = .visible + panel.level = .floating + if activateApp { + panel.makeKeyAndOrderFront(nil) + panel.makeFirstResponder(self.terminalSurface?.hostedView) + self.terminalSurface?.hostedView.setActive(true) + self.terminalSurface?.hostedView.moveFocus() + } else { + panel.orderFront(nil) + self.terminalSurface?.hostedView.setActive(false) + } + self.replayPendingTransitionActionIfNeeded() + } + } + } + + func hide(restorePreviousApp: Bool) { + if phase.isTransitioning { + pendingTransitionAction = .hide(restorePreviousApp: restorePreviousApp) + return + } + guard isVisible else { return } + + let settings = QuickTerminalSettings.resolved() + guard let panel else { + phase = .hidden + previousFrontmostApp = nil + return + } + + let visibleFrame = screen(for: panel).visibleFrame + let hiddenFrame = settings.position.hiddenFrame(from: panel.frame, visibleFrame: visibleFrame) + + phase = .hiding + + NSAnimationContext.runAnimationGroup { context in + context.duration = settings.animationDuration + context.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut) + panel.animator().alphaValue = 0 + panel.animator().setFrame(hiddenFrame, display: false) + } completionHandler: { [weak self] in + Task { @MainActor [weak self] in + guard let self else { return } + self.phase = .hidden + panel.orderOut(nil) + self.terminalSurface?.hostedView.setActive(false) + self.terminalSurface?.hostedView.setVisibleInUI(false) + if restorePreviousApp, + let previousFrontmostApp = self.previousFrontmostApp, + !previousFrontmostApp.isTerminated { + _ = previousFrontmostApp.activate(options: []) + } + self.previousFrontmostApp = nil + self.replayPendingTransitionActionIfNeeded() + } + } + } + + func statusPayload() -> [String: Any] { + let settings = QuickTerminalSettings.resolved() + return [ + "available": true, + "visible": isVisible, + "position": settings.position.rawValue, + "auto_hide": settings.autoHide, + "primary_size_ratio": settings.primarySizeRatio, + "secondary_size_ratio": settings.secondarySizeRatio + ] + } + + func teardown() { + panel?.orderOut(nil) + terminalSurface?.hostedView.setActive(false) + terminalSurface?.hostedView.setVisibleInUI(false) + panel = nil + terminalSurface = nil + phase = .hidden + previousFrontmostApp = nil + pendingTransitionAction = nil + } + + func windowDidResignKey(_ notification: Notification) { + let settings = QuickTerminalSettings.resolved() + guard settings.autoHide else { return } + guard isVisible else { return } + guard let panel = notification.object as? NSWindow, panel === self.panel else { return } + guard panel.attachedSheet == nil else { return } + hide(restorePreviousApp: false) + } + + private func replayPendingTransitionActionIfNeeded() { + guard !phase.isTransitioning, let action = pendingTransitionAction else { return } + pendingTransitionAction = nil + switch action { + case .show(let activateApp): + show(activateApp: activateApp) + case .hide(let restorePreviousApp): + hide(restorePreviousApp: restorePreviousApp) + } + } + + private func ensurePanel() -> QuickTerminalPanel? { + if let panel { + return panel + } + + let settings = QuickTerminalSettings.resolved() + let visibleFrame = screen(for: nil).visibleFrame + let initialFrame = settings.position.finalFrame( + in: visibleFrame, + primarySizeRatio: settings.primarySizeRatio, + secondarySizeRatio: settings.secondarySizeRatio + ) + let panel = QuickTerminalPanel( + contentRect: initialFrame, + styleMask: [.borderless, .resizable, .nonactivatingPanel], + backing: .buffered, + defer: false + ) + panel.identifier = NSUserInterfaceItemIdentifier("cmux.quick-terminal") + panel.title = String(localized: "quickTerminal.window.title", defaultValue: "Quick Terminal") + panel.titleVisibility = .hidden + panel.titlebarAppearsTransparent = true + panel.collectionBehavior = [.moveToActiveSpace, .fullScreenAuxiliary, .ignoresCycle] + panel.isMovableByWindowBackground = true + panel.hidesOnDeactivate = false + panel.isReleasedWhenClosed = false + panel.level = .floating + panel.delegate = self + + if terminalSurface == nil { + terminalSurface = TerminalSurface( + tabId: workspaceId, + context: GHOSTTY_SURFACE_CONTEXT_WINDOW, + configTemplate: nil, + initialEnvironmentOverrides: ["CMUX_QUICK_TERMINAL": "1"] + ) + } + + if let terminalSurface { + terminalSurface.hostedView.frame = NSRect(origin: .zero, size: initialFrame.size) + terminalSurface.hostedView.autoresizingMask = [.width, .height] + terminalSurface.hostedView.setVisibleInUI(false) + terminalSurface.hostedView.setActive(false) + panel.contentView = terminalSurface.hostedView + } + + self.panel = panel + return panel + } + + private func screen(for panel: NSWindow?) -> NSScreen { + if let panel, let panelScreen = panel.screen { + return panelScreen + } + if let keyScreen = NSApp.keyWindow?.screen { + return keyScreen + } + if let main = NSScreen.main { + return main + } + if let first = NSScreen.screens.first { + return first + } + preconditionFailure("No available NSScreen for quick terminal") + } +} + /// Caches `AXWindows` responses so repeated AX polls can reuse the same /// snapshot while the app window graph is unchanged. Only `.windows` is /// cached; `.children` and `.visibleChildren` fall through to AppKit so the @@ -757,6 +1206,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCent } ) ) + private lazy var quickTerminalController = QuickTerminalController() private static let serviceErrorNoPath = NSString(string: String(localized: "error.clipboardFolderPath", defaultValue: "Could not load any folder path from the clipboard.")) private static let didInstallWindowKeyEquivalentSwizzle: Void = { let targetClass: AnyClass = NSWindow.self @@ -1683,6 +2133,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCent closeAllWebInspectorsBeforeAppTeardown() _ = saveSessionSnapshotIncludingProcessDetectedIndexes(includeScrollback: true, removeWhenEmpty: false) stopSessionAutosaveTimer() + quickTerminalController.teardown() CloudVMActionLauncher.shared.terminateAll() CmuxSSHURLProcessLauncher.shared.terminateAll() TerminalController.shared.stop() @@ -5960,6 +6411,33 @@ final class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCent return false } + @discardableResult + func toggleQuickTerminalVisibility(activateApp: Bool = true) -> Bool { + quickTerminalController.toggle(activateApp: activateApp) + return true + } + + @discardableResult + func showQuickTerminal(activateApp: Bool = true) -> Bool { + quickTerminalController.show(activateApp: activateApp) + return true + } + + @discardableResult + func hideQuickTerminal(restorePreviousApp: Bool = true) -> Bool { + quickTerminalController.hide(restorePreviousApp: restorePreviousApp) + return true + } + + func quickTerminalStatusPayload() -> [String: Any] { + quickTerminalController.statusPayload() + } + + @objc func toggleQuickTerminal(_ sender: Any?) { + _ = sender + _ = toggleQuickTerminalVisibility() + } + @discardableResult func toggleRightSidebarInActiveMainWindow(preferredWindow: NSWindow? = nil) -> Bool { guard let context = preferredRegisteredMainWindowContext(preferredWindow: preferredWindow) else { @@ -11336,7 +11814,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCent // here would swallow the first stroke and leave the second one // orphaned, breaking that keystroke for the focused terminal/browser // input. - guard action != .showHideAllWindows && action != .globalSearch else { return false } + guard action != .showHideAllWindows && action != .globalSearch && action != .toggleQuickTerminal else { return false } return KeyboardShortcutSettings.shortcut(for: action).hasChord } } @@ -11970,6 +12448,11 @@ final class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCent return true } + if matchConfiguredShortcut(event: event, action: .toggleQuickTerminal) { + _ = toggleQuickTerminalVisibility() + return true + } + let hasEventWindowContext = shortcutEventHasAddressableWindow(event) let didSynchronizeShortcutContext = synchronizeShortcutRoutingContext(event: event) if hasEventWindowContext && !didSynchronizeShortcutContext { @@ -13942,7 +14425,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCent } private func isMenuBackedShortcutAction(_ action: KeyboardShortcutSettings.Action) -> Bool { - action != .showHideAllWindows && action != .globalSearch + action != .showHideAllWindows && action != .globalSearch && action != .toggleQuickTerminal } private func isCloseShortcutAction(_ action: KeyboardShortcutSettings.Action) -> Bool { diff --git a/Sources/ContentView+RightSidebarCommandPalette.swift b/Sources/ContentView+RightSidebarCommandPalette.swift index 6b43db52f1ad..c339e7c9b3db 100644 --- a/Sources/ContentView+RightSidebarCommandPalette.swift +++ b/Sources/ContentView+RightSidebarCommandPalette.swift @@ -11,6 +11,8 @@ extension ContentView { return .newTab case "palette.newWindow": return .newWindow + case "palette.toggleQuickTerminal": + return .toggleQuickTerminal case "palette.openFolder": return .openFolder case "palette.reopenPreviousSession": diff --git a/Sources/ContentView.swift b/Sources/ContentView.swift index 6348551f4816..daeae64ff281 100644 --- a/Sources/ContentView.swift +++ b/Sources/ContentView.swift @@ -6488,6 +6488,14 @@ struct ContentView: View { keywords: ["toggle", "sidebar", "left", "layout"] ) ) + contributions.append( + CommandPaletteCommandContribution( + commandId: "palette.toggleQuickTerminal", + title: constant(String(localized: "command.toggleQuickTerminal.title", defaultValue: "Toggle Quick Terminal")), + subtitle: constant(String(localized: "command.toggleQuickTerminal.subtitle", defaultValue: "Terminal")), + keywords: ["quick", "terminal", "toggle", "dropdown", "quake"] + ) + ) for descriptor in CmuxExtensionSidebarSelection.descriptors { let title = CmuxExtensionSidebarSelection.localizedTitle(for: descriptor) let titleFormat = String(localized: "command.switchExtensionSidebar.title", defaultValue: "Sidebar: %@") @@ -7519,6 +7527,9 @@ struct ContentView: View { registry.register(commandId: "palette.toggleSidebar") { sidebarState.toggle() } + registry.register(commandId: "palette.toggleQuickTerminal") { + AppDelegate.shared?.toggleQuickTerminal(nil) + } for descriptor in CmuxExtensionSidebarSelection.descriptors { registry.register(commandId: commandPaletteExtensionSidebarCommandID(descriptor.id)) { CmuxExtensionSidebarSelection.setProviderId(descriptor.id) diff --git a/Sources/KeyboardShortcutSettings.swift b/Sources/KeyboardShortcutSettings.swift index 81e0f422a430..fc83d9ddcc70 100644 --- a/Sources/KeyboardShortcutSettings.swift +++ b/Sources/KeyboardShortcutSettings.swift @@ -63,6 +63,7 @@ enum KeyboardShortcutSettings { case reloadConfiguration case showHideAllWindows case globalSearch + case toggleQuickTerminal case newWindow case closeWindow case toggleFullScreen @@ -151,6 +152,7 @@ enum KeyboardShortcutSettings { case .reloadConfiguration: return String(localized: "menu.app.reloadConfiguration", defaultValue: "Reload Configuration") case .showHideAllWindows: return String(localized: "settings.globalHotkey.shortcut", defaultValue: "Show/Hide All Windows") case .globalSearch: return String(localized: "shortcut.globalSearch.label", defaultValue: "Global Search") + case .toggleQuickTerminal: return String(localized: "shortcut.toggleQuickTerminal.label", defaultValue: "Toggle Quick Terminal") case .newWindow: return String(localized: "shortcut.newWindow.label", defaultValue: "New Window") case .closeWindow: return String(localized: "shortcut.closeWindow.label", defaultValue: "Close Window") case .toggleFullScreen: return String(localized: "command.toggleFullScreen.title", defaultValue: "Toggle Full Screen") @@ -254,6 +256,8 @@ enum KeyboardShortcutSettings { return StoredShortcut(key: ".", command: true, shift: false, option: true, control: true) case .globalSearch: return StoredShortcut(key: "f", command: true, shift: false, option: true, control: false) + case .toggleQuickTerminal: + return StoredShortcut(key: "`", command: true, shift: false, option: true, control: false) case .newWindow: return StoredShortcut(key: "n", command: true, shift: true, option: false, control: false) case .closeWindow: @@ -467,7 +471,7 @@ enum KeyboardShortcutSettings { // Preserve invalid settings-file values for the show/hide hotkey so managed // configuration remains visible instead of silently falling back to defaults. // Runtime registration still rejects unsupported Carbon hotkey shapes. - if usesNumberedDigitMatching || self == .globalSearch { + if usesNumberedDigitMatching || self == .globalSearch || self == .toggleQuickTerminal { return nil } return shortcut @@ -479,7 +483,7 @@ enum KeyboardShortcutSettings { } switch self { - case .showHideAllWindows, .globalSearch: + case .showHideAllWindows, .globalSearch, .toggleQuickTerminal: return KeyboardShortcutSettings.normalizedSystemWideHotkeyShortcutResult( shortcut, for: self, @@ -743,7 +747,7 @@ enum KeyboardShortcutSettings { case let .accepted(normalizedShortcut): return normalizedShortcut case .rejected: - if action.usesNumberedDigitMatching || action == .showHideAllWindows || action == .globalSearch { + if action.usesNumberedDigitMatching || action == .showHideAllWindows || action == .globalSearch || action == .toggleQuickTerminal { return nil } return shortcut @@ -972,10 +976,12 @@ final class SystemWideHotkeyController { private static let hotKeyIDs: [KeyboardShortcutSettings.Action: UInt32] = [ .showHideAllWindows: 1, .globalSearch: 2, + .toggleQuickTerminal: 3, ] private static let systemWideActions: [KeyboardShortcutSettings.Action] = [ .showHideAllWindows, .globalSearch, + .toggleQuickTerminal, ] private var hotKeyRefs: [KeyboardShortcutSettings.Action: EventHotKeyRef] = [:] @@ -1121,7 +1127,7 @@ final class SystemWideHotkeyController { switch action { case .showHideAllWindows: return SystemWideHotkeySettings.isEnabled() - case .globalSearch: + case .globalSearch, .toggleQuickTerminal: return true default: assertionFailure("Unhandled system-wide hotkey action: \(action.rawValue)") @@ -1214,6 +1220,8 @@ final class SystemWideHotkeyController { AppDelegate.shared?.toggleApplicationVisibilityFromGlobalHotkey() case .globalSearch: AppDelegate.shared?.toggleGlobalSearchPaletteFromGlobalHotkey() + case .toggleQuickTerminal: + _ = AppDelegate.shared?.toggleQuickTerminalVisibility(activateApp: true) default: assertionFailure("Unhandled system-wide hotkey action: \(action.rawValue)") break diff --git a/Sources/KeyboardShortcutSettingsFileStore+Template.swift b/Sources/KeyboardShortcutSettingsFileStore+Template.swift index 94ca1a6b18f9..67725f606088 100644 --- a/Sources/KeyboardShortcutSettingsFileStore+Template.swift +++ b/Sources/KeyboardShortcutSettingsFileStore+Template.swift @@ -85,6 +85,10 @@ extension CmuxSettingsFileStore { "copyOnSelect": TerminalCopyOnSelectSettings.defaultCopyOnSelect, "autoResumeAgentSessions": AgentSessionAutoResumeSettings.defaultAutoResumeAgentSessions, "textBoxMaxLines": TerminalTextBoxInputSettings.defaultMaxLines, + "quickTerminalPosition": QuickTerminalSettings.defaultPosition.rawValue, + "quickTerminalPrimarySizeRatio": QuickTerminalSettings.defaultPrimarySizeRatio, + "quickTerminalSecondarySizeRatio": QuickTerminalSettings.defaultSecondarySizeRatio, + "quickTerminalAutoHide": QuickTerminalSettings.defaultAutoHide, "resumeCommands": [], ], ], diff --git a/Sources/KeyboardShortcutSettingsFileStore.swift b/Sources/KeyboardShortcutSettingsFileStore.swift index 64cbdedd73ab..68453bca2858 100644 --- a/Sources/KeyboardShortcutSettingsFileStore.swift +++ b/Sources/KeyboardShortcutSettingsFileStore.swift @@ -523,6 +523,34 @@ final class CmuxSettingsFileStore { } else if section.keys.contains("textBoxMaxLines") { logInvalid("terminal.textBoxMaxLines", sourcePath: sourcePath) } + + if let raw = jsonString(section["quickTerminalPosition"]) { + if let position = QuickTerminalPosition(rawValue: raw) { + snapshot.managedUserDefaults[QuickTerminalSettings.positionKey] = .string(position.rawValue) + } else { + logInvalid("terminal.quickTerminalPosition", sourcePath: sourcePath) + } + } else if section.keys.contains("quickTerminalPosition") { + logInvalid("terminal.quickTerminalPosition", sourcePath: sourcePath) + } + + if let value = jsonDouble(section["quickTerminalPrimarySizeRatio"]) { + snapshot.managedUserDefaults[QuickTerminalSettings.primarySizeRatioKey] = .double(QuickTerminalSettings.clampRatio(value)) + } else if section.keys.contains("quickTerminalPrimarySizeRatio") { + logInvalid("terminal.quickTerminalPrimarySizeRatio", sourcePath: sourcePath) + } + + if let value = jsonDouble(section["quickTerminalSecondarySizeRatio"]) { + snapshot.managedUserDefaults[QuickTerminalSettings.secondarySizeRatioKey] = .double(QuickTerminalSettings.clampRatio(value)) + } else if section.keys.contains("quickTerminalSecondarySizeRatio") { + logInvalid("terminal.quickTerminalSecondarySizeRatio", sourcePath: sourcePath) + } + + if let value = jsonBool(section["quickTerminalAutoHide"]) { + snapshot.managedUserDefaults[QuickTerminalSettings.autoHideKey] = .bool(value) + } else if section.keys.contains("quickTerminalAutoHide") { + logInvalid("terminal.quickTerminalAutoHide", sourcePath: sourcePath) + } } private func parseSidebarSection( diff --git a/Sources/TerminalController.swift b/Sources/TerminalController.swift index 17c5d98be24b..6081ce757986 100644 --- a/Sources/TerminalController.swift +++ b/Sources/TerminalController.swift @@ -273,6 +273,9 @@ class TerminalController { "browser.tab.switch", "notification.open", "notification.jump_to_unread", + "quick_terminal.toggle", + "quick_terminal.show", + "quick_terminal.hide", "debug.command_palette.toggle", "debug.notification.focus", "debug.app.activate", @@ -3517,6 +3520,14 @@ class TerminalController { return v2Result(id: id, self.v2AppFocusOverride(params: params)) case "app.simulate_active": return v2Result(id: id, self.v2AppSimulateActive()) + case "quick_terminal.toggle": + return v2Result(id: id, self.v2QuickTerminalToggle()) + case "quick_terminal.show": + return v2Result(id: id, self.v2QuickTerminalShow()) + case "quick_terminal.hide": + return v2Result(id: id, self.v2QuickTerminalHide()) + case "quick_terminal.status": + return v2Ok(id: id, result: self.v2QuickTerminalStatus()) // Browser case "browser.open_split": @@ -3889,6 +3900,10 @@ class TerminalController { "notification.jump_to_unread", "app.focus_override.set", "app.simulate_active", + "quick_terminal.toggle", + "quick_terminal.show", + "quick_terminal.hide", + "quick_terminal.status", "file.open", "markdown.open", "browser.open_split", @@ -10918,6 +10933,54 @@ class TerminalController { return .ok([:]) } + private func v2QuickTerminalToggle() -> V2CallResult { + var didToggle = false + v2MainSync { + didToggle = AppDelegate.shared?.toggleQuickTerminalVisibility(activateApp: false) == true + } + guard didToggle else { + return .err(code: "unavailable", message: "AppDelegate not available", data: nil) + } + return .ok(v2QuickTerminalStatus()) + } + + private func v2QuickTerminalShow() -> V2CallResult { + var didShow = false + v2MainSync { + didShow = AppDelegate.shared?.showQuickTerminal(activateApp: false) == true + } + guard didShow else { + return .err(code: "unavailable", message: "AppDelegate not available", data: nil) + } + return .ok(v2QuickTerminalStatus()) + } + + private func v2QuickTerminalHide() -> V2CallResult { + var didHide = false + v2MainSync { + didHide = AppDelegate.shared?.hideQuickTerminal(restorePreviousApp: false) == true + } + guard didHide else { + return .err(code: "unavailable", message: "AppDelegate not available", data: nil) + } + return .ok(v2QuickTerminalStatus()) + } + + private func v2QuickTerminalStatus() -> [String: Any] { + var payload: [String: Any]? + v2MainSync { + payload = AppDelegate.shared?.quickTerminalStatusPayload() + } + + guard let payload else { + return [ + "available": false, + "visible": false + ] + } + return payload + } + // MARK: - V2 Browser Methods private func v2BrowserWithPanel( diff --git a/Sources/cmuxApp.swift b/Sources/cmuxApp.swift index 52654c8d0144..f902cd789821 100644 --- a/Sources/cmuxApp.swift +++ b/Sources/cmuxApp.swift @@ -665,6 +665,10 @@ struct cmuxApp: App { } } + splitCommandButton(title: String(localized: "menu.view.toggleQuickTerminal", defaultValue: "Toggle Quick Terminal"), shortcut: menuShortcut(for: .toggleQuickTerminal)) { + AppDelegate.shared?.toggleQuickTerminal(nil) + } + splitCommandButton(title: String(localized: "menu.view.toggleRightSidebar", defaultValue: "Toggle Right Sidebar"), shortcut: menuShortcut(for: .toggleRightSidebar)) { if AppDelegate.shared?.toggleRightSidebarInActiveMainWindow( preferredWindow: NSApp.keyWindow ?? NSApp.mainWindow @@ -5267,6 +5271,14 @@ struct SettingsView: View { private var textBoxMaxLines = TerminalTextBoxInputSettings.defaultMaxLines @AppStorage(TerminalCopyOnSelectSettings.copyOnSelectKey) private var terminalCopyOnSelect = TerminalCopyOnSelectSettings.defaultCopyOnSelect + @AppStorage(QuickTerminalSettings.positionKey) + private var quickTerminalPosition = QuickTerminalSettings.defaultPosition.rawValue + @AppStorage(QuickTerminalSettings.primarySizeRatioKey) + private var quickTerminalPrimarySizeRatio = QuickTerminalSettings.defaultPrimarySizeRatio + @AppStorage(QuickTerminalSettings.secondarySizeRatioKey) + private var quickTerminalSecondarySizeRatio = QuickTerminalSettings.defaultSecondarySizeRatio + @AppStorage(QuickTerminalSettings.autoHideKey) + private var quickTerminalAutoHide = QuickTerminalSettings.defaultAutoHide @AppStorage(FileDropBehaviorSettings.defaultBehaviorKey) private var fileDropDefaultBehavior = FileDropBehaviorSettings.defaultBehavior.rawValue @AppStorage(AgentSessionAutoResumeSettings.autoResumeAgentSessionsKey) @@ -5507,6 +5519,53 @@ struct SettingsView: View { ) } + private var selectedQuickTerminalPosition: QuickTerminalPosition { + QuickTerminalPosition(rawValue: quickTerminalPosition) ?? QuickTerminalSettings.defaultPosition + } + + private var quickTerminalPositionSelection: Binding { + Binding( + get: { selectedQuickTerminalPosition.rawValue }, + set: { newValue in + quickTerminalPosition = QuickTerminalPosition(rawValue: newValue)?.rawValue + ?? QuickTerminalSettings.defaultPosition.rawValue + } + ) + } + + private var quickTerminalPrimarySizeBinding: Binding { + Binding( + get: { QuickTerminalSettings.clampRatio(quickTerminalPrimarySizeRatio) }, + set: { quickTerminalPrimarySizeRatio = QuickTerminalSettings.clampRatio($0) } + ) + } + + private var quickTerminalSecondarySizeBinding: Binding { + Binding( + get: { QuickTerminalSettings.clampRatio(quickTerminalSecondarySizeRatio) }, + set: { quickTerminalSecondarySizeRatio = QuickTerminalSettings.clampRatio($0) } + ) + } + + private func quickTerminalPositionDisplayName(_ position: QuickTerminalPosition) -> String { + switch position { + case .top: + return String(localized: "settings.quickTerminal.position.top", defaultValue: "Top") + case .bottom: + return String(localized: "settings.quickTerminal.position.bottom", defaultValue: "Bottom") + case .left: + return String(localized: "settings.quickTerminal.position.left", defaultValue: "Left") + case .right: + return String(localized: "settings.quickTerminal.position.right", defaultValue: "Right") + case .center: + return String(localized: "settings.quickTerminal.position.center", defaultValue: "Center") + } + } + + private func quickTerminalRatioPercentLabel(_ ratio: Double) -> String { + "\(Int((QuickTerminalSettings.clampRatio(ratio) * 100).rounded()))%" + } + private var fileDropDefaultBehaviorSelection: Binding { Binding( get: { selectedFileDropDefaultBehavior.rawValue }, @@ -6746,6 +6805,77 @@ struct SettingsView: View { String(localized: "settings.terminal.agentAutoResume", defaultValue: "Resume Agent Sessions on Reopen") ) } + + SettingsCardDivider() + + SettingsPickerRow( + configurationReview: .json("terminal.quickTerminalPosition"), + String(localized: "settings.quickTerminal.position", defaultValue: "Quick Terminal Position"), + subtitle: String(localized: "settings.quickTerminal.position.subtitle", defaultValue: "Choose where the quick terminal slides in."), + controlWidth: pickerColumnWidth, + selection: quickTerminalPositionSelection + ) { + ForEach(Array(QuickTerminalPosition.allCases), id: \.rawValue) { position in + Text(verbatim: quickTerminalPositionDisplayName(position)) + .tag(position.rawValue) + } + } + + SettingsCardDivider() + + SettingsCardRow( + configurationReview: .json("terminal.quickTerminalPrimarySizeRatio"), + String(localized: "settings.quickTerminal.primarySize", defaultValue: "Quick Terminal Primary Size"), + subtitle: String(localized: "settings.quickTerminal.primarySize.subtitle", defaultValue: "Size along the slide-in axis.") + ) { + HStack(spacing: 8) { + Slider(value: quickTerminalPrimarySizeBinding, in: 0.2...1.0) + .frame(width: 132) + Text(verbatim: quickTerminalRatioPercentLabel(quickTerminalPrimarySizeRatio)) + .font(.system(size: 11, weight: .medium)) + .foregroundStyle(.secondary) + .monospacedDigit() + .frame(width: 42, alignment: .trailing) + } + .accessibilityIdentifier("SettingsQuickTerminalPrimarySizeSlider") + } + + SettingsCardDivider() + + SettingsCardRow( + configurationReview: .json("terminal.quickTerminalSecondarySizeRatio"), + String(localized: "settings.quickTerminal.secondarySize", defaultValue: "Quick Terminal Secondary Size"), + subtitle: String(localized: "settings.quickTerminal.secondarySize.subtitle", defaultValue: "Size across the opposite axis.") + ) { + HStack(spacing: 8) { + Slider(value: quickTerminalSecondarySizeBinding, in: 0.2...1.0) + .frame(width: 132) + Text(verbatim: quickTerminalRatioPercentLabel(quickTerminalSecondarySizeRatio)) + .font(.system(size: 11, weight: .medium)) + .foregroundStyle(.secondary) + .monospacedDigit() + .frame(width: 42, alignment: .trailing) + } + .accessibilityIdentifier("SettingsQuickTerminalSecondarySizeSlider") + } + + SettingsCardDivider() + + SettingsCardRow( + configurationReview: .json("terminal.quickTerminalAutoHide"), + String(localized: "settings.quickTerminal.autoHide", defaultValue: "Quick Terminal Auto-Hide"), + subtitle: quickTerminalAutoHide + ? String(localized: "settings.quickTerminal.autoHide.subtitleOn", defaultValue: "Hide automatically when it loses focus.") + : String(localized: "settings.quickTerminal.autoHide.subtitleOff", defaultValue: "Keep visible when focus moves away.") + ) { + Toggle("", isOn: $quickTerminalAutoHide) + .labelsHidden() + .controlSize(.small) + .accessibilityIdentifier("SettingsQuickTerminalAutoHideToggle") + .accessibilityLabel( + String(localized: "settings.quickTerminal.autoHide", defaultValue: "Quick Terminal Auto-Hide") + ) + } } SurfaceResumeApprovalSettingsCard() @@ -8001,6 +8131,10 @@ struct SettingsView: View { if previousTerminalCopyOnSelect != terminalCopyOnSelect { TerminalCopyOnSelectSettings.notifyDidChange() } + quickTerminalPosition = QuickTerminalSettings.defaultPosition.rawValue + quickTerminalPrimarySizeRatio = QuickTerminalSettings.defaultPrimarySizeRatio + quickTerminalSecondarySizeRatio = QuickTerminalSettings.defaultSecondarySizeRatio + quickTerminalAutoHide = QuickTerminalSettings.defaultAutoHide fileDropDefaultBehavior = FileDropBehaviorSettings.defaultBehavior.rawValue let previousAutoResumeAgentSessions = autoResumeAgentSessions autoResumeAgentSessions = AgentSessionAutoResumeSettings.defaultAutoResumeAgentSessions diff --git a/cmuxTests/GlobalSearchShortcutSettingsTests.swift b/cmuxTests/GlobalSearchShortcutSettingsTests.swift index 9156982353c7..517d994a5d36 100644 --- a/cmuxTests/GlobalSearchShortcutSettingsTests.swift +++ b/cmuxTests/GlobalSearchShortcutSettingsTests.swift @@ -117,4 +117,55 @@ final class GlobalSearchShortcutSettingsTests: XCTestCase { XCTAssertNil(store.override(for: .globalSearch)) } + + func testQuickTerminalDefaultShortcutIsRemappableAndSystemWideSafe() { + let defaultShortcut = KeyboardShortcutSettings.shortcut(for: .toggleQuickTerminal) + + XCTAssertEqual( + defaultShortcut, + StoredShortcut(key: "`", command: true, shift: false, option: true, control: false) + ) + XCTAssertTrue(KeyboardShortcutSettings.publicShortcutActions.contains(.toggleQuickTerminal)) + XCTAssertTrue(KeyboardShortcutSettings.settingsVisibleActions.contains(.toggleQuickTerminal)) + XCTAssertEqual( + KeyboardShortcutSettings.Action.toggleQuickTerminal.normalizedRecordedShortcutResult(defaultShortcut), + .accepted(defaultShortcut) + ) + } + + func testQuickTerminalRejectsBareSystemWideShortcut() { + let bareShortcut = StoredShortcut(key: "`", command: false, shift: false, option: false, control: false) + + XCTAssertEqual( + KeyboardShortcutSettings.Action.toggleQuickTerminal.normalizedRecordedShortcutResult(bareShortcut), + .rejected(.systemWideHotkeyRequiresModifier) + ) + } + + func testSettingsFileStoreParsesQuickTerminalShortcut() throws { + let directoryURL = FileManager.default.temporaryDirectory + .appendingPathComponent("cmux-quick-terminal-settings-\(UUID().uuidString)", isDirectory: true) + try FileManager.default.createDirectory(at: directoryURL, withIntermediateDirectories: true) + defer { try? FileManager.default.removeItem(at: directoryURL) } + + let settingsFileURL = directoryURL.appendingPathComponent("cmux.json", isDirectory: false) + try """ + { + "shortcuts": { + "toggleQuickTerminal": "cmd+ctrl+`" + } + } + """.write(to: settingsFileURL, atomically: true, encoding: .utf8) + + let store = KeyboardShortcutSettingsFileStore( + primaryPath: settingsFileURL.path, + fallbackPath: nil, + startWatching: false + ) + + XCTAssertEqual( + store.override(for: .toggleQuickTerminal), + StoredShortcut(key: "`", command: true, shift: false, option: false, control: true) + ) + } } diff --git a/web/app/[locale]/docs/configuration/page.tsx b/web/app/[locale]/docs/configuration/page.tsx index 513efe27f742..8835939e5b31 100644 --- a/web/app/[locale]/docs/configuration/page.tsx +++ b/web/app/[locale]/docs/configuration/page.tsx @@ -68,7 +68,11 @@ const settingsFileExample = `{ // "showScrollBar": false, // "copyOnSelect": true, // "autoResumeAgentSessions": true, - // "textBoxMaxLines": 10 + // "textBoxMaxLines": 10, + // "quickTerminalPosition": "top", + // "quickTerminalPrimarySizeRatio": 0.38, + // "quickTerminalSecondarySizeRatio": 1, + // "quickTerminalAutoHide": true // }, // "browser": { @@ -91,6 +95,7 @@ const settingsFileExample = `{ // "shortcuts": { // "bindings": { // "toggleSidebar": "cmd+b", + // "toggleQuickTerminal": "cmd+opt+`", // "toggleFileExplorer": "cmd+opt+b", // "newTab": ["ctrl+b", "c"], // "commandPalettePrevious": null diff --git a/web/data/cmux-shortcuts.ts b/web/data/cmux-shortcuts.ts index fbab27d5bf54..5f6742026e68 100644 --- a/web/data/cmux-shortcuts.ts +++ b/web/data/cmux-shortcuts.ts @@ -37,6 +37,12 @@ export const shortcutCategories: ShortcutCategory[] = [ description: { en: "Global search", ja: "グローバル検索" }, note: { en: "system-wide hotkey", ja: "システム全体のホットキー" }, }, + { + id: "toggleQuickTerminal", + combos: [["⌥", "⌘", "`"]], + description: { en: "Toggle quick terminal", ja: "クイックターミナルを切り替え" }, + note: { en: "system-wide hotkey", ja: "システム全体のホットキー" }, + }, { id: "commandPalette", combos: [["⌘", "⇧", "P"]], description: { en: "Command palette", ja: "コマンドパレット" } }, { id: "commandPaletteNext", diff --git a/web/data/cmux.schema.json b/web/data/cmux.schema.json index ec6f4f7e145f..9b02cd453fe4 100644 --- a/web/data/cmux.schema.json +++ b/web/data/cmux.schema.json @@ -349,6 +349,31 @@ "default": 10, "description": "Maximum number of lines the rich terminal TextBox input can grow to before it scrolls." }, + "quickTerminalPosition": { + "type": "string", + "enum": ["top", "bottom", "left", "right", "center"], + "default": "top", + "description": "Screen edge or center position for the floating quick terminal." + }, + "quickTerminalPrimarySizeRatio": { + "type": "number", + "minimum": 0.2, + "maximum": 1, + "default": 0.38, + "description": "Quick terminal size along its slide-in axis, as a fraction of the visible screen." + }, + "quickTerminalSecondarySizeRatio": { + "type": "number", + "minimum": 0.2, + "maximum": 1, + "default": 1, + "description": "Quick terminal size across the opposite axis, as a fraction of the visible screen." + }, + "quickTerminalAutoHide": { + "type": "boolean", + "default": true, + "description": "Hide the quick terminal automatically when it loses key focus." + }, "resumeCommands": { "type": "array", "default": [], @@ -900,6 +925,7 @@ "reloadConfiguration", "showHideAllWindows", "globalSearch", + "toggleQuickTerminal", "newWindow", "closeWindow", "toggleFullScreen", From c51a006ba82917834d84efcaeda038be6a96ce27 Mon Sep 17 00:00:00 2001 From: austinpower1258 Date: Tue, 26 May 2026 12:10:25 -0700 Subject: [PATCH 03/16] fix: address quick terminal ci guards --- Sources/cmuxApp.swift | 1 + web/app/[locale]/docs/configuration/page.tsx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/cmuxApp.swift b/Sources/cmuxApp.swift index 66d543691f33..b8afda3cc1f2 100644 --- a/Sources/cmuxApp.swift +++ b/Sources/cmuxApp.swift @@ -1190,6 +1190,7 @@ private let cmuxAuxiliaryWindowIdentifiers: Set = [ "cmux.browser-popup", "cmux.browserProfilePopoverDebug", "cmux.configEditor", + "cmux.quick-terminal", "cmux.feedButtonStyleDebug", "cmux.feedPreview", "cmux.feedTextEditorDebug", diff --git a/web/app/[locale]/docs/configuration/page.tsx b/web/app/[locale]/docs/configuration/page.tsx index cfb1e30c33e9..eaf8448fa042 100644 --- a/web/app/[locale]/docs/configuration/page.tsx +++ b/web/app/[locale]/docs/configuration/page.tsx @@ -100,7 +100,7 @@ const settingsFileExample = `{ // "shortcuts": { // "bindings": { // "toggleSidebar": "cmd+b", - // "toggleQuickTerminal": "cmd+opt+`", + // "toggleQuickTerminal": "cmd+opt+\`", // "toggleFileExplorer": "cmd+opt+b", // "newTab": ["ctrl+b", "c"], // "commandPalettePrevious": null From f12cc863a4163b3653c6ab2030cb2b6265cfc5d9 Mon Sep 17 00:00:00 2001 From: austinpower1258 Date: Tue, 26 May 2026 14:18:10 -0700 Subject: [PATCH 04/16] fix: address quick terminal review feedback --- Resources/Localizable.xcstrings | 38 +-- Sources/AppDelegate.swift | 449 ------------------------ Sources/QuickTerminalController.swift | 470 ++++++++++++++++++++++++++ cmux.xcodeproj/project.pbxproj | 4 + 4 files changed, 493 insertions(+), 468 deletions(-) create mode 100644 Sources/QuickTerminalController.swift diff --git a/Resources/Localizable.xcstrings b/Resources/Localizable.xcstrings index d71aa06fa6b1..d7eb6c6de85e 100644 --- a/Resources/Localizable.xcstrings +++ b/Resources/Localizable.xcstrings @@ -117901,25 +117901,25 @@ "sidebar.tree.group.other.subtitle": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", "value": "No folder" } }, "ja": { "stringUnit": { "state": "translated", "value": "フォルダなし" } } } }, "sidebar.tree.group.pinned": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", "value": "Pinned" } }, "ja": { "stringUnit": { "state": "translated", "value": "ピン留め" } } } }, "sidebar.tree.group.remote.subtitle": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", "value": "SSH" } }, "ja": { "stringUnit": { "state": "translated", "value": "SSH" } } } }, - "command.toggleQuickTerminal.subtitle": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Terminal"}},"ja":{"stringUnit":{"state":"translated","value":"ターミナル"}}}}, - "command.toggleQuickTerminal.title": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Toggle Quick Terminal"}},"ja":{"stringUnit":{"state":"translated","value":"クイックターミナルを切り替え"}}}}, - "menu.view.toggleQuickTerminal": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Toggle Quick Terminal"}},"ja":{"stringUnit":{"state":"translated","value":"クイックターミナルを切り替え"}}}}, - "quickTerminal.window.title": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Quick Terminal"}},"ja":{"stringUnit":{"state":"translated","value":"クイックターミナル"}}}}, - "settings.quickTerminal.autoHide": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Quick Terminal Auto-Hide"}},"ja":{"stringUnit":{"state":"translated","value":"クイックターミナルを自動的に隠す"}}}}, - "settings.quickTerminal.autoHide.subtitleOff": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Keep visible when focus moves away."}},"ja":{"stringUnit":{"state":"translated","value":"フォーカスが移動しても表示したままにします。"}}}}, - "settings.quickTerminal.autoHide.subtitleOn": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Hide automatically when it loses focus."}},"ja":{"stringUnit":{"state":"translated","value":"フォーカスを失うと自動的に隠します。"}}}}, - "settings.quickTerminal.position": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Quick Terminal Position"}},"ja":{"stringUnit":{"state":"translated","value":"クイックターミナルの位置"}}}}, - "settings.quickTerminal.position.bottom": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Bottom"}},"ja":{"stringUnit":{"state":"translated","value":"下"}}}}, - "settings.quickTerminal.position.center": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Center"}},"ja":{"stringUnit":{"state":"translated","value":"中央"}}}}, - "settings.quickTerminal.position.left": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Left"}},"ja":{"stringUnit":{"state":"translated","value":"左"}}}}, - "settings.quickTerminal.position.right": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Right"}},"ja":{"stringUnit":{"state":"translated","value":"右"}}}}, - "settings.quickTerminal.position.subtitle": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Choose where the quick terminal slides in."}},"ja":{"stringUnit":{"state":"translated","value":"クイックターミナルがスライドインする位置を選びます。"}}}}, - "settings.quickTerminal.position.top": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Top"}},"ja":{"stringUnit":{"state":"translated","value":"上"}}}}, - "settings.quickTerminal.primarySize": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Quick Terminal Primary Size"}},"ja":{"stringUnit":{"state":"translated","value":"クイックターミナルの主サイズ"}}}}, - "settings.quickTerminal.primarySize.subtitle": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Size along the slide-in axis."}},"ja":{"stringUnit":{"state":"translated","value":"スライドイン方向のサイズです。"}}}}, - "settings.quickTerminal.secondarySize": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Quick Terminal Secondary Size"}},"ja":{"stringUnit":{"state":"translated","value":"クイックターミナルの副サイズ"}}}}, - "settings.quickTerminal.secondarySize.subtitle": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Size across the opposite axis."}},"ja":{"stringUnit":{"state":"translated","value":"反対方向のサイズです。"}}}}, - "shortcut.toggleQuickTerminal.label": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Toggle Quick Terminal"}},"ja":{"stringUnit":{"state":"translated","value":"クイックターミナルを切り替え"}}}}, + "command.toggleQuickTerminal.subtitle": {"extractionState":"manual","localizations":{"ar":{"stringUnit":{"state":"needs_review","value":"Terminal"}},"bs":{"stringUnit":{"state":"needs_review","value":"Terminal"}},"da":{"stringUnit":{"state":"needs_review","value":"Terminal"}},"de":{"stringUnit":{"state":"needs_review","value":"Terminal"}},"en":{"stringUnit":{"state":"translated","value":"Terminal"}},"es":{"stringUnit":{"state":"needs_review","value":"Terminal"}},"fr":{"stringUnit":{"state":"needs_review","value":"Terminal"}},"it":{"stringUnit":{"state":"needs_review","value":"Terminal"}},"ja":{"stringUnit":{"state":"translated","value":"ターミナル"}},"km":{"stringUnit":{"state":"needs_review","value":"Terminal"}},"ko":{"stringUnit":{"state":"needs_review","value":"Terminal"}},"nb":{"stringUnit":{"state":"needs_review","value":"Terminal"}},"pl":{"stringUnit":{"state":"needs_review","value":"Terminal"}},"pt-BR":{"stringUnit":{"state":"needs_review","value":"Terminal"}},"ru":{"stringUnit":{"state":"needs_review","value":"Terminal"}},"th":{"stringUnit":{"state":"needs_review","value":"Terminal"}},"tr":{"stringUnit":{"state":"needs_review","value":"Terminal"}},"uk":{"stringUnit":{"state":"needs_review","value":"Terminal"}},"zh-Hans":{"stringUnit":{"state":"needs_review","value":"Terminal"}},"zh-Hant":{"stringUnit":{"state":"needs_review","value":"Terminal"}}}}, + "command.toggleQuickTerminal.title": {"extractionState":"manual","localizations":{"ar":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"bs":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"da":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"de":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"en":{"stringUnit":{"state":"translated","value":"Toggle Quick Terminal"}},"es":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"fr":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"it":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"ja":{"stringUnit":{"state":"translated","value":"クイックターミナルを切り替え"}},"km":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"ko":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"nb":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"pl":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"pt-BR":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"ru":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"th":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"tr":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"uk":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"zh-Hans":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"zh-Hant":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}}}}, + "menu.view.toggleQuickTerminal": {"extractionState":"manual","localizations":{"ar":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"bs":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"da":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"de":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"en":{"stringUnit":{"state":"translated","value":"Toggle Quick Terminal"}},"es":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"fr":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"it":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"ja":{"stringUnit":{"state":"translated","value":"クイックターミナルを切り替え"}},"km":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"ko":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"nb":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"pl":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"pt-BR":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"ru":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"th":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"tr":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"uk":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"zh-Hans":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"zh-Hant":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}}}}, + "quickTerminal.window.title": {"extractionState":"manual","localizations":{"ar":{"stringUnit":{"state":"needs_review","value":"Quick Terminal"}},"bs":{"stringUnit":{"state":"needs_review","value":"Quick Terminal"}},"da":{"stringUnit":{"state":"needs_review","value":"Quick Terminal"}},"de":{"stringUnit":{"state":"needs_review","value":"Quick Terminal"}},"en":{"stringUnit":{"state":"translated","value":"Quick Terminal"}},"es":{"stringUnit":{"state":"needs_review","value":"Quick Terminal"}},"fr":{"stringUnit":{"state":"needs_review","value":"Quick Terminal"}},"it":{"stringUnit":{"state":"needs_review","value":"Quick Terminal"}},"ja":{"stringUnit":{"state":"translated","value":"クイックターミナル"}},"km":{"stringUnit":{"state":"needs_review","value":"Quick Terminal"}},"ko":{"stringUnit":{"state":"needs_review","value":"Quick Terminal"}},"nb":{"stringUnit":{"state":"needs_review","value":"Quick Terminal"}},"pl":{"stringUnit":{"state":"needs_review","value":"Quick Terminal"}},"pt-BR":{"stringUnit":{"state":"needs_review","value":"Quick Terminal"}},"ru":{"stringUnit":{"state":"needs_review","value":"Quick Terminal"}},"th":{"stringUnit":{"state":"needs_review","value":"Quick Terminal"}},"tr":{"stringUnit":{"state":"needs_review","value":"Quick Terminal"}},"uk":{"stringUnit":{"state":"needs_review","value":"Quick Terminal"}},"zh-Hans":{"stringUnit":{"state":"needs_review","value":"Quick Terminal"}},"zh-Hant":{"stringUnit":{"state":"needs_review","value":"Quick Terminal"}}}}, + "settings.quickTerminal.autoHide": {"extractionState":"manual","localizations":{"ar":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Auto-Hide"}},"bs":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Auto-Hide"}},"da":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Auto-Hide"}},"de":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Auto-Hide"}},"en":{"stringUnit":{"state":"translated","value":"Quick Terminal Auto-Hide"}},"es":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Auto-Hide"}},"fr":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Auto-Hide"}},"it":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Auto-Hide"}},"ja":{"stringUnit":{"state":"translated","value":"クイックターミナルを自動的に隠す"}},"km":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Auto-Hide"}},"ko":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Auto-Hide"}},"nb":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Auto-Hide"}},"pl":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Auto-Hide"}},"pt-BR":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Auto-Hide"}},"ru":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Auto-Hide"}},"th":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Auto-Hide"}},"tr":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Auto-Hide"}},"uk":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Auto-Hide"}},"zh-Hans":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Auto-Hide"}},"zh-Hant":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Auto-Hide"}}}}, + "settings.quickTerminal.autoHide.subtitleOff": {"extractionState":"manual","localizations":{"ar":{"stringUnit":{"state":"needs_review","value":"Keep visible when focus moves away."}},"bs":{"stringUnit":{"state":"needs_review","value":"Keep visible when focus moves away."}},"da":{"stringUnit":{"state":"needs_review","value":"Keep visible when focus moves away."}},"de":{"stringUnit":{"state":"needs_review","value":"Keep visible when focus moves away."}},"en":{"stringUnit":{"state":"translated","value":"Keep visible when focus moves away."}},"es":{"stringUnit":{"state":"needs_review","value":"Keep visible when focus moves away."}},"fr":{"stringUnit":{"state":"needs_review","value":"Keep visible when focus moves away."}},"it":{"stringUnit":{"state":"needs_review","value":"Keep visible when focus moves away."}},"ja":{"stringUnit":{"state":"translated","value":"フォーカスが移動しても表示したままにします。"}},"km":{"stringUnit":{"state":"needs_review","value":"Keep visible when focus moves away."}},"ko":{"stringUnit":{"state":"needs_review","value":"Keep visible when focus moves away."}},"nb":{"stringUnit":{"state":"needs_review","value":"Keep visible when focus moves away."}},"pl":{"stringUnit":{"state":"needs_review","value":"Keep visible when focus moves away."}},"pt-BR":{"stringUnit":{"state":"needs_review","value":"Keep visible when focus moves away."}},"ru":{"stringUnit":{"state":"needs_review","value":"Keep visible when focus moves away."}},"th":{"stringUnit":{"state":"needs_review","value":"Keep visible when focus moves away."}},"tr":{"stringUnit":{"state":"needs_review","value":"Keep visible when focus moves away."}},"uk":{"stringUnit":{"state":"needs_review","value":"Keep visible when focus moves away."}},"zh-Hans":{"stringUnit":{"state":"needs_review","value":"Keep visible when focus moves away."}},"zh-Hant":{"stringUnit":{"state":"needs_review","value":"Keep visible when focus moves away."}}}}, + "settings.quickTerminal.autoHide.subtitleOn": {"extractionState":"manual","localizations":{"ar":{"stringUnit":{"state":"needs_review","value":"Hide automatically when it loses focus."}},"bs":{"stringUnit":{"state":"needs_review","value":"Hide automatically when it loses focus."}},"da":{"stringUnit":{"state":"needs_review","value":"Hide automatically when it loses focus."}},"de":{"stringUnit":{"state":"needs_review","value":"Hide automatically when it loses focus."}},"en":{"stringUnit":{"state":"translated","value":"Hide automatically when it loses focus."}},"es":{"stringUnit":{"state":"needs_review","value":"Hide automatically when it loses focus."}},"fr":{"stringUnit":{"state":"needs_review","value":"Hide automatically when it loses focus."}},"it":{"stringUnit":{"state":"needs_review","value":"Hide automatically when it loses focus."}},"ja":{"stringUnit":{"state":"translated","value":"フォーカスを失うと自動的に隠します。"}},"km":{"stringUnit":{"state":"needs_review","value":"Hide automatically when it loses focus."}},"ko":{"stringUnit":{"state":"needs_review","value":"Hide automatically when it loses focus."}},"nb":{"stringUnit":{"state":"needs_review","value":"Hide automatically when it loses focus."}},"pl":{"stringUnit":{"state":"needs_review","value":"Hide automatically when it loses focus."}},"pt-BR":{"stringUnit":{"state":"needs_review","value":"Hide automatically when it loses focus."}},"ru":{"stringUnit":{"state":"needs_review","value":"Hide automatically when it loses focus."}},"th":{"stringUnit":{"state":"needs_review","value":"Hide automatically when it loses focus."}},"tr":{"stringUnit":{"state":"needs_review","value":"Hide automatically when it loses focus."}},"uk":{"stringUnit":{"state":"needs_review","value":"Hide automatically when it loses focus."}},"zh-Hans":{"stringUnit":{"state":"needs_review","value":"Hide automatically when it loses focus."}},"zh-Hant":{"stringUnit":{"state":"needs_review","value":"Hide automatically when it loses focus."}}}}, + "settings.quickTerminal.position": {"extractionState":"manual","localizations":{"ar":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Position"}},"bs":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Position"}},"da":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Position"}},"de":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Position"}},"en":{"stringUnit":{"state":"translated","value":"Quick Terminal Position"}},"es":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Position"}},"fr":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Position"}},"it":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Position"}},"ja":{"stringUnit":{"state":"translated","value":"クイックターミナルの位置"}},"km":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Position"}},"ko":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Position"}},"nb":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Position"}},"pl":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Position"}},"pt-BR":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Position"}},"ru":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Position"}},"th":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Position"}},"tr":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Position"}},"uk":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Position"}},"zh-Hans":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Position"}},"zh-Hant":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Position"}}}}, + "settings.quickTerminal.position.bottom": {"extractionState":"manual","localizations":{"ar":{"stringUnit":{"state":"needs_review","value":"Bottom"}},"bs":{"stringUnit":{"state":"needs_review","value":"Bottom"}},"da":{"stringUnit":{"state":"needs_review","value":"Bottom"}},"de":{"stringUnit":{"state":"needs_review","value":"Bottom"}},"en":{"stringUnit":{"state":"translated","value":"Bottom"}},"es":{"stringUnit":{"state":"needs_review","value":"Bottom"}},"fr":{"stringUnit":{"state":"needs_review","value":"Bottom"}},"it":{"stringUnit":{"state":"needs_review","value":"Bottom"}},"ja":{"stringUnit":{"state":"translated","value":"下"}},"km":{"stringUnit":{"state":"needs_review","value":"Bottom"}},"ko":{"stringUnit":{"state":"needs_review","value":"Bottom"}},"nb":{"stringUnit":{"state":"needs_review","value":"Bottom"}},"pl":{"stringUnit":{"state":"needs_review","value":"Bottom"}},"pt-BR":{"stringUnit":{"state":"needs_review","value":"Bottom"}},"ru":{"stringUnit":{"state":"needs_review","value":"Bottom"}},"th":{"stringUnit":{"state":"needs_review","value":"Bottom"}},"tr":{"stringUnit":{"state":"needs_review","value":"Bottom"}},"uk":{"stringUnit":{"state":"needs_review","value":"Bottom"}},"zh-Hans":{"stringUnit":{"state":"needs_review","value":"Bottom"}},"zh-Hant":{"stringUnit":{"state":"needs_review","value":"Bottom"}}}}, + "settings.quickTerminal.position.center": {"extractionState":"manual","localizations":{"ar":{"stringUnit":{"state":"needs_review","value":"Center"}},"bs":{"stringUnit":{"state":"needs_review","value":"Center"}},"da":{"stringUnit":{"state":"needs_review","value":"Center"}},"de":{"stringUnit":{"state":"needs_review","value":"Center"}},"en":{"stringUnit":{"state":"translated","value":"Center"}},"es":{"stringUnit":{"state":"needs_review","value":"Center"}},"fr":{"stringUnit":{"state":"needs_review","value":"Center"}},"it":{"stringUnit":{"state":"needs_review","value":"Center"}},"ja":{"stringUnit":{"state":"translated","value":"中央"}},"km":{"stringUnit":{"state":"needs_review","value":"Center"}},"ko":{"stringUnit":{"state":"needs_review","value":"Center"}},"nb":{"stringUnit":{"state":"needs_review","value":"Center"}},"pl":{"stringUnit":{"state":"needs_review","value":"Center"}},"pt-BR":{"stringUnit":{"state":"needs_review","value":"Center"}},"ru":{"stringUnit":{"state":"needs_review","value":"Center"}},"th":{"stringUnit":{"state":"needs_review","value":"Center"}},"tr":{"stringUnit":{"state":"needs_review","value":"Center"}},"uk":{"stringUnit":{"state":"needs_review","value":"Center"}},"zh-Hans":{"stringUnit":{"state":"needs_review","value":"Center"}},"zh-Hant":{"stringUnit":{"state":"needs_review","value":"Center"}}}}, + "settings.quickTerminal.position.left": {"extractionState":"manual","localizations":{"ar":{"stringUnit":{"state":"needs_review","value":"Left"}},"bs":{"stringUnit":{"state":"needs_review","value":"Left"}},"da":{"stringUnit":{"state":"needs_review","value":"Left"}},"de":{"stringUnit":{"state":"needs_review","value":"Left"}},"en":{"stringUnit":{"state":"translated","value":"Left"}},"es":{"stringUnit":{"state":"needs_review","value":"Left"}},"fr":{"stringUnit":{"state":"needs_review","value":"Left"}},"it":{"stringUnit":{"state":"needs_review","value":"Left"}},"ja":{"stringUnit":{"state":"translated","value":"左"}},"km":{"stringUnit":{"state":"needs_review","value":"Left"}},"ko":{"stringUnit":{"state":"needs_review","value":"Left"}},"nb":{"stringUnit":{"state":"needs_review","value":"Left"}},"pl":{"stringUnit":{"state":"needs_review","value":"Left"}},"pt-BR":{"stringUnit":{"state":"needs_review","value":"Left"}},"ru":{"stringUnit":{"state":"needs_review","value":"Left"}},"th":{"stringUnit":{"state":"needs_review","value":"Left"}},"tr":{"stringUnit":{"state":"needs_review","value":"Left"}},"uk":{"stringUnit":{"state":"needs_review","value":"Left"}},"zh-Hans":{"stringUnit":{"state":"needs_review","value":"Left"}},"zh-Hant":{"stringUnit":{"state":"needs_review","value":"Left"}}}}, + "settings.quickTerminal.position.right": {"extractionState":"manual","localizations":{"ar":{"stringUnit":{"state":"needs_review","value":"Right"}},"bs":{"stringUnit":{"state":"needs_review","value":"Right"}},"da":{"stringUnit":{"state":"needs_review","value":"Right"}},"de":{"stringUnit":{"state":"needs_review","value":"Right"}},"en":{"stringUnit":{"state":"translated","value":"Right"}},"es":{"stringUnit":{"state":"needs_review","value":"Right"}},"fr":{"stringUnit":{"state":"needs_review","value":"Right"}},"it":{"stringUnit":{"state":"needs_review","value":"Right"}},"ja":{"stringUnit":{"state":"translated","value":"右"}},"km":{"stringUnit":{"state":"needs_review","value":"Right"}},"ko":{"stringUnit":{"state":"needs_review","value":"Right"}},"nb":{"stringUnit":{"state":"needs_review","value":"Right"}},"pl":{"stringUnit":{"state":"needs_review","value":"Right"}},"pt-BR":{"stringUnit":{"state":"needs_review","value":"Right"}},"ru":{"stringUnit":{"state":"needs_review","value":"Right"}},"th":{"stringUnit":{"state":"needs_review","value":"Right"}},"tr":{"stringUnit":{"state":"needs_review","value":"Right"}},"uk":{"stringUnit":{"state":"needs_review","value":"Right"}},"zh-Hans":{"stringUnit":{"state":"needs_review","value":"Right"}},"zh-Hant":{"stringUnit":{"state":"needs_review","value":"Right"}}}}, + "settings.quickTerminal.position.subtitle": {"extractionState":"manual","localizations":{"ar":{"stringUnit":{"state":"needs_review","value":"Choose where the quick terminal slides in."}},"bs":{"stringUnit":{"state":"needs_review","value":"Choose where the quick terminal slides in."}},"da":{"stringUnit":{"state":"needs_review","value":"Choose where the quick terminal slides in."}},"de":{"stringUnit":{"state":"needs_review","value":"Choose where the quick terminal slides in."}},"en":{"stringUnit":{"state":"translated","value":"Choose where the quick terminal slides in."}},"es":{"stringUnit":{"state":"needs_review","value":"Choose where the quick terminal slides in."}},"fr":{"stringUnit":{"state":"needs_review","value":"Choose where the quick terminal slides in."}},"it":{"stringUnit":{"state":"needs_review","value":"Choose where the quick terminal slides in."}},"ja":{"stringUnit":{"state":"translated","value":"クイックターミナルがスライドインする位置を選びます。"}},"km":{"stringUnit":{"state":"needs_review","value":"Choose where the quick terminal slides in."}},"ko":{"stringUnit":{"state":"needs_review","value":"Choose where the quick terminal slides in."}},"nb":{"stringUnit":{"state":"needs_review","value":"Choose where the quick terminal slides in."}},"pl":{"stringUnit":{"state":"needs_review","value":"Choose where the quick terminal slides in."}},"pt-BR":{"stringUnit":{"state":"needs_review","value":"Choose where the quick terminal slides in."}},"ru":{"stringUnit":{"state":"needs_review","value":"Choose where the quick terminal slides in."}},"th":{"stringUnit":{"state":"needs_review","value":"Choose where the quick terminal slides in."}},"tr":{"stringUnit":{"state":"needs_review","value":"Choose where the quick terminal slides in."}},"uk":{"stringUnit":{"state":"needs_review","value":"Choose where the quick terminal slides in."}},"zh-Hans":{"stringUnit":{"state":"needs_review","value":"Choose where the quick terminal slides in."}},"zh-Hant":{"stringUnit":{"state":"needs_review","value":"Choose where the quick terminal slides in."}}}}, + "settings.quickTerminal.position.top": {"extractionState":"manual","localizations":{"ar":{"stringUnit":{"state":"needs_review","value":"Top"}},"bs":{"stringUnit":{"state":"needs_review","value":"Top"}},"da":{"stringUnit":{"state":"needs_review","value":"Top"}},"de":{"stringUnit":{"state":"needs_review","value":"Top"}},"en":{"stringUnit":{"state":"translated","value":"Top"}},"es":{"stringUnit":{"state":"needs_review","value":"Top"}},"fr":{"stringUnit":{"state":"needs_review","value":"Top"}},"it":{"stringUnit":{"state":"needs_review","value":"Top"}},"ja":{"stringUnit":{"state":"translated","value":"上"}},"km":{"stringUnit":{"state":"needs_review","value":"Top"}},"ko":{"stringUnit":{"state":"needs_review","value":"Top"}},"nb":{"stringUnit":{"state":"needs_review","value":"Top"}},"pl":{"stringUnit":{"state":"needs_review","value":"Top"}},"pt-BR":{"stringUnit":{"state":"needs_review","value":"Top"}},"ru":{"stringUnit":{"state":"needs_review","value":"Top"}},"th":{"stringUnit":{"state":"needs_review","value":"Top"}},"tr":{"stringUnit":{"state":"needs_review","value":"Top"}},"uk":{"stringUnit":{"state":"needs_review","value":"Top"}},"zh-Hans":{"stringUnit":{"state":"needs_review","value":"Top"}},"zh-Hant":{"stringUnit":{"state":"needs_review","value":"Top"}}}}, + "settings.quickTerminal.primarySize": {"extractionState":"manual","localizations":{"ar":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Primary Size"}},"bs":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Primary Size"}},"da":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Primary Size"}},"de":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Primary Size"}},"en":{"stringUnit":{"state":"translated","value":"Quick Terminal Primary Size"}},"es":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Primary Size"}},"fr":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Primary Size"}},"it":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Primary Size"}},"ja":{"stringUnit":{"state":"translated","value":"クイックターミナルの主サイズ"}},"km":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Primary Size"}},"ko":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Primary Size"}},"nb":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Primary Size"}},"pl":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Primary Size"}},"pt-BR":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Primary Size"}},"ru":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Primary Size"}},"th":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Primary Size"}},"tr":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Primary Size"}},"uk":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Primary Size"}},"zh-Hans":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Primary Size"}},"zh-Hant":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Primary Size"}}}}, + "settings.quickTerminal.primarySize.subtitle": {"extractionState":"manual","localizations":{"ar":{"stringUnit":{"state":"needs_review","value":"Size along the slide-in axis."}},"bs":{"stringUnit":{"state":"needs_review","value":"Size along the slide-in axis."}},"da":{"stringUnit":{"state":"needs_review","value":"Size along the slide-in axis."}},"de":{"stringUnit":{"state":"needs_review","value":"Size along the slide-in axis."}},"en":{"stringUnit":{"state":"translated","value":"Size along the slide-in axis."}},"es":{"stringUnit":{"state":"needs_review","value":"Size along the slide-in axis."}},"fr":{"stringUnit":{"state":"needs_review","value":"Size along the slide-in axis."}},"it":{"stringUnit":{"state":"needs_review","value":"Size along the slide-in axis."}},"ja":{"stringUnit":{"state":"translated","value":"スライドイン方向のサイズです。"}},"km":{"stringUnit":{"state":"needs_review","value":"Size along the slide-in axis."}},"ko":{"stringUnit":{"state":"needs_review","value":"Size along the slide-in axis."}},"nb":{"stringUnit":{"state":"needs_review","value":"Size along the slide-in axis."}},"pl":{"stringUnit":{"state":"needs_review","value":"Size along the slide-in axis."}},"pt-BR":{"stringUnit":{"state":"needs_review","value":"Size along the slide-in axis."}},"ru":{"stringUnit":{"state":"needs_review","value":"Size along the slide-in axis."}},"th":{"stringUnit":{"state":"needs_review","value":"Size along the slide-in axis."}},"tr":{"stringUnit":{"state":"needs_review","value":"Size along the slide-in axis."}},"uk":{"stringUnit":{"state":"needs_review","value":"Size along the slide-in axis."}},"zh-Hans":{"stringUnit":{"state":"needs_review","value":"Size along the slide-in axis."}},"zh-Hant":{"stringUnit":{"state":"needs_review","value":"Size along the slide-in axis."}}}}, + "settings.quickTerminal.secondarySize": {"extractionState":"manual","localizations":{"ar":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Secondary Size"}},"bs":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Secondary Size"}},"da":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Secondary Size"}},"de":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Secondary Size"}},"en":{"stringUnit":{"state":"translated","value":"Quick Terminal Secondary Size"}},"es":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Secondary Size"}},"fr":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Secondary Size"}},"it":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Secondary Size"}},"ja":{"stringUnit":{"state":"translated","value":"クイックターミナルの副サイズ"}},"km":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Secondary Size"}},"ko":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Secondary Size"}},"nb":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Secondary Size"}},"pl":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Secondary Size"}},"pt-BR":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Secondary Size"}},"ru":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Secondary Size"}},"th":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Secondary Size"}},"tr":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Secondary Size"}},"uk":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Secondary Size"}},"zh-Hans":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Secondary Size"}},"zh-Hant":{"stringUnit":{"state":"needs_review","value":"Quick Terminal Secondary Size"}}}}, + "settings.quickTerminal.secondarySize.subtitle": {"extractionState":"manual","localizations":{"ar":{"stringUnit":{"state":"needs_review","value":"Size across the opposite axis."}},"bs":{"stringUnit":{"state":"needs_review","value":"Size across the opposite axis."}},"da":{"stringUnit":{"state":"needs_review","value":"Size across the opposite axis."}},"de":{"stringUnit":{"state":"needs_review","value":"Size across the opposite axis."}},"en":{"stringUnit":{"state":"translated","value":"Size across the opposite axis."}},"es":{"stringUnit":{"state":"needs_review","value":"Size across the opposite axis."}},"fr":{"stringUnit":{"state":"needs_review","value":"Size across the opposite axis."}},"it":{"stringUnit":{"state":"needs_review","value":"Size across the opposite axis."}},"ja":{"stringUnit":{"state":"translated","value":"反対方向のサイズです。"}},"km":{"stringUnit":{"state":"needs_review","value":"Size across the opposite axis."}},"ko":{"stringUnit":{"state":"needs_review","value":"Size across the opposite axis."}},"nb":{"stringUnit":{"state":"needs_review","value":"Size across the opposite axis."}},"pl":{"stringUnit":{"state":"needs_review","value":"Size across the opposite axis."}},"pt-BR":{"stringUnit":{"state":"needs_review","value":"Size across the opposite axis."}},"ru":{"stringUnit":{"state":"needs_review","value":"Size across the opposite axis."}},"th":{"stringUnit":{"state":"needs_review","value":"Size across the opposite axis."}},"tr":{"stringUnit":{"state":"needs_review","value":"Size across the opposite axis."}},"uk":{"stringUnit":{"state":"needs_review","value":"Size across the opposite axis."}},"zh-Hans":{"stringUnit":{"state":"needs_review","value":"Size across the opposite axis."}},"zh-Hant":{"stringUnit":{"state":"needs_review","value":"Size across the opposite axis."}}}}, + "shortcut.toggleQuickTerminal.label": {"extractionState":"manual","localizations":{"ar":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"bs":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"da":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"de":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"en":{"stringUnit":{"state":"translated","value":"Toggle Quick Terminal"}},"es":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"fr":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"it":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"ja":{"stringUnit":{"state":"translated","value":"クイックターミナルを切り替え"}},"km":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"ko":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"nb":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"pl":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"pt-BR":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"ru":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"th":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"tr":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"uk":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"zh-Hans":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}},"zh-Hant":{"stringUnit":{"state":"needs_review","value":"Toggle Quick Terminal"}}}}, "settings.terminal.textBoxMaxLines": {"extractionState":"manual","localizations":{"ar":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"bs":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"da":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"de":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"en":{"stringUnit":{"state":"translated","value":"TextBox Max Lines"}},"es":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"fr":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"it":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"ja":{"stringUnit":{"state":"translated","value":"TextBox の最大行数"}},"km":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"ko":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"nb":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"pl":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"pt-BR":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"ru":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"th":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"tr":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"uk":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"zh-Hans":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}},"zh-Hant":{"stringUnit":{"state":"needs_review","value":"TextBox Max Lines"}}}}, "settings.terminal.textBoxMaxLines.subtitle": {"extractionState":"manual","localizations":{"ar":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"bs":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"da":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"de":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"en":{"stringUnit":{"state":"translated","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"es":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"fr":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"it":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"ja":{"stringUnit":{"state":"translated","value":"リッチなターミナル入力欄がスクロールする前に広がれる最大の高さを制限します。"}},"km":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"ko":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"nb":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"pl":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"pt-BR":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"ru":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"th":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"tr":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"uk":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"zh-Hans":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}},"zh-Hant":{"stringUnit":{"state":"needs_review","value":"Limits how tall the rich terminal input can grow before it scrolls."}}}}, "command.terminalToggleTextBoxInput.title": {"extractionState":"manual","localizations":{"ar":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"bs":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"da":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"de":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"en":{"stringUnit":{"state":"translated","value":"Toggle TextBox Input"}},"es":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"fr":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"it":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"ja":{"stringUnit":{"state":"translated","value":"TextBox入力を切り替え"}},"km":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"ko":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"nb":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"pl":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"pt-BR":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"ru":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"th":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"tr":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"uk":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"zh-Hans":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}},"zh-Hant":{"stringUnit":{"state":"needs_review","value":"Toggle TextBox Input"}}}}, diff --git a/Sources/AppDelegate.swift b/Sources/AppDelegate.swift index 89b37f6051fc..0b6a5e0abe60 100644 --- a/Sources/AppDelegate.swift +++ b/Sources/AppDelegate.swift @@ -9,7 +9,6 @@ import WebKit import Combine import ObjectiveC.runtime import Darwin -import QuartzCore func cmuxJavaScriptStringLiteral(_ value: String?) -> String? { guard let value else { return nil } @@ -60,454 +59,6 @@ private func runMultiWindowRouteCLI( ) } -enum QuickTerminalSettings { - static let positionKey = "quickTerminal.position" - static let primarySizeRatioKey = "quickTerminal.primarySizeRatio" - static let secondarySizeRatioKey = "quickTerminal.secondarySizeRatio" - static let autoHideKey = "quickTerminal.autoHide" - - static let defaultPosition: QuickTerminalPosition = .top - static let defaultPrimarySizeRatio: Double = 0.38 - static let defaultSecondarySizeRatio: Double = 1.0 - static let defaultAutoHide = true - static let defaultAnimationDuration: TimeInterval = 0.16 - - static func resolved(defaults: UserDefaults = .standard) -> QuickTerminalResolvedSettings { - let rawPosition = defaults.string(forKey: positionKey) - let position = QuickTerminalPosition(rawValue: rawPosition ?? "") ?? defaultPosition - - let rawPrimary = defaults.double(forKey: primarySizeRatioKey) - let primarySizeRatio = clampRatio( - defaults.object(forKey: primarySizeRatioKey) == nil ? defaultPrimarySizeRatio : rawPrimary - ) - - let rawSecondary = defaults.double(forKey: secondarySizeRatioKey) - let secondarySizeRatio = clampRatio( - defaults.object(forKey: secondarySizeRatioKey) == nil ? defaultSecondarySizeRatio : rawSecondary - ) - - let autoHide = defaults.object(forKey: autoHideKey) == nil - ? defaultAutoHide - : defaults.bool(forKey: autoHideKey) - - return QuickTerminalResolvedSettings( - position: position, - primarySizeRatio: primarySizeRatio, - secondarySizeRatio: secondarySizeRatio, - autoHide: autoHide, - animationDuration: defaultAnimationDuration - ) - } - - static func clampRatio(_ value: Double) -> Double { - min(max(value, 0.2), 1.0) - } -} - -struct QuickTerminalResolvedSettings { - let position: QuickTerminalPosition - let primarySizeRatio: Double - let secondarySizeRatio: Double - let autoHide: Bool - let animationDuration: TimeInterval -} - -enum QuickTerminalPosition: String, CaseIterable, Identifiable { - case top - case bottom - case left - case right - case center - - var id: String { rawValue } - - func finalFrame( - in visibleFrame: NSRect, - primarySizeRatio: Double, - secondarySizeRatio: Double - ) -> NSRect { - let primary = CGFloat(QuickTerminalSettings.clampRatio(primarySizeRatio)) - let secondary = CGFloat(QuickTerminalSettings.clampRatio(secondarySizeRatio)) - let minWidth: CGFloat = 420 - let minHeight: CGFloat = 200 - - let size: NSSize = { - switch self { - case .top, .bottom: - return NSSize( - width: max(minWidth, visibleFrame.width * secondary), - height: max(minHeight, visibleFrame.height * primary) - ) - case .left, .right: - return NSSize( - width: max(minWidth, visibleFrame.width * primary), - height: max(minHeight, visibleFrame.height * secondary) - ) - case .center: - return NSSize( - width: max(minWidth, visibleFrame.width * primary), - height: max(minHeight, visibleFrame.height * secondary) - ) - } - }() - - let clamped = NSSize( - width: min(size.width, visibleFrame.width), - height: min(size.height, visibleFrame.height) - ) - - switch self { - case .top: - return NSRect( - x: round(visibleFrame.midX - clamped.width / 2), - y: visibleFrame.maxY - clamped.height, - width: clamped.width, - height: clamped.height - ) - case .bottom: - return NSRect( - x: round(visibleFrame.midX - clamped.width / 2), - y: visibleFrame.minY, - width: clamped.width, - height: clamped.height - ) - case .left: - return NSRect( - x: visibleFrame.minX, - y: round(visibleFrame.midY - clamped.height / 2), - width: clamped.width, - height: clamped.height - ) - case .right: - return NSRect( - x: visibleFrame.maxX - clamped.width, - y: round(visibleFrame.midY - clamped.height / 2), - width: clamped.width, - height: clamped.height - ) - case .center: - return NSRect( - x: round(visibleFrame.midX - clamped.width / 2), - y: round(visibleFrame.midY - clamped.height / 2), - width: clamped.width, - height: clamped.height - ) - } - } - - func hiddenFrame(from finalFrame: NSRect, visibleFrame: NSRect) -> NSRect { - switch self { - case .top: - return NSRect( - x: finalFrame.origin.x, - y: visibleFrame.maxY, - width: finalFrame.width, - height: finalFrame.height - ) - case .bottom: - return NSRect( - x: finalFrame.origin.x, - y: visibleFrame.minY - finalFrame.height, - width: finalFrame.width, - height: finalFrame.height - ) - case .left: - return NSRect( - x: visibleFrame.minX - finalFrame.width, - y: finalFrame.origin.y, - width: finalFrame.width, - height: finalFrame.height - ) - case .right: - return NSRect( - x: visibleFrame.maxX, - y: finalFrame.origin.y, - width: finalFrame.width, - height: finalFrame.height - ) - case .center: - return NSRect( - x: finalFrame.origin.x, - y: visibleFrame.maxY + 18, - width: finalFrame.width, - height: finalFrame.height - ) - } - } -} - -private final class QuickTerminalPanel: NSPanel { - override var canBecomeKey: Bool { true } - override var canBecomeMain: Bool { true } -} - -@MainActor -private final class QuickTerminalController: NSObject, NSWindowDelegate { - private enum VisibilityPhase { - case hidden - case showing - case visible - case hiding - - var reportsVisible: Bool { - switch self { - case .showing, .visible: - return true - case .hiding, .hidden: - return false - } - } - - var isTransitioning: Bool { - switch self { - case .showing, .hiding: - return true - case .visible, .hidden: - return false - } - } - } - - private enum PendingTransitionAction { - case show(activateApp: Bool) - case hide(restorePreviousApp: Bool) - } - - private var panel: QuickTerminalPanel? - private var terminalSurface: TerminalSurface? - private var previousFrontmostApp: NSRunningApplication? - private let workspaceId = UUID() - private var phase: VisibilityPhase = .hidden - private var pendingTransitionAction: PendingTransitionAction? - - private var isVisible: Bool { phase.reportsVisible } - - func toggle(activateApp: Bool = true) { - if isVisible { - hide(restorePreviousApp: activateApp) - } else { - show(activateApp: activateApp) - } - } - - func show(activateApp: Bool = true) { - if phase.isTransitioning { - pendingTransitionAction = .show(activateApp: activateApp) - return - } - guard !isVisible else { return } - - let settings = QuickTerminalSettings.resolved() - guard let panel = ensurePanel() else { return } - let visibleFrame = screen(for: panel).visibleFrame - let finalFrame = settings.position.finalFrame( - in: visibleFrame, - primarySizeRatio: settings.primarySizeRatio, - secondarySizeRatio: settings.secondarySizeRatio - ) - let hiddenFrame = settings.position.hiddenFrame(from: finalFrame, visibleFrame: visibleFrame) - - if activateApp, - !NSApp.isActive, - let frontmost = NSWorkspace.shared.frontmostApplication, - frontmost.bundleIdentifier != Bundle.main.bundleIdentifier { - previousFrontmostApp = frontmost - } - - phase = .showing - panel.alphaValue = 0 - panel.setFrame(hiddenFrame, display: false) - panel.level = .popUpMenu - if activateApp { - panel.orderFrontRegardless() - panel.makeKeyAndOrderFront(nil) - } else { - panel.orderFront(nil) - } - - terminalSurface?.hostedView.setVisibleInUI(true) - terminalSurface?.hostedView.setActive(activateApp) - - if activateApp, !NSApp.isActive { - NSApp.activate(ignoringOtherApps: true) - } - - NSAnimationContext.runAnimationGroup { context in - context.duration = settings.animationDuration - context.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut) - panel.animator().alphaValue = 1 - panel.animator().setFrame(finalFrame, display: true) - } completionHandler: { [weak self] in - Task { @MainActor [weak self] in - guard let self else { return } - self.phase = .visible - panel.level = .floating - if activateApp { - panel.makeKeyAndOrderFront(nil) - panel.makeFirstResponder(self.terminalSurface?.hostedView) - self.terminalSurface?.hostedView.setActive(true) - self.terminalSurface?.hostedView.moveFocus() - } else { - panel.orderFront(nil) - self.terminalSurface?.hostedView.setActive(false) - } - self.replayPendingTransitionActionIfNeeded() - } - } - } - - func hide(restorePreviousApp: Bool) { - if phase.isTransitioning { - pendingTransitionAction = .hide(restorePreviousApp: restorePreviousApp) - return - } - guard isVisible else { return } - - let settings = QuickTerminalSettings.resolved() - guard let panel else { - phase = .hidden - previousFrontmostApp = nil - return - } - - let visibleFrame = screen(for: panel).visibleFrame - let hiddenFrame = settings.position.hiddenFrame(from: panel.frame, visibleFrame: visibleFrame) - - phase = .hiding - - NSAnimationContext.runAnimationGroup { context in - context.duration = settings.animationDuration - context.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut) - panel.animator().alphaValue = 0 - panel.animator().setFrame(hiddenFrame, display: false) - } completionHandler: { [weak self] in - Task { @MainActor [weak self] in - guard let self else { return } - self.phase = .hidden - panel.orderOut(nil) - self.terminalSurface?.hostedView.setActive(false) - self.terminalSurface?.hostedView.setVisibleInUI(false) - if restorePreviousApp, - let previousFrontmostApp = self.previousFrontmostApp, - !previousFrontmostApp.isTerminated { - _ = previousFrontmostApp.activate(options: []) - } - self.previousFrontmostApp = nil - self.replayPendingTransitionActionIfNeeded() - } - } - } - - func statusPayload() -> [String: Any] { - let settings = QuickTerminalSettings.resolved() - return [ - "available": true, - "visible": isVisible, - "position": settings.position.rawValue, - "auto_hide": settings.autoHide, - "primary_size_ratio": settings.primarySizeRatio, - "secondary_size_ratio": settings.secondarySizeRatio - ] - } - - func teardown() { - panel?.orderOut(nil) - terminalSurface?.hostedView.setActive(false) - terminalSurface?.hostedView.setVisibleInUI(false) - panel = nil - terminalSurface = nil - phase = .hidden - previousFrontmostApp = nil - pendingTransitionAction = nil - } - - func windowDidResignKey(_ notification: Notification) { - let settings = QuickTerminalSettings.resolved() - guard settings.autoHide else { return } - guard isVisible else { return } - guard let panel = notification.object as? NSWindow, panel === self.panel else { return } - guard panel.attachedSheet == nil else { return } - hide(restorePreviousApp: false) - } - - private func replayPendingTransitionActionIfNeeded() { - guard !phase.isTransitioning, let action = pendingTransitionAction else { return } - pendingTransitionAction = nil - switch action { - case .show(let activateApp): - show(activateApp: activateApp) - case .hide(let restorePreviousApp): - hide(restorePreviousApp: restorePreviousApp) - } - } - - private func ensurePanel() -> QuickTerminalPanel? { - if let panel { - return panel - } - - let settings = QuickTerminalSettings.resolved() - let visibleFrame = screen(for: nil).visibleFrame - let initialFrame = settings.position.finalFrame( - in: visibleFrame, - primarySizeRatio: settings.primarySizeRatio, - secondarySizeRatio: settings.secondarySizeRatio - ) - let panel = QuickTerminalPanel( - contentRect: initialFrame, - styleMask: [.borderless, .resizable, .nonactivatingPanel], - backing: .buffered, - defer: false - ) - panel.identifier = NSUserInterfaceItemIdentifier("cmux.quick-terminal") - panel.title = String(localized: "quickTerminal.window.title", defaultValue: "Quick Terminal") - panel.titleVisibility = .hidden - panel.titlebarAppearsTransparent = true - panel.collectionBehavior = [.moveToActiveSpace, .fullScreenAuxiliary, .ignoresCycle] - panel.isMovableByWindowBackground = true - panel.hidesOnDeactivate = false - panel.isReleasedWhenClosed = false - panel.level = .floating - panel.delegate = self - - if terminalSurface == nil { - terminalSurface = TerminalSurface( - tabId: workspaceId, - context: GHOSTTY_SURFACE_CONTEXT_WINDOW, - configTemplate: nil, - initialEnvironmentOverrides: ["CMUX_QUICK_TERMINAL": "1"] - ) - } - - if let terminalSurface { - terminalSurface.hostedView.frame = NSRect(origin: .zero, size: initialFrame.size) - terminalSurface.hostedView.autoresizingMask = [.width, .height] - terminalSurface.hostedView.setVisibleInUI(false) - terminalSurface.hostedView.setActive(false) - panel.contentView = terminalSurface.hostedView - } - - self.panel = panel - return panel - } - - private func screen(for panel: NSWindow?) -> NSScreen { - if let panel, let panelScreen = panel.screen { - return panelScreen - } - if let keyScreen = NSApp.keyWindow?.screen { - return keyScreen - } - if let main = NSScreen.main { - return main - } - if let first = NSScreen.screens.first { - return first - } - preconditionFailure("No available NSScreen for quick terminal") - } -} - /// Caches `AXWindows` responses so repeated AX polls can reuse the same /// snapshot while the app window graph is unchanged. Only `.windows` is /// cached; `.children` and `.visibleChildren` fall through to AppKit so the diff --git a/Sources/QuickTerminalController.swift b/Sources/QuickTerminalController.swift new file mode 100644 index 000000000000..f475362651c9 --- /dev/null +++ b/Sources/QuickTerminalController.swift @@ -0,0 +1,470 @@ +import AppKit +import Foundation +import QuartzCore + +enum QuickTerminalSettings { + static let positionKey = "quickTerminal.position" + static let primarySizeRatioKey = "quickTerminal.primarySizeRatio" + static let secondarySizeRatioKey = "quickTerminal.secondarySizeRatio" + static let autoHideKey = "quickTerminal.autoHide" + + static let defaultPosition: QuickTerminalPosition = .top + static let defaultPrimarySizeRatio: Double = 0.38 + static let defaultSecondarySizeRatio: Double = 1.0 + static let defaultAutoHide = true + static let defaultAnimationDuration: TimeInterval = 0.16 + + static func resolved(defaults: UserDefaults = .standard) -> QuickTerminalResolvedSettings { + let rawPosition = defaults.string(forKey: positionKey) + let position = QuickTerminalPosition(rawValue: rawPosition ?? "") ?? defaultPosition + + let rawPrimary = defaults.double(forKey: primarySizeRatioKey) + let primarySizeRatio = clampRatio( + defaults.object(forKey: primarySizeRatioKey) == nil ? defaultPrimarySizeRatio : rawPrimary + ) + + let rawSecondary = defaults.double(forKey: secondarySizeRatioKey) + let secondarySizeRatio = clampRatio( + defaults.object(forKey: secondarySizeRatioKey) == nil ? defaultSecondarySizeRatio : rawSecondary + ) + + let autoHide = defaults.object(forKey: autoHideKey) == nil + ? defaultAutoHide + : defaults.bool(forKey: autoHideKey) + + return QuickTerminalResolvedSettings( + position: position, + primarySizeRatio: primarySizeRatio, + secondarySizeRatio: secondarySizeRatio, + autoHide: autoHide, + animationDuration: defaultAnimationDuration + ) + } + + static func clampRatio(_ value: Double) -> Double { + min(max(value, 0.2), 1.0) + } +} + +struct QuickTerminalResolvedSettings { + let position: QuickTerminalPosition + let primarySizeRatio: Double + let secondarySizeRatio: Double + let autoHide: Bool + let animationDuration: TimeInterval +} + +enum QuickTerminalPosition: String, CaseIterable, Identifiable { + case top + case bottom + case left + case right + case center + + var id: String { rawValue } + + func finalFrame( + in visibleFrame: NSRect, + primarySizeRatio: Double, + secondarySizeRatio: Double + ) -> NSRect { + let primary = CGFloat(QuickTerminalSettings.clampRatio(primarySizeRatio)) + let secondary = CGFloat(QuickTerminalSettings.clampRatio(secondarySizeRatio)) + let minWidth: CGFloat = 420 + let minHeight: CGFloat = 200 + + let size: NSSize = { + switch self { + case .top, .bottom: + return NSSize( + width: max(minWidth, visibleFrame.width * secondary), + height: max(minHeight, visibleFrame.height * primary) + ) + case .left, .right: + return NSSize( + width: max(minWidth, visibleFrame.width * primary), + height: max(minHeight, visibleFrame.height * secondary) + ) + case .center: + return NSSize( + width: max(minWidth, visibleFrame.width * primary), + height: max(minHeight, visibleFrame.height * secondary) + ) + } + }() + + let clamped = NSSize( + width: min(size.width, visibleFrame.width), + height: min(size.height, visibleFrame.height) + ) + + switch self { + case .top: + return NSRect( + x: round(visibleFrame.midX - clamped.width / 2), + y: visibleFrame.maxY - clamped.height, + width: clamped.width, + height: clamped.height + ) + case .bottom: + return NSRect( + x: round(visibleFrame.midX - clamped.width / 2), + y: visibleFrame.minY, + width: clamped.width, + height: clamped.height + ) + case .left: + return NSRect( + x: visibleFrame.minX, + y: round(visibleFrame.midY - clamped.height / 2), + width: clamped.width, + height: clamped.height + ) + case .right: + return NSRect( + x: visibleFrame.maxX - clamped.width, + y: round(visibleFrame.midY - clamped.height / 2), + width: clamped.width, + height: clamped.height + ) + case .center: + return NSRect( + x: round(visibleFrame.midX - clamped.width / 2), + y: round(visibleFrame.midY - clamped.height / 2), + width: clamped.width, + height: clamped.height + ) + } + } + + func hiddenFrame(from finalFrame: NSRect, visibleFrame: NSRect) -> NSRect { + switch self { + case .top: + return NSRect( + x: finalFrame.origin.x, + y: visibleFrame.maxY, + width: finalFrame.width, + height: finalFrame.height + ) + case .bottom: + return NSRect( + x: finalFrame.origin.x, + y: visibleFrame.minY - finalFrame.height, + width: finalFrame.width, + height: finalFrame.height + ) + case .left: + return NSRect( + x: visibleFrame.minX - finalFrame.width, + y: finalFrame.origin.y, + width: finalFrame.width, + height: finalFrame.height + ) + case .right: + return NSRect( + x: visibleFrame.maxX, + y: finalFrame.origin.y, + width: finalFrame.width, + height: finalFrame.height + ) + case .center: + return NSRect( + x: finalFrame.origin.x, + y: visibleFrame.maxY + 18, + width: finalFrame.width, + height: finalFrame.height + ) + } + } +} + +private final class QuickTerminalPanel: NSPanel { + override var canBecomeKey: Bool { true } + override var canBecomeMain: Bool { true } +} + +@MainActor +final class QuickTerminalController: NSObject, NSWindowDelegate { + private enum VisibilityPhase { + case hidden + case showing + case visible + case hiding + + var reportsVisible: Bool { + switch self { + case .showing, .visible: + return true + case .hiding, .hidden: + return false + } + } + + var canAutoHide: Bool { + switch self { + case .visible: + return true + case .showing, .hiding, .hidden: + return false + } + } + + var isTransitioning: Bool { + switch self { + case .showing, .hiding: + return true + case .visible, .hidden: + return false + } + } + } + + private enum PendingTransitionAction { + case show(activateApp: Bool) + case hide(restorePreviousApp: Bool) + } + + private var panel: QuickTerminalPanel? + private var terminalSurface: TerminalSurface? + private var previousFrontmostApp: NSRunningApplication? + private let workspaceId = UUID() + private var phase: VisibilityPhase = .hidden + private var pendingTransitionAction: PendingTransitionAction? + + private var isVisible: Bool { phase.reportsVisible } + + func toggle(activateApp: Bool = true) { + if isVisible { + hide(restorePreviousApp: activateApp) + } else { + show(activateApp: activateApp) + } + } + + func show(activateApp: Bool = true) { + if phase.isTransitioning { + pendingTransitionAction = .show(activateApp: activateApp) + return + } + guard !isVisible else { return } + + let settings = QuickTerminalSettings.resolved() + guard let panel = ensurePanel(), + let visibleFrame = screen(for: panel)?.visibleFrame else { + return + } + let finalFrame = settings.position.finalFrame( + in: visibleFrame, + primarySizeRatio: settings.primarySizeRatio, + secondarySizeRatio: settings.secondarySizeRatio + ) + let hiddenFrame = settings.position.hiddenFrame(from: finalFrame, visibleFrame: visibleFrame) + + if activateApp, + !NSApp.isActive, + let frontmost = NSWorkspace.shared.frontmostApplication, + frontmost.bundleIdentifier != Bundle.main.bundleIdentifier { + previousFrontmostApp = frontmost + } + + phase = .showing + panel.alphaValue = 0 + panel.setFrame(hiddenFrame, display: false) + panel.level = .popUpMenu + if activateApp { + panel.orderFrontRegardless() + panel.makeKeyAndOrderFront(nil) + } else { + panel.orderFront(nil) + } + + terminalSurface?.hostedView.setVisibleInUI(true) + terminalSurface?.hostedView.setActive(activateApp) + + if activateApp, !NSApp.isActive { + NSApp.activate(ignoringOtherApps: true) + } + + NSAnimationContext.runAnimationGroup { context in + context.duration = settings.animationDuration + context.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut) + panel.animator().alphaValue = 1 + panel.animator().setFrame(finalFrame, display: true) + } completionHandler: { [weak self] in + MainActor.assumeIsolated { + guard let self else { return } + self.phase = .visible + panel.level = .floating + if activateApp { + panel.makeKeyAndOrderFront(nil) + panel.makeFirstResponder(self.terminalSurface?.hostedView) + self.terminalSurface?.hostedView.setActive(true) + self.terminalSurface?.hostedView.moveFocus() + } else { + panel.orderFront(nil) + self.terminalSurface?.hostedView.setActive(false) + } + self.replayPendingTransitionActionIfNeeded() + } + } + } + + func hide(restorePreviousApp: Bool) { + if phase.isTransitioning { + pendingTransitionAction = .hide(restorePreviousApp: restorePreviousApp) + return + } + guard isVisible else { return } + + let settings = QuickTerminalSettings.resolved() + guard let panel else { + phase = .hidden + previousFrontmostApp = nil + return + } + + guard let visibleFrame = screen(for: panel)?.visibleFrame else { + finishHide(panel: panel, restorePreviousApp: restorePreviousApp) + return + } + let hiddenFrame = settings.position.hiddenFrame(from: panel.frame, visibleFrame: visibleFrame) + + phase = .hiding + + NSAnimationContext.runAnimationGroup { context in + context.duration = settings.animationDuration + context.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut) + panel.animator().alphaValue = 0 + panel.animator().setFrame(hiddenFrame, display: false) + } completionHandler: { [weak self] in + MainActor.assumeIsolated { + self?.finishHide(panel: panel, restorePreviousApp: restorePreviousApp) + } + } + } + + func statusPayload() -> [String: Any] { + let settings = QuickTerminalSettings.resolved() + return [ + "available": true, + "visible": isVisible, + "position": settings.position.rawValue, + "auto_hide": settings.autoHide, + "primary_size_ratio": settings.primarySizeRatio, + "secondary_size_ratio": settings.secondarySizeRatio + ] + } + + func teardown() { + panel?.orderOut(nil) + terminalSurface?.hostedView.setActive(false) + terminalSurface?.hostedView.setVisibleInUI(false) + panel = nil + terminalSurface = nil + phase = .hidden + previousFrontmostApp = nil + pendingTransitionAction = nil + } + + func windowDidResignKey(_ notification: Notification) { + let settings = QuickTerminalSettings.resolved() + guard settings.autoHide else { return } + guard phase.canAutoHide else { return } + guard let panel = notification.object as? NSWindow, panel === self.panel else { return } + guard panel.attachedSheet == nil else { return } + hide(restorePreviousApp: false) + } + + private func replayPendingTransitionActionIfNeeded() { + guard !phase.isTransitioning, let action = pendingTransitionAction else { return } + pendingTransitionAction = nil + switch action { + case .show(let activateApp): + show(activateApp: activateApp) + case .hide(let restorePreviousApp): + hide(restorePreviousApp: restorePreviousApp) + } + } + + private func ensurePanel() -> QuickTerminalPanel? { + if let panel { + return panel + } + + let settings = QuickTerminalSettings.resolved() + guard let visibleFrame = screen(for: nil)?.visibleFrame else { + return nil + } + let initialFrame = settings.position.finalFrame( + in: visibleFrame, + primarySizeRatio: settings.primarySizeRatio, + secondarySizeRatio: settings.secondarySizeRatio + ) + let panel = QuickTerminalPanel( + contentRect: initialFrame, + styleMask: [.borderless, .resizable, .nonactivatingPanel], + backing: .buffered, + defer: false + ) + panel.identifier = NSUserInterfaceItemIdentifier("cmux.quick-terminal") + panel.title = String(localized: "quickTerminal.window.title", defaultValue: "Quick Terminal") + panel.titleVisibility = .hidden + panel.titlebarAppearsTransparent = true + panel.collectionBehavior = [.moveToActiveSpace, .fullScreenAuxiliary, .ignoresCycle] + panel.isMovableByWindowBackground = true + panel.hidesOnDeactivate = false + panel.isReleasedWhenClosed = false + panel.level = .floating + panel.delegate = self + + if terminalSurface == nil { + terminalSurface = TerminalSurface( + tabId: workspaceId, + context: GHOSTTY_SURFACE_CONTEXT_WINDOW, + configTemplate: nil, + initialEnvironmentOverrides: ["CMUX_QUICK_TERMINAL": "1"] + ) + } + + if let terminalSurface { + terminalSurface.hostedView.frame = NSRect(origin: .zero, size: initialFrame.size) + terminalSurface.hostedView.autoresizingMask = [.width, .height] + terminalSurface.hostedView.setVisibleInUI(false) + terminalSurface.hostedView.setActive(false) + panel.contentView = terminalSurface.hostedView + } + + self.panel = panel + return panel + } + + private func finishHide(panel: QuickTerminalPanel, restorePreviousApp: Bool) { + phase = .hidden + panel.orderOut(nil) + terminalSurface?.hostedView.setActive(false) + terminalSurface?.hostedView.setVisibleInUI(false) + if restorePreviousApp, + let previousFrontmostApp, + !previousFrontmostApp.isTerminated { + _ = previousFrontmostApp.activate(options: []) + } + previousFrontmostApp = nil + replayPendingTransitionActionIfNeeded() + } + + private func screen(for panel: NSWindow?) -> NSScreen? { + if let panel, let panelScreen = panel.screen { + return panelScreen + } + if let keyScreen = NSApp.keyWindow?.screen { + return keyScreen + } + if let main = NSScreen.main { + return main + } + if let first = NSScreen.screens.first { + return first + } + return nil + } +} diff --git a/cmux.xcodeproj/project.pbxproj b/cmux.xcodeproj/project.pbxproj index abd489cf1b1e..3922b8f9a683 100644 --- a/cmux.xcodeproj/project.pbxproj +++ b/cmux.xcodeproj/project.pbxproj @@ -75,6 +75,7 @@ D36A00010000000000000001 /* AgentHibernationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D36A00010000000000000002 /* AgentHibernationController.swift */; }; D36A00030000000000000001 /* AgentHibernationLifecycleState.swift in Sources */ = {isa = PBXBuildFile; fileRef = D36A00030000000000000002 /* AgentHibernationLifecycleState.swift */; }; D36A00030000000000000003 /* AgentHibernationLifecycleState.swift in Sources */ = {isa = PBXBuildFile; fileRef = D36A00030000000000000002 /* AgentHibernationLifecycleState.swift */; }; + C4327001A1B2C3D4E5F60718 /* QuickTerminalController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4327002A1B2C3D4E5F60718 /* QuickTerminalController.swift */; }; C0DEF0A40000000000000001 /* CmuxConfigContextMenuTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0DEF0A40000000000000002 /* CmuxConfigContextMenuTests.swift */; }; D0B10000A1B2C3D4E5F60001 /* TerminalPaneDropTargetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0B10001A1B2C3D4E5F60001 /* TerminalPaneDropTargetView.swift */; }; D0B10002A1B2C3D4E5F60001 /* BonsplitTabBarPassThrough.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0B10003A1B2C3D4E5F60001 /* BonsplitTabBarPassThrough.swift */; }; @@ -816,6 +817,7 @@ C7A504000000000000000001 /* TaskManagerTypes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TaskManagerTypes.swift; sourceTree = ""; }; C7A505000000000000000001 /* TerminalControllerTopSupport.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TerminalControllerTopSupport.swift; sourceTree = ""; }; A5001090 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + C4327002A1B2C3D4E5F60718 /* QuickTerminalController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuickTerminalController.swift; sourceTree = ""; }; C3873002C3873002C3873002 /* GhosttyCrashBreadcrumb.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GhosttyCrashBreadcrumb.swift; sourceTree = ""; }; C3873004C3873004C3873004 /* GhosttyCrashReportMetadata.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GhosttyCrashReportMetadata.swift; sourceTree = ""; }; C3677002000000000000002 /* CmuxSSHURLRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CmuxSSHURLRequest.swift; sourceTree = ""; }; @@ -1437,6 +1439,7 @@ F4350A130000000000000001 /* AppBundleIconPersistencePolicy.swift */, D1320AA0D1320AA0D1320AA4 /* AppIconDockTilePlugin.swift */, A5001090 /* AppDelegate.swift */, + C4327002A1B2C3D4E5F60718 /* QuickTerminalController.swift */, 3865B0063865B0063865B006 /* AppDelegate+GlobalSearch.swift */, C3873002C3873002C3873002 /* GhosttyCrashBreadcrumb.swift */, C3873004C3873004C3873004 /* GhosttyCrashReportMetadata.swift */, @@ -2213,6 +2216,7 @@ C3873001C3873001C3873001 /* GhosttyCrashBreadcrumb.swift in Sources */, C3873003C3873003C3873003 /* GhosttyCrashReportMetadata.swift in Sources */, A5001093 /* AppDelegate.swift in Sources */, + C4327001A1B2C3D4E5F60718 /* QuickTerminalController.swift in Sources */, C3677002000000000000001 /* CmuxSSHURLRequest.swift in Sources */, C3677004000000000000001 /* AppDelegate+CmuxSSHURL.swift in Sources */, A50016B1A1B2C3D4E5F60718 /* SessionSnapshotDebugBenchmark.swift in Sources */, From 10865c4fdc76f7a59b4927524a3ca63aa87dddf3 Mon Sep 17 00:00:00 2001 From: austinpower1258 Date: Tue, 26 May 2026 14:22:08 -0700 Subject: [PATCH 05/16] fix: harden quick terminal command results --- Sources/AppDelegate.swift | 9 ++--- Sources/QuickTerminalController.swift | 41 +++++++++++++++------- Sources/TabManager+DetachedWorkspace.swift | 3 +- Sources/TabManager.swift | 18 ++++++---- Sources/TerminalController.swift | 6 ++-- 5 files changed, 47 insertions(+), 30 deletions(-) diff --git a/Sources/AppDelegate.swift b/Sources/AppDelegate.swift index 0b6a5e0abe60..fb4bb815f3b3 100644 --- a/Sources/AppDelegate.swift +++ b/Sources/AppDelegate.swift @@ -6019,20 +6019,17 @@ final class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCent @discardableResult func toggleQuickTerminalVisibility(activateApp: Bool = true) -> Bool { - quickTerminalController.toggle(activateApp: activateApp) - return true + return quickTerminalController.toggle(activateApp: activateApp) } @discardableResult func showQuickTerminal(activateApp: Bool = true) -> Bool { - quickTerminalController.show(activateApp: activateApp) - return true + return quickTerminalController.show(activateApp: activateApp) } @discardableResult func hideQuickTerminal(restorePreviousApp: Bool = true) -> Bool { - quickTerminalController.hide(restorePreviousApp: restorePreviousApp) - return true + return quickTerminalController.hide(restorePreviousApp: restorePreviousApp) } func quickTerminalStatusPayload() -> [String: Any] { diff --git a/Sources/QuickTerminalController.swift b/Sources/QuickTerminalController.swift index f475362651c9..172034d60446 100644 --- a/Sources/QuickTerminalController.swift +++ b/Sources/QuickTerminalController.swift @@ -228,30 +228,33 @@ final class QuickTerminalController: NSObject, NSWindowDelegate { private var terminalSurface: TerminalSurface? private var previousFrontmostApp: NSRunningApplication? private let workspaceId = UUID() + private var portOrdinal: Int? private var phase: VisibilityPhase = .hidden private var pendingTransitionAction: PendingTransitionAction? private var isVisible: Bool { phase.reportsVisible } - func toggle(activateApp: Bool = true) { + @discardableResult + func toggle(activateApp: Bool = true) -> Bool { if isVisible { - hide(restorePreviousApp: activateApp) + return hide(restorePreviousApp: activateApp) } else { - show(activateApp: activateApp) + return show(activateApp: activateApp) } } - func show(activateApp: Bool = true) { + @discardableResult + func show(activateApp: Bool = true) -> Bool { if phase.isTransitioning { pendingTransitionAction = .show(activateApp: activateApp) - return + return true } - guard !isVisible else { return } + guard !isVisible else { return true } let settings = QuickTerminalSettings.resolved() guard let panel = ensurePanel(), let visibleFrame = screen(for: panel)?.visibleFrame else { - return + return false } let finalFrame = settings.position.finalFrame( in: visibleFrame, @@ -307,25 +310,27 @@ final class QuickTerminalController: NSObject, NSWindowDelegate { self.replayPendingTransitionActionIfNeeded() } } + return true } - func hide(restorePreviousApp: Bool) { + @discardableResult + func hide(restorePreviousApp: Bool) -> Bool { if phase.isTransitioning { pendingTransitionAction = .hide(restorePreviousApp: restorePreviousApp) - return + return true } - guard isVisible else { return } + guard isVisible else { return true } let settings = QuickTerminalSettings.resolved() guard let panel else { phase = .hidden previousFrontmostApp = nil - return + return false } guard let visibleFrame = screen(for: panel)?.visibleFrame else { finishHide(panel: panel, restorePreviousApp: restorePreviousApp) - return + return true } let hiddenFrame = settings.position.hiddenFrame(from: panel.frame, visibleFrame: visibleFrame) @@ -341,6 +346,7 @@ final class QuickTerminalController: NSObject, NSWindowDelegate { self?.finishHide(panel: panel, restorePreviousApp: restorePreviousApp) } } + return true } func statusPayload() -> [String: Any] { @@ -361,6 +367,7 @@ final class QuickTerminalController: NSObject, NSWindowDelegate { terminalSurface?.hostedView.setVisibleInUI(false) panel = nil terminalSurface = nil + portOrdinal = nil phase = .hidden previousFrontmostApp = nil pendingTransitionAction = nil @@ -422,6 +429,7 @@ final class QuickTerminalController: NSObject, NSWindowDelegate { tabId: workspaceId, context: GHOSTTY_SURFACE_CONTEXT_WINDOW, configTemplate: nil, + portOrdinal: quickTerminalPortOrdinal(), initialEnvironmentOverrides: ["CMUX_QUICK_TERMINAL": "1"] ) } @@ -438,6 +446,15 @@ final class QuickTerminalController: NSObject, NSWindowDelegate { return panel } + private func quickTerminalPortOrdinal() -> Int { + if let portOrdinal { + return portOrdinal + } + let allocatedOrdinal = TabManager.allocatePortOrdinal() + portOrdinal = allocatedOrdinal + return allocatedOrdinal + } + private func finishHide(panel: QuickTerminalPanel, restorePreviousApp: Bool) { phase = .hidden panel.orderOut(nil) diff --git a/Sources/TabManager+DetachedWorkspace.swift b/Sources/TabManager+DetachedWorkspace.swift index 6be416cf4157..7e0a6421b53c 100644 --- a/Sources/TabManager+DetachedWorkspace.swift +++ b/Sources/TabManager+DetachedWorkspace.swift @@ -57,8 +57,7 @@ extension TabManager { snapshot: snapshot, placementOverride: placementOverride ) - let ordinal = Self.nextPortOrdinal - Self.nextPortOrdinal += 1 + let ordinal = Self.allocatePortOrdinal() let newWorkspace = Workspace( title: title ?? detached.title, workingDirectory: normalizedWorkingDirectory(detached.directory) ?? snapshot.preferredWorkingDirectory, diff --git a/Sources/TabManager.swift b/Sources/TabManager.swift index e485a1b7ef7e..ec316973e05d 100644 --- a/Sources/TabManager.swift +++ b/Sources/TabManager.swift @@ -1139,7 +1139,14 @@ class TabManager: ObservableObject { /// Global monotonically increasing counter for CMUX_PORT ordinal assignment. /// Static so port ranges don't overlap across multiple windows (each window has its own TabManager). - static var nextPortOrdinal: Int = 0 + private(set) static var nextPortOrdinal: Int = 0 + + static func allocatePortOrdinal() -> Int { + let ordinal = nextPortOrdinal + nextPortOrdinal += 1 + return ordinal + } + private nonisolated static let initialWorkspaceGitProbeDelays: [TimeInterval] = [0, 0.5, 1.5, 3.0, 6.0, 10.0] private nonisolated static let workspaceGitMetadataFallbackRefreshInterval: TimeInterval = 5 * 60 private nonisolated static let backgroundPollInterval: TimeInterval = 60 @@ -2615,8 +2622,7 @@ class TabManager: ObservableObject { // boots terminal state. The ssh/new-workspace path can otherwise crash while // reading @Published placement state from existing workspaces mid-creation. let insertIndex = newTabInsertIndex(snapshot: snapshot, placementOverride: placementOverride) - let ordinal = Self.nextPortOrdinal - Self.nextPortOrdinal += 1 + let ordinal = Self.allocatePortOrdinal() let newWorkspace = makeWorkspaceForCreation( title: title ?? "Terminal \(nextTabCount)", workingDirectory: workingDirectory, @@ -9953,8 +9959,7 @@ extension TabManager { let workspaceSnapshots = snapshot.workspaces .prefix(SessionPersistencePolicy.maxWorkspacesPerWindow) for workspaceSnapshot in workspaceSnapshots { - let ordinal = Self.nextPortOrdinal - Self.nextPortOrdinal += 1 + let ordinal = Self.allocatePortOrdinal() let workspace = Workspace( title: workspaceSnapshot.processTitle, workingDirectory: workspaceSnapshot.currentDirectory, @@ -9968,8 +9973,7 @@ extension TabManager { } if newTabs.isEmpty { - let ordinal = Self.nextPortOrdinal - Self.nextPortOrdinal += 1 + let ordinal = Self.allocatePortOrdinal() let fallback = Workspace(title: "Terminal 1", portOrdinal: ordinal) fallback.owningTabManager = self wireClosedBrowserTracking(for: fallback) diff --git a/Sources/TerminalController.swift b/Sources/TerminalController.swift index 9d410125d766..531181bc9c7e 100644 --- a/Sources/TerminalController.swift +++ b/Sources/TerminalController.swift @@ -11004,7 +11004,7 @@ class TerminalController { didToggle = AppDelegate.shared?.toggleQuickTerminalVisibility(activateApp: false) == true } guard didToggle else { - return .err(code: "unavailable", message: "AppDelegate not available", data: nil) + return .err(code: "unavailable", message: "Quick terminal unavailable", data: nil) } return .ok(v2QuickTerminalStatus()) } @@ -11015,7 +11015,7 @@ class TerminalController { didShow = AppDelegate.shared?.showQuickTerminal(activateApp: false) == true } guard didShow else { - return .err(code: "unavailable", message: "AppDelegate not available", data: nil) + return .err(code: "unavailable", message: "Quick terminal unavailable", data: nil) } return .ok(v2QuickTerminalStatus()) } @@ -11026,7 +11026,7 @@ class TerminalController { didHide = AppDelegate.shared?.hideQuickTerminal(restorePreviousApp: false) == true } guard didHide else { - return .err(code: "unavailable", message: "AppDelegate not available", data: nil) + return .err(code: "unavailable", message: "Quick terminal unavailable", data: nil) } return .ok(v2QuickTerminalStatus()) } From 0b9e4ece65d1a83647289ef9a3070a7ba1c56b40 Mon Sep 17 00:00:00 2001 From: austinpower1258 Date: Tue, 26 May 2026 14:33:08 -0700 Subject: [PATCH 06/16] fix: address quick terminal review follow-ups --- CLI/cmux.swift | 7 +++-- Sources/TerminalController.swift | 36 ++++++++++++++++++------ web/app/[locale]/docs/changelog/page.tsx | 20 +++++++++---- web/data/cmux.schema.json | 4 +++ web/messages/ar.json | 11 ++++++-- web/messages/bs.json | 11 ++++++-- web/messages/da.json | 11 ++++++-- web/messages/de.json | 11 ++++++-- web/messages/en.json | 11 ++++++-- web/messages/es.json | 11 ++++++-- web/messages/fr.json | 11 ++++++-- web/messages/it.json | 11 ++++++-- web/messages/ja.json | 11 ++++++-- web/messages/km.json | 11 ++++++-- web/messages/ko.json | 11 ++++++-- web/messages/no.json | 11 ++++++-- web/messages/pl.json | 11 ++++++-- web/messages/pt-BR.json | 11 ++++++-- web/messages/ru.json | 11 ++++++-- web/messages/th.json | 11 ++++++-- web/messages/tr.json | 11 ++++++-- web/messages/uk.json | 11 ++++++-- web/messages/zh-CN.json | 11 ++++++-- web/messages/zh-TW.json | 11 ++++++-- 24 files changed, 230 insertions(+), 57 deletions(-) diff --git a/CLI/cmux.swift b/CLI/cmux.swift index 9b76a8413816..e96af9926b3d 100644 --- a/CLI/cmux.swift +++ b/CLI/cmux.swift @@ -4764,9 +4764,6 @@ struct CMUXCLI { let normalizedArgs = Array(commandArgs.drop(while: { $0 == "--" })) let subcommand = normalizedArgs.first?.lowercased() ?? "toggle" let remaining = Array(normalizedArgs.dropFirst()).filter { $0 != "--" } - if let unknown = remaining.first { - throw CLIError(message: "quick-terminal \(subcommand): unexpected argument '\(unknown)'") - } let method: String switch subcommand { @@ -4781,6 +4778,10 @@ struct CMUXCLI { default: throw CLIError(message: "quick-terminal requires one of: toggle, show, hide, status") } + if !remaining.isEmpty { + let suffix = remaining.count == 1 ? "" : "s" + throw CLIError(message: "quick-terminal \(subcommand): unexpected \(remaining.count) argument\(suffix)") + } let payload = try client.sendV2(method: method) if jsonOutput { diff --git a/Sources/TerminalController.swift b/Sources/TerminalController.swift index 531181bc9c7e..d214de319d1c 100644 --- a/Sources/TerminalController.swift +++ b/Sources/TerminalController.swift @@ -10999,34 +10999,52 @@ class TerminalController { } private func v2QuickTerminalToggle() -> V2CallResult { - var didToggle = false + var didToggle: Bool? v2MainSync { - didToggle = AppDelegate.shared?.toggleQuickTerminalVisibility(activateApp: false) == true + guard let appDelegate = AppDelegate.shared else { + return + } + didToggle = appDelegate.toggleQuickTerminalVisibility(activateApp: false) + } + guard let didToggle else { + return .err(code: "service_unavailable", message: "Quick terminal service is not available", data: nil) } guard didToggle else { - return .err(code: "unavailable", message: "Quick terminal unavailable", data: nil) + return .err(code: "action_failed", message: "Could not toggle quick terminal", data: nil) } return .ok(v2QuickTerminalStatus()) } private func v2QuickTerminalShow() -> V2CallResult { - var didShow = false + var didShow: Bool? v2MainSync { - didShow = AppDelegate.shared?.showQuickTerminal(activateApp: false) == true + guard let appDelegate = AppDelegate.shared else { + return + } + didShow = appDelegate.showQuickTerminal(activateApp: false) + } + guard let didShow else { + return .err(code: "service_unavailable", message: "Quick terminal service is not available", data: nil) } guard didShow else { - return .err(code: "unavailable", message: "Quick terminal unavailable", data: nil) + return .err(code: "action_failed", message: "Could not show quick terminal", data: nil) } return .ok(v2QuickTerminalStatus()) } private func v2QuickTerminalHide() -> V2CallResult { - var didHide = false + var didHide: Bool? v2MainSync { - didHide = AppDelegate.shared?.hideQuickTerminal(restorePreviousApp: false) == true + guard let appDelegate = AppDelegate.shared else { + return + } + didHide = appDelegate.hideQuickTerminal(restorePreviousApp: false) + } + guard let didHide else { + return .err(code: "service_unavailable", message: "Quick terminal service is not available", data: nil) } guard didHide else { - return .err(code: "unavailable", message: "Quick terminal unavailable", data: nil) + return .err(code: "action_failed", message: "Could not hide quick terminal", data: nil) } return .ok(v2QuickTerminalStatus()) } diff --git a/web/app/[locale]/docs/changelog/page.tsx b/web/app/[locale]/docs/changelog/page.tsx index 3dbae5b3ef23..7fa1ecb80db3 100644 --- a/web/app/[locale]/docs/changelog/page.tsx +++ b/web/app/[locale]/docs/changelog/page.tsx @@ -39,6 +39,13 @@ interface ChangelogVersion { sections: ChangelogSection[]; } +const quickTerminalChangelogItem = + "Quick Terminal panel with a configurable position/size, Option-Command-backtick shortcut, command palette action, and `cmux quick-terminal` CLI controls."; + +const localizedChangelogItems: Record = { + [quickTerminalChangelogItem]: "entries.quickTerminal", +}; + function parseChangelog(markdown: string): ChangelogVersion[] { const versions: ChangelogVersion[] = []; let current: ChangelogVersion | null = null; @@ -321,11 +328,14 @@ export default function ChangelogPage() { )}
    - {section.items.map((item, j) => ( -
  • - -
  • - ))} + {section.items.map((item, j) => { + const localizedKey = localizedChangelogItems[item]; + return ( +
  • + +
  • + ); + })}
); diff --git a/web/data/cmux.schema.json b/web/data/cmux.schema.json index c3b070eeb083..e7702bfb570b 100644 --- a/web/data/cmux.schema.json +++ b/web/data/cmux.schema.json @@ -379,6 +379,7 @@ "type": "string", "enum": ["top", "bottom", "left", "right", "center"], "default": "top", + "descriptionKey": "schemaDescriptions.terminal.quickTerminalPosition", "description": "Screen edge or center position for the floating quick terminal." }, "quickTerminalPrimarySizeRatio": { @@ -386,6 +387,7 @@ "minimum": 0.2, "maximum": 1, "default": 0.38, + "descriptionKey": "schemaDescriptions.terminal.quickTerminalPrimarySizeRatio", "description": "Quick terminal size along its slide-in axis, as a fraction of the visible screen." }, "quickTerminalSecondarySizeRatio": { @@ -393,11 +395,13 @@ "minimum": 0.2, "maximum": 1, "default": 1, + "descriptionKey": "schemaDescriptions.terminal.quickTerminalSecondarySizeRatio", "description": "Quick terminal size across the opposite axis, as a fraction of the visible screen." }, "quickTerminalAutoHide": { "type": "boolean", "default": true, + "descriptionKey": "schemaDescriptions.terminal.quickTerminalAutoHide", "description": "Hide the quick terminal automatically when it loses key focus." }, "resumeCommands": { diff --git a/web/messages/ar.json b/web/messages/ar.json index 578131e964a3..0fb014180d98 100644 --- a/web/messages/ar.json +++ b/web/messages/ar.json @@ -498,7 +498,11 @@ "hideTabCloseButton": "أخفِ أزرار إغلاق التبويبات في شريط تبويبات الجزء." }, "terminal": { - "copyOnSelect": "ينسخ نص الطرفية المحدد إلى حافظة النظام عند تثبيت التحديد، بما في ذلك تحديد الكلمات والأسطر بالنقر المزدوج والثلاثي." + "copyOnSelect": "ينسخ نص الطرفية المحدد إلى حافظة النظام عند تثبيت التحديد، بما في ذلك تحديد الكلمات والأسطر بالنقر المزدوج والثلاثي.", + "quickTerminalPosition": "موضع حافة الشاشة أو الوسط للـ Quick Terminal العائم.", + "quickTerminalPrimarySizeRatio": "حجم Quick Terminal على محور الانزلاق، كنسبة من الشاشة المرئية.", + "quickTerminalSecondarySizeRatio": "حجم Quick Terminal على المحور المقابل، كنسبة من الشاشة المرئية.", + "quickTerminalAutoHide": "إخفاء Quick Terminal تلقائيًا عندما يفقد تركيز لوحة المفاتيح." } } }, @@ -895,7 +899,10 @@ "changelog": { "title": "سجل التغييرات", "metaDescription": "ملاحظات إصدار cmux وسجل الإصدارات. الميزات الجديدة وإصلاحات الأخطاء والتغييرات لطرفية macOS الأصلية.", - "metaTitle": "سجل التغييرات" + "metaTitle": "سجل التغييرات", + "entries": { + "quickTerminal": "لوحة Quick Terminal مع موضع/حجم قابلين للضبط، واختصار Option-Command-backtick، وإجراء في لوحة الأوامر، وعناصر تحكم CLI عبر `cmux quick-terminal`." + } }, "navItems": { "gettingStarted": "البدء", diff --git a/web/messages/bs.json b/web/messages/bs.json index aa6f8411b38c..61a37dfa9ba2 100644 --- a/web/messages/bs.json +++ b/web/messages/bs.json @@ -498,7 +498,11 @@ "hideTabCloseButton": "Sakrij dugmad za zatvaranje tabova na traci tabova okna." }, "terminal": { - "copyOnSelect": "Kopira odabrani tekst iz terminala u sistemski međuspremnik kada se odabir potvrdi, uključujući riječi i redove odabrane dvoklikom ili troklikom." + "copyOnSelect": "Kopira odabrani tekst iz terminala u sistemski međuspremnik kada se odabir potvrdi, uključujući riječi i redove odabrane dvoklikom ili troklikom.", + "quickTerminalPosition": "Položaj na ivici ekrana ili u sredini za plutajući Quick Terminal.", + "quickTerminalPrimarySizeRatio": "Veličina Quick Terminala duž ose uvlačenja, kao udio vidljivog ekrana.", + "quickTerminalSecondarySizeRatio": "Veličina Quick Terminala na suprotnoj osi, kao udio vidljivog ekrana.", + "quickTerminalAutoHide": "Automatski sakrij Quick Terminal kada izgubi fokus tastature." } } }, @@ -895,7 +899,10 @@ "changelog": { "title": "Zapisnik promjena", "metaDescription": "cmux bilješke o izdanjima i historija verzija. Nove funkcionalnosti, ispravke grešaka i promjene za nativni macOS terminal.", - "metaTitle": "Dnevnik promjena" + "metaTitle": "Dnevnik promjena", + "entries": { + "quickTerminal": "Quick Terminal panel s podesivom pozicijom/veličinom, Option-Command-backtick prečicom, akcijom u paleti komandi i `cmux quick-terminal` CLI kontrolama." + } }, "navItems": { "gettingStarted": "Početak rada", diff --git a/web/messages/da.json b/web/messages/da.json index 6c690e6d717e..332e436c0a6d 100644 --- a/web/messages/da.json +++ b/web/messages/da.json @@ -498,7 +498,11 @@ "hideTabCloseButton": "Skjul fanernes luk-knapper i rudens fanelinje." }, "terminal": { - "copyOnSelect": "Kopierer markeret terminaltekst til systemets udklipsholder, når markeringen bekræftes, inklusive ord- og linjemarkeringer fra dobbelt- og tredobbeltklik." + "copyOnSelect": "Kopierer markeret terminaltekst til systemets udklipsholder, når markeringen bekræftes, inklusive ord- og linjemarkeringer fra dobbelt- og tredobbeltklik.", + "quickTerminalPosition": "Skærmkant- eller centerplacering for den flydende Quick Terminal.", + "quickTerminalPrimarySizeRatio": "Quick Terminal-størrelse langs indskydningsaksen som en andel af den synlige skærm.", + "quickTerminalSecondarySizeRatio": "Quick Terminal-størrelse på den modsatte akse som en andel af den synlige skærm.", + "quickTerminalAutoHide": "Skjul automatisk Quick Terminal, når den mister tastaturfokus." } } }, @@ -895,7 +899,10 @@ "changelog": { "title": "Ændringslog", "metaDescription": "cmux udgivelsesnoter og versionshistorik. Nye funktioner, fejlrettelser og ændringer for den native macOS-terminal.", - "metaTitle": "Ændringslog" + "metaTitle": "Ændringslog", + "entries": { + "quickTerminal": "Quick Terminal-panel med konfigurerbar placering/størrelse, Option-Kommando-backtick-genvej, kommandopalet-handling og `cmux quick-terminal` CLI-styring." + } }, "navItems": { "gettingStarted": "Kom i gang", diff --git a/web/messages/de.json b/web/messages/de.json index e5b6a7532b4b..13bdabe57b4a 100644 --- a/web/messages/de.json +++ b/web/messages/de.json @@ -498,7 +498,11 @@ "hideTabCloseButton": "Tab-Schließen-Schaltflächen in der Pane-Tableiste ausblenden." }, "terminal": { - "copyOnSelect": "Kopiert ausgewählten Terminaltext in die Systemzwischenablage, sobald die Auswahl bestätigt wird, einschließlich Wort- und Zeilenauswahl per Doppel- und Dreifachklick." + "copyOnSelect": "Kopiert ausgewählten Terminaltext in die Systemzwischenablage, sobald die Auswahl bestätigt wird, einschließlich Wort- und Zeilenauswahl per Doppel- und Dreifachklick.", + "quickTerminalPosition": "Bildschirmrand- oder Mittenposition für das schwebende Quick Terminal.", + "quickTerminalPrimarySizeRatio": "Größe des Quick Terminals entlang seiner Einschubachse als Anteil des sichtbaren Bildschirms.", + "quickTerminalSecondarySizeRatio": "Größe des Quick Terminals entlang der Gegenachse als Anteil des sichtbaren Bildschirms.", + "quickTerminalAutoHide": "Quick Terminal automatisch ausblenden, wenn es den Tastaturfokus verliert." } } }, @@ -895,7 +899,10 @@ "changelog": { "title": "Changelog", "metaDescription": "cmux Release-Notes und Versionshistorie. Neue Funktionen, Fehlerbehebungen und Änderungen für das native macOS-Terminal.", - "metaTitle": "Änderungsprotokoll" + "metaTitle": "Änderungsprotokoll", + "entries": { + "quickTerminal": "Quick-Terminal-Panel mit konfigurierbarer Position/Größe, Option-Befehl-Backtick-Kurzbefehl, Command-Palette-Aktion und `cmux quick-terminal`-CLI-Steuerung." + } }, "navItems": { "gettingStarted": "Erste Schritte", diff --git a/web/messages/en.json b/web/messages/en.json index 68c31a0a7f36..478bece89de4 100644 --- a/web/messages/en.json +++ b/web/messages/en.json @@ -599,7 +599,11 @@ "hideTabCloseButton": "Hide tab close buttons in the pane tab bar." }, "terminal": { - "copyOnSelect": "Copy selected terminal text to the system clipboard when the selection is committed, including word and line selections from double- and triple-click." + "copyOnSelect": "Copy selected terminal text to the system clipboard when the selection is committed, including word and line selections from double- and triple-click.", + "quickTerminalPosition": "Screen edge or center position for the floating quick terminal.", + "quickTerminalPrimarySizeRatio": "Quick terminal size along its slide-in axis, as a fraction of the visible screen.", + "quickTerminalSecondarySizeRatio": "Quick terminal size across the opposite axis, as a fraction of the visible screen.", + "quickTerminalAutoHide": "Hide the quick terminal automatically when it loses key focus." } } }, @@ -1112,7 +1116,10 @@ "changelog": { "title": "Changelog", "metaTitle": "Changelog", - "metaDescription": "cmux release notes and version history. New features, bug fixes, and changes for the native macOS terminal." + "metaDescription": "cmux release notes and version history. New features, bug fixes, and changes for the native macOS terminal.", + "entries": { + "quickTerminal": "Quick Terminal panel with a configurable position/size, Option-Command-backtick shortcut, command palette action, and `cmux quick-terminal` CLI controls." + } }, "claudeCodeTeams": { "title": "Claude Code Teams", diff --git a/web/messages/es.json b/web/messages/es.json index 618f4d90e87a..29ddc05eb855 100644 --- a/web/messages/es.json +++ b/web/messages/es.json @@ -498,7 +498,11 @@ "hideTabCloseButton": "Ocultar los botones de cerrar pestaña en la barra de pestañas del panel." }, "terminal": { - "copyOnSelect": "Copia el texto seleccionado del terminal al portapapeles del sistema cuando se confirma la selección, incluidas las selecciones de palabras y líneas con doble y triple clic." + "copyOnSelect": "Copia el texto seleccionado del terminal al portapapeles del sistema cuando se confirma la selección, incluidas las selecciones de palabras y líneas con doble y triple clic.", + "quickTerminalPosition": "Posición en el borde de la pantalla o en el centro para el Quick Terminal flotante.", + "quickTerminalPrimarySizeRatio": "Tamaño del Quick Terminal a lo largo de su eje de deslizamiento, como fracción de la pantalla visible.", + "quickTerminalSecondarySizeRatio": "Tamaño del Quick Terminal en el eje opuesto, como fracción de la pantalla visible.", + "quickTerminalAutoHide": "Oculta el Quick Terminal automáticamente cuando pierde el foco de teclado." } } }, @@ -895,7 +899,10 @@ "changelog": { "title": "Changelog", "metaDescription": "Notas de versión e historial de versiones de cmux. Nuevas funciones, correcciones de errores y cambios para la terminal nativa de macOS.", - "metaTitle": "Registro de cambios" + "metaTitle": "Registro de cambios", + "entries": { + "quickTerminal": "Panel Quick Terminal con posición/tamaño configurable, atajo Opción-Comando-acento grave, acción de paleta de comandos y controles CLI `cmux quick-terminal`." + } }, "navItems": { "gettingStarted": "Primeros pasos", diff --git a/web/messages/fr.json b/web/messages/fr.json index 0ae0849f6eb7..a1d47febad21 100644 --- a/web/messages/fr.json +++ b/web/messages/fr.json @@ -498,7 +498,11 @@ "hideTabCloseButton": "Masquer les boutons de fermeture d’onglet dans la barre d’onglets du volet." }, "terminal": { - "copyOnSelect": "Copie le texte sélectionné dans le terminal dans le presse-papiers système lorsque la sélection est validée, y compris les sélections de mots et de lignes par double ou triple clic." + "copyOnSelect": "Copie le texte sélectionné dans le terminal dans le presse-papiers système lorsque la sélection est validée, y compris les sélections de mots et de lignes par double ou triple clic.", + "quickTerminalPosition": "Position au bord de l'écran ou au centre pour le Quick Terminal flottant.", + "quickTerminalPrimarySizeRatio": "Taille du Quick Terminal le long de son axe d'apparition, sous forme de fraction de l'écran visible.", + "quickTerminalSecondarySizeRatio": "Taille du Quick Terminal sur l'axe opposé, sous forme de fraction de l'écran visible.", + "quickTerminalAutoHide": "Masque automatiquement le Quick Terminal lorsqu'il perd le focus clavier." } } }, @@ -895,7 +899,10 @@ "changelog": { "title": "Changelog", "metaDescription": "Notes de version et historique des versions de cmux. Nouvelles fonctionnalités, corrections de bugs et changements pour le terminal macOS natif.", - "metaTitle": "Journal des modifications" + "metaTitle": "Journal des modifications", + "entries": { + "quickTerminal": "Panneau Quick Terminal avec position/taille configurables, raccourci Option-Commande-accent grave, action de palette de commandes et contrôles CLI `cmux quick-terminal`." + } }, "navItems": { "gettingStarted": "Premiers pas", diff --git a/web/messages/it.json b/web/messages/it.json index a67555bf9ddf..59b56d78b116 100644 --- a/web/messages/it.json +++ b/web/messages/it.json @@ -498,7 +498,11 @@ "hideTabCloseButton": "Nasconde i pulsanti di chiusura scheda nella barra delle schede del riquadro." }, "terminal": { - "copyOnSelect": "Copia il testo selezionato nel terminale negli appunti di sistema quando la selezione viene confermata, incluse le selezioni di parole e righe con doppio e triplo clic." + "copyOnSelect": "Copia il testo selezionato nel terminale negli appunti di sistema quando la selezione viene confermata, incluse le selezioni di parole e righe con doppio e triplo clic.", + "quickTerminalPosition": "Posizione sul bordo dello schermo o al centro per il Quick Terminal flottante.", + "quickTerminalPrimarySizeRatio": "Dimensione del Quick Terminal lungo l'asse di scorrimento in entrata, come frazione dello schermo visibile.", + "quickTerminalSecondarySizeRatio": "Dimensione del Quick Terminal sull'asse opposto, come frazione dello schermo visibile.", + "quickTerminalAutoHide": "Nasconde automaticamente il Quick Terminal quando perde il focus della tastiera." } } }, @@ -895,7 +899,10 @@ "changelog": { "title": "Changelog", "metaDescription": "Note di rilascio e cronologia delle versioni di cmux. Nuove funzionalità, correzioni di bug e modifiche per il terminale macOS nativo.", - "metaTitle": "Registro modifiche" + "metaTitle": "Registro modifiche", + "entries": { + "quickTerminal": "Pannello Quick Terminal con posizione/dimensioni configurabili, scorciatoia Opzione-Comando-accento grave, azione nella palette comandi e controlli CLI `cmux quick-terminal`." + } }, "navItems": { "gettingStarted": "Per iniziare", diff --git a/web/messages/ja.json b/web/messages/ja.json index 23eef0390f65..8e87c08ab03e 100644 --- a/web/messages/ja.json +++ b/web/messages/ja.json @@ -558,7 +558,11 @@ "hideTabCloseButton": "ペインのタブバーでタブの閉じるボタンを非表示にします。" }, "terminal": { - "copyOnSelect": "選択が確定したとき、ダブルクリックやトリプルクリックによる単語・行の選択を含め、選択したターミナルテキストをシステムクリップボードへコピーします。" + "copyOnSelect": "選択が確定したとき、ダブルクリックやトリプルクリックによる単語・行の選択を含め、選択したターミナルテキストをシステムクリップボードへコピーします。", + "quickTerminalPosition": "浮動 Quick Terminal の画面端または中央の位置。", + "quickTerminalPrimarySizeRatio": "Quick Terminal がスライドインする軸方向のサイズ(表示中の画面に対する割合)。", + "quickTerminalSecondarySizeRatio": "Quick Terminal の反対軸方向のサイズ(表示中の画面に対する割合)。", + "quickTerminalAutoHide": "キー入力フォーカスを失ったときに Quick Terminal を自動的に隠します。" } } }, @@ -1034,7 +1038,10 @@ "changelog": { "title": "変更履歴", "metaDescription": "cmuxのリリースノートとバージョン履歴。ネイティブmacOSターミナルの新機能、バグ修正、変更点。", - "metaTitle": "変更履歴" + "metaTitle": "変更履歴", + "entries": { + "quickTerminal": "位置とサイズを設定できる Quick Terminal パネル、Option-Command-バッククォートのショートカット、コマンドパレットアクション、`cmux quick-terminal` CLI コントロールを追加しました。" + } }, "claudeCodeTeams": { "title": "Claude Code Teams", diff --git a/web/messages/km.json b/web/messages/km.json index 10e06acb843f..266edc1fafb5 100644 --- a/web/messages/km.json +++ b/web/messages/km.json @@ -498,7 +498,11 @@ "hideTabCloseButton": "លាក់ប៊ូតុងបិទផ្ទាំងនៅក្នុងរបារផ្ទាំងរបស់ផ្ទាំងបង្អួច។" }, "terminal": { - "copyOnSelect": "ចម្លងអត្ថបទ terminal ដែលបានជ្រើសទៅក្ដារតម្រៀបរបស់ប្រព័ន្ធ ពេលការជ្រើសត្រូវបានបញ្ជាក់ រួមទាំងការជ្រើសពាក្យ និងបន្ទាត់ដោយចុចពីរដង និងចុចបីដង។" + "copyOnSelect": "ចម្លងអត្ថបទ terminal ដែលបានជ្រើសទៅក្ដារតម្រៀបរបស់ប្រព័ន្ធ ពេលការជ្រើសត្រូវបានបញ្ជាក់ រួមទាំងការជ្រើសពាក្យ និងបន្ទាត់ដោយចុចពីរដង និងចុចបីដង។", + "quickTerminalPosition": "ទីតាំងនៅគែមអេក្រង់ ឬកណ្ដាល សម្រាប់ Quick Terminal អណ្ដែត។", + "quickTerminalPrimarySizeRatio": "ទំហំ Quick Terminal តាមអ័ក្សរុញចូល ជាសមាមាត្រនៃអេក្រង់ដែលមើលឃើញ។", + "quickTerminalSecondarySizeRatio": "ទំហំ Quick Terminal តាមអ័ក្សផ្ទុយ ជាសមាមាត្រនៃអេក្រង់ដែលមើលឃើញ។", + "quickTerminalAutoHide": "លាក់ Quick Terminal ដោយស្វ័យប្រវត្តិ នៅពេលវាបាត់បង់ focus ក្ដារចុច។" } } }, @@ -895,7 +899,10 @@ "changelog": { "title": "កំណត់ត្រាផ្លាស់ប្ដូរ", "metaDescription": "កំណត់ត្រាការចេញផ្សាយ cmux និងប្រវត្តិកំណែ។ មុខងារថ្មី, ការជួសជុលកំហុស, និងការផ្លាស់ប្ដូរសម្រាប់ទែមីណល macOS ដើម។", - "metaTitle": "កំណត់ហេតុផ្លាស់ប្ដូរ" + "metaTitle": "កំណត់ហេតុផ្លាស់ប្ដូរ", + "entries": { + "quickTerminal": "ផ្ទាំង Quick Terminal ដែលកំណត់ទីតាំង/ទំហំបាន ជាមួយផ្លូវកាត់ Option-Command-backtick សកម្មភាព command palette និងការគ្រប់គ្រង CLI `cmux quick-terminal`។" + } }, "navItems": { "gettingStarted": "ចាប់ផ្ដើម", diff --git a/web/messages/ko.json b/web/messages/ko.json index 5b215d13959d..1a150798dec6 100644 --- a/web/messages/ko.json +++ b/web/messages/ko.json @@ -498,7 +498,11 @@ "hideTabCloseButton": "창 영역 탭 막대에서 탭 닫기 버튼을 숨깁니다." }, "terminal": { - "copyOnSelect": "선택이 확정되면 더블 클릭 및 트리플 클릭으로 선택한 단어와 줄을 포함해 선택한 터미널 텍스트를 시스템 클립보드에 복사합니다." + "copyOnSelect": "선택이 확정되면 더블 클릭 및 트리플 클릭으로 선택한 단어와 줄을 포함해 선택한 터미널 텍스트를 시스템 클립보드에 복사합니다.", + "quickTerminalPosition": "플로팅 Quick Terminal의 화면 가장자리 또는 중앙 위치입니다.", + "quickTerminalPrimarySizeRatio": "Quick Terminal이 슬라이드되어 들어오는 축의 크기이며, 보이는 화면에 대한 비율입니다.", + "quickTerminalSecondarySizeRatio": "Quick Terminal의 반대 축 크기이며, 보이는 화면에 대한 비율입니다.", + "quickTerminalAutoHide": "키 포커스를 잃으면 Quick Terminal을 자동으로 숨깁니다." } } }, @@ -895,7 +899,10 @@ "changelog": { "title": "변경 로그", "metaDescription": "cmux 릴리스 노트 및 버전 히스토리. 네이티브 macOS 터미널의 새로운 기능, 버그 수정, 변경 사항.", - "metaTitle": "변경 내역" + "metaTitle": "변경 내역", + "entries": { + "quickTerminal": "위치와 크기를 설정할 수 있는 Quick Terminal 패널, Option-Command-백틱 단축키, 명령 팔레트 작업, `cmux quick-terminal` CLI 제어를 추가했습니다." + } }, "navItems": { "gettingStarted": "시작하기", diff --git a/web/messages/no.json b/web/messages/no.json index bf8d57ebb30e..7a4194332182 100644 --- a/web/messages/no.json +++ b/web/messages/no.json @@ -498,7 +498,11 @@ "hideTabCloseButton": "Skjul lukkeknapper for faner i faneraden i ruten." }, "terminal": { - "copyOnSelect": "Kopierer markert terminaltekst til systemutklippstavlen når markeringen bekreftes, inkludert ord- og linjemarkeringer fra dobbelt- og trippelklikk." + "copyOnSelect": "Kopierer markert terminaltekst til systemutklippstavlen når markeringen bekreftes, inkludert ord- og linjemarkeringer fra dobbelt- og trippelklikk.", + "quickTerminalPosition": "Skjermkant- eller midtposisjon for den flytende Quick Terminal.", + "quickTerminalPrimarySizeRatio": "Quick Terminal-størrelse langs innskyvingsaksen som en andel av den synlige skjermen.", + "quickTerminalSecondarySizeRatio": "Quick Terminal-størrelse på motsatt akse som en andel av den synlige skjermen.", + "quickTerminalAutoHide": "Skjul Quick Terminal automatisk når den mister tastaturfokus." } } }, @@ -895,7 +899,10 @@ "changelog": { "title": "Endringslogg", "metaDescription": "cmux utgivelsesnotater og versjonshistorikk. Nye funksjoner, feilrettinger og endringer for den native macOS-terminalen.", - "metaTitle": "Endringslogg" + "metaTitle": "Endringslogg", + "entries": { + "quickTerminal": "Quick Terminal-panel med konfigurerbar posisjon/størrelse, Option-Kommando-backtick-snarvei, kommandopalett-handling og `cmux quick-terminal` CLI-kontroller." + } }, "navItems": { "gettingStarted": "Kom i gang", diff --git a/web/messages/pl.json b/web/messages/pl.json index b2a42319f796..7a4788fb9b22 100644 --- a/web/messages/pl.json +++ b/web/messages/pl.json @@ -498,7 +498,11 @@ "hideTabCloseButton": "Ukryj przyciski zamykania kart na pasku kart panelu." }, "terminal": { - "copyOnSelect": "Kopiuje zaznaczony tekst terminala do schowka systemowego po zatwierdzeniu zaznaczenia, w tym zaznaczenia słów i wierszy wykonane dwuklikiem lub potrójnym kliknięciem." + "copyOnSelect": "Kopiuje zaznaczony tekst terminala do schowka systemowego po zatwierdzeniu zaznaczenia, w tym zaznaczenia słów i wierszy wykonane dwuklikiem lub potrójnym kliknięciem.", + "quickTerminalPosition": "Pozycja przy krawędzi ekranu lub na środku dla pływającego Quick Terminal.", + "quickTerminalPrimarySizeRatio": "Rozmiar Quick Terminal wzdłuż osi wysuwania jako ułamek widocznego ekranu.", + "quickTerminalSecondarySizeRatio": "Rozmiar Quick Terminal na przeciwnej osi jako ułamek widocznego ekranu.", + "quickTerminalAutoHide": "Automatycznie ukrywaj Quick Terminal po utracie fokusu klawiatury." } } }, @@ -895,7 +899,10 @@ "changelog": { "title": "Dziennik zmian", "metaDescription": "Notatki wydań i historia wersji cmux. Nowe funkcje, poprawki błędów i zmiany dla natywnego terminala macOS.", - "metaTitle": "Historia zmian" + "metaTitle": "Historia zmian", + "entries": { + "quickTerminal": "Panel Quick Terminal z konfigurowalną pozycją/rozmiarem, skrótem Option-Command-backtick, akcją w palecie poleceń i sterowaniem CLI `cmux quick-terminal`." + } }, "navItems": { "gettingStarted": "Szybki start", diff --git a/web/messages/pt-BR.json b/web/messages/pt-BR.json index 9a75d94c0baf..2e4ce1718ac3 100644 --- a/web/messages/pt-BR.json +++ b/web/messages/pt-BR.json @@ -498,7 +498,11 @@ "hideTabCloseButton": "Ocultar os botões de fechar aba na barra de abas do painel." }, "terminal": { - "copyOnSelect": "Copia o texto selecionado no terminal para a área de transferência do sistema quando a seleção é confirmada, incluindo seleções de palavras e linhas por clique duplo e triplo." + "copyOnSelect": "Copia o texto selecionado no terminal para a área de transferência do sistema quando a seleção é confirmada, incluindo seleções de palavras e linhas por clique duplo e triplo.", + "quickTerminalPosition": "Posição na borda da tela ou no centro para o Quick Terminal flutuante.", + "quickTerminalPrimarySizeRatio": "Tamanho do Quick Terminal ao longo do eixo de entrada, como fração da tela visível.", + "quickTerminalSecondarySizeRatio": "Tamanho do Quick Terminal no eixo oposto, como fração da tela visível.", + "quickTerminalAutoHide": "Oculta automaticamente o Quick Terminal quando ele perde o foco do teclado." } } }, @@ -895,7 +899,10 @@ "changelog": { "title": "Changelog", "metaDescription": "Notas de lançamento e histórico de versões do cmux. Novos recursos, correções de bugs e mudanças para o terminal macOS nativo.", - "metaTitle": "Registro de alterações" + "metaTitle": "Registro de alterações", + "entries": { + "quickTerminal": "Painel Quick Terminal com posição/tamanho configuráveis, atalho Option-Command-acento grave, ação na paleta de comandos e controles CLI `cmux quick-terminal`." + } }, "navItems": { "gettingStarted": "Primeiros Passos", diff --git a/web/messages/ru.json b/web/messages/ru.json index 198082f10d92..99db90de2b99 100644 --- a/web/messages/ru.json +++ b/web/messages/ru.json @@ -498,7 +498,11 @@ "hideTabCloseButton": "Скрывать кнопки закрытия вкладок на панели вкладок области." }, "terminal": { - "copyOnSelect": "Копирует выделенный текст терминала в системный буфер обмена после подтверждения выделения, включая слова и строки, выбранные двойным или тройным щелчком." + "copyOnSelect": "Копирует выделенный текст терминала в системный буфер обмена после подтверждения выделения, включая слова и строки, выбранные двойным или тройным щелчком.", + "quickTerminalPosition": "Положение у края экрана или по центру для плавающего Quick Terminal.", + "quickTerminalPrimarySizeRatio": "Размер Quick Terminal вдоль оси появления как доля видимой области экрана.", + "quickTerminalSecondarySizeRatio": "Размер Quick Terminal по противоположной оси как доля видимой области экрана.", + "quickTerminalAutoHide": "Автоматически скрывать Quick Terminal при потере фокуса клавиатуры." } } }, @@ -895,7 +899,10 @@ "changelog": { "title": "История изменений", "metaDescription": "Заметки о релизах cmux и история версий. Новые функции, исправления ошибок и изменения для нативного macOS-терминала.", - "metaTitle": "Журнал изменений" + "metaTitle": "Журнал изменений", + "entries": { + "quickTerminal": "Панель Quick Terminal с настраиваемыми положением/размером, сочетанием Option-Command-обратная кавычка, действием в палитре команд и управлением CLI `cmux quick-terminal`." + } }, "navItems": { "gettingStarted": "Начало работы", diff --git a/web/messages/th.json b/web/messages/th.json index 87d7f5c9bc4c..bd230367b1da 100644 --- a/web/messages/th.json +++ b/web/messages/th.json @@ -498,7 +498,11 @@ "hideTabCloseButton": "ซ่อนปุ่มปิดแท็บในแถบแท็บของพาเนล" }, "terminal": { - "copyOnSelect": "คัดลอกข้อความเทอร์มินัลที่เลือกไปยังคลิปบอร์ดของระบบเมื่อยืนยันการเลือก รวมถึงการเลือกคำและบรรทัดจากการดับเบิลคลิกและทริปเปิลคลิก" + "copyOnSelect": "คัดลอกข้อความเทอร์มินัลที่เลือกไปยังคลิปบอร์ดของระบบเมื่อยืนยันการเลือก รวมถึงการเลือกคำและบรรทัดจากการดับเบิลคลิกและทริปเปิลคลิก", + "quickTerminalPosition": "ตำแหน่งริมหน้าจอหรือกึ่งกลางสำหรับ Quick Terminal แบบลอย", + "quickTerminalPrimarySizeRatio": "ขนาดของ Quick Terminal ตามแกนที่สไลด์เข้ามา คิดเป็นสัดส่วนของหน้าจอที่มองเห็น", + "quickTerminalSecondarySizeRatio": "ขนาดของ Quick Terminal ตามแกนตรงข้าม คิดเป็นสัดส่วนของหน้าจอที่มองเห็น", + "quickTerminalAutoHide": "ซ่อน Quick Terminal โดยอัตโนมัติเมื่อเสียโฟกัสแป้นพิมพ์" } } }, @@ -895,7 +899,10 @@ "changelog": { "title": "Changelog", "metaDescription": "บันทึกการอัปเดต cmux และประวัติเวอร์ชัน ฟีเจอร์ใหม่, แก้ไขบั๊ก และการเปลี่ยนแปลงสำหรับเทอร์มินัล macOS เนทีฟ", - "metaTitle": "บันทึกการเปลี่ยนแปลง" + "metaTitle": "บันทึกการเปลี่ยนแปลง", + "entries": { + "quickTerminal": "เพิ่มพาเนล Quick Terminal ที่กำหนดตำแหน่ง/ขนาดได้ พร้อมปุ่มลัด Option-Command-backtick, คำสั่งใน command palette และตัวควบคุม CLI `cmux quick-terminal`" + } }, "navItems": { "gettingStarted": "เริ่มต้นใช้งาน", diff --git a/web/messages/tr.json b/web/messages/tr.json index 3b578d5174e0..aa5f390e1575 100644 --- a/web/messages/tr.json +++ b/web/messages/tr.json @@ -498,7 +498,11 @@ "hideTabCloseButton": "Bölme sekme çubuğundaki sekme kapatma düğmelerini gizle." }, "terminal": { - "copyOnSelect": "Seçim kesinleştiğinde seçilen terminal metnini sistem panosuna kopyalar; çift ve üçlü tıklamayla yapılan sözcük ve satır seçimleri dahil." + "copyOnSelect": "Seçim kesinleştiğinde seçilen terminal metnini sistem panosuna kopyalar; çift ve üçlü tıklamayla yapılan sözcük ve satır seçimleri dahil.", + "quickTerminalPosition": "Yüzen Quick Terminal için ekran kenarı veya merkez konumu.", + "quickTerminalPrimarySizeRatio": "Quick Terminal'in içeri kayma ekseni boyunca boyutu; görünür ekranın oranı olarak.", + "quickTerminalSecondarySizeRatio": "Quick Terminal'in karşı eksendeki boyutu; görünür ekranın oranı olarak.", + "quickTerminalAutoHide": "Klavye odağını kaybettiğinde Quick Terminal'i otomatik olarak gizle." } } }, @@ -895,7 +899,10 @@ "changelog": { "title": "Değişiklik Günlüğü", "metaDescription": "cmux sürüm notları ve sürüm geçmişi. Yerel macOS terminali için yeni özellikler, hata düzeltmeleri ve değişiklikler.", - "metaTitle": "Değişiklik günlüğü" + "metaTitle": "Değişiklik günlüğü", + "entries": { + "quickTerminal": "Yapılandırılabilir konum/boyut, Option-Command-backtick kısayolu, komut paleti eylemi ve `cmux quick-terminal` CLI denetimleri içeren Quick Terminal paneli." + } }, "navItems": { "gettingStarted": "Başlarken", diff --git a/web/messages/uk.json b/web/messages/uk.json index b17a4804e752..5d94523e6e18 100644 --- a/web/messages/uk.json +++ b/web/messages/uk.json @@ -498,7 +498,11 @@ "hideTabCloseButton": "Приховувати кнопки закриття вкладок на панелі вкладок області." }, "terminal": { - "copyOnSelect": "Копіює вибраний текст термінала до системного буфера обміну після підтвердження виділення, зокрема слова й рядки, вибрані подвійним або потрійним клацанням." + "copyOnSelect": "Копіює вибраний текст термінала до системного буфера обміну після підтвердження виділення, зокрема слова й рядки, вибрані подвійним або потрійним клацанням.", + "quickTerminalPosition": "Положення біля краю екрана або по центру для плаваючого Quick Terminal.", + "quickTerminalPrimarySizeRatio": "Розмір Quick Terminal уздовж осі появи як частка видимого екрана.", + "quickTerminalSecondarySizeRatio": "Розмір Quick Terminal по протилежній осі як частка видимого екрана.", + "quickTerminalAutoHide": "Автоматично приховувати Quick Terminal, коли він втрачає фокус клавіатури." } } }, @@ -895,7 +899,10 @@ "changelog": { "title": "Журнал змін", "metaTitle": "Журнал змін", - "metaDescription": "Примітки до випусків та історія версій cmux. Нові можливості, виправлення помилок та зміни для нативного терміналу macOS." + "metaDescription": "Примітки до випусків та історія версій cmux. Нові можливості, виправлення помилок та зміни для нативного терміналу macOS.", + "entries": { + "quickTerminal": "Панель Quick Terminal із налаштовуваними позицією/розміром, скороченням Option-Command-backtick, дією в палітрі команд і керуванням CLI `cmux quick-terminal`." + } }, "claudeCodeTeams": { "title": "Claude Code Teams", diff --git a/web/messages/zh-CN.json b/web/messages/zh-CN.json index e2e21f877490..266448282665 100644 --- a/web/messages/zh-CN.json +++ b/web/messages/zh-CN.json @@ -498,7 +498,11 @@ "hideTabCloseButton": "在窗格标签栏中隐藏标签关闭按钮。" }, "terminal": { - "copyOnSelect": "确认选择后,将所选终端文本复制到系统剪贴板,包括通过双击和三击选择的单词和整行。" + "copyOnSelect": "确认选择后,将所选终端文本复制到系统剪贴板,包括通过双击和三击选择的单词和整行。", + "quickTerminalPosition": "浮动 Quick Terminal 在屏幕边缘或中央的位置。", + "quickTerminalPrimarySizeRatio": "Quick Terminal 沿滑入轴的大小,占可见屏幕的比例。", + "quickTerminalSecondarySizeRatio": "Quick Terminal 沿另一轴的大小,占可见屏幕的比例。", + "quickTerminalAutoHide": "当 Quick Terminal 失去键盘焦点时自动隐藏。" } } }, @@ -895,7 +899,10 @@ "changelog": { "title": "更新日志", "metaDescription": "cmux 发布说明和版本历史。原生 macOS 终端的新功能、问题修复和变更记录。", - "metaTitle": "更新日志" + "metaTitle": "更新日志", + "entries": { + "quickTerminal": "新增 Quick Terminal 面板,支持可配置的位置/大小、Option-Command-反引号快捷键、命令面板操作,以及 `cmux quick-terminal` CLI 控制。" + } }, "navItems": { "gettingStarted": "入门指南", diff --git a/web/messages/zh-TW.json b/web/messages/zh-TW.json index 2f0a453dffa7..fb7e1ded7a09 100644 --- a/web/messages/zh-TW.json +++ b/web/messages/zh-TW.json @@ -498,7 +498,11 @@ "hideTabCloseButton": "在窗格分頁列中隱藏分頁關閉按鈕。" }, "terminal": { - "copyOnSelect": "確認選取後,將所選終端機文字複製到系統剪貼簿,包括透過按兩下和按三下選取的單字與整行。" + "copyOnSelect": "確認選取後,將所選終端機文字複製到系統剪貼簿,包括透過按兩下和按三下選取的單字與整行。", + "quickTerminalPosition": "浮動 Quick Terminal 在螢幕邊緣或中央的位置。", + "quickTerminalPrimarySizeRatio": "Quick Terminal 沿滑入軸的大小,作為可見螢幕的比例。", + "quickTerminalSecondarySizeRatio": "Quick Terminal 沿另一軸的大小,作為可見螢幕的比例。", + "quickTerminalAutoHide": "當 Quick Terminal 失去鍵盤焦點時自動隱藏。" } } }, @@ -895,7 +899,10 @@ "changelog": { "title": "更新日誌", "metaDescription": "cmux 版本說明和版本歷史。原生 macOS 終端機的新功能、錯誤修復和變更。", - "metaTitle": "更新日誌" + "metaTitle": "更新日誌", + "entries": { + "quickTerminal": "新增 Quick Terminal 面板,支援可設定的位置/大小、Option-Command-反引號快捷鍵、指令面板動作,以及 `cmux quick-terminal` CLI 控制。" + } }, "navItems": { "gettingStarted": "入門指南", From b498950e41b962a5aedaffd715f8286b39b10924 Mon Sep 17 00:00:00 2001 From: austinpower1258 Date: Tue, 26 May 2026 14:36:05 -0700 Subject: [PATCH 07/16] fix: clear quick terminal restore target on focus change --- Sources/QuickTerminalController.swift | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Sources/QuickTerminalController.swift b/Sources/QuickTerminalController.swift index 172034d60446..aedba479465d 100644 --- a/Sources/QuickTerminalController.swift +++ b/Sources/QuickTerminalController.swift @@ -374,12 +374,16 @@ final class QuickTerminalController: NSObject, NSWindowDelegate { } func windowDidResignKey(_ notification: Notification) { - let settings = QuickTerminalSettings.resolved() - guard settings.autoHide else { return } - guard phase.canAutoHide else { return } guard let panel = notification.object as? NSWindow, panel === self.panel else { return } guard panel.attachedSheet == nil else { return } - hide(restorePreviousApp: false) + guard phase.canAutoHide else { return } + + let settings = QuickTerminalSettings.resolved() + if settings.autoHide { + hide(restorePreviousApp: false) + } else { + previousFrontmostApp = nil + } } private func replayPendingTransitionActionIfNeeded() { From f79c6cc75c2102234adef3b8a4846b195e95ef55 Mon Sep 17 00:00:00 2001 From: austinpower1258 Date: Tue, 26 May 2026 14:44:07 -0700 Subject: [PATCH 08/16] fix: isolate terminal port ordinal allocator --- Sources/TabManager.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sources/TabManager.swift b/Sources/TabManager.swift index ec316973e05d..7f35e395283b 100644 --- a/Sources/TabManager.swift +++ b/Sources/TabManager.swift @@ -1139,8 +1139,10 @@ class TabManager: ObservableObject { /// Global monotonically increasing counter for CMUX_PORT ordinal assignment. /// Static so port ranges don't overlap across multiple windows (each window has its own TabManager). + @MainActor private(set) static var nextPortOrdinal: Int = 0 + @MainActor static func allocatePortOrdinal() -> Int { let ordinal = nextPortOrdinal nextPortOrdinal += 1 From f07629a51695ef446a26f99e992e1470871fa382 Mon Sep 17 00:00:00 2001 From: austinpower1258 Date: Thu, 4 Jun 2026 05:24:35 -0700 Subject: [PATCH 09/16] docs: document quick terminal setting keys --- .../Keys/TerminalCatalogSection.swift | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/Packages/CmuxSettings/Sources/CmuxSettings/Keys/TerminalCatalogSection.swift b/Packages/CmuxSettings/Sources/CmuxSettings/Keys/TerminalCatalogSection.swift index 0d15a0da2b2c..084bedc0d01b 100644 --- a/Packages/CmuxSettings/Sources/CmuxSettings/Keys/TerminalCatalogSection.swift +++ b/Packages/CmuxSettings/Sources/CmuxSettings/Keys/TerminalCatalogSection.swift @@ -50,24 +50,60 @@ public struct TerminalCatalogSection: SettingCatalogSection { userDefaultsKey: "terminal.focusTextBoxOnNewTerminals" ) + /// The screen position used by the floating quick terminal panel. + /// + /// Valid values are `"top"`, `"bottom"`, `"left"`, `"right"`, and + /// `"center"`. The default is `"top"`. The `UserDefaults` key intentionally + /// uses the existing `quickTerminal.*` namespace so preferences written by + /// the quick-terminal runtime continue to be read by the settings catalog. + /// + /// ```swift + /// let key = SettingCatalog().terminal.quickTerminalPosition + /// ``` public let quickTerminalPosition = DefaultsKey( id: "terminal.quickTerminalPosition", defaultValue: "top", userDefaultsKey: "quickTerminal.position" ) + /// The quick terminal size ratio along the slide-in axis. + /// + /// Values are clamped by the quick-terminal runtime to the range + /// `0.2...1.0`. For top and bottom positions this controls height; for + /// left and right positions this controls width. The default is `0.38`. + /// + /// ```swift + /// let key = SettingCatalog().terminal.quickTerminalPrimarySizeRatio + /// ``` public let quickTerminalPrimarySizeRatio = DefaultsKey( id: "terminal.quickTerminalPrimarySizeRatio", defaultValue: 0.38, userDefaultsKey: "quickTerminal.primarySizeRatio" ) + /// The quick terminal size ratio across the axis opposite the slide-in direction. + /// + /// Values are clamped by the quick-terminal runtime to the range + /// `0.2...1.0`. For top and bottom positions this controls width; for left, + /// right, and center positions this controls height. The default is `1.0`. + /// + /// ```swift + /// let key = SettingCatalog().terminal.quickTerminalSecondarySizeRatio + /// ``` public let quickTerminalSecondarySizeRatio = DefaultsKey( id: "terminal.quickTerminalSecondarySizeRatio", defaultValue: 1.0, userDefaultsKey: "quickTerminal.secondarySizeRatio" ) + /// Whether the quick terminal hides automatically after losing key focus. + /// + /// The default is `true`. When disabled, the panel remains visible until a + /// toggle, hide command, or app shutdown closes it. + /// + /// ```swift + /// let key = SettingCatalog().terminal.quickTerminalAutoHide + /// ``` public let quickTerminalAutoHide = DefaultsKey( id: "terminal.quickTerminalAutoHide", defaultValue: true, From 6520b9b1a4b852a1c0f6a244d073bfd0bda54bde Mon Sep 17 00:00:00 2001 From: austinpower1258 Date: Thu, 4 Jun 2026 05:41:00 -0700 Subject: [PATCH 10/16] fix: localize quick terminal search aliases --- Resources/Localizable.xcstrings | 68 +++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/Resources/Localizable.xcstrings b/Resources/Localizable.xcstrings index 40a7abc7fcc2..e0adbfd4cbe2 100644 --- a/Resources/Localizable.xcstrings +++ b/Resources/Localizable.xcstrings @@ -168592,6 +168592,74 @@ } } }, + "settings.search.alias.setting.terminal.quick-terminal-position": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "terminal.quickTerminalPosition quick terminal dropdown quake position top bottom left right center" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "terminal.quickTerminalPosition quick terminal dropdown quake position top bottom left right center クイックターミナル ドロップダウン 位置 上 下 左 右 中央" + } + } + } + }, + "settings.search.alias.setting.terminal.quick-terminal-primary-size": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "terminal.quickTerminalPrimarySizeRatio quick terminal dropdown quake primary size height width" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "terminal.quickTerminalPrimarySizeRatio quick terminal dropdown quake primary size height width クイックターミナル ドロップダウン 主サイズ 高さ 幅" + } + } + } + }, + "settings.search.alias.setting.terminal.quick-terminal-secondary-size": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "terminal.quickTerminalSecondarySizeRatio quick terminal dropdown quake secondary size height width" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "terminal.quickTerminalSecondarySizeRatio quick terminal dropdown quake secondary size height width クイックターミナル ドロップダウン 副サイズ 高さ 幅" + } + } + } + }, + "settings.search.alias.setting.terminal.quick-terminal-auto-hide": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "terminal.quickTerminalAutoHide quick terminal dropdown quake auto hide blur focus" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "terminal.quickTerminalAutoHide quick terminal dropdown quake auto hide blur focus クイックターミナル ドロップダウン 自動 非表示 フォーカス" + } + } + } + }, "settings.search.alias.setting.textBox.focus-textbox-new-terminals": { "extractionState": "manual", "localizations": { From af7a08d01d01a6663cedc53ad0e1d52c86fe8c44 Mon Sep 17 00:00:00 2001 From: austinpower1258 Date: Sun, 14 Jun 2026 12:33:07 -0700 Subject: [PATCH 11/16] fix: regenerate Swift file length budget --- .github/swift-file-length-budget.tsv | 34 ++++++++++++++-------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/swift-file-length-budget.tsv b/.github/swift-file-length-budget.tsv index ea13c6d70701..791ab9b6b5ac 100644 --- a/.github/swift-file-length-budget.tsv +++ b/.github/swift-file-length-budget.tsv @@ -1,27 +1,27 @@ # cmux-owned Swift file length budget. # Format: max_linesrelative path # Reduce counts as files shrink. CI fails if tracked files exceed this budget. -33857 CLI/cmux.swift -17914 Sources/AppDelegate.swift -16740 Sources/ContentView.swift -14612 Sources/TerminalController.swift +33948 CLI/cmux.swift +17945 Sources/AppDelegate.swift +16751 Sources/ContentView.swift +14695 Sources/TerminalController.swift 13595 Sources/Panels/BrowserPanel.swift 12088 Sources/GhosttyTerminalView.swift 12046 cmuxTests/AppDelegateShortcutRoutingTests.swift 11992 Sources/Workspace.swift 9331 cmuxTests/CLINotifyProcessIntegrationRegressionTests.swift 7911 Sources/Panels/BrowserPanelView.swift -7350 cmuxTests/WorkspaceUnitTests.swift +7404 cmuxTests/WorkspaceUnitTests.swift 6944 cmuxTests/WorkspaceRemoteConnectionTests.swift 6317 cmuxTests/SessionPersistenceTests.swift 6299 cmuxTests/GhosttyConfigTests.swift 6153 CLI/cmux_open.swift -6074 Sources/TabManager.swift +6078 Sources/TabManager.swift 6074 Sources/TextBoxInput.swift 5925 cmuxTests/TerminalAndGhosttyTests.swift 5522 cmuxTests/BrowserConfigTests.swift -4921 Sources/cmuxApp.swift 5113 Packages/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite.swift +4926 Sources/cmuxApp.swift 4460 Sources/Panels/FilePreviewPanel.swift 4400 cmuxTests/BrowserPanelTests.swift 4227 Sources/BrowserWindowPortal.swift @@ -32,10 +32,10 @@ 3664 Packages/CmuxMobileTerminal/Sources/CmuxMobileTerminal/GhosttySurfaceView.swift 3397 Sources/CmuxConfig.swift 3331 cmuxTests/TabManagerSessionSnapshotTests.swift -3204 Sources/Update/UpdateTitlebarAccessory.swift +3200 Sources/Update/UpdateTitlebarAccessory.swift 2878 Sources/SessionIndexView.swift 2871 cmuxTests/CMUXOpenCommandTests.swift -2573 Sources/KeyboardShortcutSettings.swift +2581 Sources/KeyboardShortcutSettings.swift 2565 Sources/Panels/CmuxWebView.swift 2546 cmuxTests/WorkspaceManualUnreadTests.swift 2449 cmuxTests/CommandPaletteSearchEngineTests.swift @@ -46,8 +46,8 @@ 2236 Sources/TerminalNotificationStore.swift 2117 cmuxTests/CmuxConfigTests.swift 2095 cmuxTests/ShortcutAndCommandPaletteTests.swift +2064 Sources/KeyboardShortcutSettingsFileStore.swift 2059 Sources/SessionPersistence.swift -2036 Sources/KeyboardShortcutSettingsFileStore.swift 1949 Sources/Panels/BrowserWebAuthnSupport.swift 1860 cmuxTests/NotificationAndMenuBarTests.swift 1794 Sources/SessionIndexStore.swift @@ -59,11 +59,11 @@ 1652 cmuxTests/CMUXCLIErrorOutputRegressionTests.swift 1574 cmuxTests/MarkdownPanelTests.swift 1560 cmuxTests/TextBoxMentionCompletionTests.swift -1498 cmuxTests/OmnibarAndToolsTests.swift +1497 cmuxTests/OmnibarAndToolsTests.swift 1496 cmuxUITests/MultiWindowNotificationsUITests.swift 1446 Sources/FileExplorerStore.swift -1380 cmuxUITests/MenuKeyEquivalentRoutingUITests.swift 1382 cmuxTests/KeyboardShortcutSettingsFileStoreStartupTests.swift +1380 cmuxUITests/MenuKeyEquivalentRoutingUITests.swift 1373 cmuxTests/AppDelegateIssue2907RoutingTests.swift 1366 Sources/Feed/FeedButtonStyleDebugWindowController.swift 1362 Sources/CMUXInstalledExtensionSidebarHostView.swift @@ -92,9 +92,9 @@ 937 Sources/TextBoxMentionIndexStore.swift 934 Sources/App/ShortcutRoutingSupport.swift 926 Sources/DockPanelView.swift +920 Sources/CommandPalette/CommandPaletteSettingsToggle.swift 919 Packages/CmuxTerminal/Sources/CmuxTerminal/Surface/TerminalSurface+RuntimeLifecycle.swift 918 cmuxTests/WorkspaceGroupTests.swift -920 Sources/CommandPalette/CommandPaletteSettingsToggle.swift 905 Sources/CmuxSSHURLRequest.swift 901 Packages/CmuxSettingsUI/Sources/CmuxSettingsUI/Sections/AppSection.swift 893 Sources/WorkspaceContentView.swift @@ -117,13 +117,14 @@ 752 cmuxUITests/CloseWorkspaceCmdDUITests.swift 746 Sources/App/MenuBarExtraController.swift 738 Packages/CMUXProjectModel/Sources/CMUXProjectModel/XcodeProjectAdapter.swift -738 Packages/CmuxAuthRuntime/Sources/CmuxAuthRuntime/Coordinator/AuthCoordinator.swift +736 Packages/CmuxAuthRuntime/Sources/CmuxAuthRuntime/Coordinator/AuthCoordinator.swift +726 cmuxTests/CLICodexHookTimeoutRegressionTests.swift 716 Sources/TaskManagerSnapshot.swift 715 Packages/CmuxTerminal/Sources/CmuxTerminal/Surface/TerminalSurface+Input.swift 715 Sources/AppleScriptSupport.swift 710 Sources/TerminalSSHSessionDetector.swift -706 CLI/CMUXCLI+Config.swift 707 CLI/CMUXCLI+AgentHookDefinitions.swift +706 CLI/CMUXCLI+Config.swift 699 Sources/RightSidebarPanelView.swift 699 cmuxTests/TerminalNotificationClearAllTests.swift 698 cmuxTests/RestorableAgentHookProviderResumeTests.swift @@ -149,10 +150,10 @@ 620 cmuxTests/TerminalNotificationQueueTests.swift 614 Sources/PortScanner.swift 614 cmuxTests/SessionIndexViewTests.swift +611 Sources/SettingsNavigation.swift 611 Sources/TerminalController+ControlPaneContext.swift 608 Packages/CmuxWorkspaces/Sources/CmuxWorkspaces/Coordinators/WorkspaceGroupCoordinator.swift 604 Packages/CmuxCommandPalette/Tests/CmuxCommandPaletteTests/CommandPaletteNucleoFFITests.swift -603 Sources/SettingsNavigation.swift 599 Packages/CMUXAgentLaunch/Sources/CMUXAgentLaunch/AgentLaunchSanitizerPrimaryPolicies.swift 596 cmuxTests/CmuxEventBusTests.swift 594 Sources/SessionIndexModels.swift @@ -187,7 +188,6 @@ 528 cmuxTests/CLINotifyProcessTestSupport.swift 528 cmuxUITests/AutomationSocketUITests.swift 527 CLI/CLISocketPathResolver.swift -726 cmuxTests/CLICodexHookTimeoutRegressionTests.swift 523 Packages/CmuxRemoteSession/Sources/CmuxRemoteSession/Session/RemoteSessionCoordinator+PortScan.swift 520 CLI/CMUXCLI+AmpExtension.swift 520 cmuxTests/MainWindowVisibilityControllerTests.swift From 9c48ac04146212f06684ef5045d9a366fa48fc46 Mon Sep 17 00:00:00 2001 From: austinpower1258 Date: Sun, 14 Jun 2026 13:08:41 -0700 Subject: [PATCH 12/16] fix: sync quick terminal after main merge --- .github/swift-file-length-budget.tsv | 4 ++-- Sources/QuickTerminalController.swift | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/swift-file-length-budget.tsv b/.github/swift-file-length-budget.tsv index 791ab9b6b5ac..c88ffa0ab10e 100644 --- a/.github/swift-file-length-budget.tsv +++ b/.github/swift-file-length-budget.tsv @@ -3,7 +3,7 @@ # Reduce counts as files shrink. CI fails if tracked files exceed this budget. 33948 CLI/cmux.swift 17945 Sources/AppDelegate.swift -16751 Sources/ContentView.swift +16720 Sources/ContentView.swift 14695 Sources/TerminalController.swift 13595 Sources/Panels/BrowserPanel.swift 12088 Sources/GhosttyTerminalView.swift @@ -13,8 +13,8 @@ 7911 Sources/Panels/BrowserPanelView.swift 7404 cmuxTests/WorkspaceUnitTests.swift 6944 cmuxTests/WorkspaceRemoteConnectionTests.swift +6363 cmuxTests/GhosttyConfigTests.swift 6317 cmuxTests/SessionPersistenceTests.swift -6299 cmuxTests/GhosttyConfigTests.swift 6153 CLI/cmux_open.swift 6078 Sources/TabManager.swift 6074 Sources/TextBoxInput.swift diff --git a/Sources/QuickTerminalController.swift b/Sources/QuickTerminalController.swift index aedba479465d..92fa2b51009c 100644 --- a/Sources/QuickTerminalController.swift +++ b/Sources/QuickTerminalController.swift @@ -1,4 +1,5 @@ import AppKit +import CmuxTerminal import Foundation import QuartzCore From fa28473f3aea9c85bb5cd1889d405d62e427a460 Mon Sep 17 00:00:00 2001 From: austinpower1258 Date: Sun, 14 Jun 2026 13:27:12 -0700 Subject: [PATCH 13/16] fix: localize quick terminal shortcut docs --- web/app/[locale]/docs/configuration/page.tsx | 10 ++-- web/app/[locale]/keyboard-shortcuts.tsx | 14 ++--- web/data/cmux-shortcuts.ts | 56 ++++++++++++++++++-- 3 files changed, 61 insertions(+), 19 deletions(-) diff --git a/web/app/[locale]/docs/configuration/page.tsx b/web/app/[locale]/docs/configuration/page.tsx index 08b914b4aab9..9c586dd4cf5b 100644 --- a/web/app/[locale]/docs/configuration/page.tsx +++ b/web/app/[locale]/docs/configuration/page.tsx @@ -5,7 +5,7 @@ import { Link } from "../../../../i18n/navigation"; import { CodeBlock } from "../../components/code-block"; import { Callout } from "../../components/callout"; import settingsSchema from "../../../../data/cmux.schema.json"; -import { shortcutCategories, type LocalizedText } from "../../../../data/cmux-shortcuts"; +import { localizedShortcutText, shortcutCategories } from "../../../../data/cmux-shortcuts"; import { DocsHeading } from "../../components/docs-heading"; type SchemaProperty = { @@ -151,10 +151,6 @@ export async function generateMetadata({ params }: { params: Promise<{ locale: s }; } -function localizedText(text: LocalizedText, locale: string) { - return locale.startsWith("ja") ? text.ja : text.en; -} - function shortcutToConfig(shortcut: { combos: string[][]; configValue?: string }) { if (shortcut.configValue) return shortcut.configValue; return shortcutComboToConfig(shortcut.combos[0] ?? []); @@ -449,10 +445,10 @@ working-directory = ~/code`} {shortcut.id}

- {localizedText(shortcut.description, locale)} + {localizedShortcutText(shortcut.description, locale)} {shortcut.note && ( - {localizedText(shortcut.note, locale)} + {localizedShortcutText(shortcut.note, locale)} )}

diff --git a/web/app/[locale]/keyboard-shortcuts.tsx b/web/app/[locale]/keyboard-shortcuts.tsx index 6072d4e037f7..61f33ba99638 100644 --- a/web/app/[locale]/keyboard-shortcuts.tsx +++ b/web/app/[locale]/keyboard-shortcuts.tsx @@ -2,11 +2,7 @@ import { useMemo, useState } from "react"; import { useLocale, useTranslations } from "next-intl"; -import { shortcutCategories, type LocalizedText, type Shortcut } from "../../data/cmux-shortcuts"; - -function localizedText(text: LocalizedText, locale: string) { - return locale.startsWith("ja") ? text.ja : text.en; -} +import { localizedShortcutText, shortcutCategories, type Shortcut } from "../../data/cmux-shortcuts"; function normalize(s: string) { return s.toLowerCase().replace(/\s+/g, " ").trim(); @@ -34,8 +30,8 @@ function KeyCombo({ combo }: { combo: string[] }) { } function ShortcutRow({ shortcut, locale }: { shortcut: Shortcut; locale: string }) { - const description = localizedText(shortcut.description, locale); - const note = shortcut.note ? localizedText(shortcut.note, locale) : undefined; + const description = localizedShortcutText(shortcut.description, locale); + const note = shortcut.note ? localizedShortcutText(shortcut.note, locale) : undefined; return (
@@ -73,8 +69,8 @@ export function KeyboardShortcuts() { ...cat, shortcuts: cat.shortcuts.filter((shortcut) => { const catTitle = t(`cat.${cat.titleKey}`); - const description = localizedText(shortcut.description, locale); - const note = shortcut.note ? localizedText(shortcut.note, locale) : ""; + const description = localizedShortcutText(shortcut.description, locale); + const note = shortcut.note ? localizedShortcutText(shortcut.note, locale) : ""; const combos = shortcut.combos.map(comboToText).join(" "); return normalize(`${catTitle} ${combos} ${description} ${note}`).includes(q); }), diff --git a/web/data/cmux-shortcuts.ts b/web/data/cmux-shortcuts.ts index 97de4ba074fa..16f3cd929deb 100644 --- a/web/data/cmux-shortcuts.ts +++ b/web/data/cmux-shortcuts.ts @@ -1,7 +1,15 @@ +import type { Locale } from "../i18n/routing"; + export type LocalizedText = { en: string; ja: string; -}; +} & Partial, string>>; + +export function localizedShortcutText(text: LocalizedText, locale: string) { + const exact = (text as Partial>)[locale]; + if (exact) return exact; + return locale.startsWith("ja") ? text.ja : text.en; +} export type Shortcut = { id: string; @@ -41,8 +49,50 @@ export const shortcutCategories: ShortcutCategory[] = [ { id: "toggleQuickTerminal", combos: [["⌥", "⌘", "`"]], - description: { en: "Toggle quick terminal", ja: "クイックターミナルを切り替え" }, - note: { en: "system-wide hotkey", ja: "システム全体のホットキー" }, + description: { + en: "Toggle quick terminal", + ja: "クイックターミナルを切り替え", + "zh-CN": "切换快速终端", + "zh-TW": "切換快速終端", + ko: "빠른 터미널 전환", + de: "Schnellterminal ein-/ausblenden", + es: "Alternar terminal rápido", + fr: "Afficher/masquer le terminal rapide", + it: "Attiva/disattiva terminale rapido", + da: "Slå hurtig terminal til/fra", + pl: "Przełącz szybki terminal", + ru: "Переключить быстрый терминал", + bs: "Uključi/isključi brzi terminal", + ar: "تبديل الطرفية السريعة", + no: "Slå hurtigterminal av/på", + "pt-BR": "Alternar terminal rápido", + th: "สลับเทอร์มินัลด่วน", + tr: "Hızlı terminali aç/kapat", + km: "បិទ/បើក terminal រហ័ស", + uk: "Перемкнути швидкий термінал", + }, + note: { + en: "system-wide hotkey", + ja: "システム全体のホットキー", + "zh-CN": "系统级热键", + "zh-TW": "系統層級快速鍵", + ko: "시스템 전체 단축키", + de: "systemweiter Kurzbefehl", + es: "atajo global del sistema", + fr: "raccourci système global", + it: "scorciatoia a livello di sistema", + da: "systemgenvej", + pl: "globalny skrót systemowy", + ru: "общесистемная горячая клавиша", + bs: "sistemska prečica", + ar: "اختصار على مستوى النظام", + no: "systemomfattende hurtigtast", + "pt-BR": "atalho global do sistema", + th: "ปุ่มลัดทั้งระบบ", + tr: "sistem genelinde kısayol", + km: "គ្រាប់ចុចកាត់ប្រព័ន្ធទាំងមូល", + uk: "загальносистемна гаряча клавіша", + }, }, { id: "commandPalette", combos: [["⌘", "⇧", "P"]], description: { en: "Command palette", ja: "コマンドパレット" } }, { From 153d6d238c9fd368f27ad81e143caddf319a8592 Mon Sep 17 00:00:00 2001 From: austinpower1258 Date: Thu, 18 Jun 2026 12:25:26 -0700 Subject: [PATCH 14/16] fix: handle quick terminal exit lifecycle --- .../CmuxSettingsUI/Sections/TerminalSection.swift | 4 ++++ Sources/AppDelegate.swift | 5 +++++ Sources/GhosttyTerminalView.swift | 4 ++++ Sources/QuickTerminalController.swift | 9 +++++++++ 4 files changed, 22 insertions(+) diff --git a/Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Sections/TerminalSection.swift b/Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Sections/TerminalSection.swift index 2bd3ef4340ba..763bda6dcde1 100644 --- a/Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Sections/TerminalSection.swift +++ b/Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Sections/TerminalSection.swift @@ -66,6 +66,10 @@ public struct TerminalSection: View { let models: [any SettingObservationStarting] = [ scrollBar, copyOnSelect, + quickTerminalPosition, + quickTerminalPrimarySizeRatio, + quickTerminalSecondarySizeRatio, + quickTerminalAutoHide, autoResume, hibernation, idleSeconds, diff --git a/Sources/AppDelegate.swift b/Sources/AppDelegate.swift index 815da1fb15c5..0e51c9b6a4b7 100644 --- a/Sources/AppDelegate.swift +++ b/Sources/AppDelegate.swift @@ -6513,6 +6513,11 @@ final class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCent quickTerminalController.statusPayload() } + @discardableResult + func handleQuickTerminalChildExited(surfaceId: UUID) -> Bool { + quickTerminalController.handleChildExited(surfaceId: surfaceId) + } + @objc func toggleQuickTerminal(_ sender: Any?) { _ = sender _ = toggleQuickTerminalVisibility() diff --git a/Sources/GhosttyTerminalView.swift b/Sources/GhosttyTerminalView.swift index 6ff8387630e6..a8396a36cc1d 100644 --- a/Sources/GhosttyTerminalView.swift +++ b/Sources/GhosttyTerminalView.swift @@ -2730,6 +2730,10 @@ class GhosttyApp { // dispatching this action callback. DispatchQueue.main.async { guard let app = AppDelegate.shared else { return } + if let callbackSurfaceId, + app.handleQuickTerminalChildExited(surfaceId: callbackSurfaceId) { + return + } if let callbackTabId, let callbackSurfaceId, let manager = app.tabManagerFor(tabId: callbackTabId) ?? app.tabManager, diff --git a/Sources/QuickTerminalController.swift b/Sources/QuickTerminalController.swift index 92fa2b51009c..2e275e76b5cd 100644 --- a/Sources/QuickTerminalController.swift +++ b/Sources/QuickTerminalController.swift @@ -374,6 +374,15 @@ final class QuickTerminalController: NSObject, NSWindowDelegate { pendingTransitionAction = nil } + @discardableResult + func handleChildExited(surfaceId: UUID) -> Bool { + guard terminalSurface?.id == surfaceId else { + return false + } + teardown() + return true + } + func windowDidResignKey(_ notification: Notification) { guard let panel = notification.object as? NSWindow, panel === self.panel else { return } guard panel.attachedSheet == nil else { return } From d30eeac8bdfe71778ceb62f567071e5ad243d030 Mon Sep 17 00:00:00 2001 From: austinpower1258 Date: Thu, 18 Jun 2026 12:29:36 -0700 Subject: [PATCH 15/16] chore: refresh swift file length budget --- .github/swift-file-length-budget.tsv | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/swift-file-length-budget.tsv b/.github/swift-file-length-budget.tsv index e58e28223a1e..fc5e286fcec0 100644 --- a/.github/swift-file-length-budget.tsv +++ b/.github/swift-file-length-budget.tsv @@ -2,12 +2,12 @@ # Format: max_linesrelative path # Reduce counts as files shrink. CI fails if tracked files exceed this budget. 34566 CLI/cmux.swift -17636 Sources/AppDelegate.swift +17641 Sources/AppDelegate.swift 15944 Sources/ContentView.swift 14187 Sources/TerminalController.swift 12658 Sources/Workspace.swift 12115 cmuxTests/AppDelegateShortcutRoutingTests.swift -11833 Sources/GhosttyTerminalView.swift +11837 Sources/GhosttyTerminalView.swift 11413 Sources/Panels/BrowserPanel.swift 9331 cmuxTests/CLINotifyProcessIntegrationRegressionTests.swift 7953 Sources/Panels/BrowserPanelView.swift @@ -217,3 +217,4 @@ 504 cmuxTests/TerminalNotificationSocketActionTests.swift 503 Sources/Settings/ConfigSource.swift 502 Sources/CmuxEventPublishing.swift +501 Sources/QuickTerminalController.swift From eb674c323ca815ba4b0516993dfdea1b54af5775 Mon Sep 17 00:00:00 2001 From: austinpower1258 Date: Thu, 18 Jun 2026 12:35:39 -0700 Subject: [PATCH 16/16] fix: redact CLI argument errors --- CLI/cmux.swift | 32 ++++++------ Resources/Localizable.xcstrings | 90 +++++++++++++++++++++++++++------ 2 files changed, 90 insertions(+), 32 deletions(-) diff --git a/CLI/cmux.swift b/CLI/cmux.swift index 70c7fcb3e94d..4bdf998bfce9 100644 --- a/CLI/cmux.swift +++ b/CLI/cmux.swift @@ -7548,15 +7548,14 @@ struct CMUXCLI { commandName )) } - if let unknown = remaining.first(where: { $0.hasPrefix("--") }) { + if remaining.contains(where: { $0.hasPrefix("--") }) { throw CLIError(message: String( format: String( localized: "cli.workspace.create.error.unknownFlag", - defaultValue: "%@: unknown flag '%@'. Known flags: --name , --description <text>, --command <text>, --cwd <path>, --env KEY=VALUE, --env-file <path>, --layout <json>, --window <id|ref|index>, --focus <true|false>" + defaultValue: "%@: unknown flag. Known flags: --name <title>, --description <text>, --command <text>, --cwd <path>, --env KEY=VALUE, --env-file <path>, --layout <json>, --window <id|ref|index>, --focus <true|false>" ), locale: .current, - commandName, - unknown + commandName )) } var params: [String: Any] = [:] @@ -7698,12 +7697,11 @@ struct CMUXCLI { throw CLIError(message: String( format: String( localized: "cli.workspace.env.error.invalidAssignment", - defaultValue: "%@: %@ entry '%@' must be in KEY=VALUE form" + defaultValue: "%@: %@ entry must be in KEY=VALUE form" ), locale: .current, commandName, - source, - raw + source )) } let key = String(raw[..<eq]).trimmingCharacters(in: .whitespaces) @@ -7712,12 +7710,11 @@ struct CMUXCLI { throw CLIError(message: String( format: String( localized: "cli.workspace.env.error.emptyKey", - defaultValue: "%@: %@ entry '%@' has an empty key" + defaultValue: "%@: %@ entry has an empty key" ), locale: .current, commandName, - source, - raw + source )) } return (key, value) @@ -7761,17 +7758,20 @@ struct CMUXCLI { let (workspaceArg, rem0) = parseOption(rest, name: "--workspace") let (_, rem1) = parseOption(rem0, name: "--window") - if let unknown = rem1.first(where: { $0.hasPrefix("--") }) { + if rem1.contains(where: { $0.hasPrefix("--") }) { throw CLIError(message: String( format: String( localized: "cli.workspace.env.error.unknownFlag", - defaultValue: "workspace env: unknown flag '%@'. Known flags: --workspace <id|ref|index>, --window <id|ref|index>, --mask" + defaultValue: "workspace env: unknown flag. Known flags: --workspace <id|ref|index>, --window <id|ref|index>, --mask" ), - locale: .current, - unknown + locale: .current )) } - let positional = rem1.first(where: { !$0.hasPrefix("--") }) + let positionals = rem1.filter { !$0.hasPrefix("--") } + if positionals.count > 1 { + throw CLIError(message: String(localized: "cli.workspace.env.error.unexpectedExtraArgument", defaultValue: "workspace env: unexpected extra argument")) + } + let positional = positionals.first let windowRaw = windowFromArgsOrOverride(commandArgs, windowOverride: windowOverride) // Match reconnect/disconnect: default to the caller's workspace // ($CMUX_WORKSPACE_ID) before the selected one, but only when no explicit @@ -8837,7 +8837,7 @@ struct CMUXCLI { if destination == nil { destination = arg } else { - throw CLIError(message: "ssh-tmux: unexpected extra argument '\(arg)'") + throw CLIError(message: String(localized: "cli.ssh-tmux.error.unexpectedExtraArgument", defaultValue: "ssh-tmux: unexpected extra argument")) } index += 1 } diff --git a/Resources/Localizable.xcstrings b/Resources/Localizable.xcstrings index 3922627e2621..1634afc63810 100644 --- a/Resources/Localizable.xcstrings +++ b/Resources/Localizable.xcstrings @@ -198855,25 +198855,25 @@ "en": { "stringUnit": { "state": "translated", - "value": "%@: unknown flag '%@'. Known flags: --name <title>, --description <text>, --command <text>, --cwd <path>, --env KEY=VALUE, --env-file <path>, --layout <json>, --window <id|ref|index>, --focus <true|false>" + "value": "%@: unknown flag. Known flags: --name <title>, --description <text>, --command <text>, --cwd <path>, --env KEY=VALUE, --env-file <path>, --layout <json>, --window <id|ref|index>, --focus <true|false>" } }, "ja": { "stringUnit": { "state": "translated", - "value": "%@: 不明なフラグ '%@'。利用可能なフラグ: --name <title>, --description <text>, --command <text>, --cwd <path>, --env KEY=VALUE, --env-file <path>, --layout <json>, --window <id|ref|index>, --focus <true|false>" + "value": "%@: 不明なフラグです。利用可能なフラグ: --name <title>, --description <text>, --command <text>, --cwd <path>, --env KEY=VALUE, --env-file <path>, --layout <json>, --window <id|ref|index>, --focus <true|false>" } }, "ko": { "stringUnit": { "state": "translated", - "value": "%@: 알 수 없는 플래그 '%@'. 사용 가능한 플래그: --name <title>, --description <text>, --command <text>, --cwd <path>, --env KEY=VALUE, --env-file <path>, --layout <json>, --window <id|ref|index>, --focus <true|false>" + "value": "%@: 알 수 없는 플래그입니다. 사용 가능한 플래그: --name <title>, --description <text>, --command <text>, --cwd <path>, --env KEY=VALUE, --env-file <path>, --layout <json>, --window <id|ref|index>, --focus <true|false>" } }, "uk": { "stringUnit": { "state": "translated", - "value": "%@: невідомий прапорець '%@'. Доступні прапорці: --name <title>, --description <text>, --command <text>, --cwd <path>, --env KEY=VALUE, --env-file <path>, --layout <json>, --window <id|ref|index>, --focus <true|false>" + "value": "%@: невідомий прапорець. Доступні прапорці: --name <title>, --description <text>, --command <text>, --cwd <path>, --env KEY=VALUE, --env-file <path>, --layout <json>, --window <id|ref|index>, --focus <true|false>" } } } @@ -198942,25 +198942,25 @@ "en": { "stringUnit": { "state": "translated", - "value": "%@: %@ entry '%@' has an empty key" + "value": "%@: %@ entry has an empty key" } }, "ja": { "stringUnit": { "state": "translated", - "value": "%@: %@ のエントリ '%@' のキーが空です" + "value": "%@: %@ のエントリのキーが空です" } }, "ko": { "stringUnit": { "state": "translated", - "value": "%@: %@ 항목 '%@'의 키가 비어 있습니다" + "value": "%@: %@ 항목의 키가 비어 있습니다" } }, "uk": { "stringUnit": { "state": "translated", - "value": "%@: запис %@ '%@' має порожній ключ" + "value": "%@: запис %@ має порожній ключ" } } } @@ -198971,25 +198971,25 @@ "en": { "stringUnit": { "state": "translated", - "value": "%@: %@ entry '%@' must be in KEY=VALUE form" + "value": "%@: %@ entry must be in KEY=VALUE form" } }, "ja": { "stringUnit": { "state": "translated", - "value": "%@: %@ のエントリ '%@' は KEY=VALUE 形式である必要があります" + "value": "%@: %@ のエントリは KEY=VALUE 形式である必要があります" } }, "ko": { "stringUnit": { "state": "translated", - "value": "%@: %@ 항목 '%@'은(는) KEY=VALUE 형식이어야 합니다" + "value": "%@: %@ 항목은 KEY=VALUE 형식이어야 합니다" } }, "uk": { "stringUnit": { "state": "translated", - "value": "%@: запис %@ '%@' має бути у форматі KEY=VALUE" + "value": "%@: запис %@ має бути у форматі KEY=VALUE" } } } @@ -199000,25 +199000,83 @@ "en": { "stringUnit": { "state": "translated", - "value": "workspace env: unknown flag '%@'. Known flags: --workspace <id|ref|index>, --window <id|ref|index>, --mask" + "value": "workspace env: unknown flag. Known flags: --workspace <id|ref|index>, --window <id|ref|index>, --mask" } }, "ja": { "stringUnit": { "state": "translated", - "value": "workspace env: 不明なフラグ '%@'。利用可能なフラグ: --workspace <id|ref|index>, --window <id|ref|index>, --mask" + "value": "workspace env: 不明なフラグです。利用可能なフラグ: --workspace <id|ref|index>, --window <id|ref|index>, --mask" } }, "ko": { "stringUnit": { "state": "translated", - "value": "workspace env: 알 수 없는 플래그 '%@'. 사용 가능한 플래그: --workspace <id|ref|index>, --window <id|ref|index>, --mask" + "value": "workspace env: 알 수 없는 플래그입니다. 사용 가능한 플래그: --workspace <id|ref|index>, --window <id|ref|index>, --mask" } }, "uk": { "stringUnit": { "state": "translated", - "value": "workspace env: невідомий прапорець '%@'. Доступні прапорці: --workspace <id|ref|index>, --window <id|ref|index>, --mask" + "value": "workspace env: невідомий прапорець. Доступні прапорці: --workspace <id|ref|index>, --window <id|ref|index>, --mask" + } + } + } + }, + "cli.workspace.env.error.unexpectedExtraArgument": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "workspace env: unexpected extra argument" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "workspace env: 予期しない追加引数です" + } + }, + "ko": { + "stringUnit": { + "state": "translated", + "value": "workspace env: 예기치 않은 추가 인수입니다" + } + }, + "uk": { + "stringUnit": { + "state": "translated", + "value": "workspace env: неочікуваний зайвий аргумент" + } + } + } + }, + "cli.ssh-tmux.error.unexpectedExtraArgument": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "ssh-tmux: unexpected extra argument" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "ssh-tmux: 予期しない追加引数です" + } + }, + "ko": { + "stringUnit": { + "state": "translated", + "value": "ssh-tmux: 예기치 않은 추가 인수입니다" + } + }, + "uk": { + "stringUnit": { + "state": "translated", + "value": "ssh-tmux: неочікуваний зайвий аргумент" } } }