mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
macos: support drag and drop with no windows
This commit is contained in:
@ -2,6 +2,21 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Folders</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>LSHandlerRank</key>
|
||||
<string>Alternate</string>
|
||||
<key>LSItemContentTypes</key>
|
||||
<array>
|
||||
<string>public.directory</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
<key>LSEnvironment</key>
|
||||
<dict>
|
||||
<key>GHOSTTY_MAC_APP</key>
|
||||
|
@ -138,6 +138,23 @@ class AppDelegate: NSObject, ObservableObject, NSApplicationDelegate, GhosttyApp
|
||||
return false
|
||||
}
|
||||
|
||||
func application(_ sender: NSApplication, openFile filename: String) -> Bool {
|
||||
AppDelegate.logger.warning("OPEN FILE=\(filename)")
|
||||
|
||||
// Build our config
|
||||
var config = Ghostty.SurfaceConfiguration()
|
||||
config.workingDirectory = filename
|
||||
|
||||
// If we don't have a window open through the window manager, we launch
|
||||
// a new window.
|
||||
guard let mainWindow = windowManager.mainWindow else {
|
||||
windowManager.addNewWindow(withBaseConfig: config)
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/// This is called for the dock right-click menu.
|
||||
func applicationDockMenu(_ sender: NSApplication) -> NSMenu? {
|
||||
return dockMenu
|
||||
|
@ -199,8 +199,6 @@ extension Ghostty {
|
||||
init(from config: ghostty_surface_config_s) {
|
||||
self.fontSize = config.font_size
|
||||
self.workingDirectory = String.init(cString: config.working_directory, encoding: .utf8)
|
||||
let blah = workingDirectory!
|
||||
AppDelegate.logger.warning("OPEN from=\(blah)")
|
||||
}
|
||||
|
||||
/// Returns the ghostty configuration for this surface configuration struct. The memory
|
||||
|
Reference in New Issue
Block a user