Skip to content

Commit 7bacf20

Browse files
authored
Merge pull request #1901 from fastfetch-cli/dev
Release: v2.50.1
2 parents 9a11ff8 + 1479de1 commit 7bacf20

File tree

6 files changed

+60
-43
lines changed

6 files changed

+60
-43
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 2.50.1
2+
3+
Bugfixes:
4+
* Fixes percentage bar not displaying correctly in certain cases
5+
* Fixes linglong package detection on Debian 13 (#1899, Packages, Linux)
6+
17
# 2.50.0
28

39
Changes:

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url
22

33
project(fastfetch
4-
VERSION 2.50.0
4+
VERSION 2.50.1
55
LANGUAGES C
66
DESCRIPTION "Fast neofetch-like system information tool"
77
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"

doc/json_schema.json

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,19 @@
22
"$schema": "https://json-schema.org/draft-07/schema",
33
"$defs": {
44
"colors": {
5-
"type": "string",
6-
"description": "https://github.com/fastfetch-cli/fastfetch/wiki/Color-Format-Specification",
7-
"examples": [
8-
"reset_", "bright_", "dim_", "italic_", "underline_", "blink_", "inverse_", "hidden_", "strike_", "light_",
9-
"black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "default"
5+
"oneOf": [
6+
{
7+
"type": "string",
8+
"$comment": "https://github.com/fastfetch-cli/fastfetch/wiki/Color-Format-Specification",
9+
"examples": [
10+
"reset_", "bright_", "dim_", "italic_", "underline_", "blink_", "inverse_", "hidden_", "strike_", "light_",
11+
"black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "default"
12+
]
13+
},
14+
{
15+
"type": "null",
16+
"$comment": "Disable default color"
17+
}
1018
]
1119
},
1220
"key": {

presets/examples/29.jsonc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
"bar": {
1616
"border": {
1717
"left": "[",
18-
"leftElapsed": "[",
18+
"leftElapsed": "[",
1919
"right": "]",
20-
"rightElapsed": "]"
20+
"rightElapsed": "]"
2121
},
2222
"char": {
2323
"elapsed": "",
@@ -27,7 +27,7 @@
2727
"elapsed": "default",
2828
"total": "light_black"
2929
},
30-
"width": 14
30+
"width": 16
3131
},
3232
"color": {
3333
"separator": "default",

src/common/percent.c

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -97,40 +97,38 @@ void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFPercentageModuleConf
9797

9898
bool autoColorElapsed = ffStrbufIgnCaseEqualS(&options->barColorElapsed, "auto");
9999

100+
bool monochrome = (percentType & FF_PERCENTAGE_TYPE_BAR_MONOCHROME_BIT) || !autoColorElapsed;
101+
if (!options->pipe && options->barColorElapsed.length > 0 && monochrome)
102+
{
103+
const char* color = NULL;
104+
if (!autoColorElapsed)
105+
color = options->barColorElapsed.chars;
106+
else if (green <= yellow)
107+
{
108+
if (percent < green) color = colorGreen;
109+
else if (percent < yellow) color = colorYellow;
110+
else color = colorRed;
111+
}
112+
else
113+
{
114+
if (percent < yellow) color = colorRed;
115+
else if (percent < green) color = colorYellow;
116+
else color = colorGreen;
117+
}
118+
ffStrbufAppendF(buffer, "\e[%sm", color);
119+
}
100120
for (uint8_t i = 0; i < blocksPercent; ++i)
101121
{
102-
if(!options->pipe && options->barColorElapsed.length > 0)
122+
if (!options->pipe && options->barColorElapsed.length > 0 && !monochrome)
103123
{
104-
if ((percentType & FF_PERCENTAGE_TYPE_BAR_MONOCHROME_BIT) || !autoColorElapsed)
105-
{
106-
const char* color = NULL;
107-
if (!autoColorElapsed)
108-
color = options->barColorElapsed.chars;
109-
else if (green <= yellow)
110-
{
111-
if (percent < green) color = colorGreen;
112-
else if (percent < yellow) color = colorYellow;
113-
else color = colorRed;
114-
}
115-
else
116-
{
117-
if (percent < yellow) color = colorRed;
118-
else if (percent < green) color = colorYellow;
119-
else color = colorGreen;
120-
}
121-
ffStrbufAppendF(buffer, "\e[%sm", color);
122-
}
123-
else
124-
{
125-
uint32_t section1Begin = (uint32_t) ((green <= yellow ? green : yellow) / 100.0 * options->barWidth + 0.5);
126-
uint32_t section2Begin = (uint32_t) ((green > yellow ? green : yellow) / 100.0 * options->barWidth + 0.5);
127-
if (i == section2Begin)
128-
ffStrbufAppendF(buffer, "\e[%sm", (green > yellow ? colorGreen : colorRed));
129-
else if (i == section1Begin)
130-
ffStrbufAppendF(buffer, "\e[%sm", colorYellow);
131-
else if (i == 0)
132-
ffStrbufAppendF(buffer, "\e[%sm", (green <= yellow ? colorGreen : colorRed));
133-
}
124+
uint32_t section1Begin = (uint32_t) ((green <= yellow ? green : yellow) / 100.0 * options->barWidth + 0.5);
125+
uint32_t section2Begin = (uint32_t) ((green > yellow ? green : yellow) / 100.0 * options->barWidth + 0.5);
126+
if (i == section2Begin)
127+
ffStrbufAppendF(buffer, "\e[%sm", (green > yellow ? colorGreen : colorRed));
128+
else if (i == section1Begin)
129+
ffStrbufAppendF(buffer, "\e[%sm", colorYellow);
130+
else if (i == 0)
131+
ffStrbufAppendF(buffer, "\e[%sm", (green <= yellow ? colorGreen : colorRed));
134132
}
135133
ffStrbufAppend(buffer, borderAsValue && i == 0
136134
? &options->barBorderLeftElapsed
@@ -146,9 +144,9 @@ void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFPercentageModuleConf
146144
for (uint8_t i = blocksPercent; i < options->barWidth; ++i)
147145
{
148146
ffStrbufAppend(buffer, borderAsValue && i == 0
149-
? &options->barBorderLeftElapsed
147+
? &options->barBorderLeft
150148
: borderAsValue && i == options->barWidth - 1
151-
? &options->barBorderRightElapsed
149+
? &options->barBorderRight
152150
: &options->barCharTotal);
153151
}
154152
}

src/detection/packages/packages_linux.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,12 @@ static void getPackageCounts(FFstrbuf* baseDir, FFPackagesResult* packageCounts,
446446
{
447447
packageCounts->guixSystem += getGuixPackages(baseDir, "/run/current-system/profile");
448448
}
449-
if (!(options->disabled & FF_PACKAGES_FLAG_LINGLONG_BIT)) packageCounts->linglong += getNumElements(baseDir, "/var/lib/linglong/repo/refs/heads/main", true);
449+
if (!(options->disabled & FF_PACKAGES_FLAG_LINGLONG_BIT))
450+
{
451+
packageCounts->linglong += getNumElements(baseDir, "/var/lib/linglong/repo/refs/heads/main", true);
452+
if (packageCounts->linglong == 0)
453+
packageCounts->linglong += getNumElements(baseDir, "/var/lib/linglong/repo/refs/remotes/stable/main", true);
454+
}
450455
if (!(options->disabled & FF_PACKAGES_FLAG_PACSTALL_BIT)) packageCounts->pacstall += getNumElements(baseDir, "/var/lib/pacstall/metadata", false);
451456
if (!(options->disabled & FF_PACKAGES_FLAG_PISI_BIT)) packageCounts->pisi += getNumElements(baseDir, "/var/lib/pisi/package", true);
452457
if (!(options->disabled & FF_PACKAGES_FLAG_PKGSRC_BIT)) packageCounts->pkgsrc += getNumElements(baseDir, "/usr/pkg/pkgdb", DT_DIR);

0 commit comments

Comments
 (0)