mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-20 02:36:22 +03:00
macos: add button and menu item for opening scrollback file
This commit is contained in:

committed by
Mitchell Hashimoto

parent
4e9639711c
commit
f9c14c55b4
@ -49,6 +49,7 @@ class AppDelegate: NSObject,
|
||||
@IBOutlet private var menuDecreaseFontSize: NSMenuItem?
|
||||
@IBOutlet private var menuResetFontSize: NSMenuItem?
|
||||
@IBOutlet private var menuTerminalInspector: NSMenuItem?
|
||||
@IBOutlet private var menuOpenScrollback: NSMenuItem?
|
||||
|
||||
@IBOutlet private var menuEqualizeSplits: NSMenuItem?
|
||||
@IBOutlet private var menuMoveSplitDividerUp: NSMenuItem?
|
||||
@ -281,6 +282,7 @@ class AppDelegate: NSObject,
|
||||
syncMenuShortcut(action: "decrease_font_size:1", menuItem: self.menuDecreaseFontSize)
|
||||
syncMenuShortcut(action: "reset_font_size", menuItem: self.menuResetFontSize)
|
||||
syncMenuShortcut(action: "inspector:toggle", menuItem: self.menuTerminalInspector)
|
||||
syncMenuShortcut(action: "write_scrollback_file:open", menuItem: self.menuOpenScrollback)
|
||||
|
||||
// This menu item is NOT synced with the configuration because it disables macOS
|
||||
// global fullscreen keyboard shortcut. The shortcut in the Ghostty config will continue
|
||||
|
@ -30,6 +30,7 @@
|
||||
<outlet property="menuNewWindow" destination="Was-JA-tGl" id="lK7-3I-CPG"/>
|
||||
<outlet property="menuNextSplit" destination="bD7-ei-wKU" id="LeT-xw-eh4"/>
|
||||
<outlet property="menuOpenConfig" destination="BOF-NM-1cW" id="Nze-Go-glw"/>
|
||||
<outlet property="menuOpenScrollback" destination="p4o-jY-u18" id="Vs5-LJ-5Jf"/>
|
||||
<outlet property="menuPaste" destination="i27-pK-umN" id="ICc-X2-gV3"/>
|
||||
<outlet property="menuPreviousSplit" destination="Lic-px-1wg" id="Rto-CG-yRe"/>
|
||||
<outlet property="menuQuit" destination="4sb-4s-VLi" id="qYN-S1-6UW"/>
|
||||
@ -215,6 +216,12 @@
|
||||
<action selector="toggleTerminalInspector:" target="-1" id="87m-3R-fQl"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Open Scrollback" id="p4o-jY-u18">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="openScrollback:" target="-1" id="6xl-Py-iOg"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
|
@ -605,6 +605,11 @@ class TerminalController: NSWindowController, NSWindowDelegate,
|
||||
ghostty.toggleTerminalInspector(surface: surface)
|
||||
}
|
||||
|
||||
@IBAction func openScrollback(_ sender: Any) {
|
||||
guard let surface = focusedSurface?.surface else { return }
|
||||
ghostty.openScrollback(surface: surface)
|
||||
}
|
||||
|
||||
//MARK: - TerminalViewDelegate
|
||||
|
||||
func focusedSurfaceDidChange(to: Ghostty.SurfaceView?) {
|
||||
|
@ -241,6 +241,13 @@ extension Ghostty {
|
||||
}
|
||||
}
|
||||
|
||||
func openScrollback(surface: ghostty_surface_t) {
|
||||
let action = "write_scrollback_file:open"
|
||||
if (!ghostty_surface_binding_action(surface, action, UInt(action.count))) {
|
||||
logger.warning("action failed action=\(action)")
|
||||
}
|
||||
}
|
||||
|
||||
#if os(iOS)
|
||||
// MARK: Ghostty Callbacks (iOS)
|
||||
|
||||
|
@ -952,6 +952,7 @@ extension Ghostty {
|
||||
|
||||
menu.addItem(.separator())
|
||||
menu.addItem(withTitle: "Toggle Terminal Inspector", action: #selector(TerminalController.toggleTerminalInspector(_:)), keyEquivalent: "")
|
||||
menu.addItem(withTitle: "Open Scrollback", action: #selector(TerminalController.openScrollback(_:)), keyEquivalent: "")
|
||||
|
||||
return menu
|
||||
}
|
||||
|
Reference in New Issue
Block a user