Add macos-dock-drop-folder-behavior configuration option

This adds a new configuration option that controls whether folders
dropped onto the Ghostty dock icon open in a new tab (default) or
a new window.

The option accepts two values:
- tab: Opens folders in a new tab in the main window (default)
- window: Opens folders in a new window

This is useful for users who prefer window-based workflows over
tab-based workflows when opening folders via drag and drop.
This commit is contained in:
David Keegan
2025-07-31 13:16:52 -06:00
committed by Mitchell Hashimoto
parent d20376c1ff
commit f9ad061ea8
4 changed files with 47 additions and 4 deletions

View File

@@ -402,11 +402,17 @@ class AppDelegate: NSObject,
var config = Ghostty.SurfaceConfiguration()
if (isDirectory.boolValue) {
// When opening a directory, create a new tab in the main
// window with that as the working directory.
// If no windows exist, a new one will be created.
// When opening a directory, check the configuration to decide
// whether to open in a new tab or new window.
config.workingDirectory = filename
_ = TerminalController.newTab(ghostty, withBaseConfig: config)
let behavior = ghostty.config.macosDockDropFolderBehavior
if behavior == .window {
_ = TerminalController.newWindow(ghostty, withBaseConfig: config)
} else {
// Default to tab behavior
_ = TerminalController.newTab(ghostty, withBaseConfig: config)
}
} else {
// When opening a file, we want to execute the file. To do this, we
// don't override the command directly, because it won't load the