From d7e90942973a5cf71e208a78877666ce43c8e243 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Thu, 30 May 2024 09:27:35 +0800 Subject: [PATCH] Shell (macOS): better xonsh detection Fix #977 --- CHANGELOG.md | 1 + src/common/processing_linux.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c60906388..d1f0cb5f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ Features: * See `fastfetch -h format` for detail * Add option `--color-separator` to set the color of key-value separators * Support Guix package manager count (#792, Packages, Linux) +* Improve python based shell detection (#977, Shell, macOS) Bugfixes: * Don't detect `.conf` files in `--list-config-paths` diff --git a/src/common/processing_linux.c b/src/common/processing_linux.c index 912cbc7f4..24ae675b8 100644 --- a/src/common/processing_linux.c +++ b/src/common/processing_linux.c @@ -165,6 +165,18 @@ void ffProcessGetInfoLinux(pid_t pid, FFstrbuf* processName, FFstrbuf* exe, cons do arg0++; while (*arg0 == '\0'); assert(arg0 < procArgs2 + len); + + { + // #977 + char* p = (char*) strrchr(arg0, '/'); + if (p) + { + p++; + if (ffStrStartsWithIgnCase(p, "python")) // /opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/Resources/Python.app/Contents/MacOS/Python /Users/carter/.local/bin/xonsh + arg0 = p + strlen(p) + 1; + } + } + if (*arg0 == '-') arg0++; // Login shells ffStrbufSetS(exe, arg0);