Skip to content

Commit

Permalink
Terminal: better tmux version detection
Browse files Browse the repository at this point in the history
  • Loading branch information
CarterLi committed Feb 26, 2024
1 parent 743eeba commit e046787
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/detection/terminalshell/terminalshell.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,20 @@ static bool getTerminalVersionScreen(FFstrbuf* exe, FFstrbuf* version)
return version->length > 0;
}

static bool getTerminalVersionTmux(FFstrbuf* exe, FFstrbuf* version)
{
if (ffProcessAppendStdOut(version, (char* const[]) {
exe->chars,
"-V",
NULL
}) != NULL)
return false;

// tmux 3.4
ffStrbufSubstrAfterFirstC(version, ' ');
return version->length > 0;
}

#ifdef _WIN32

static bool getTerminalVersionWindowsTerminal(FFstrbuf* exe, FFstrbuf* version)
Expand Down Expand Up @@ -572,6 +586,9 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe
}
}

if(ffStrbufStartsWithIgnCaseS(processName, "tmux"))
return getTerminalVersionTmux(exe, version);

#ifdef _WIN32

return getFileVersion(exe->chars, version);
Expand Down

0 comments on commit e046787

Please sign in to comment.