From c40ac6b785cc7482d7556943b7d26f7fd4897617 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 5 Jun 2025 07:09:46 -0700 Subject: [PATCH] input: add focus split directional commands to command palette --- .../Terminal/BaseTerminalController.swift | 6 ++-- src/input/command.zig | 34 ++++++++++++++++++- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/macos/Sources/Features/Terminal/BaseTerminalController.swift b/macos/Sources/Features/Terminal/BaseTerminalController.swift index 5e2777195..ea849bb4a 100644 --- a/macos/Sources/Features/Terminal/BaseTerminalController.swift +++ b/macos/Sources/Features/Terminal/BaseTerminalController.swift @@ -447,7 +447,7 @@ class BaseTerminalController: NSWindowController, case .left: focusDirection = .spatial(.left) case .right: focusDirection = .spatial(.right) } - + // Find the node for the target surface guard let targetNode = surfaceTree.root?.node(view: target) else { return } @@ -462,7 +462,9 @@ class BaseTerminalController: NSWindowController, } // Move focus to the next surface - Ghostty.moveFocus(to: nextSurface, from: target) + DispatchQueue.main.async { + Ghostty.moveFocus(to: nextSurface, from: target) + } } @objc private func ghosttyDidToggleSplitZoom(_ notification: Notification) { diff --git a/src/input/command.zig b/src/input/command.zig index 1ce6aa7cb..4a918cff3 100644 --- a/src/input/command.zig +++ b/src/input/command.zig @@ -274,6 +274,39 @@ fn actionCommands(action: Action.Key) []const Command { }, }, + .goto_split => comptime &.{ + .{ + .action = .{ .goto_split = .previous }, + .title = "Focus Split: Previous", + .description = "Focus the previous split, if any.", + }, + .{ + .action = .{ .goto_split = .next }, + .title = "Focus Split: Next", + .description = "Focus the next split, if any.", + }, + .{ + .action = .{ .goto_split = .left }, + .title = "Focus Split: Left", + .description = "Focus the split to the left, if it exists.", + }, + .{ + .action = .{ .goto_split = .right }, + .title = "Focus Split: Right", + .description = "Focus the split to the right, if it exists.", + }, + .{ + .action = .{ .goto_split = .up }, + .title = "Focus Split: Up", + .description = "Focus the split above, if it exists.", + }, + .{ + .action = .{ .goto_split = .down }, + .title = "Focus Split: Down", + .description = "Focus the split below, if it exists.", + }, + }, + .toggle_split_zoom => comptime &.{.{ .action = .toggle_split_zoom, .title = "Toggle Split Zoom", @@ -396,7 +429,6 @@ fn actionCommands(action: Action.Key) []const Command { .jump_to_prompt, .write_scrollback_file, .goto_tab, - .goto_split, .resize_split, .crash, => comptime &.{},