Terminal: correctly detecting version and font on NixOS

This commit is contained in:
李通洲
2023-08-19 10:02:07 +08:00
parent f0a10fcc6d
commit 125759dc75
2 changed files with 11 additions and 4 deletions
+1 -1
View File
@@ -354,7 +354,7 @@ static bool detectTerminalFontCommon(const FFTerminalShellResult* terminalShell,
#ifndef _WIN32
else if(ffStrbufStartsWithIgnCaseS(&terminalShell->terminalExe, "/dev/pts/"))
ffStrbufAppendS(&terminalFont->error, "Terminal font detection is not supported on PTS");
else if(ffStrbufIgnCaseEqualS(&terminalShell->terminalPrettyName, "kitty"))
else if(ffStrbufIgnCaseEqualS(&terminalShell->terminalProcessName, "kitty"))
detectKitty(terminalFont);
else if(ffStrbufStartsWithIgnCaseS(&terminalShell->terminalExe, "/dev/tty"))
detectTTY(terminalFont);
@@ -375,12 +375,19 @@ const FFTerminalShellResult* ffDetectTerminalShell()
ffStrbufInitS(&result.shellPrettyName, result.shellExeName);
}
if(result.terminalExeName[0] == '.' && ffStrEndsWith(result.terminalExeName, "-wrapper"))
{
// For NixOS. Ref: #510 and https://github.com/NixOS/nixpkgs/pull/249428
// We use terminalProcessName when detecting version and font, overriding it for simplication
ffStrbufSetNS(
&result.terminalProcessName,
(uint32_t) (strlen(result.terminalExeName) - strlen(".-wrapper")),
result.terminalExeName + 1);
}
if(ffStrbufEqualS(&result.terminalProcessName, "wezterm-gui"))
ffStrbufInitStatic(&result.terminalPrettyName, "WezTerm");
else if(ffStrbufEqualS(&result.terminalProcessName, ".kitty-wrapped"))
ffStrbufInitStatic(&result.terminalPrettyName, "kitty"); // #510
#if defined(__linux__) || defined(__FreeBSD__)
else if(ffStrbufStartsWithS(&result.terminalProcessName, "gnome-terminal-"))