From b9e4d04d6578acdcb31c64aeecbd26e265769a94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Mon, 31 Aug 2026 19:08:33 +0800 Subject: [PATCH] Global: addresses review comments generated by CI --- CHANGELOG.md | 2 +- CMakeLists.txt | 2 +- doc/json_schema.json | 4 ++-- src/common/impl/FFPlatform_unix.c | 2 ++ src/detection/processes/processes_gnu.c | 3 +-- src/detection/processes/processes_nosupport.c | 2 +- src/detection/terminalfont/terminalfont_android.c | 3 ++- src/detection/top/top_gnu.c | 3 +++ src/modules/diskio/diskio.c | 3 +++ src/modules/netio/netio.c | 3 +++ src/modules/top/top.c | 6 +++--- 11 files changed, 22 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a18be3800..6e9021131 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# Unreleased +# 2.68.0 Changes: * The DE / WM / LM modules now reports the full name "Desktop Environment" / "Window Manager" / "Login Manager" instead of the abbreviations. diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d526dbb7..995c2049d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.21.0) # C_STANDARD project(fastfetch - VERSION 2.67.1 + VERSION 2.68.0 LANGUAGES C DESCRIPTION "Fast neofetch-like system information tool" HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch" diff --git a/doc/json_schema.json b/doc/json_schema.json index b2f07370d..1ec527f38 100644 --- a/doc/json_schema.json +++ b/doc/json_schema.json @@ -322,7 +322,7 @@ "type": "string" }, "cpuFormat": { - "description": "Output format for the `CPU` module. See Wiki for formatting syntax\n 1. {name}: Name\n 2. {vendor}: Vendor\n 3. {cores-physical}: Physical core count\n 4. {cores-logical}: Logical core count\n 5. {cores-online}: Online core count\n 6. {freq-base}: Base frequency (formatted)\n 7. {freq-max}: Max frequency (formatted)\n 8. {temperature}: Temperature (formatted)\n 9. {core-types}: Logical core count grouped by frequency\n 10. {packages}: Processor package count\n 11. {march}: CPU microarchitecture\n 12. {numa-nodes}: NUMA node count", + "description": "Output format for the `CPU` module. See Wiki for formatting syntax\n 1. {name}: Name\n 2. {vendor}: Vendor\n 3. {cores-physical}: Physical core count\n 4. {cores-logical}: Logical core count\n 5. {cores-online}: Online core count\n 6. {freq-base}: Base frequency (formatted)\n 7. {freq-max}: Max frequency (formatted)\n 8. {temperature}: Temperature (formatted)\n 9. {core-types}: Logical core count grouped by frequency\n 10. {packages}: Processor package count\n 11. {march}: CPU microarchitecture\n 12. {numa-nodes}: NUMA node count\n 13. {code-name}: CPU code name\n 14. {technology}: CPU technology", "type": "string" }, "cpucacheFormat": { @@ -506,7 +506,7 @@ "type": "string" }, "topFormat": { - "description": "Output format for the `Top` module. See Wiki for formatting syntax\n 1. {name}: Process name\n 2. {path}: Executable path\n 3. {pid}: Process ID\n 4. {cpu}: CPU usage\n 5. {mem}: Memory usage (RSS) in bytes\n 6. {disk-read}: Disk read bytes per second (0 if unsupported)\n 7. {disk-write}: Disk write bytes per second (0 if unsupported)\n 8. {cpu-percentage}: CPU usage percentage\n 9. {mem-formatted}: Memory usage (RSS) formatted\n 10. {disk-read-formatted}: Disk read formatted\n 11. {disk-write-formatted}: Disk write formatted", + "description": "Output format for the `Top` module. See Wiki for formatting syntax\n 1. {name}: Process name\n 2. {pid}: Process ID\n 3. {cpu}: CPU usage\n 4. {mem}: Memory usage (RSS) in bytes\n 5. {disk-read}: Disk read bytes per second (0 if unsupported)\n 6. {disk-write}: Disk write bytes per second (0 if unsupported)\n 7. {cpu-percentage}: CPU usage percentage\n 8. {mem-formatted}: Memory usage (RSS) formatted\n 9. {disk-read-formatted}: Disk read formatted\n 10. {disk-write-formatted}: Disk write formatted", "type": "string" }, "themeFormat": { diff --git a/src/common/impl/FFPlatform_unix.c b/src/common/impl/FFPlatform_unix.c index e3ea77f51..92f0e8634 100644 --- a/src/common/impl/FFPlatform_unix.c +++ b/src/common/impl/FFPlatform_unix.c @@ -238,7 +238,9 @@ static void getDataDirs(FFPlatform* platform) { ffPlatformPathAddHome(&platform->dataDirs, platform, ""); platformPathAddEnv(&platform->dataDirs, "XDG_DATA_DIRS"); +#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) ffPlatformPathAddAbsolute(&platform->dataDirs, FF_PATH_PKG_BASE "/share/"); +#endif ffPlatformPathAddAbsolute(&platform->dataDirs, FASTFETCH_TARGET_DIR_USR "/local/share/"); ffPlatformPathAddAbsolute(&platform->dataDirs, FASTFETCH_TARGET_DIR_USR "/share/"); } diff --git a/src/detection/processes/processes_gnu.c b/src/detection/processes/processes_gnu.c index ba4351f5e..53c9781c6 100644 --- a/src/detection/processes/processes_gnu.c +++ b/src/detection/processes/processes_gnu.c @@ -29,13 +29,12 @@ const char* ffDetectProcesses(const FFProcessesOptions* options, FFProcessesResu continue; } + ++result->processes; if (proc_stat_has(stat, PSTAT_NUM_THREADS)) { result->threads += proc_stat_num_threads(stat); } } - result->processes = (uint32_t) list->num_procs; - done: if (list) { proc_stat_list_free(list); diff --git a/src/detection/processes/processes_nosupport.c b/src/detection/processes/processes_nosupport.c index e7218a5c2..04a5eafd8 100644 --- a/src/detection/processes/processes_nosupport.c +++ b/src/detection/processes/processes_nosupport.c @@ -1,5 +1,5 @@ #include "processes.h" -const char* ffDetectProcesses([[maybe_unused]] FFProcessesResult* result) { +const char* ffDetectProcesses([[maybe_unused]] const FFProcessesOptions* options, [[maybe_unused]] FFProcessesResult* result) { return "Not supported on this platform"; } diff --git a/src/detection/terminalfont/terminalfont_android.c b/src/detection/terminalfont/terminalfont_android.c index 7ef0f5250..494dcee1f 100644 --- a/src/detection/terminalfont/terminalfont_android.c +++ b/src/detection/terminalfont/terminalfont_android.c @@ -16,7 +16,8 @@ const char* detectTermux(FFTerminalFontResult* terminalFont) { FF_STRBUF_AUTO_DESTROY fontSize = ffStrbufCreate(); // SharedPreferences XML: 14, in px - if (ffParsePropFile(FF_TERMUX_PREF_PATH, "", &fontSize)) { + ffParsePropFile(FF_TERMUX_PREF_PATH, "", &fontSize); + if (fontSize.length > 0) { ffStrbufAppendS(&fontSize, "px"); } diff --git a/src/detection/top/top_gnu.c b/src/detection/top/top_gnu.c index 0407124fb..37845a640 100644 --- a/src/detection/top/top_gnu.c +++ b/src/detection/top/top_gnu.c @@ -57,6 +57,9 @@ const char* ffTopGetProcessSnapshot(FFlist* snapshots, FFTopTypes) { } item->pid = pid; + item->cpuTime = 0; + item->memBytes = 0; + item->startTime = 0; if (proc_stat_has(stat, PSTAT_TASK_BASIC)) { const task_basic_info_t info = proc_stat_task_basic_info(stat); diff --git a/src/modules/diskio/diskio.c b/src/modules/diskio/diskio.c index 71f6970d8..61ed83001 100644 --- a/src/modules/diskio/diskio.c +++ b/src/modules/diskio/diskio.c @@ -111,6 +111,9 @@ void ffParseDiskIOJsonObject(FFDiskIOOptions* options, yyjson_val* module) { if (unsafe_yyjson_equals_str(key, "waitTime")) { options->waitTime = (uint32_t) yyjson_get_uint(val); + if (options->waitTime == 0) { + options->waitTime = 1; + } continue; } diff --git a/src/modules/netio/netio.c b/src/modules/netio/netio.c index 0729b444e..0ffe4f1d3 100644 --- a/src/modules/netio/netio.c +++ b/src/modules/netio/netio.c @@ -126,6 +126,9 @@ void ffParseNetIOJsonObject(FFNetIOOptions* options, yyjson_val* module) { if (unsafe_yyjson_equals_str(key, "waitTime")) { options->waitTime = (uint32_t) yyjson_get_uint(val); + if (options->waitTime == 0) { + options->waitTime = 1; + } continue; } diff --git a/src/modules/top/top.c b/src/modules/top/top.c index 60b5a614e..7087e38ed 100644 --- a/src/modules/top/top.c +++ b/src/modules/top/top.c @@ -43,7 +43,7 @@ static void printTopResult(FFTopOptions* options, uint32_t index, uint32_t total FF_STRBUF_AUTO_DESTROY diskWriteFormatted = ffStrbufCreate(); ffSizeAppendNum(process->bytesWritten, &diskWriteFormatted); ffStrbufAppendS(&diskWriteFormatted, "/s"); - FF_PRINT_FORMAT_CHECKED(FF_MODULE_GET_DISPLAY_NAME(Top), (uint8_t) index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]){ + FF_PRINT_FORMAT_CHECKED(FF_MODULE_GET_DISPLAY_NAME(Top), total == 1 ? 0 : (uint8_t) (index + 1), &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]){ FF_ARG(process->name, "name"), FF_ARG(process->pid, "pid"), FF_ARG(process->cpuPercent, "cpu"), @@ -73,11 +73,12 @@ bool ffPrintTop(FFTopOptions* options) { } else { ffPrintLogoAndKey(FF_MODULE_GET_DISPLAY_NAME(Top), 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT); FF_LIST_FOR_EACH (FFTopProcessResult, process, results) { - ffStrbufWriteTo(&process->name, stdout); if ((void*) process != results.data) { putchar(' '); } + ffStrbufWriteTo(&process->name, stdout); } + putchar('\n'); } FF_LIST_FOR_EACH (FFTopProcessResult, item, results) { @@ -271,7 +272,6 @@ FFModuleBaseInfo ffTopModuleInfo = { .generateJsonConfig = (void*) ffGenerateTopJsonConfig, .formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]){ { "Process name", "name" }, - { "Executable path", "path" }, { "Process ID", "pid" }, { "CPU usage", "cpu" }, { "Memory usage (RSS) in bytes", "mem" },