Skip to content

Commit 125759d

Browse files
committed
Terminal: correctly detecting version and font on NixOS
1 parent f0a10fc commit 125759d

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/detection/terminalfont/terminalfont.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ static bool detectTerminalFontCommon(const FFTerminalShellResult* terminalShell,
354354
#ifndef _WIN32
355355
else if(ffStrbufStartsWithIgnCaseS(&terminalShell->terminalExe, "/dev/pts/"))
356356
ffStrbufAppendS(&terminalFont->error, "Terminal font detection is not supported on PTS");
357-
else if(ffStrbufIgnCaseEqualS(&terminalShell->terminalPrettyName, "kitty"))
357+
else if(ffStrbufIgnCaseEqualS(&terminalShell->terminalProcessName, "kitty"))
358358
detectKitty(terminalFont);
359359
else if(ffStrbufStartsWithIgnCaseS(&terminalShell->terminalExe, "/dev/tty"))
360360
detectTTY(terminalFont);

src/detection/terminalshell/terminalshell_linux.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -375,12 +375,19 @@ const FFTerminalShellResult* ffDetectTerminalShell()
375375
ffStrbufInitS(&result.shellPrettyName, result.shellExeName);
376376
}
377377

378+
if(result.terminalExeName[0] == '.' && ffStrEndsWith(result.terminalExeName, "-wrapper"))
379+
{
380+
// For NixOS. Ref: #510 and https://github.com/NixOS/nixpkgs/pull/249428
381+
// We use terminalProcessName when detecting version and font, overriding it for simplication
382+
ffStrbufSetNS(
383+
&result.terminalProcessName,
384+
(uint32_t) (strlen(result.terminalExeName) - strlen(".-wrapper")),
385+
result.terminalExeName + 1);
386+
}
387+
378388

379389
if(ffStrbufEqualS(&result.terminalProcessName, "wezterm-gui"))
380390
ffStrbufInitStatic(&result.terminalPrettyName, "WezTerm");
381-
else if(ffStrbufEqualS(&result.terminalProcessName, ".kitty-wrapped"))
382-
ffStrbufInitStatic(&result.terminalPrettyName, "kitty"); // #510
383-
384391
#if defined(__linux__) || defined(__FreeBSD__)
385392

386393
else if(ffStrbufStartsWithS(&result.terminalProcessName, "gnome-terminal-"))

0 commit comments

Comments
 (0)