TerminalFont (macOS): fix Ghostty termfont detection

`~/Library/Application Support/com.mitchellh.ghostty/config` is generated as an empty file if the settings dialog is opened

Fix #1495
This commit is contained in:
李通洲
2025-01-10 09:41:14 +08:00
parent c5c2589f4d
commit 8c227ae4b8
+6 -10
View File
@@ -58,18 +58,14 @@ static void detectGhostty(FFTerminalFontResult* terminalFont)
{"font-size =", &fontSize},
};
if (
#if __APPLE__
!ffParsePropFileConfigValues("com.mitchellh.ghostty/config", 2, fontQueryToml) &&
#endif
!ffParsePropFileConfigValues("ghostty/config", 2, fontQueryToml)
) {
ffStrbufAppendS(&terminalFont->error, "Couldn't find file `ghostty/config`");
return;
}
#if __APPLE__
ffParsePropFileConfigValues("com.mitchellh.ghostty/config", 2, fontQueryToml);
#endif
ffParsePropFileConfigValues("ghostty/config", 2, fontQueryToml);
if(fontName.length == 0)
ffStrbufAppendS(&fontName, "JetBrains Mono");
ffStrbufAppendS(&fontName, "JetBrainsMono Nerd Font");
if(fontSize.length == 0)
ffStrbufAppendS(&fontSize, "13");