Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Sources/AppDelegate+DockShortcutRouting.swift
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,23 @@ extension AppDelegate {
)
}

/// Focuses the TextBox composer from a menu or command entrypoint. The
/// terminal panel owns the same focus toggle as the keyboard shortcut:
/// the first invocation reveals/focuses TextBox and the next returns focus
/// to the terminal.
@discardableResult
func performFocusTextBoxInputShortcut(preferredWindow: NSWindow? = nil) -> Bool {
let targetWindow = preferredWindow ?? shortcutRoutingActiveWindow
if let dock = focusedDockStoreForShortcut(
action: .focusTextBoxInput,
preferredWindow: targetWindow
) {
return dock.performShortcutCommand(.focusTextBoxInput)
}
return activeTabManagerForCommands(preferredWindow: targetWindow)?
.focusFocusedTerminalTextBoxInputOrTerminal() ?? false
}

/// Creates a New Terminal / New Browser surface in the focused Dock pane.
/// Returns the created Dock panel id when handled, or `nil` to fall through to
/// the main-area creation path.
Expand Down
9 changes: 9 additions & 0 deletions Sources/cmuxApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1075,6 +1075,15 @@ struct cmuxApp: App {
}
}

splitCommandButton(
title: String(localized: "shortcut.focusTextBoxInput.label", defaultValue: "Focus TextBox Input"),
shortcut: menuShortcut(for: .focusTextBoxInput)
) {
_ = AppDelegate.shared?.performFocusTextBoxInputShortcut(
preferredWindow: NSApp.keyWindow ?? NSApp.mainWindow
)
}

splitCommandButton(title: String(localized: "menu.view.toggleRightSidebar", defaultValue: "Toggle Right Sidebar"), shortcut: menuShortcut(for: .toggleRightSidebar)) {
if AppDelegate.shared?.toggleRightSidebarInActiveMainWindow(
preferredWindow: NSApp.keyWindow ?? NSApp.mainWindow
Expand Down
Loading