Skip to content

Commit efd9e94

Browse files
authored
Merge pull request #1086 from fastfetch-cli/dev
Release: v2.18.1
2 parents 5060c26 + 0707b29 commit efd9e94

File tree

18 files changed

+130
-97
lines changed

18 files changed

+130
-97
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,9 +416,9 @@ jobs:
416416
with:
417417
operating_system: freebsd
418418
architecture: x86-64
419-
cpu_count: 3
419+
cpu_count: 4
420420
shell: bash
421-
version: '13.2'
421+
version: '14.1'
422422
run: |
423423
uname -a
424424
sudo pkg update

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
# 2.18.1
2+
3+
Fix a regression introduced in v2.18.0
4+
5+
Changes:
6+
* `--ts-version` has been renamed to `--detect-version`
7+
* `general.detectVersion` in JSON config file
8+
9+
Bugfixes:
10+
* Fix and improve GPU driver detection (#1084, GPU, Linux)
11+
112
# 2.18.0
213

314
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.18.0
4+
VERSION 2.18.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: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,11 @@
339339
"type": "string",
340340
"description": "Set the command to be executed before printing logos",
341341
"default": ""
342+
},
343+
"showVersion": {
344+
"type": "boolean",
345+
"description": "Whether to detect and display component versions. Mainly for benchmarking",
346+
"default": true
342347
}
343348
}
344349
},
@@ -573,11 +578,6 @@
573578
"type": "boolean",
574579
"description": "Whether to disable the stdout application buffer",
575580
"default": false
576-
},
577-
"tsVersion": {
578-
"type": "boolean",
579-
"description": "Whether to detect and display the version of terminal, shell and editor. Mainly for benchmarking",
580-
"default": true
581581
}
582582
}
583583
},

src/data/help.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,16 @@
148148
"false": "Try `wayland`, then `x11`, then `drm`"
149149
}
150150
}
151+
},
152+
{
153+
"long": "detect-version",
154+
"desc": "Whether to detect and display the version of terminal, shell and editor",
155+
"remark": "Mainly for benchmarking",
156+
"arg": {
157+
"type": "bool",
158+
"optional": true,
159+
"default": true
160+
}
151161
}
152162
],
153163
"Logo": [
@@ -725,16 +735,6 @@
725735
"type": "color",
726736
"default": "light_red"
727737
}
728-
},
729-
{
730-
"long": "ts-version",
731-
"desc": "Whether to detect and display the version of terminal, shell and editor",
732-
"remark": "Mainly for benchmarking",
733-
"arg": {
734-
"type": "bool",
735-
"optional": true,
736-
"default": true
737-
}
738738
}
739739
],
740740
"Library path": [

src/detection/de/de_linux.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ static void getBudgie(FFstrbuf* result, FF_MAYBE_UNUSED FFDEOptions* options)
180180

181181
const char* ffDetectDEVersion(const FFstrbuf* deName, FFstrbuf* result, FFDEOptions* options)
182182
{
183+
if (!instance.config.general.detectVersion) return "Disabled by config";
184+
183185
if (ffStrbufEqualS(deName, FF_DE_PRETTY_PLASMA))
184186
getKDE(result, options);
185187
else if (ffStrbufEqualS(deName, FF_DE_PRETTY_GNOME))

src/detection/editor/editor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const char* ffDetectEditor(FFEditorResult* result)
2626
return "$VISUAL or $EDITOR not set";
2727
}
2828

29-
if (!instance.config.display.tsVersion) return NULL;
29+
if (!instance.config.general.detectVersion) return NULL;
3030

3131
#ifndef _WIN32
3232
if (result->name.chars[0] != '/')

src/detection/gpu/gpu_linux.c

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,29 +32,42 @@
3232

3333
static bool pciDetectDriver(FFGPUResult* gpu, FFstrbuf* pciDir, FFstrbuf* buffer, FF_MAYBE_UNUSED const char* drmKey)
3434
{
35+
uint32_t pciDirLength = pciDir->length;
3536
ffStrbufAppendS(pciDir, "/driver");
3637
char pathBuf[PATH_MAX];
3738
ssize_t resultLength = readlink(pciDir->chars, pathBuf, sizeof(pathBuf));
38-
if(resultLength > 0)
39+
if(resultLength <= 0) return false;
40+
41+
const char* slash = memrchr(pathBuf, '/', (size_t) resultLength);
42+
if (slash)
3943
{
40-
const char* slash = memrchr(pathBuf, '/', (size_t) resultLength);
41-
if (slash)
42-
{
43-
slash++;
44-
ffStrbufSetNS(&gpu->driver, (uint32_t) (resultLength - (slash - pathBuf)), slash);
45-
}
44+
slash++;
45+
ffStrbufSetNS(&gpu->driver, (uint32_t) (resultLength - (slash - pathBuf)), slash);
46+
}
4647

48+
if (instance.config.general.detectVersion)
49+
{
4750
ffStrbufAppendS(pciDir, "/module/version");
4851
if (ffReadFileBuffer(pciDir->chars, buffer))
4952
{
5053
ffStrbufTrimRightSpace(buffer);
5154
ffStrbufAppendC(&gpu->driver, ' ');
5255
ffStrbufAppend(&gpu->driver, buffer);
53-
return true;
56+
}
57+
else if (ffStrbufEqualS(&gpu->driver, "zx"))
58+
{
59+
ffStrbufSubstrBefore(pciDir, pciDirLength);
60+
ffStrbufAppendS(pciDir, "/zx_info/driver_version");
61+
if (ffReadFileBuffer(pciDir->chars, buffer))
62+
{
63+
ffStrbufTrimRightSpace(buffer);
64+
ffStrbufAppendC(&gpu->driver, ' ');
65+
ffStrbufAppend(&gpu->driver, buffer);
66+
}
5467
}
5568
}
5669

57-
return false;
70+
return true;
5871
}
5972

6073
static void pciDetectAmdSpecific(const FFGPUOptions* options, FFGPUResult* gpu, FFstrbuf* pciDir, FFstrbuf* buffer)
@@ -198,6 +211,7 @@ static const char* detectPci(const FFGPUOptions* options, FFlist* gpus, FFstrbuf
198211
if (!ffStrbufStartsWithC(buffer, '1'))
199212
return "GPU disabled";
200213
}
214+
ffStrbufSubstrBefore(deviceDir, drmDirPathLength);
201215

202216
FFGPUResult* gpu = (FFGPUResult*)ffListAdd(gpus);
203217
ffStrbufInitStatic(&gpu->vendor, ffGetGPUVendorString((uint16_t) vendorId));

src/detection/host/host_linux.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,15 @@ const char* ffDetectHost(FFHostResult* host)
7878
ffStrbufAppendF(&host->name, " - %s", wslDistroName);
7979
ffStrbufAppendS(&host->family, "WSL");
8080

81-
ffProcessAppendStdOut(&host->version, (char* const[]){
82-
"wslinfo",
83-
"--wsl-version",
84-
"-n",
85-
NULL,
86-
}); // supported in 2.2.3 and later
81+
if (instance.config.general.detectVersion)
82+
{
83+
ffProcessAppendStdOut(&host->version, (char* const[]){
84+
"wslinfo",
85+
"--wsl-version",
86+
"-n",
87+
NULL,
88+
}); // supported in 2.2.3 and later
89+
}
8790
}
8891
}
8992

