Skip to content

Commit 630d876

Browse files
authored
Merge pull request #1722 from fastfetch-cli/dev
Release: v2.42.0
2 parents 5769791 + 1938be8 commit 630d876

32 files changed

+725
-157
lines changed

CHANGELOG.md

+26-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,34 @@
1+
# 2.42.0
2+
3+
Changes:
4+
* Normalize the module name `Bios` to `BIOS` (#1721)
5+
* No configuration file changes are required because fastfetch parses module names case-insensitively.
6+
7+
Bugfixes:
8+
* Disable disk type detection for virtual disks (PhysicalDisk, Linux, #1669)
9+
* Fix incorrect CPU temperature reporting (CPU, OpenBSD)
10+
* Fix setting `logo.chafa.symbols` in JSON configuration (Logo, #1709)
11+
* Fix non-normalized time display (Uptime, #1720)
12+
* Miscellaneous minor fixes
13+
14+
Features:
15+
* Add CPU temperature detection support (CPU, SunOS)
16+
* Improve CPU frequency detection (CPU, NetBSD)
17+
* Add Wi-Fi detection support (Wifi, NetBSD)
18+
* Add Webcam detection support (Camera, OpenBSD)
19+
* Requires root privileges
20+
21+
Logos:
22+
* Remove GoralixOS logo (#1699)
23+
* Add Aurora logo (#1700)
24+
* Add Codex Linux logo (#1701)
25+
126
# 2.41.0
227

328
Changes:
429
* Due to [the deprecation](https://github.com/actions/runner-images/issues/11101), Linux x86_64 binaries are now built with Ubuntu 22.04 (Glibc 2.35, Debian 12)
530
* You can always build fastfetch yourself on your own. Please don't report bugs related to this change.
631

7-
Bugfixes:
8-
* Don't detect disk type for virtual disks (PhysicalDisk, Linux, #1669)
9-
1032
Features:
1133
* Support physical core count detection on non-x86 platforms (CPU, Linux / FreeBSD)
1234
* Support CPU frequency detection on PPC64 (CPU, FreeBSD)
@@ -881,7 +903,7 @@ Bugfixes:
881903
* Fix some presets
882904
* Better detection for XTerm terminal fonts (#1095, TerminalFont, Linux)
883905
* Remove debug output (#1097, Windows)
884-
* Fix command line option `--gpu-hide-type` doesn't work (#1098, GPU)
906+
* Fix flag `--gpu-hide-type` doesn't work (#1098, GPU)
885907
* Fix wrong date on Raspbian 10 (#1108, DateTime, Linux)
886908
* Use `brightness` instead of `actuall_brightness` when detecting current brightness level (Brightness, Linux)
887909
* Ref: https://bugzilla.kernel.org/show_bug.cgi?id=203905

CMakeLists.txt

+19-3
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.41.0
4+
VERSION 2.42.0
55
LANGUAGES C
66
DESCRIPTION "Fast neofetch-like system information tool"
77
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
@@ -797,7 +797,7 @@ elseif(NetBSD)
797797
src/detection/uptime/uptime_bsd.c
798798
src/detection/users/users_linux.c
799799
src/detection/wallpaper/wallpaper_linux.c
800-
src/detection/wifi/wifi_nosupport.c
800+
src/detection/wifi/wifi_nbsd.c
801801
src/detection/wm/wm_nosupport.c
802802
src/detection/de/de_linux.c
803803
src/detection/wmtheme/wmtheme_linux.c
@@ -879,7 +879,7 @@ elseif(OpenBSD)
879879
src/detection/uptime/uptime_bsd.c
880880
src/detection/users/users_obsd.c
881881
src/detection/wallpaper/wallpaper_linux.c
882-
src/detection/wifi/wifi_nbsd.c
882+
src/detection/wifi/wifi_obsd.c
883883
src/detection/wm/wm_nosupport.c
884884
src/detection/de/de_linux.c
885885
src/detection/wmtheme/wmtheme_linux.c
@@ -1834,10 +1834,26 @@ if (BUILD_TESTS)
18341834
PRIVATE libfastfetch
18351835
)
18361836

1837+
add_executable(fastfetch-test-color
1838+
tests/color.c
1839+
)
1840+
target_link_libraries(fastfetch-test-color
1841+
PRIVATE libfastfetch
1842+
)
1843+
1844+
add_executable(fastfetch-test-duration
1845+
tests/duration.c
1846+
)
1847+
target_link_libraries(fastfetch-test-duration
1848+
PRIVATE libfastfetch
1849+
)
1850+
18371851
enable_testing()
18381852
add_test(NAME test-strbuf COMMAND fastfetch-test-strbuf)
18391853
add_test(NAME test-list COMMAND fastfetch-test-list)
18401854
add_test(NAME test-format COMMAND fastfetch-test-format)
1855+
add_test(NAME test-color COMMAND fastfetch-test-color)
1856+
add_test(NAME test-duration COMMAND fastfetch-test-duration)
18411857
endif()
18421858

18431859
##################

debian/changelog

+18
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
fastfetch (2.41.0) jammy; urgency=medium
2+
3+
* Update to 2.41.0
4+
5+
-- Carter Li <[email protected]> Wed, 16 Apr 2025 13:42:58 +0800
6+
7+
fastfetch (2.40.4) jammy; urgency=medium
8+
9+
* Update to 2.40.4
10+
11+
-- Carter Li <[email protected]> Thu, 10 Apr 2025 15:38:21 +0800
12+
13+
fastfetch (2.40.3) jammy; urgency=medium
14+
15+
* Update to 2.40.3
16+
17+
-- Carter Li <[email protected]> Mon, 07 Apr 2025 09:29:27 +0800
18+
119
fastfetch (2.40.0) jammy; urgency=medium
220

321
* Update to 2.40.0

debian/files

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
fastfetch_2.40.0_source.buildinfo universe/utils optional
1+
fastfetch_2.41.0_source.buildinfo universe/utils optional

src/common/option.c

+30
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ void ffOptionParseColorNoClear(const char* value, FFstrbuf* buffer)
177177
if (ffCharIsEnglishAlphabet(value[0]))
178178
{
179179
FF_APPEND_COLOR_CODE_COND(reset_, FF_COLOR_MODE_RESET)
180+
else FF_APPEND_COLOR_CODE_COND(bold_, FF_COLOR_MODE_BOLD)
180181
else FF_APPEND_COLOR_CODE_COND(bright_, FF_COLOR_MODE_BOLD)
181182
else FF_APPEND_COLOR_CODE_COND(dim_, FF_COLOR_MODE_DIM)
182183
else FF_APPEND_COLOR_CODE_COND(italic_, FF_COLOR_MODE_ITALIC)
@@ -212,6 +213,35 @@ void ffOptionParseColorNoClear(const char* value, FFstrbuf* buffer)
212213
exit(479);
213214
}
214215
}
216+
else if (value[0] == '#')
217+
{
218+
// RGB color
219+
++value;
220+
char* pend = NULL;
221+
uint32_t rgb = (uint32_t) strtoul(value, &pend, 16);
222+
if (pend == value) {
223+
fprintf(stderr, "Error: invalid RGB color code found: %s\n", value);
224+
exit(479);
225+
}
226+
if (pend - value > 6) {
227+
fprintf(stderr, "Error: RGB color code too long: %s\n", value);
228+
exit(479);
229+
}
230+
else if (pend - value == 3) {
231+
rgb = ((rgb & 0xF00) >> 8) * 0x110000 +
232+
((rgb & 0x0F0) >> 4) * 0x001100 +
233+
((rgb & 0x00F) >> 0) * 0x000011;
234+
}
235+
else if (pend - value != 6) {
236+
fprintf(stderr, "Error: invalid RGB color code length: %s\n", value);
237+
exit(479);
238+
}
239+
240+
uint32_t r = rgb >> 16, g = (rgb >> 8) & 0xFF, b = rgb & 0xFF;
241+
ffStrbufAppendF(buffer, FF_COLOR_FG_RGB "%u;%u;%u", r, g, b);
242+
value = pend;
243+
continue;
244+
}
215245
ffStrbufAppendC(buffer, *value);
216246
++value;
217247

src/common/parsing.c

+15-8
Original file line numberDiff line numberDiff line change
@@ -190,19 +190,26 @@ void ffParseGTK(FFstrbuf* buffer, const FFstrbuf* gtk2, const FFstrbuf* gtk3, co
190190
}
191191
}
192192

193-
void ffParseDuration(uint32_t days, uint32_t hours, uint32_t minutes, uint32_t seconds, FFstrbuf* result)
193+
void ffParseDuration(uint64_t totalSeconds, FFstrbuf* result)
194194
{
195-
if(days == 0 && hours == 0 && minutes == 0)
195+
if(totalSeconds < 60)
196196
{
197-
ffStrbufAppendF(result, "%u seconds", seconds);
197+
ffStrbufAppendF(result, "%u second", (unsigned) totalSeconds);
198+
if (totalSeconds != 1)
199+
ffStrbufAppendC(result, 's');
198200
return;
199201
}
200202

201-
if(seconds >= 30)
202-
{
203-
minutes++;
204-
seconds = 0;
205-
}
203+
uint32_t seconds = totalSeconds % 60;
204+
totalSeconds /= 60;
205+
if (seconds >= 30)
206+
totalSeconds++;
207+
208+
uint32_t minutes = totalSeconds % 60;
209+
totalSeconds /= 60;
210+
uint32_t hours = totalSeconds % 24;
211+
totalSeconds /= 24;
212+
uint32_t days = (uint32_t) totalSeconds;
206213

207214
if(days > 0)
208215
{

src/common/parsing.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ int8_t ffVersionCompare(const FFVersion* version1, const FFVersion* version2);
2727

2828
void ffParseSize(uint64_t bytes, FFstrbuf* result);
2929
bool ffParseFrequency(uint32_t mhz, FFstrbuf* result);
30-
void ffParseDuration(uint32_t days, uint32_t hours, uint32_t minutes, uint32_t seconds, FFstrbuf* result);
30+
void ffParseDuration(uint64_t totalSeconds, FFstrbuf* result);

src/common/printing.c

+4-9
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void ffPrintFormat(const char* moduleName, uint8_t moduleIndex, const FFModuleAr
100100
ffStrbufPutTo(&buffer, stdout);
101101
}
102102

103-
static void printError(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, const char* message, va_list arguments)
103+
void ffPrintError(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, const char* message, ...)
104104
{
105105
if(!instance.config.display.showErrors)
106106
return;
@@ -110,22 +110,17 @@ static void printError(const char* moduleName, uint8_t moduleIndex, const FFModu
110110
if(!instance.config.display.pipe)
111111
fputs(FASTFETCH_TEXT_MODIFIER_ERROR, stdout);
112112

113+
va_list arguments;
114+
va_start(arguments, message);
113115
vprintf(message, arguments);
116+
va_end(arguments);
114117

115118
if(!instance.config.display.pipe)
116119
fputs(FASTFETCH_TEXT_MODIFIER_RESET, stdout);
117120

118121
putchar('\n');
119122
}
120123

121-
void ffPrintError(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, const char* message, ...)
122-
{
123-
va_list arguments;
124-
va_start(arguments, message);
125-
printError(moduleName, moduleIndex, moduleArgs, printType, message, arguments);
126-
va_end(arguments);
127-
}
128-
129124
void ffPrintColor(const FFstrbuf* colorValue)
130125
{
131126
//If the color is not set, this would reset in \033[m, which resets everything.

src/detection/bluetooth/bluetooth_linux.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ static uint32_t connectedDevices(void)
232232

233233
#endif
234234

235-
const char* ffDetectBluetooth(FFBluetoothOptions* options, FF_MAYBE_UNUSED FFlist* devices /* FFBluetoothResult */)
235+
const char* ffDetectBluetooth(FF_MAYBE_UNUSED FFBluetoothOptions* options, FF_MAYBE_UNUSED FFlist* devices /* FFBluetoothResult */)
236236
{
237237
#ifdef FF_HAVE_DBUS
238238
int32_t connectedCount = -1;

src/detection/camera/camera_linux.c

+10-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
#if FF_HAVE_LINUX_VIDEODEV2
99
#include <linux/videodev2.h>
10+
#elif __has_include(<sys/videoio.h>) // OpenBSD
11+
#include <sys/videoio.h>
12+
#define FF_HAVE_LINUX_VIDEODEV2 1
1013
#endif
1114

1215
const char* ffDetectCamera(FFlist* result)
@@ -19,7 +22,13 @@ const char* ffDetectCamera(FFlist* result)
1922
path[ARRAY_SIZE(path) - 2] = (char) (i + '0');
2023
FF_AUTO_CLOSE_FD int fd = open(path, O_RDONLY);
2124
if (fd < 0)
22-
break;
25+
{
26+
if (errno == ENOENT)
27+
break;
28+
if (errno == ENXIO)
29+
continue;
30+
return "Failed to open /dev/videoN";
31+
}
2332

2433
struct v4l2_capability cap = {};
2534
if (ioctl(fd, VIDIOC_QUERYCAP, &cap) < 0 || !(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE))

src/detection/cpu/cpu_nbsd.c

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
6767

6868
uint32_t freq = (uint32_t) ffSysctlGetInt("machdep.cpu.frequency.target", 0);
6969
if (freq == 0) freq = (uint32_t) (ffSysctlGetInt64("hw.cpu0.clock_frequency", 0) / 1000000);
70+
if (freq == 0) freq = (uint32_t) ffSysctlGetInt("machdep.dmi.processor-frequency", 0);
7071
if (freq > cpu->frequencyBase) cpu->frequencyBase = freq;
7172

7273
cpu->temperature = FF_CPU_TEMP_UNSET;

src/detection/cpu/cpu_obsd.c

+45-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,53 @@
11
#include "cpu.h"
22
#include "common/sysctl.h"
3+
#include "util/stringUtils.h"
34

5+
#include <errno.h>
46
#include <sys/time.h>
57
#include <sys/sensors.h>
68

7-
const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
9+
static const char* detectCPUTemp(FFCPUResult* cpu)
10+
{
11+
int mib[5] = {CTL_HW, HW_SENSORS, 0, SENSOR_TEMP, 0};
12+
13+
for (mib[2] = 0; mib[2] < 1024; mib[2]++)
14+
{
15+
struct sensordev sensordev;
16+
size_t sdlen = sizeof(struct sensordev);
17+
if (sysctl(mib, 3, &sensordev, &sdlen, NULL, 0) < 0)
18+
{
19+
if (errno == ENOENT)
20+
break;
21+
if (errno == ENXIO)
22+
continue;
23+
return "sysctl(sensordev) failed";
24+
}
25+
26+
if (!ffStrStartsWith(sensordev.xname, "cpu"))
27+
continue;
28+
29+
for (mib[4] = 0; mib[4] < sensordev.maxnumt[SENSOR_TEMP]; mib[4]++)
30+
{
31+
struct sensor sensor;
32+
size_t slen = sizeof(struct sensor);
33+
if (sysctl(mib, 5, &sensor, &slen, NULL, 0) < 0)
34+
{
35+
if (errno != ENOENT)
36+
return "sysctl(sensor) failed";
37+
continue;
38+
}
39+
if (sensor.flags & SENSOR_FINVALID)
40+
continue;
41+
42+
cpu->temperature = (double)(sensor.value - 273150000) / 1E6;
43+
return NULL;
44+
}
45+
}
46+
47+
return "No sensor for CPU temp found";
48+
}
49+
50+
const char *ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
851
{
952
if (ffSysctlGetString(CTL_HW, HW_MODEL, &cpu->name))
1053
return "sysctl(hw.model) failed";
@@ -19,13 +62,7 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
1962
if (cpuspeed > cpu->frequencyBase) cpu->frequencyBase = cpuspeed;
2063

2164
cpu->temperature = FF_CPU_TEMP_UNSET;
22-
if (options->temp)
23-
{
24-
struct sensor sensors;
25-
size_t size = sizeof(sensors);
26-
if (sysctl((int[]) {CTL_HW, HW_SENSORS, 0, SENSOR_TEMP, 0}, 5, &sensors, &size, NULL, 0) == 0)
27-
cpu->temperature = (double) (sensors.value - 273150000) / 1E6;
28-
}
65+
if (options->temp) detectCPUTemp(cpu);
2966

3067
return NULL;
3168
}

0 commit comments

Comments
 (0)