Skip to content

Commit 924d78d

Browse files
CarterLiyelnineigitee-zeqiDariqqDariqq
authored
Release: v2.56.1 (#2097)
* Logo (Builtin): drop opak Ref: #1070 * Swap (Windows): adds `K32GetPerformanceInfo` fallback * Platform (Windows): fixes if checks * Platform (Windows): adds a null check * Packages (Windows): improves performance for directory enumeration * Util (Windows): fixes / adds a new Unicode conversion function * Packaging: update debian stuff [ci skip] * IO (Windows): enhances `openat` * CPU: adds option `tempSensor` * CPU (macOS): supports `tempSensor` * CPU (Windows): supports `tempSensor` * CPU (Linux): supports `tempSensor` * CPU (FreeBSD): supports `tempSensor` * CPU (NetBSD): supports `tempSensor` * CPU (OpenBSD): supports `tempSensor` * CPU (Linux): prevents variables from integer overflow * GPU (Linux): add comments * CPU (SunOS): supports `tempSensor` * Doc: clarifies that we supports illumos only * JsonSchema: documents `cpu.tempSensor` Fixes #2073 * CPUCache (macOS): fixes cache line size detection * CPU(Linux): Fix build on GNU. * Chore: refines usage of `PATH_MAX` * DisplayServer (Linux): upgrades kde-output-device-v2 wayland protocol files (again) Fixes #2093 * Logo (Builtin): adds gxde logo (#2094) * add gxde-logo * add gxdeos * add gxdeos * add gxdeos * Release: v2.56.1 * Memory (macOS): uses `hw.memsize_usable` * Chore (Windows): Standardize windows header casing. (#2096) [ci skip] Followup to 0b6ca15. Co-authored-by: Dariqq <dariqq@noreply.codeberg.org> * IO (Windows): removes unneeded null terminator appending * CPU (SunOS): adds `const` for consistancy * Host (macOS): prefers `hw.product` than `hw.model` ... because `HW_MODEL` is deprecated * Doc: update changelog * Memory (macOS): Refines Memory usage detection on macOS to match Activity Monitor more closely * Packages (Windows): fixes possible UB Reported by Github Copilot * JsonSchema: refines comments [ci skip] --------- Co-authored-by: Yelninei <yelninei@tutamail.com> Co-authored-by: gitee-zeqi <a202128502@163.com> Co-authored-by: Dariqq <77271900+Dariqq@users.noreply.github.com> Co-authored-by: Dariqq <dariqq@noreply.codeberg.org>
2 parents e50421a + fa92bb8 commit 924d78d

36 files changed

+487
-160
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
# 2.56.1
2+
3+
Features:
4+
* Improves compatibility with KDE Plasma 6.5 (#2093, Display)
5+
* Adds a `tempSensor` option to specify the sensor name used for CPU temperature detection (CPU)
6+
* Example: `{ "type": "cpu", "tempSensor": "hwmon0" /* Use /sys/class/hwmon/hwmon0 for temperature detection */ }`
7+
* Refines Memory usage detection on macOS to match Activity Monitor more closely (Memory, macOS)
8+
* Minor optimizations
9+
10+
Bugfixes:
11+
* Fixes cache line size detection (CPU, macOS)
12+
13+
Logos:
14+
* Removes Opak
15+
* Updates GXDE
16+
117
# 2.56.0
218

319
Features:

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.56.0
4+
VERSION 2.56.1
55
LANGUAGES C
66
DESCRIPTION "Fast neofetch-like system information tool"
77
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/fastfetch-cli/fastfetch)
1414
[![中文README](https://img.shields.io/badge/%E4%B8%AD%E6%96%87-README-red)](README-cn.md)
1515

16-
Fastfetch is a [neofetch](https://github.com/dylanaraps/neofetch)-like tool for fetching system information and displaying it in a visually appealing way. It is written mainly in C, with a focus on performance and customizability. Currently, it supports Linux, macOS, Windows 7+, Android, FreeBSD, OpenBSD, NetBSD, DragonFly, Haiku, and SunOS.
16+
Fastfetch is a [neofetch](https://github.com/dylanaraps/neofetch)-like tool for fetching system information and displaying it in a visually appealing way. It is written mainly in C, with a focus on performance and customizability. Currently, it supports Linux, macOS, Windows 7+, Android, FreeBSD, OpenBSD, NetBSD, DragonFly, Haiku, and illumos (SunOS).
1717

1818
<img src="screenshots/example1.png" width="49%" align="left" />
1919
<img src="https://upload.wikimedia.org/wikipedia/commons/2/24/Transparent_Square_Tiles_Texture.png" width="49%" height="16px" align="left" />

debian/changelog.tpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
fastfetch (2.56.0~#UBUNTU_CODENAME#) #UBUNTU_CODENAME#; urgency=medium
2+
3+
* Update to 2.56.0
4+
5+
-- Carter Li <zhangsongcui@live.cn> Mon, 08 Dec 2025 09:21:58 +0800
6+
17
fastfetch (2.55.1~#UBUNTU_CODENAME#) #UBUNTU_CODENAME#; urgency=medium
28

39
* Update to 2.55.1

doc/json_schema.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1880,6 +1880,10 @@
18801880
"temp": {
18811881
"$ref": "#/$defs/temperature"
18821882
},
1883+
"tempSensor": {
1884+
"description": "Set the temperature sensor to use for CPU temperature detection\n* Linux: `hwmon` or `thermal` path name (eg. `hwmon0`, `thermal_zone0)`\n* macOS: SMC sensor key (eg. `Tp01`)\n* Windows: thermal zone key (eg. `\\_TZ.CPUZ`)\n* FreeBSD: sysctl key (eg. `dev.cpu.0.temperature`)\n* NetBSD: sysmon sensor key (eg. `coretemp0`)",
1885+
"type": "string"
1886+
},
18831887
"showPeCoreCount": {
18841888
"description": "Detect and display CPU frequency of different core types (eg. Pcore and Ecore) if supported",
18851889
"type": "boolean",

src/common/io/io.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ bool ffAppendFileBuffer(const char* fileName, FFstrbuf* buffer);
8383
FF_C_NONNULL(2, 3)
8484
bool ffAppendFileBufferRelative(FFNativeFD dfd, const char* fileName, FFstrbuf* buffer);
8585

86+
FF_C_NONNULL(2)
87+
static inline bool ffReadFDBuffer(FFNativeFD fd, FFstrbuf* buffer)
88+
{
89+
ffStrbufClear(buffer);
90+
return ffAppendFDBuffer(fd, buffer);
91+
}
92+
8693
FF_C_NONNULL(1, 2)
8794
static inline bool ffReadFileBuffer(const char* fileName, FFstrbuf* buffer)
8895
{
@@ -254,4 +261,5 @@ bool ffRemoveFile(const char* fileName);
254261
#ifdef _WIN32
255262
// Only O_RDONLY is supported
256263
HANDLE openat(HANDLE dfd, const char* fileName, bool directory);
264+
HANDLE openatW(HANDLE dfd, const wchar_t* fileName, uint16_t fileNameLen, bool directory);
257265
#endif

src/common/io/io_windows.c

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
#include "util/stringUtils.h"
44

55
#include <windows.h>
6+
#include "util/windows/nt.h"
67
#include <ntstatus.h>
7-
#include <winternl.h>
88

99
static void createSubfolders(const char* fileName)
1010
{
@@ -102,31 +102,48 @@ bool ffAppendFileBuffer(const char* fileName, FFstrbuf* buffer)
102102
return ffAppendFDBuffer(handle, buffer);
103103
}
104104

105-
HANDLE openat(HANDLE dfd, const char* fileName, bool directory)
105+
HANDLE openatW(HANDLE dfd, const wchar_t* fileName, uint16_t fileNameLen, bool directory)
106106
{
107-
NTSTATUS ret;
108-
UNICODE_STRING fileNameW;
109-
ret = RtlAnsiStringToUnicodeString(&fileNameW, &(ANSI_STRING) {
110-
.Length = (USHORT) strlen(fileName),
111-
.Buffer = (PCHAR) fileName
112-
}, TRUE);
113-
if (!NT_SUCCESS(ret)) return INVALID_HANDLE_VALUE;
114-
115-
FF_AUTO_CLOSE_FD HANDLE hFile;
107+
assert(fileNameLen <= 0x7FFF);
108+
109+
HANDLE hFile;
116110
IO_STATUS_BLOCK iosb = {};
117-
ret = NtOpenFile(&hFile, FILE_READ_DATA | SYNCHRONIZE, &(OBJECT_ATTRIBUTES) {
118-
.Length = sizeof(OBJECT_ATTRIBUTES),
119-
.RootDirectory = dfd,
120-
.ObjectName = &fileNameW,
121-
}, &iosb, FILE_SHARE_READ, FILE_SYNCHRONOUS_IO_NONALERT | (directory ? FILE_DIRECTORY_FILE : FILE_NON_DIRECTORY_FILE));
122-
RtlFreeUnicodeString(&fileNameW);
123-
124-
if(!NT_SUCCESS(ret) || iosb.Information != FILE_OPENED)
111+
if(!NT_SUCCESS(NtOpenFile(&hFile,
112+
(directory ? FILE_LIST_DIRECTORY | FILE_TRAVERSE : FILE_READ_DATA | FILE_READ_EA) | FILE_READ_ATTRIBUTES | SYNCHRONIZE, &(OBJECT_ATTRIBUTES) {
113+
.Length = sizeof(OBJECT_ATTRIBUTES),
114+
.RootDirectory = dfd,
115+
.ObjectName = &(UNICODE_STRING) {
116+
.Buffer = (PWSTR) fileName,
117+
.Length = fileNameLen * (USHORT) sizeof(wchar_t),
118+
.MaximumLength = (fileNameLen + 1) * (USHORT) sizeof(wchar_t),
119+
},
120+
.Attributes = OBJ_CASE_INSENSITIVE,
121+
},
122+
&iosb,
123+
FILE_SHARE_READ | (directory ? FILE_SHARE_WRITE | FILE_SHARE_DELETE : 0),
124+
FILE_SYNCHRONOUS_IO_NONALERT | (directory ? FILE_DIRECTORY_FILE : FILE_NON_DIRECTORY_FILE)
125+
)))
125126
return INVALID_HANDLE_VALUE;
126127

127128
return hFile;
128129
}
129130

131+
HANDLE openat(HANDLE dfd, const char* fileName, bool directory)
132+
{
133+
wchar_t fileNameW[MAX_PATH];
134+
int len = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, fileName, -1, fileNameW, ARRAY_SIZE(fileNameW));
135+
if (len == 0) return INVALID_HANDLE_VALUE;
136+
// Implies `fileNameW[len] = L'\0';` and `len` includes the null terminator
137+
138+
for (int i = 0; i < len - 1; ++i)
139+
{
140+
if (fileNameW[i] == L'/')
141+
fileNameW[i] = L'\\';
142+
}
143+
144+
return openatW(dfd, fileNameW, (uint16_t)(len - 1), directory);
145+
}
146+
130147
bool ffAppendFileBufferRelative(HANDLE dfd, const char* fileName, FFstrbuf* buffer)
131148
{
132149
HANDLE FF_AUTO_CLOSE_FD fd = openat(dfd, fileName, false);

src/detection/brightness/brightness_linux.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static const char* detectWithBacklight(FFlist* result)
4141
FFBrightnessResult* brightness = (FFBrightnessResult*) ffListAdd(result);
4242
ffStrbufSubstrBeforeLastC(&backlightDir, '/');
4343
ffStrbufAppendS(&backlightDir, "/device");
44-
ffStrbufInitA(&brightness->name, PATH_MAX + 1);
44+
ffStrbufInitA(&brightness->name, PATH_MAX);
4545
if(realpath(backlightDir.chars, brightness->name.chars))
4646
{
4747
ffStrbufRecalculateLength(&brightness->name);

src/detection/cpu/cpu_apple.c

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,34 @@
33
#include "util/apple/smc_temps.h"
44
#include "util/stringUtils.h"
55

6-
static double detectCpuTemp(const FFstrbuf* cpuName)
6+
static double detectCpuTemp(const FFCPUOptions* options, const FFstrbuf* cpuName)
77
{
88
double result = 0;
99

1010
const char* error = NULL;
11-
if (ffStrbufStartsWithS(cpuName, "Apple M"))
11+
12+
if (options->tempSensor.length)
13+
{
14+
error = ffDetectSmcSpecificTemp(options->tempSensor.chars, &result);
15+
}
16+
else
1217
{
13-
switch (strtol(cpuName->chars + strlen("Apple M"), NULL, 10))
18+
if (ffStrbufStartsWithS(cpuName, "Apple M"))
1419
{
15-
case 1: error = ffDetectSmcTemps(FF_TEMP_CPU_M1X, &result); break;
16-
case 2: error = ffDetectSmcTemps(FF_TEMP_CPU_M2X, &result); break;
17-
case 3: error = ffDetectSmcTemps(FF_TEMP_CPU_M3X, &result); break;
18-
case 4: error = ffDetectSmcTemps(FF_TEMP_CPU_M4X, &result); break;
19-
default: error = "Unsupported Apple Silicon CPU";
20+
switch (strtol(cpuName->chars + strlen("Apple M"), NULL, 10))
21+
{
22+
case 1: error = ffDetectSmcTemps(FF_TEMP_CPU_M1X, &result); break;
23+
case 2: error = ffDetectSmcTemps(FF_TEMP_CPU_M2X, &result); break;
24+
case 3: error = ffDetectSmcTemps(FF_TEMP_CPU_M3X, &result); break;
25+
case 4: error = ffDetectSmcTemps(FF_TEMP_CPU_M4X, &result); break;
26+
default: error = "Unsupported Apple Silicon CPU";
27+
}
2028
}
29+
else // PPC?
30+
error = ffDetectSmcTemps(FF_TEMP_CPU_X64, &result);
2131
}
22-
else // PPC?
23-
error = ffDetectSmcTemps(FF_TEMP_CPU_X64, &result);
2432

25-
if(error)
33+
if (error)
2634
return FF_CPU_TEMP_UNSET;
2735

2836
return result;
@@ -130,7 +138,7 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
130138
detectFrequency(cpu);
131139
if (options->showPeCoreCount) detectCoreCount(cpu);
132140

133-
cpu->temperature = options->temp ? detectCpuTemp(&cpu->name) : FF_CPU_TEMP_UNSET;
141+
cpu->temperature = options->temp ? detectCpuTemp(options, &cpu->name) : FF_CPU_TEMP_UNSET;
134142

135143
return NULL;
136144
}

src/detection/cpu/cpu_bsd.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,26 @@
88
#define FF_HAVE_CPUSET 1
99
#endif
1010

11-
static const char* detectCpuTemp(double* current)
11+
static const char* detectCpuTemp(const FFCPUOptions* options, double* current)
1212
{
13-
int temp = ffSysctlGetInt("dev.cpu.0.temperature", -999999);
14-
if (temp == -999999)
15-
return "ffSysctlGetInt(\"dev.cpu.0.temperature\") failed";
16-
17-
// In tenth of degrees Kelvin
18-
*current = (double) temp / 10 - 273.15;
19-
return NULL;
20-
}
21-
22-
static const char* detectThermalTemp(double* current)
23-
{
24-
int temp = ffSysctlGetInt("hw.acpi.thermal.tz0.temperature", -999999);
25-
if (temp == -999999)
26-
return "ffSysctlGetInt(\"hw.acpi.thermal.tz0.temperature\") failed";
13+
int temp;
14+
if (options->tempSensor.length > 0)
15+
{
16+
temp = ffSysctlGetInt(options->tempSensor.chars, -999999);
17+
if (temp == -999999)
18+
return "ffSysctlGetInt(options->tempSensor) failed";
19+
}
20+
else
21+
{
22+
temp = ffSysctlGetInt("dev.cpu.0.temperature", -999999);
23+
if (temp == -999999)
24+
{
25+
// Thermal zone temperature
26+
temp = ffSysctlGetInt("hw.acpi.thermal.tz0.temperature", -999999);
27+
if (temp == -999999)
28+
return "ffSysctlGetInt(\"dev.cpu.0.temperature\" or \"hw.acpi.thermal.tz0.temperature\") failed";
29+
}
30+
}
2731

2832
// In tenth of degrees Kelvin
2933
*current = (double) temp / 10 - 273.15;
@@ -94,11 +98,7 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
9498

9599
cpu->temperature = FF_CPU_TEMP_UNSET;
96100

97-
if (options->temp)
98-
{
99-
if (detectCpuTemp(&cpu->temperature) != NULL)
100-
detectThermalTemp(&cpu->temperature);
101-
}
101+
if (options->temp) detectCpuTemp(options, &cpu->temperature);
102102

103103
cpu->numaNodes = (uint16_t) ffSysctlGetInt("vm.ndomains", 0);
104104

0 commit comments

Comments
 (0)