From 76d957a144b52b293ab0936e7c47adb72e338d4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Wed, 11 Jan 2023 15:03:42 +0800 Subject: [PATCH] TerminalShell: support gnome-terminal version detection --- src/detection/terminalshell/terminalshell.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/detection/terminalshell/terminalshell.c b/src/detection/terminalshell/terminalshell.c index 2c139b5f2..363fdb418 100644 --- a/src/detection/terminalshell/terminalshell.c +++ b/src/detection/terminalshell/terminalshell.c @@ -162,6 +162,20 @@ FF_MAYBE_UNUSED static bool getTerminalVersionTermux(FFstrbuf* version) return true; } +FF_MAYBE_UNUSED static bool getTerminalVersionGnome(FFstrbuf* version) +{ + if(ffProcessAppendStdOut(version, (char* const[]){ + "gnome-terminal", + "--version", + NULL + })) return false; + + //# GNOME Terminal 3.46.7 using VTE 0.70.2 +BIDI +GNUTLS +ICU +SYSTEMD + ffStrbufSubstrAfterFirstS(version, "Terminal "); + ffStrbufSubstrBeforeFirstC(version, ' '); + return true; +} + bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe, FFstrbuf* version) { #ifdef __ANDROID__ @@ -171,6 +185,13 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe #endif + #if defined(__linux__) || defined(__FreeBSD__) + + if(ffStrbufIgnCaseEqualS(processName, "gnome-terminal-")) + return getTerminalVersionGnome(version); + + #endif + const char* termProgramVersion = getenv("TERM_PROGRAM_VERSION"); if(termProgramVersion) {