Skip to content

Commit c0774b8

Browse files
authored
Merge pull request #1184 from fastfetch-cli/dev
Release: v2.21.2
2 parents 5df2a75 + 030f34d commit c0774b8

File tree

357 files changed

+1164
-626
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

357 files changed

+1164
-626
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ jobs:
422422
run: |
423423
uname -a
424424
sudo pkg update
425-
sudo pkg install -y cmake git pkgconf binutils wayland vulkan-headers vulkan-loader libxcb libXrandr libX11 libdrm libelf glib dconf dbus sqlite3-tcl xfce4-conf ImageMagick6 ImageMagick7 chafa egl libosmesa opencl ocl-icd v4l_compat
425+
sudo pkg install -y cmake git pkgconf binutils wayland vulkan-headers vulkan-loader libxcb libXrandr libX11 libdrm libelf glib dconf dbus sqlite3-tcl xfce4-conf egl libosmesa opencl ocl-icd v4l_compat
426426
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On .
427427
cmake --build . --target package --verbose -j4
428428
./fastfetch --list-features

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# 2.21.2
2+
3+
Features:
4+
* Support `--stat <num_in_ms>` to display long running modules in yellow or red
5+
6+
Bugfixes:
7+
* Fix bad Intel Arc GPU name and type detection (GPU, Linux)
8+
* Fix uninited struct fields (GPU, Linux)
9+
* Skip cpu model smbios detection on ARM platforms (CPU, Linux)
10+
* Always use `CurrentControlSet` instead of `ControlSet001` when querying registry (Windows)
11+
* Fix NVIDIA GPUs are missing in GPU detection sometimes (GPU, Windows)
12+
* Fixing detection of `pthread_timedjoin_np` (Linux)
13+
14+
Logos:
15+
* Add HyprOS
16+
* Add GoldenDog Linux
17+
118
# 2.21.1
219

320
Hotfix for a regression that breaks WM detection when running `startx` from TTY (Regression from 2.21.0, #1172 / #1162)

CMakeLists.txt

Lines changed: 14 additions & 8 deletions
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.21.1
4+
VERSION 2.21.2
55
LANGUAGES C
66
DESCRIPTION "Fast neofetch-like system information tool"
77
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
@@ -1210,13 +1210,19 @@ if(NOT WIN32)
12101210
if(HAVE_WORDEXP)
12111211
target_compile_definitions(libfastfetch PRIVATE FF_HAVE_WORDEXP=1)
12121212
endif()
1213-
CHECK_INCLUDE_FILE("pthread_np.h" HAVE_PTHREAD_NP)
1214-
if(HAVE_PTHREAD_NP)
1215-
target_compile_definitions(libfastfetch PRIVATE FF_HAVE_PTHREAD_NP=1)
1216-
endif()
1217-
check_function_exists("pthread_timedjoin_np" HAVE_TIMEDJOIN_NP)
1218-
if(HAVE_TIMEDJOIN_NP)
1219-
target_compile_definitions(libfastfetch PRIVATE FF_HAVE_TIMEDJOIN_NP=1)
1213+
if(ENABLE_THREADS AND CMAKE_USE_PTHREADS_INIT)
1214+
CHECK_INCLUDE_FILE("pthread_np.h" HAVE_PTHREAD_NP)
1215+
if(HAVE_PTHREAD_NP)
1216+
target_compile_definitions(libfastfetch PRIVATE FF_HAVE_PTHREAD_NP=1)
1217+
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} pthread_np.h)
1218+
endif()
1219+
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} Threads::Threads)
1220+
check_function_exists("pthread_timedjoin_np" HAVE_TIMEDJOIN_NP)
1221+
if(HAVE_TIMEDJOIN_NP)
1222+
target_compile_definitions(libfastfetch PRIVATE FF_HAVE_TIMEDJOIN_NP=1)
1223+
else()
1224+
message(WARNING "pthread_timedjoin_np was not found; networking timeout will not work")
1225+
endif()
12201226
endif()
12211227
endif()
12221228

debian/changelog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
fastfetch (2.21.1) jammy; urgency=medium
2+
3+
* Update to 2.21.1
4+
5+
-- Carter Li <[email protected]> Fri, 09 Aug 2024 14:27:10 +0800
6+
17
fastfetch (2.21.0) jammy; urgency=medium
28

39
* Update to 2.21.0

debian/files

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
fastfetch_2.20.0_source.buildinfo universe/utils optional
1+
fastfetch_2.21.1_source.buildinfo universe/utils optional

doc/json_schema.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,9 +357,17 @@
357357
"additionalProperties": false,
358358
"properties": {
359359
"stat": {
360-
"type": "boolean",
361-
"description": "Show time usage (in ms) for individual modules",
362-
"default": false
360+
"description": "Show time usage (in ms) for individual modules with optional threshold",
361+
"oneOf": [
362+
{
363+
"type": "boolean",
364+
"default": false
365+
},
366+
{
367+
"type": "integer",
368+
"minimum": 1
369+
}
370+
]
363371
},
364372
"pipe": {
365373
"type": "boolean",

src/common/commandoption.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "commandoption.h"
2+
#include "common/color.h"
23
#include "common/printing.h"
34
#include "common/time.h"
45
#include "common/jsonconfig.h"
@@ -105,32 +106,35 @@ static void parseStructureCommand(
105106
void ffPrintCommandOption(FFdata* data, yyjson_mut_doc* jsonDoc)
106107
{
107108
//Parse the structure and call the modules
109+
int32_t thres = instance.config.display.stat;
108110
uint32_t startIndex = 0;
109111
while (startIndex < data->structure.length)
110112
{
111113
uint32_t colonIndex = ffStrbufNextIndexC(&data->structure, startIndex, ':');
112114
data->structure.chars[colonIndex] = '\0';
113115

114-
uint64_t ms = 0;
115-
if(instance.config.display.stat)
116+
double ms = 0;
117+
if(thres >= 0)
116118
ms = ffTimeGetTick();
117119

118120
parseStructureCommand(data->structure.chars + startIndex, genJsonResult, jsonDoc);
119121

120-
if(instance.config.display.stat)
122+
if(thres >= 0)
121123
{
122124
ms = ffTimeGetTick() - ms;
123125

124126
if (jsonDoc)
125127
{
126128
yyjson_mut_val* moduleJson = yyjson_mut_arr_get_last(jsonDoc->root);
127-
yyjson_mut_obj_add_uint(jsonDoc, moduleJson, "stat", ms);
129+
yyjson_mut_obj_add_real(jsonDoc, moduleJson, "stat", ms);
128130
}
129131
else
130132
{
131-
char str[32];
132-
int len = snprintf(str, sizeof str, "%" PRIu64 "ms", ms);
133-
printf("\033[s\033[1A\033[9999999C\033[%dD%s\033[u", len, str); // Save; Up 1; Right 9999999; Left <len>; Print <str>; Load
133+
char str[64];
134+
int len = snprintf(str, sizeof str, "%.3fms", ms);
135+
if (thres > 0)
136+
snprintf(str, sizeof str, "\e[%sm%.3fms\e[m", (ms <= thres ? FF_COLOR_FG_GREEN : ms <= 2 * thres ? FF_COLOR_FG_YELLOW : FF_COLOR_FG_RED), ms);
137+
printf("\e[s\e[1A\e[9999999C\e[%dD%s\e[u", len, str); // Save; Up 1; Right 9999999; Left <len>; Print <str>; Load
134138
}
135139
}
136140

src/common/jsonconfig.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "fastfetch.h"
2+
#include "common/color.h"
23
#include "common/jsonconfig.h"
34
#include "common/printing.h"
45
#include "common/io/io.h"
@@ -181,12 +182,13 @@ static const char* printJsonConfig(bool prepare, yyjson_mut_doc* jsonDoc)
181182
if (!modules) return NULL;
182183
if (!yyjson_is_arr(modules)) return "Property 'modules' must be an array of strings or objects";
183184

185+
int32_t thres = instance.config.display.stat;
184186
yyjson_val* item;
185187
size_t idx, max;
186188
yyjson_arr_foreach(modules, idx, max, item)
187189
{
188-
uint64_t ms = 0;
189-
if(!prepare && instance.config.display.stat)
190+
double ms = 0;
191+
if(!prepare && thres >= 0)
190192
ms = ffTimeGetTick();
191193

192194
yyjson_val* module = item;
@@ -208,19 +210,21 @@ static const char* printJsonConfig(bool prepare, yyjson_mut_doc* jsonDoc)
208210
else if(!parseModuleJsonObject(type, module, jsonDoc))
209211
return "Unknown module type";
210212

211-
if(!prepare && instance.config.display.stat)
213+
if(!prepare && thres >= 0)
212214
{
213215
ms = ffTimeGetTick() - ms;
214216
if (jsonDoc)
215217
{
216218
yyjson_mut_val* moduleJson = yyjson_mut_arr_get_last(jsonDoc->root);
217-
yyjson_mut_obj_add_uint(jsonDoc, moduleJson, "stat", ms);
219+
yyjson_mut_obj_add_real(jsonDoc, moduleJson, "stat", ms);
218220
}
219221
else
220222
{
221-
char str[32];
222-
int len = snprintf(str, sizeof str, "%" PRIu64 "ms", ms);
223-
printf("\033[s\033[1A\033[9999999C\033[%dD%s\033[u", len, str); // Save; Up 1; Right 9999999; Left <len>; Print <str>; Load
223+
char str[64];
224+
int len = snprintf(str, sizeof str, "%.3fms", ms);
225+
if (thres > 0)
226+
snprintf(str, sizeof str, "\e[%sm%.3fms\e[m", (ms <= thres ? FF_COLOR_FG_GREEN : ms <= 2 * thres ? FF_COLOR_FG_YELLOW : FF_COLOR_FG_RED), ms);
227+
printf("\e[s\e[1A\e[9999999C\e[%dD%s\e[u", len, str); // Save; Up 1; Right 9999999; Left <len>; Print <str>; Load
224228
}
225229
}
226230

src/common/time.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@
99
#include <sysinfoapi.h>
1010
#endif
1111

12-
static inline uint64_t ffTimeGetTick() //In msec
12+
static inline double ffTimeGetTick(void) //In msec
1313
{
1414
#ifdef _WIN32
1515
LARGE_INTEGER frequency;
1616
QueryPerformanceFrequency(&frequency);
1717
LARGE_INTEGER start;
1818
QueryPerformanceCounter(&start);
19-
return (uint64_t)(start.QuadPart * 1000 / frequency.QuadPart);
19+
return (double) start.QuadPart * 1000 / (double) frequency.QuadPart;
2020
#else
2121
struct timespec timeNow;
2222
clock_gettime(CLOCK_MONOTONIC, &timeNow);
23-
return (uint64_t)(((uint64_t) timeNow.tv_sec * 1000u) + ((uint64_t) timeNow.tv_nsec / 1000000u));
23+
return (double) timeNow.tv_sec * 1000. + (double) timeNow.tv_nsec / 1000000.;
2424
#endif
2525
}
2626

27-
static inline uint64_t ffTimeGetNow()
27+
static inline uint64_t ffTimeGetNow(void)
2828
{
2929
#ifdef _WIN32
3030
uint64_t timeNow;

src/detection/bootmgr/bootmgr_windows.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const char* ffDetectBootmgr(FFBootmgrResult* result)
4646
ffEfiFillLoadOption((FFEfiLoadOption *)buffer, result);
4747

4848
DWORD uefiSecureBootEnabled = 0, bufSize = 0;
49-
if (RegGetValueW(HKEY_LOCAL_MACHINE, L"SYSTEM\\ControlSet001\\Control\\SecureBoot\\State", L"UEFISecureBootEnabled", RRF_RT_REG_DWORD, NULL, &uefiSecureBootEnabled, &bufSize) == ERROR_SUCCESS)
49+
if (RegGetValueW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\SecureBoot\\State", L"UEFISecureBootEnabled", RRF_RT_REG_DWORD, NULL, &uefiSecureBootEnabled, &bufSize) == ERROR_SUCCESS)
5050
result->secureBoot = !!uefiSecureBootEnabled;
5151

5252
return NULL;

0 commit comments

Comments
 (0)