Terminal (Android): reports real app display name instead of hard coding Termux

This commit is contained in:
Carter Li
2026-10-11 10:42:30 +08:00
parent ab6ec4c3f5
commit ad1d12ed38
2 changed files with 17 additions and 1 deletions
+1
View File
@@ -16,6 +16,7 @@ Features:
* Added battery temperature, remaining time and charger type (AC / USB / wireless) detection on Android. (Battery, Android)
* Added media detection on Android when fastfetch runs as an app UID. (Media, Android)
* Requires `Notification access` permission
* Added app display-name detection on Android, so the media module names the player the way the app names itself instead of by its package name, and the terminal module reports the label Termux is installed under. (Media, Terminal, Android)
* Performance improvements & internal cleanups
* Added Finnish language support. (General)
* Added pkgsrc package detection on macOS. (#2627, Packages, Apple)
@@ -1,11 +1,16 @@
#include "terminalshell.h"
#include "common/FFcache.h"
#include "common/debug.h"
#include "common/io.h"
#include "common/parsing.h"
#include "common/processing.h"
#include "common/thread.h"
#include "common/strutil.h"
#ifdef __ANDROID__
#include "common/android/applabel.h"
#endif
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
@@ -324,8 +329,18 @@ static void setTerminalInfoDetails(FFTerminalResult* result) {
#if defined(__ANDROID__)
else if (ffStrbufEqualS(&result->processName, "com.termux"))
else if (ffStrbufEqualS(&result->processName, "com.termux")) {
// The app is installed under a label rather than under its package name, and the label is
// what every screen the user sees calls it -- "Termux:Launcher" on the test device, not
// "Termux". The package name is the fallback for a build whose label cannot be read, which
// includes an app whose label is a literal string in its manifest rather than a resource
// reference; see common/android/applabel.h for what that read costs and when it fails.
ffStrbufInitStatic(&result->prettyName, "Termux");
const char* labelError = ffAndroidGetAppLabel("com.termux", &result->prettyName);
if (labelError != nullptr) {
FF_DEBUG("The label of com.termux could not be resolved: %s", labelError);
}
}
#elif defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__GNU__)