macOS: Fix New Tab behaviours (#9124)

- Fix `macos-dock-drop-behavior = new-tab` not working, which also
affects `open /path/to/directory -a Ghostty.app`
- Fix 'New Tab' in dock icon not working **when Ghostty's not active**

### Issue preview with `1.2.2(12187)`


https://github.com/user-attachments/assets/18068cc2-c25d-4360-97ab-cec22d5d3ff4
pull/9128/head
Xiangbao Meng 2025-10-10 18:31:55 +02:00 committed by GitHub
parent 207eccffda
commit c8ea42b894
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 3 deletions

View File

@ -465,7 +465,12 @@ class AppDelegate: NSObject,
}
switch ghostty.config.macosDockDropBehavior {
case .new_tab: _ = TerminalController.newTab(ghostty, withBaseConfig: config)
case .new_tab:
_ = TerminalController.newTab(
ghostty,
from: TerminalController.preferredParent?.window,
withBaseConfig: config
)
case .new_window: _ = TerminalController.newWindow(ghostty, withBaseConfig: config)
}
@ -1002,13 +1007,15 @@ class AppDelegate: NSObject,
//UpdateSimulator.happyPath.simulate(with: updateViewModel)
}
@IBAction func newWindow(_ sender: Any?) {
_ = TerminalController.newWindow(ghostty)
}
@IBAction func newTab(_ sender: Any?) {
_ = TerminalController.newTab(ghostty)
_ = TerminalController.newTab(
ghostty,
from: TerminalController.preferredParent?.window
)
}
@IBAction func closeAllWindows(_ sender: Any?) {