From ffac35436816508bf12bd65c42f5da01d5993190 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Tue, 26 Mar 2024 08:42:48 +0000 Subject: [PATCH] Terminal (Linux): support Lxterminal version detection --- CHANGELOG.md | 5 +++++ src/detection/terminalshell/terminalshell.c | 13 ++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b1d79f25..9186935cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 2.8.11 + +Features: +* Support Lxterminal version detection + # 2.8.10 Bugfixes: diff --git a/src/detection/terminalshell/terminalshell.c b/src/detection/terminalshell/terminalshell.c index 8fc56d34b..d2df1137b 100644 --- a/src/detection/terminalshell/terminalshell.c +++ b/src/detection/terminalshell/terminalshell.c @@ -400,6 +400,14 @@ FF_MAYBE_UNUSED static bool getTerminalVersionSt(FF_MAYBE_UNUSED FFstrbuf* exe, return version->length > 0; } +FF_MAYBE_UNUSED static bool getTerminalVersionLxterminal(FFstrbuf* exe, FFstrbuf* version) +{ + if(!getExeVersionRaw(exe, version)) return false; + // lxterminal 0.3.2 + ffStrbufSubstrAfterFirstC(version, ' '); + return version->length > 0; +} + static bool getTerminalVersionContour(FFstrbuf* exe, FFstrbuf* version) { const char* env = getenv("TERMINAL_VERSION_STRING"); @@ -410,7 +418,7 @@ static bool getTerminalVersionContour(FFstrbuf* exe, FFstrbuf* version) } if(!getExeVersionRaw(exe, version)) return false; // Contour Terminal Emulator 0.3.12.262 - ffStrbufSubstrAfterFirstC(version, ' '); + ffStrbufSubstrAfterLastC(version, ' '); return version->length > 0; } @@ -525,6 +533,9 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe if(ffStrbufIgnCaseEqualS(processName, "st")) return getTerminalVersionSt(exe, version); + if(ffStrbufIgnCaseEqualS(processName, "lxterminal")) + return getTerminalVersionLxterminal(exe, version); + if(ffStrbufIgnCaseEqualS(processName, "urxvt") || ffStrbufIgnCaseEqualS(processName, "urxvtd") || ffStrbufIgnCaseEqualS(processName, "rxvt") ||