TerminalShell (Linux): fix nixos wrapped process name

Fix #814
This commit is contained in:
李通洲 2024-04-27 16:29:35 +08:00
parent 74c89cc03f
commit e157b9a51f

View File

@ -482,14 +482,12 @@ static void setShellInfoDetails(FFShellResult* result)
static void setTerminalInfoDetails(FFTerminalResult* result)
{
if(result->exeName[0] == '.' && ffStrEndsWith(result->exeName, "-wrapped"))
if(ffStrbufStartsWithC(&result->processName, '.') && ffStrbufEndsWithS(&result->processName, "-wrapped"))
{
// For NixOS. Ref: #510 and https://github.com/NixOS/nixpkgs/pull/249428
// We use processName when detecting version and font, overriding it for simplification
ffStrbufSetNS(
&result->processName,
(uint32_t) (strlen(result->exeName) - strlen(".-wrapped")),
result->exeName + 1);
ffStrbufSubstrBefore(&result->processName, result->processName.length - (uint32_t) strlen("-wrapped"));
ffStrbufSubstrAfter(&result->processName, 1);
}
if(ffStrbufEqualS(&result->processName, "wezterm-gui"))