src/detection/initsystem/initsystem_linux.c

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,38 +17,41 @@ const char* ffDetectInitSystem(FFInitSystemResult* result)
1717
ffStrbufSetS(&result->exe, buf);
1818
}
1919

20-
if (ffStrbufEqualS(&result->name, "systemd"))
20+
if (instance.config.general.detectVersion)
2121
{
22-
if (ffProcessAppendStdOut(&result->version, (char* const[]) {
23-
ffStrbufEndsWithS(&result->exe, "/systemd") ? result->exe.chars : "systemctl", // use exe path in case users have another systemd installed
24-
"--version",
25-
NULL,
26-
}) == NULL && result->version.length)
22+
if (ffStrbufEqualS(&result->name, "systemd"))
2723
{
28-
uint32_t iStart = ffStrbufFirstIndexC(&result->version, '(');
29-
if (iStart < result->version.length)
24+
if (ffProcessAppendStdOut(&result->version, (char* const[]) {
25+
ffStrbufEndsWithS(&result->exe, "/systemd") ? result->exe.chars : "systemctl", // use exe path in case users have another systemd installed
26+
"--version",
27+
NULL,
28+
}) == NULL && result->version.length)
3029
{
31-
uint32_t iEnd = ffStrbufNextIndexC(&result->version, iStart + 1, ')');
32-
ffStrbufSubstrBefore(&result->version, iEnd);
33-
ffStrbufSubstrAfter(&result->version, iStart);
30+
uint32_t iStart = ffStrbufFirstIndexC(&result->version, '(');
31+
if (iStart < result->version.length)
32+
{
33+
uint32_t iEnd = ffStrbufNextIndexC(&result->version, iStart + 1, ')');
34+
ffStrbufSubstrBefore(&result->version, iEnd);
35+
ffStrbufSubstrAfter(&result->version, iStart);
36+
}
3437
}
3538
}
36-
}
37-
else if (ffStrbufEqualS(&result->name, "launchd"))
38-
{
39-
if (ffProcessAppendStdOut(&result->version, (char* const[]) {
40-
"/bin/launchctl",
41-
"version",
42-
NULL,
43-
}) == NULL && result->version.length)
39+
else if (ffStrbufEqualS(&result->name, "launchd"))
4440
{
45-
uint32_t iStart = ffStrbufFirstIndexS(&result->version, "Version ");
46-
if (iStart < result->version.length)
41+
if (ffProcessAppendStdOut(&result->version, (char* const[]) {
42+
"/bin/launchctl",
43+
"version",
44+
NULL,
45+
}) == NULL && result->version.length)
4746
{
48-
iStart += (uint32_t) strlen("Version");
49-
uint32_t iEnd = ffStrbufNextIndexC(&result->version, iStart + 1, ':');
50-
ffStrbufSubstrBefore(&result->version, iEnd);
51-
ffStrbufSubstrAfter(&result->version, iStart);
47+
uint32_t iStart = ffStrbufFirstIndexS(&result->version, "Version ");
48+
if (iStart < result->version.length)
49+
{
50+
iStart += (uint32_t) strlen("Version");
51+
uint32_t iEnd = ffStrbufNextIndexC(&result->version, iStart + 1, ':');
52+
ffStrbufSubstrBefore(&result->version, iEnd);
53+
ffStrbufSubstrAfter(&result->version, iStart);
54+
}
5255
}
5356
}
5457
}

0 commit comments

Comments
 (0)