Add reset-terminal terminal menu workaround (#2349)
This commit is contained in:
parent
63dd7281f5
commit
27db2eb8dd
2 changed files with 134 additions and 5 deletions
|
|
@ -84898,6 +84898,108 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"terminalContextMenu.copy": {
|
||||
"extractionState": "manual",
|
||||
"localizations": {
|
||||
"en": {
|
||||
"stringUnit": {
|
||||
"state": "translated",
|
||||
"value": "Copy"
|
||||
}
|
||||
},
|
||||
"ja": {
|
||||
"stringUnit": {
|
||||
"state": "translated",
|
||||
"value": "コピー"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"terminalContextMenu.paste": {
|
||||
"extractionState": "manual",
|
||||
"localizations": {
|
||||
"en": {
|
||||
"stringUnit": {
|
||||
"state": "translated",
|
||||
"value": "Paste"
|
||||
}
|
||||
},
|
||||
"ja": {
|
||||
"stringUnit": {
|
||||
"state": "translated",
|
||||
"value": "ペースト"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"terminalContextMenu.resetTerminal": {
|
||||
"extractionState": "manual",
|
||||
"localizations": {
|
||||
"en": {
|
||||
"stringUnit": {
|
||||
"state": "translated",
|
||||
"value": "Reset Terminal"
|
||||
}
|
||||
},
|
||||
"ja": {
|
||||
"stringUnit": {
|
||||
"state": "translated",
|
||||
"value": "ターミナルをリセット"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"terminalContextMenu.splitHorizontally": {
|
||||
"extractionState": "manual",
|
||||
"localizations": {
|
||||
"en": {
|
||||
"stringUnit": {
|
||||
"state": "translated",
|
||||
"value": "Split Horizontally"
|
||||
}
|
||||
},
|
||||
"ja": {
|
||||
"stringUnit": {
|
||||
"state": "translated",
|
||||
"value": "水平に分割"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"terminalContextMenu.splitVertically": {
|
||||
"extractionState": "manual",
|
||||
"localizations": {
|
||||
"en": {
|
||||
"stringUnit": {
|
||||
"state": "translated",
|
||||
"value": "Split Vertically"
|
||||
}
|
||||
},
|
||||
"ja": {
|
||||
"stringUnit": {
|
||||
"state": "translated",
|
||||
"value": "垂直に分割"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"terminalContextMenu.triggerFlash": {
|
||||
"extractionState": "manual",
|
||||
"localizations": {
|
||||
"en": {
|
||||
"stringUnit": {
|
||||
"state": "translated",
|
||||
"value": "Trigger Flash"
|
||||
}
|
||||
},
|
||||
"ja": {
|
||||
"stringUnit": {
|
||||
"state": "translated",
|
||||
"value": "フラッシュを発火"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6445,19 +6445,31 @@ class GhosttyNSView: NSView, NSUserInterfaceValidations {
|
|||
|
||||
let menu = NSMenu()
|
||||
if onTriggerFlash != nil {
|
||||
let flashItem = menu.addItem(withTitle: "Trigger Flash", action: #selector(triggerFlash(_:)), keyEquivalent: "")
|
||||
let flashItem = menu.addItem(
|
||||
withTitle: String(localized: "terminalContextMenu.triggerFlash", defaultValue: "Trigger Flash"),
|
||||
action: #selector(triggerFlash(_:)),
|
||||
keyEquivalent: ""
|
||||
)
|
||||
flashItem.target = self
|
||||
menu.addItem(.separator())
|
||||
}
|
||||
if ghostty_surface_has_selection(surface) {
|
||||
let item = menu.addItem(withTitle: "Copy", action: #selector(copy(_:)), keyEquivalent: "")
|
||||
let item = menu.addItem(
|
||||
withTitle: String(localized: "terminalContextMenu.copy", defaultValue: "Copy"),
|
||||
action: #selector(copy(_:)),
|
||||
keyEquivalent: ""
|
||||
)
|
||||
item.target = self
|
||||
}
|
||||
let pasteItem = menu.addItem(withTitle: "Paste", action: #selector(paste(_:)), keyEquivalent: "")
|
||||
let pasteItem = menu.addItem(
|
||||
withTitle: String(localized: "terminalContextMenu.paste", defaultValue: "Paste"),
|
||||
action: #selector(paste(_:)),
|
||||
keyEquivalent: ""
|
||||
)
|
||||
pasteItem.target = self
|
||||
menu.addItem(.separator())
|
||||
let splitHorizontallyItem = menu.addItem(
|
||||
withTitle: "Split Horizontally",
|
||||
withTitle: String(localized: "terminalContextMenu.splitHorizontally", defaultValue: "Split Horizontally"),
|
||||
action: #selector(splitHorizontally(_:)),
|
||||
keyEquivalent: "d"
|
||||
)
|
||||
|
|
@ -6469,7 +6481,7 @@ class GhosttyNSView: NSView, NSUserInterfaceValidations {
|
|||
)
|
||||
|
||||
let splitVerticallyItem = menu.addItem(
|
||||
withTitle: "Split Vertically",
|
||||
withTitle: String(localized: "terminalContextMenu.splitVertically", defaultValue: "Split Vertically"),
|
||||
action: #selector(splitVertically(_:)),
|
||||
keyEquivalent: "d"
|
||||
)
|
||||
|
|
@ -6479,6 +6491,17 @@ class GhosttyNSView: NSView, NSUserInterfaceValidations {
|
|||
systemSymbolName: "rectangle.righthalf.inset.filled",
|
||||
accessibilityDescription: nil
|
||||
)
|
||||
menu.addItem(.separator())
|
||||
let resetTerminalItem = menu.addItem(
|
||||
withTitle: String(localized: "terminalContextMenu.resetTerminal", defaultValue: "Reset Terminal"),
|
||||
action: #selector(resetTerminal(_:)),
|
||||
keyEquivalent: ""
|
||||
)
|
||||
resetTerminalItem.target = self
|
||||
resetTerminalItem.image = NSImage(
|
||||
systemSymbolName: "arrow.trianglehead.2.clockwise",
|
||||
accessibilityDescription: nil
|
||||
)
|
||||
return menu
|
||||
}
|
||||
|
||||
|
|
@ -6516,6 +6539,10 @@ class GhosttyNSView: NSView, NSUserInterfaceValidations {
|
|||
onTriggerFlash?()
|
||||
}
|
||||
|
||||
@objc private func resetTerminal(_ sender: Any?) {
|
||||
_ = performBindingAction("reset")
|
||||
}
|
||||
|
||||
override func mouseMoved(with event: NSEvent) {
|
||||
maybeRequestFirstResponderForMouseFocus()
|
||||
guard let surface = surface else { return }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue