macos: add "Close Split" to right-click context menu

Add a "Close Split" option to the right-click context menu, allowing
users to close the focused split pane directly from the context menu.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pull/11174/head
Caleb 2026-03-04 16:29:47 -08:00
parent 46522a8779
commit 3b27318510
1 changed files with 11 additions and 0 deletions

View File

@ -1485,6 +1485,9 @@ extension Ghostty {
item.setImageIfDesired(systemSymbolName: "rectangle.bottomhalf.inset.filled")
item = menu.addItem(withTitle: "Split Up", action: #selector(splitUp(_:)), keyEquivalent: "")
item.setImageIfDesired(systemSymbolName: "rectangle.tophalf.inset.filled")
menu.addItem(.separator())
item = menu.addItem(withTitle: "Close Split", action: #selector(closeSurface(_:)), keyEquivalent: "")
item.setImageIfDesired(systemSymbolName: "xmark.rectangle")
menu.addItem(.separator())
item = menu.addItem(withTitle: "Reset Terminal", action: #selector(resetTerminal(_:)), keyEquivalent: "")
@ -1628,6 +1631,14 @@ extension Ghostty {
ghostty_surface_split(surface, GHOSTTY_SPLIT_DIRECTION_UP)
}
@IBAction func closeSurface(_ sender: Any?) {
guard let surface = self.surface else { return }
let action = "close_surface"
if !ghostty_surface_binding_action(surface, action, UInt(action.lengthOfBytes(using: .utf8))) {
AppDelegate.logger.warning("action failed action=\(action)")
}
}
@objc func resetTerminal(_ sender: Any) {
guard let surface = self.surface else { return }
let action = "reset"