macOS: use default app for `*.ghostty` files first (#9180)
A small improvement for #8885, tested `config` and `config.ghostty` <img width="526" height="267" alt="image" src="https://github.com/user-attachments/assets/d09305ab-4a87-4393-b09c-804e618968f3" />pull/9184/head
parent
f5af3d4585
commit
dafb9e89a3
|
|
@ -637,8 +637,9 @@ extension Ghostty {
|
||||||
|
|
||||||
switch action.kind {
|
switch action.kind {
|
||||||
case .text:
|
case .text:
|
||||||
// Open with the default text editor
|
// Open with the default editor for `*.ghostty` file or just system text editor
|
||||||
if let textEditor = NSWorkspace.shared.defaultTextEditor {
|
let editor = NSWorkspace.shared.defaultApplicationURL(forExtension: url.pathExtension) ?? NSWorkspace.shared.defaultTextEditor
|
||||||
|
if let textEditor = editor {
|
||||||
NSWorkspace.shared.open([url], withApplicationAt: textEditor, configuration: NSWorkspace.OpenConfiguration())
|
NSWorkspace.shared.open([url], withApplicationAt: textEditor, configuration: NSWorkspace.OpenConfiguration())
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue