From 56d22292b0fa3cb0b5775ab7627dc0869685b52a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Thu, 14 Aug 2025 16:04:55 +0800 Subject: [PATCH 1/4] Revert "Percent: fix a copy-paste error" This reverts commit 3345c1e9dda1434fe108ca4117a48abd356b5dbc. --- src/common/percent.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/percent.c b/src/common/percent.c index e14c62a8d6..f609b1c196 100644 --- a/src/common/percent.c +++ b/src/common/percent.c @@ -146,9 +146,9 @@ void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFPercentageModuleConf for (uint8_t i = blocksPercent; i < options->barWidth; ++i) { ffStrbufAppend(buffer, borderAsValue && i == 0 - ? &options->barBorderLeftElapsed + ? &options->barBorderLeft : borderAsValue && i == options->barWidth - 1 - ? &options->barBorderRightElapsed + ? &options->barBorderRight : &options->barCharTotal); } } From 81bac8bca4be4cd7f3ab89fc668411fd114918e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Thu, 14 Aug 2025 16:47:30 +0800 Subject: [PATCH 2/4] Percent: refactors bar color logic for clarity and consistency; update examples --- doc/json_schema.json | 18 ++++++++---- presets/examples/29.jsonc | 6 ++-- src/common/percent.c | 60 +++++++++++++++++++-------------------- 3 files changed, 45 insertions(+), 39 deletions(-) diff --git a/doc/json_schema.json b/doc/json_schema.json index a1e66b3f9d..6e09686670 100644 --- a/doc/json_schema.json +++ b/doc/json_schema.json @@ -2,11 +2,19 @@ "$schema": "https://json-schema.org/draft-07/schema", "$defs": { "colors": { - "type": "string", - "description": "https://github.com/fastfetch-cli/fastfetch/wiki/Color-Format-Specification", - "examples": [ - "reset_", "bright_", "dim_", "italic_", "underline_", "blink_", "inverse_", "hidden_", "strike_", "light_", - "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "default" + "oneOf": [ + { + "type": "string", + "$comment": "https://github.com/fastfetch-cli/fastfetch/wiki/Color-Format-Specification", + "examples": [ + "reset_", "bright_", "dim_", "italic_", "underline_", "blink_", "inverse_", "hidden_", "strike_", "light_", + "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "default" + ] + }, + { + "type": "null", + "$comment": "Disable default color" + } ] }, "key": { diff --git a/presets/examples/29.jsonc b/presets/examples/29.jsonc index 493350a439..25b25a4c26 100644 --- a/presets/examples/29.jsonc +++ b/presets/examples/29.jsonc @@ -15,9 +15,9 @@ "bar": { "border": { "left": "[", - "leftElapsed": "[─", + "leftElapsed": "[", "right": "]", - "rightElapsed": "─]" + "rightElapsed": "]" }, "char": { "elapsed": "─", @@ -27,7 +27,7 @@ "elapsed": "default", "total": "light_black" }, - "width": 14 + "width": 16 }, "color": { "separator": "default", diff --git a/src/common/percent.c b/src/common/percent.c index f609b1c196..ea41596d8b 100644 --- a/src/common/percent.c +++ b/src/common/percent.c @@ -97,40 +97,38 @@ void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFPercentageModuleConf bool autoColorElapsed = ffStrbufIgnCaseEqualS(&options->barColorElapsed, "auto"); + bool monochrome = (percentType & FF_PERCENTAGE_TYPE_BAR_MONOCHROME_BIT) || !autoColorElapsed; + if (!options->pipe && options->barColorElapsed.length > 0 && monochrome) + { + const char* color = NULL; + if (!autoColorElapsed) + color = options->barColorElapsed.chars; + else if (green <= yellow) + { + if (percent < green) color = colorGreen; + else if (percent < yellow) color = colorYellow; + else color = colorRed; + } + else + { + if (percent < yellow) color = colorRed; + else if (percent < green) color = colorYellow; + else color = colorGreen; + } + ffStrbufAppendF(buffer, "\e[%sm", color); + } for (uint8_t i = 0; i < blocksPercent; ++i) { - if(!options->pipe && options->barColorElapsed.length > 0) + if (!options->pipe && options->barColorElapsed.length > 0 && !monochrome) { - if ((percentType & FF_PERCENTAGE_TYPE_BAR_MONOCHROME_BIT) || !autoColorElapsed) - { - const char* color = NULL; - if (!autoColorElapsed) - color = options->barColorElapsed.chars; - else if (green <= yellow) - { - if (percent < green) color = colorGreen; - else if (percent < yellow) color = colorYellow; - else color = colorRed; - } - else - { - if (percent < yellow) color = colorRed; - else if (percent < green) color = colorYellow; - else color = colorGreen; - } - ffStrbufAppendF(buffer, "\e[%sm", color); - } - else - { - uint32_t section1Begin = (uint32_t) ((green <= yellow ? green : yellow) / 100.0 * options->barWidth + 0.5); - uint32_t section2Begin = (uint32_t) ((green > yellow ? green : yellow) / 100.0 * options->barWidth + 0.5); - if (i == section2Begin) - ffStrbufAppendF(buffer, "\e[%sm", (green > yellow ? colorGreen : colorRed)); - else if (i == section1Begin) - ffStrbufAppendF(buffer, "\e[%sm", colorYellow); - else if (i == 0) - ffStrbufAppendF(buffer, "\e[%sm", (green <= yellow ? colorGreen : colorRed)); - } + uint32_t section1Begin = (uint32_t) ((green <= yellow ? green : yellow) / 100.0 * options->barWidth + 0.5); + uint32_t section2Begin = (uint32_t) ((green > yellow ? green : yellow) / 100.0 * options->barWidth + 0.5); + if (i == section2Begin) + ffStrbufAppendF(buffer, "\e[%sm", (green > yellow ? colorGreen : colorRed)); + else if (i == section1Begin) + ffStrbufAppendF(buffer, "\e[%sm", colorYellow); + else if (i == 0) + ffStrbufAppendF(buffer, "\e[%sm", (green <= yellow ? colorGreen : colorRed)); } ffStrbufAppend(buffer, borderAsValue && i == 0 ? &options->barBorderLeftElapsed From bb9ca73db10b1e48c62533a0be83b9815d4d5c16 Mon Sep 17 00:00:00 2001 From: Guiling Qiyu <114603828+GuilingQiyu@users.noreply.github.com> Date: Thu, 14 Aug 2025 18:06:42 +0800 Subject: [PATCH 3/4] Packages (Linux): fixes Linglong detection on Debian (#1899) Fixes #1898 --- src/detection/packages/packages_linux.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/detection/packages/packages_linux.c b/src/detection/packages/packages_linux.c index 2fb000300b..04bf4935b5 100644 --- a/src/detection/packages/packages_linux.c +++ b/src/detection/packages/packages_linux.c @@ -446,7 +446,12 @@ static void getPackageCounts(FFstrbuf* baseDir, FFPackagesResult* packageCounts, { packageCounts->guixSystem += getGuixPackages(baseDir, "/run/current-system/profile"); } - if (!(options->disabled & FF_PACKAGES_FLAG_LINGLONG_BIT)) packageCounts->linglong += getNumElements(baseDir, "/var/lib/linglong/repo/refs/heads/main", true); + if (!(options->disabled & FF_PACKAGES_FLAG_LINGLONG_BIT)) + { + packageCounts->linglong += getNumElements(baseDir, "/var/lib/linglong/repo/refs/heads/main", true); + if (packageCounts->linglong == 0) + packageCounts->linglong += getNumElements(baseDir, "/var/lib/linglong/repo/refs/remotes/stable/main", true); + } if (!(options->disabled & FF_PACKAGES_FLAG_PACSTALL_BIT)) packageCounts->pacstall += getNumElements(baseDir, "/var/lib/pacstall/metadata", false); if (!(options->disabled & FF_PACKAGES_FLAG_PISI_BIT)) packageCounts->pisi += getNumElements(baseDir, "/var/lib/pisi/package", true); if (!(options->disabled & FF_PACKAGES_FLAG_PKGSRC_BIT)) packageCounts->pkgsrc += getNumElements(baseDir, "/usr/pkg/pkgdb", DT_DIR); From 1479de19ef45c6db2c79237b39d17668e5890388 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Thu, 14 Aug 2025 18:34:30 +0800 Subject: [PATCH 4/4] Release: v2.50.1 --- CHANGELOG.md | 6 ++++++ CMakeLists.txt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fcb195631..aa772285ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# 2.50.1 + +Bugfixes: +* Fixes percentage bar not displaying correctly in certain cases +* Fixes linglong package detection on Debian 13 (#1899, Packages, Linux) + # 2.50.0 Changes: diff --git a/CMakeLists.txt b/CMakeLists.txt index d162f508db..98b839efb3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url project(fastfetch - VERSION 2.50.0 + VERSION 2.50.1 LANGUAGES C DESCRIPTION "Fast neofetch-like system information tool" HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"