feat: implement toggleMaximize for macOS

This commit is contained in:
Aaron Ruan
2025-04-25 15:59:44 +08:00
parent 4e91d11a60
commit 334093a9ea
3 changed files with 17 additions and 1 deletions

View File

@@ -807,6 +807,12 @@ class AppDelegate: NSObject,
setSecureInput(.toggle)
}
@IBAction func toggleMaximize(_ sender: Any) {
if NSApp.isActive, let keyWindow = NSApp.keyWindow {
keyWindow.zoom(self)
}
}
@IBAction func toggleQuickTerminal(_ sender: Any) {
if quickController == nil {
quickController = QuickTerminalController(

View File

@@ -29,7 +29,6 @@ struct TerminalCommandPaletteView: View {
let key = String(cString: c.action_key)
switch (key) {
case "toggle_tab_overview",
"toggle_maximize",
"toggle_window_decorations":
return false
default:

View File

@@ -523,6 +523,9 @@ extension Ghostty {
case GHOSTTY_ACTION_TOGGLE_COMMAND_PALETTE:
toggleCommandPalette(app, target: target)
case GHOSTTY_ACTION_TOGGLE_MAXIMIZE:
toggleMaximize(app, target: target)
case GHOSTTY_ACTION_TOGGLE_QUICK_TERMINAL:
toggleQuickTerminal(app, target: target)
@@ -767,6 +770,14 @@ extension Ghostty {
}
}
private static func toggleMaximize(
_ app: ghostty_app_t,
target: ghostty_target_s
) {
guard let appDelegate = NSApplication.shared.delegate as? AppDelegate else { return }
appDelegate.toggleMaximize(self)
}
private static func toggleVisibility(
_ app: ghostty_app_t,
target: ghostty_target_s