diff --git a/CHANGELOG.md b/CHANGELOG.md index 858ea4776..474deb29b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ Logos: Bugfixes: * `--logo-type` now does accept `iterm` too (@CarterLi, #374) +* Fix mintty terminal font detection Other: * Fixed a Typo in iterm error message (@jessebot, #376) diff --git a/src/common/init.c b/src/common/init.c index b571bf753..0e76a4470 100644 --- a/src/common/init.c +++ b/src/common/init.c @@ -77,6 +77,30 @@ static void initConfigDirs(FFstate* state) ffStrbufEnsureEndsWithC(userHome, '/'); FF_ENSURE_ONLY_ONCE_IN_LIST(userHome) + #ifdef _WIN32 + + if(getenv("MSYSTEM") && getenv("HOME")) + { + // We are in MSYS2 / Git Bash + + FFstrbuf* msysConfigHome = ffListAdd(&state->configDirs); + ffStrbufInitA(msysConfigHome, 64); + ffStrbufAppendS(msysConfigHome, getenv("HOME")); + ffStrbufReplaceAllC(msysConfigHome, '\\', '/'); + ffStrbufEnsureEndsWithC(msysConfigHome, '/'); + ffStrbufAppendS(msysConfigHome, ".config/"); + FF_ENSURE_ONLY_ONCE_IN_LIST(msysConfigHome) + + FFstrbuf* msysHome = ffListAdd(&state->configDirs); + ffStrbufInitA(msysHome, 64); + ffStrbufAppendS(msysHome, getenv("HOME")); + ffStrbufReplaceAllC(msysHome, '\\', '/'); + ffStrbufEnsureEndsWithC(msysHome, '/'); + FF_ENSURE_ONLY_ONCE_IN_LIST(msysHome) + } + + #endif + #if !(defined(_WIN32) || defined(__APPLE__) || defined(__ANDROID__)) FFstrbuf xdgConfigDirs; @@ -112,11 +136,15 @@ static void initConfigDirs(FFstate* state) #endif + #ifndef _WIN32 + FFstrbuf* systemConfig = ffListAdd(&state->configDirs); ffStrbufInitA(systemConfig, 64); ffStrbufAppendS(systemConfig, FASTFETCH_TARGET_DIR_ETC"/"); FF_ENSURE_ONLY_ONCE_IN_LIST(systemConfig) + #endif + #undef FF_ENSURE_ONLY_ONCE_IN_LIST } diff --git a/src/detection/terminalfont/terminalfont_windows.c b/src/detection/terminalfont/terminalfont_windows.c index ea41f018e..060108290 100644 --- a/src/detection/terminalfont/terminalfont_windows.c +++ b/src/detection/terminalfont/terminalfont_windows.c @@ -14,10 +14,14 @@ static void detectMintty(const FFinstance* instance, FFTerminalFontResult* termi FF_STRBUF_AUTO_DESTROY fontSize; ffStrbufInit(&fontSize); - ffParsePropFileHomeValues(instance, ".minttyrc", 2, (FFpropquery[]) { + if(!ffParsePropFileConfigValues(instance, "mintty/config", 2, (FFpropquery[]) { {"Font=", &fontName}, {"FontHeight=", &fontSize} - }); + })) + ffParsePropFileConfigValues(instance, ".minttyrc", 2, (FFpropquery[]) { + {"Font=", &fontName}, + {"FontHeight=", &fontSize} + }); if(fontName.length == 0) ffStrbufAppendS(&fontName, "Lucida Console"); if(fontSize.length == 0)