Skip to content

Commit ac71ebc

Browse files
committed
Terminal (Linux): support termite version detection
1 parent 383a6c8 commit ac71ebc

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/detection/terminalshell/terminalshell.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,20 @@ FF_MAYBE_UNUSED static bool getTerminalVersionSakura(FFstrbuf* exe, FFstrbuf* ve
707707
ffStrbufSubstrAfterLastC(version, ' ');
708708
return true;
709709
}
710+
711+
FF_MAYBE_UNUSED static bool getTerminalVersionTermite(FFstrbuf* exe, FFstrbuf* version)
712+
{
713+
if(ffProcessAppendStdOut(version, (char* const[]) {
714+
exe->chars,
715+
"--version",
716+
NULL
717+
}) != NULL) // termite v16.9\nvte 0.78.1 +BIDI +GNUTLS +ICU +SYSTEMD
718+
return false;
719+
720+
ffStrbufSubstrBeforeFirstC(version, '\n');
721+
ffStrbufSubstrAfterLastC(version, 'v');
722+
return true;
723+
}
710724
#endif
711725

712726
#ifdef _WIN32
@@ -812,6 +826,9 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe
812826
if(ffStrbufIgnCaseEqualS(processName, "sakura"))
813827
return getTerminalVersionSakura(exe, version);
814828

829+
if(ffStrbufIgnCaseEqualS(processName, "termite"))
830+
return getTerminalVersionTermite(exe, version);
831+
815832
#endif
816833

817834
#ifdef _WIN32

0 commit comments

Comments
 (0)