Skip to content

Commit 1206f6d

Browse files
authored
Merge pull request #701 from fastfetch-cli/dev
Release v2.7.0
2 parents 35a5a03 + 9aad3e3 commit 1206f6d

35 files changed

+698
-60
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ assignees: ''
1919

2020
# Often helpful information:
2121

22-
The content of the configuration file you use (if any)
22+
Screenshot:
23+
<!-- Paste the screenshot here -->
24+
25+
The content of the configuration file you use (if any):
2326
```
2427
//paste here
2528
```

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,9 @@ jobs:
402402
echo -e "\n---\n\n<details><summary>SHA256SUMs</summary><br>\n\n\`\`\`" >> fastfetch-release-notes.md
403403
sha256sum fastfetch-*/* >> fastfetch-release-notes.md
404404
echo -e "\`\`\`\n</details>" >> fastfetch-release-notes.md
405+
echo -e "\n<details><summary>SHA512SUMs</summary><br>\n\n\`\`\`" >> fastfetch-release-notes.md
406+
sha512sum fastfetch-*/* >> fastfetch-release-notes.md
407+
echo -e "\`\`\`\n</details>" >> fastfetch-release-notes.md
405408
406409
- name: update release body
407410
if: needs.linux.outputs.ffversion != steps.get_version_release.outputs.release

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# 2.7.0
2+
3+
Features:
4+
* Add new module `TerminalTheme`, which prints the foreground and background color of the current terminal window. Currently doesn't work on Windows.
5+
* Allow command substitution when expanding paths. For example, now it's possible to use `"source": "$(ls ~/path/to/images/*.png | shuf -n 1)"` in JSONC config file to randomly choose an image to display. (#698)
6+
* Use native methods instead of pciutils to detect GPUs in FreeBSD. (GPU, FreeBSD)
7+
8+
Bugfixes:
9+
* Fix text formatting (Wifi, Linux)
10+
* Fix terminal detection in some cases (Terminal)
11+
* Remove trailing `\0` in JSON results (FreeBSD)
12+
* Fix uninitialized variables (GPU, Linux)
13+
* Fix a possible segfault (OpenCL)
14+
15+
Logo:
16+
* Add ASCII logos for fedora immutable variants (#700)
17+
118
# 2.6.3
219

320
Bugfixes:

CMakeLists.txt

Lines changed: 4 additions & 2 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.6.3
4+
VERSION 2.7.0
55
LANGUAGES C
66
DESCRIPTION "Fast neofetch-like system information tool"
77
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
@@ -293,6 +293,7 @@ set(LIBFASTFETCH_SRC
293293
src/detection/os/os.c
294294
src/detection/packages/packages.c
295295
src/detection/publicip/publicip.c
296+
src/detection/terminaltheme/terminaltheme.c
296297
src/detection/terminalfont/terminalfont.c
297298
src/detection/terminalshell/terminalshell.c
298299
src/detection/version/version.c
@@ -348,6 +349,7 @@ set(LIBFASTFETCH_SRC
348349
src/modules/swap/swap.c
349350
src/modules/media/media.c
350351
src/modules/terminal/terminal.c
352+
src/modules/terminaltheme/terminaltheme.c
351353
src/modules/terminalfont/terminalfont.c
352354
src/modules/terminalsize/terminalsize.c
353355
src/modules/theme/theme.c
@@ -514,7 +516,7 @@ elseif(BSD)
514516
src/detection/displayserver/linux/xcb.c
515517
src/detection/displayserver/linux/xlib.c
516518
src/detection/font/font_linux.c
517-
src/detection/gpu/gpu_linux.c
519+
src/detection/gpu/gpu_bsd.c
518520
src/detection/gtk_qt/gtk.c
519521
src/detection/host/host_bsd.c
520522
src/detection/lm/lm_linux.c

doc/json_schema.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,7 @@
648648
"terminal",
649649
"terminalfont",
650650
"terminalsize",
651+
"terminaltheme",
651652
"title",
652653
"theme",
653654
"uptime",
@@ -772,6 +773,10 @@
772773
"const": "terminalsize",
773774
"description": "Print current terminal size"
774775
},
776+
{
777+
"const": "terminaltheme",
778+
"description": "Print current terminal theme (foreground and background colors)"
779+
},
775780
{
776781
"const": "theme",
777782
"description": "Print current theme of desktop environment"

presets/all.jsonc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"terminal",
2929
"terminalfont",
3030
"terminalsize",
31+
"terminaltheme",
3132
"cpu",
3233
"cpuusage",
3334
"gpu",

presets/ci.jsonc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"terminal",
3535
"terminalfont",
3636
"terminalsize",
37+
"terminaltheme",
3738
"cpu",
3839
"cpuusage",
3940
"gpu",

src/common/io/io_unix.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ bool ffPathExpandEnv(FF_MAYBE_UNUSED const char* in, FF_MAYBE_UNUSED FFstrbuf* o
115115
#if __has_include(<wordexp.h>) // https://github.com/termux/termux-packages/pull/7056
116116

117117
wordexp_t exp;
118-
if(wordexp(in, &exp, WRDE_NOCMD) != 0)
118+
if(wordexp(in, &exp, 0) != 0)
119119
return false;
120120

121121
if (exp.we_wordc == 1)

src/common/modules.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ static FFModuleBaseInfo* T[] = {
124124
(void*) &instance.config.modules.terminal,
125125
(void*) &instance.config.modules.terminalFont,
126126
(void*) &instance.config.modules.terminalSize,
127+
(void*) &instance.config.modules.terminalTheme,
127128
(void*) &instance.config.modules.title,
128129
(void*) &instance.config.modules.theme,
129130
NULL,

src/detection/gpu/gpu_bsd.c

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
#include "gpu_driver_specific.h"
2+
3+
#include "common/io/io.h"
4+
#include "3rdparty/nvml/nvml.h"
5+
#include "util/mallocHelper.h"
6+
#include "common/io/io.h"
7+
8+
#include <dev/pci/pcireg.h>
9+
#include <sys/pciio.h>
10+
#include <fcntl.h>
11+
#include <paths.h>
12+
13+
static bool loadPciIds(FFstrbuf* pciids)
14+
{
15+
// https://github.com/freebsd/freebsd-src/blob/main/usr.sbin/pciconf/pathnames.h
16+
17+
ffReadFileBuffer(_PATH_LOCALBASE "/share/pciids/pci.ids", pciids);
18+
if (pciids->length > 0) return true;
19+
20+
ffReadFileBuffer("/usr/share/pciids/pci.ids", pciids);
21+
if (pciids->length > 0) return true;
22+
23+
return false;
24+
}
25+
26+
const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus)
27+
{
28+
FF_AUTO_CLOSE_FD int fd = open("/dev/pci", O_RDONLY, 0);
29+
struct pci_conf confs[128];
30+
struct pci_match_conf match = {
31+
.pc_class = PCIC_DISPLAY,
32+
.flags = PCI_GETCONF_MATCH_CLASS,
33+
};
34+
struct pci_conf_io pcio = {
35+
.pat_buf_len = sizeof(match),
36+
.num_patterns = 1,
37+
.patterns = &match,
38+
.match_buf_len = sizeof(confs),
39+
.matches = confs,
40+
};
41+
42+
if (ioctl(fd, PCIOCGETCONF, &pcio) < 0)
43+
return "ioctl(fd, PCIOCGETCONF, &pc) failed";
44+
45+
if (pcio.status == PCI_GETCONF_ERROR)
46+
return "ioctl(fd, PCIOCGETCONF, &pc) returned error";
47+
48+
FF_STRBUF_AUTO_DESTROY pciids = ffStrbufCreate();
49+
loadPciIds(&pciids);
50+
51+
for (uint32_t i = 0; i < pcio.num_matches; ++i)
52+
{
53+
struct pci_conf* pc = &confs[i];
54+
55+
FFGPUResult* gpu = (FFGPUResult*)ffListAdd(gpus);
56+
ffStrbufInitStatic(&gpu->vendor, ffGetGPUVendorString(pc->pc_vendor));
57+
ffStrbufInit(&gpu->name);
58+
ffStrbufInitS(&gpu->driver, pc->pd_name);
59+
ffStrbufInit(&gpu->platformApi);
60+
gpu->temperature = FF_GPU_TEMP_UNSET;
61+
gpu->coreCount = FF_GPU_CORE_COUNT_UNSET;
62+
gpu->type = FF_GPU_TYPE_UNKNOWN;
63+
gpu->dedicated.total = gpu->dedicated.used = gpu->shared.total = gpu->shared.used = FF_GPU_VMEM_SIZE_UNSET;
64+
gpu->deviceId = ((uint64_t) pc->pc_vendor << 16) + pc->pc_device;
65+
gpu->frequency = FF_GPU_FREQUENCY_UNSET;
66+
67+
if (pciids.length)
68+
{
69+
char buffer[32];
70+
uint32_t len = (uint32_t) snprintf(buffer, sizeof(buffer), "\n%04x ", pc->pc_vendor);
71+
char* start = (char*) memmem(pciids.chars, pciids.length, buffer, len);
72+
char* end = pciids.chars + pciids.length;
73+
if (start)
74+
{
75+
start += len;
76+
end = memchr(start, '\n', (uint32_t) (end - start));
77+
if (!end)
78+
end = pciids.chars + pciids.length;
79+
if (!gpu->vendor.length)
80+
ffStrbufSetNS(&gpu->vendor, (uint32_t) (end - start), start);
81+
82+
start = end; // point to '\n' of vendor
83+
end = start + 1; // point to start of devices
84+
// find the start of next vendor
85+
while (end[0] == '\t' || end[0] == '#')
86+
{
87+
end = strchr(end, '\n');
88+
if (!end)
89+
{
90+
end = pciids.chars + pciids.length;
91+
break;
92+
}
93+
else
94+
end++;
95+
}
96+
97+
len = (uint32_t) snprintf(buffer, sizeof(buffer), "\n\t%04x ", pc->pc_device);
98+
start = memmem(start, (size_t) (end - start), buffer, len);
99+
if (start)
100+
{
101+
start += len;
102+
end = memchr(start, '\n', (uint32_t) (end - start));
103+
if (!end)
104+
end = pciids.chars + pciids.length;
105+
106+
char* openingBracket = memchr(start, '[', (uint32_t) (end - start));
107+
if (openingBracket)
108+
{
109+
openingBracket++;
110+
char* closingBracket = memchr(openingBracket, ']', (uint32_t) (end - openingBracket));
111+
if (closingBracket)
112+
ffStrbufSetNS(&gpu->name, (uint32_t) (closingBracket - openingBracket), openingBracket);
113+
}
114+
if (!gpu->name.length)
115+
ffStrbufSetNS(&gpu->name, (uint32_t) (end - start), start);
116+
}
117+
}
118+
}
119+
120+
if (!gpu->name.length)
121+
{
122+
const char* subclass;
123+
switch (pc->pc_subclass)
124+
{
125+
case PCIS_DISPLAY_VGA: subclass = " (VGA compatible)"; break;
126+
case PCIS_DISPLAY_XGA: subclass = " (XGA compatible)"; break;
127+
case PCIS_DISPLAY_3D: subclass = " (3D)"; break;
128+
default: subclass = ""; break;
129+
}
130+
131+
ffStrbufSetF(&gpu->name, "%s Device %04X%s", gpu->vendor.length ? gpu->vendor.chars : "Unknown", pc->pc_device, subclass);
132+
}
133+
134+
#ifdef FF_USE_PROPRIETARY_GPU_DRIVER_API
135+
if (gpu->vendor.chars == FF_GPU_VENDOR_NAME_NVIDIA && (options->temp || options->driverSpecific))
136+
{
137+
ffDetectNvidiaGpuInfo(&(FFGpuDriverCondition) {
138+
.type = FF_GPU_DRIVER_CONDITION_TYPE_BUS_ID,
139+
.pciBusId = {
140+
.domain = (uint32_t) pc->pc_sel.pc_domain,
141+
.bus = pc->pc_sel.pc_bus,
142+
.device = pc->pc_sel.pc_dev,
143+
.func = pc->pc_sel.pc_func,
144+
},
145+
}, (FFGpuDriverResult) {
146+
.temp = options->temp ? &gpu->temperature : NULL,
147+
.memory = options->driverSpecific ? &gpu->dedicated : NULL,
148+
.coreCount = options->driverSpecific ? (uint32_t*) &gpu->coreCount : NULL,
149+
.type = &gpu->type,
150+
.frequency = &gpu->frequency,
151+
}, "libnvidia-ml.so");
152+
153+
if (gpu->dedicated.total != FF_GPU_VMEM_SIZE_UNSET)
154+
gpu->type = gpu->dedicated.total > (uint64_t)1024 * 1024 * 1024 ? FF_GPU_TYPE_DISCRETE : FF_GPU_TYPE_INTEGRATED;
155+
}
156+
#endif // FF_USE_PROPRIETARY_GPU_DRIVER_API
157+
}
158+
159+
return NULL;
160+
}

0 commit comments

Comments
 (0)