From 9b21ec6e1fafa6ebdabb28aa684d65b4b364043a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Thu, 28 Mar 2024 03:12:46 +0000 Subject: [PATCH] Terminal (Linux): support weston-terminal version detection --- src/detection/terminalshell/terminalshell.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/detection/terminalshell/terminalshell.c b/src/detection/terminalshell/terminalshell.c index d2df1137b..40f5129d3 100644 --- a/src/detection/terminalshell/terminalshell.c +++ b/src/detection/terminalshell/terminalshell.c @@ -408,6 +408,21 @@ FF_MAYBE_UNUSED static bool getTerminalVersionLxterminal(FFstrbuf* exe, FFstrbuf return version->length > 0; } +FF_MAYBE_UNUSED static bool getTerminalVersionWeston(FF_MAYBE_UNUSED FFstrbuf* exe, FFstrbuf* version) +{ + // weston-terminal doesn't report a version, use weston version instead + if(ffProcessAppendStdOut(version, (char* const[]){ + "weston", + "--version", + NULL + })) return false; + + //weston 8.0.0 + ffStrbufSubstrAfterFirstC(version, ' '); + + return version->length > 0; +} + static bool getTerminalVersionContour(FFstrbuf* exe, FFstrbuf* version) { const char* env = getenv("TERMINAL_VERSION_STRING"); @@ -536,6 +551,9 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe if(ffStrbufIgnCaseEqualS(processName, "lxterminal")) return getTerminalVersionLxterminal(exe, version); + if(ffStrbufIgnCaseEqualS(processName, "weston-terminal")) + return getTerminalVersionWeston(exe, version); + if(ffStrbufIgnCaseEqualS(processName, "urxvt") || ffStrbufIgnCaseEqualS(processName, "urxvtd") || ffStrbufIgnCaseEqualS(processName, "rxvt") ||