Refactor toggleMaximize to use notifications

This commit is contained in:
Aaron Ruan
2025-04-27 08:48:06 +08:00
parent 334093a9ea
commit 1ec3e331de
4 changed files with 30 additions and 8 deletions

View File

@@ -115,6 +115,11 @@ class BaseTerminalController: NSWindowController,
selector: #selector(ghosttyCommandPaletteDidToggle(_:)),
name: .ghosttyCommandPaletteDidToggle,
object: nil)
center.addObserver(
self,
selector: #selector(toggleMaximize),
name: .ghosttyToggleMaximize,
object: nil)
// Listen for local events that we need to know of outside of
// single surface handlers.
@@ -548,6 +553,11 @@ class BaseTerminalController: NSWindowController,
window.performClose(sender)
}
@IBAction func toggleMaximize(_ sender: Any) {
guard let window = window else { return }
window.zoom(self)
}
@IBAction func splitRight(_ sender: Any) {
guard let surface = focusedSurface?.surface else { return }
ghostty.split(surface: surface, direction: GHOSTTY_SPLIT_DIRECTION_RIGHT)