Terminal (macOS): fix compatibility with (*term) (#909)

Ignore <shell> (<char>term).
This is because Fig(<shell> (figterm)) migrated to CodeWhisperer(<shell> (cwterm)) and CodeWhisperer renamed to Q(<shell> (qterm)).
Future changes will all be ignored by this change.
Related: #676
This commit is contained in:
Souma
2024-05-09 20:39:17 +09:00
committed by GitHub
parent 2accfbc894
commit ec0af17fb5
@@ -307,10 +307,19 @@ static pid_t getTerminalInfo(FFTerminalResult* result, pid_t pid)
#ifdef __APPLE__
// https://github.com/fastfetch-cli/fastfetch/discussions/501
if (ffStrEndsWith(name, " (figterm)") || ffStrEndsWith(name, " (cwterm)"))
const char* pLeft = strstr(name, " (");
if (pLeft)
{
if (__builtin_expect(getProcessNameAndPpid(ppid, name, &ppid, NULL) != NULL, false))
return 0;
pLeft += 2;
const char* pRight = strstr(pLeft, "term)");
if (pRight && pRight[5] == '\0')
{
for (; pLeft < pRight; ++pLeft)
if (*pLeft < 'a' || *pLeft > 'z')
break;
if (pLeft == pRight && getProcessNameAndPpid(ppid, name, &ppid, NULL) != NULL)
return 0;
}
}
#endif