Skip to content

Commit b7a9fe5

Browse files
committed
Terminal (Linux): support tilix version detection
1 parent e5451b6 commit b7a9fe5

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Features:
1414
* Generate manual pages from `help.json` (Doc)
1515
* Detect marketing name of vivo smartphone (Host, Android)
1616
* Add txDrops detection if supported (NetIO, *BSD)
17+
* Support tilix version detection (Terminal, Linux)
1718
* Support percent type config in module level. Example:
1819

1920
```json

src/detection/terminalshell/terminalshell.c

+23
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,26 @@ FF_MAYBE_UNUSED static bool getTerminalVersionPtyxis(FF_MAYBE_UNUSED FFstrbuf* e
641641
ffStrbufSubstrAfterFirstC(version, ' ');
642642
return true;
643643
}
644+
645+
FF_MAYBE_UNUSED static bool getTerminalVersionTilix(FFstrbuf* exe, FFstrbuf* version)
646+
{
647+
if(ffProcessAppendStdOut(version, (char* const[]) {
648+
exe->chars,
649+
"--version",
650+
NULL
651+
}) != NULL)
652+
return false;
653+
654+
uint32_t index = ffStrbufFirstIndexS(version, "Tilix version: ");
655+
if (index == version->length) return false;
656+
657+
index += (uint32_t) strlen("Tilix version:");
658+
uint32_t end = ffStrbufNextIndexC(version, index, '\n');
659+
660+
ffStrbufSubstrBefore(version, end);
661+
ffStrbufSubstrAfter(version, index);
662+
return true;
663+
}
644664
#endif
645665

646666
#ifdef _WIN32
@@ -740,6 +760,9 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe
740760
if(ffStrbufIgnCaseEqualS(processName, "ptyxis-agent"))
741761
return getTerminalVersionPtyxis(exe, version);
742762

763+
if(ffStrbufIgnCaseEqualS(processName, "tilix"))
764+
return getTerminalVersionTilix(exe, version);
765+
743766
#endif
744767

745768
#ifdef _WIN32

0 commit comments

Comments
 (0)