Skip to content

Commit 823f2ef

Browse files
authored
Merge pull request #1215 from fastfetch-cli/dev
Release: v2.22.0
2 parents ff8e0e7 + 11cfdba commit 823f2ef

Some content is hidden

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

47 files changed

+1271
-237
lines changed

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
# 2.22.0
2+
3+
Features:
4+
* Small performance improvements (Terminal, Editor)
5+
* Improve arm32 and loongarch support (CPU, Linux)
6+
* Ignore the parent process if env `$FFTS_IGNORE_PARENT` is set to `1` (Shell)
7+
* Add code name of Apple M4 (CPU, Linux)
8+
* Add ethernet speed rate detection support (LocalIP)
9+
* Add zsh completion script
10+
* Add Linglong package manager detection support (Packages, Linux)
11+
12+
Bugfixes:
13+
* Fix building on macOS 10.14
14+
* Fix tmux in linux TTY (Colors)
15+
* Fix hang in WSL when custom format is used (Disk, Linux)
16+
* Fix `/proc/loadavg` parsing (Loadavg, Linux)
17+
* Disable use of `LC_NUMERIC` locale settings to fix parsing of decimal numbers
18+
* Fix possible segfault (DiskIO, Linux)
19+
* Honor `preciseRefreshRate` in custom format (Display)
20+
21+
Logos:
22+
* Add Lingmo OS
23+
* Add Sleeper OS
24+
125
# 2.21.3
226

327
Bugfixes:

CMakeLists.txt

Lines changed: 16 additions & 5 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.3
4+
VERSION 2.22.0
55
LANGUAGES C
66
DESCRIPTION "Fast neofetch-like system information tool"
77
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
@@ -69,7 +69,7 @@ cmake_dependent_option(ENABLE_FREETYPE "Enable freetype" ON "ANDROID" OFF)
6969
cmake_dependent_option(ENABLE_PULSE "Enable pulse" ON "LINUX OR SunOS" OFF)
7070
cmake_dependent_option(ENABLE_DDCUTIL "Enable ddcutil" ON "LINUX" OFF)
7171
cmake_dependent_option(ENABLE_DIRECTX_HEADERS "Enable DirectX headers for WSL" ON "LINUX" OFF)
72-
cmake_dependent_option(ENABLE_ELF "Enable libelf" ON "LINUX OR FreeBSD OR SunOS" OFF)
72+
cmake_dependent_option(ENABLE_ELF "Enable libelf" ON "LINUX OR FreeBSD OR ANDROID" OFF)
7373
cmake_dependent_option(ENABLE_THREADS "Enable multithreading" ON "Threads_FOUND" OFF)
7474

7575
option(ENABLE_SYSTEM_YYJSON "Use system provided (instead of fastfetch embedded) yyjson library" OFF)
@@ -401,6 +401,7 @@ set(LIBFASTFETCH_SRC
401401
src/util/base64.c
402402
src/util/FFlist.c
403403
src/util/FFstrbuf.c
404+
src/util/path.c
404405
src/util/platform/FFPlatform.c
405406
src/util/smbiosHelper.c
406407
)
@@ -481,7 +482,7 @@ if(LINUX)
481482
src/detection/wmtheme/wmtheme_linux.c
482483
src/detection/camera/camera_linux.c
483484
src/util/platform/FFPlatform_unix.c
484-
src/util/linux/elf.c
485+
src/util/binary_linux.c
485486
)
486487
elseif(ANDROID)
487488
list(APPEND LIBFASTFETCH_SRC
@@ -543,6 +544,7 @@ elseif(ANDROID)
543544
src/detection/wmtheme/wmtheme_nosupport.c
544545
src/detection/camera/camera_android.c
545546
src/util/platform/FFPlatform_unix.c
547+
src/util/binary_linux.c
546548
)
547549
elseif(FreeBSD)
548550
list(APPEND LIBFASTFETCH_SRC
@@ -621,7 +623,7 @@ elseif(FreeBSD)
621623
src/detection/wmtheme/wmtheme_linux.c
622624
src/detection/camera/camera_linux.c
623625
src/util/platform/FFPlatform_unix.c
624-
src/util/linux/elf.c
626+
src/util/binary_linux.c
625627
)
626628
elseif(APPLE)
627629
list(APPEND LIBFASTFETCH_SRC
@@ -687,6 +689,7 @@ elseif(APPLE)
687689
src/util/apple/cf_helpers.c
688690
src/util/apple/osascript.m
689691
src/util/platform/FFPlatform_unix.c
692+
src/util/binary_apple.c
690693
)
691694
elseif(WIN32)
692695
list(APPEND LIBFASTFETCH_SRC
@@ -753,6 +756,7 @@ elseif(WIN32)
753756
src/util/windows/unicode.c
754757
src/util/windows/wmi.cpp
755758
src/util/platform/FFPlatform_windows.c
759+
src/util/binary_windows.c
756760
)
757761
elseif(SunOS)
758762
list(APPEND LIBFASTFETCH_SRC
@@ -829,7 +833,7 @@ elseif(SunOS)
829833
src/detection/wmtheme/wmtheme_linux.c
830834
src/detection/camera/camera_nosupport.c
831835
src/util/platform/FFPlatform_unix.c
832-
src/util/linux/elf.c
836+
src/util/binary_linux.c
833837
)
834838
endif()
835839

@@ -1135,6 +1139,7 @@ elseif(WIN32)
11351139
PRIVATE "setupapi"
11361140
PRIVATE "hid"
11371141
PRIVATE "wtsapi32"
1142+
PRIVATE "imagehlp"
11381143
)
11391144
elseif(FreeBSD)
11401145
target_link_libraries(libfastfetch
@@ -1332,6 +1337,12 @@ install(
13321337
RENAME "${CMAKE_PROJECT_NAME}"
13331338
)
13341339

1340+
install(
1341+
FILES "${CMAKE_SOURCE_DIR}/completions/${CMAKE_PROJECT_NAME}.zsh"
1342+
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/zsh/site-functions"
1343+
RENAME "_${CMAKE_PROJECT_NAME}"
1344+
)
1345+
13351346
install(
13361347
FILES "${CMAKE_SOURCE_DIR}/completions/${CMAKE_PROJECT_NAME}.fish"
13371348
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/fish/vendor_completions.d"

README.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,23 @@ There are [screenshots on different platforms](https://github.com/fastfetch-cli/
3030
Some distros packaged an outdated fastfetch version. Older version receive no support, so please try always to use the latest version.
3131

3232
* Ubuntu: [`ppa:zhangsongcui3371/fastfetch`](https://launchpad.net/~zhangsongcui3371/+archive/ubuntu/fastfetch) (for Ubuntu 22.04 or newer)
33-
* Debian: `sudo apt install fastfetch` (for Debian 13 or newer)
33+
* Debian: `apt install fastfetch` (for Debian 13 or newer)
3434
* Debian / Ubuntu: Download `fastfetch-linux-<proper architecture>.deb` from [Github release page](https://github.com/fastfetch-cli/fastfetch/releases/latest) and double-click it (for Ubuntu 20.04 or newer and Debian 11 or newer).
35-
* Arch Linux: `sudo pacman -S fastfetch`
36-
* Fedora: `sudo dnf install fastfetch`
37-
* Gentoo: `sudo emerge --ask app-misc/fastfetch`
35+
* Arch Linux: `pacman -S fastfetch`
36+
* Fedora: `dnf install fastfetch`
37+
* Gentoo: `emerge --ask app-misc/fastfetch`
3838
* Alpine: `apk add --upgrade fastfetch`
3939
* NixOS: `nix-shell -p fastfetch`
40-
* openSUSE: `sudo zypper install fastfetch`
41-
* ALT Linux: `sudo apt-get install fastfetch`
40+
* openSUSE: `zypper install fastfetch`
41+
* ALT Linux: `apt-get install fastfetch`
42+
* Exherbo: `cave resolve --execute app-misc/fastfetch`
43+
* GNU Guix: `guix install fastfetch`
44+
* Solus: `eopkg install fastfetch`
45+
* Slackware: `sbopkg -i fastfetch`
46+
* Void Linux: `xbps-install fastfetch`
47+
* Venom Linux: `scratch install fastfetch`
4248

43-
Replace sudo with doas depending on what you use.
49+
You may need `sudo`, `doas` or `sup` to run these commands.
4450

4551
[See also if fastfetch has been packaged for your favorite Linux distro](#Packaging).
4652

@@ -54,8 +60,9 @@ If fastfetch is not packaged for your distro or an outdated version is packaged,
5460
### Windows
5561

5662
* [scoop](https://scoop.sh/#/apps?q=fastfetch): `scoop install fastfetch`
63+
* [Chocolatey](https://community.chocolatey.org/packages/fastfetch): `choco install fastfetch`
5764
* [winget](https://github.com/microsoft/winget-pkgs/tree/master/manifests/f/Fastfetch-cli/Fastfetch): `winget install fastfetch`
58-
* [MSYS2 MinGW](https://github.com/msys2/MINGW-packages/tree/master/mingw-w64-fastfetch): `pacman -S mingw-w64-<subsystem>-<arch>-fastfetch`
65+
* [MSYS2 MinGW](https://packages.msys2.org/base/mingw-w64-fastfetch): `pacman -S mingw-w64-<subsystem>-<arch>-fastfetch`
5966

6067
You may also download the program directly from [the GitHub releases page](https://github.com/fastfetch-cli/fastfetch/releases/latest) in the form of an archive file.
6168

completions/fastfetch.zsh

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
#compdef fastfetch
2+
3+
function _fastfetch() {
4+
local state
5+
6+
local -a opts
7+
opts=(${(f)"$(
8+
python <<EOF
9+
import json
10+
import subprocess
11+
import sys
12+
13+
14+
def main():
15+
data: dict[str, list[dict]] = json.loads(
16+
subprocess.check_output(["fastfetch", "--help-raw"])
17+
)
18+
19+
for key in data:
20+
for flag in data[key]:
21+
if flag.get("pseudo", False):
22+
continue
23+
24+
if "short" in flag:
25+
command_prefix = f"""-{flag["short"]}[{flag["desc"]}]"""
26+
print_command(command_prefix, flag)
27+
28+
if "long" in flag:
29+
command_prefix = f"""--{flag["long"]}[{flag["desc"]}]"""
30+
print_command(command_prefix, flag)
31+
32+
33+
def print_command(command_prefix: str, flag: dict):
34+
if "arg" in flag:
35+
type: str = flag["arg"]["type"]
36+
if type == "bool":
37+
print(f"{command_prefix}:bool:(true false)")
38+
elif type == "color":
39+
print(f"{command_prefix}:color:(black red green yellow blue magenta cyan white default)")
40+
elif type == "command":
41+
print(f"{command_prefix}:module:->modules")
42+
elif type == "config":
43+
print(f"{command_prefix}:presets:->presets")
44+
elif type == "enum":
45+
temp: str = " ".join(flag["arg"]["enum"])
46+
print(f'{command_prefix}:type:( {temp} )')
47+
elif type == "logo":
48+
print(f"{command_prefix}:logo:->logo")
49+
elif type == "structure":
50+
print(f"{command_prefix}:structure:->structure")
51+
elif type == "path":
52+
print(f"{command_prefix}:path:_files -/")
53+
else:
54+
print(f"{command_prefix}:")
55+
else:
56+
print(f"{command_prefix}")
57+
58+
59+
if __name__ == "__main__":
60+
try:
61+
main()
62+
except Exception:
63+
sys.exit(1)
64+
EOF
65+
)"})
66+
67+
_arguments -C "$opts[@]"
68+
69+
case $state in
70+
modules)
71+
local -a modules=( ${(f)"$(fastfetch --list-modules autocompletion)"} )
72+
modules=( ${(L)^modules%%:*}-format format color )
73+
_describe 'module' modules
74+
;;
75+
presets)
76+
local -a presets=(
77+
${$(fastfetch --list-presets autocompletion):#.*}
78+
"none:Disable loading config file"
79+
)
80+
_describe 'preset' presets
81+
;;
82+
structure)
83+
local -a structures=( ${(f)"$(fastfetch --list-modules autocompletion)"} )
84+
_describe 'structure' structures
85+
;;
86+
logo)
87+
local -a logos=(
88+
$(fastfetch --list-logos autocompletion)
89+
"none:Don't print logo"
90+
"small:Print small ascii logo if available"
91+
)
92+
_describe 'logo' logos
93+
;;
94+
esac
95+
}
96+
97+
_fastfetch "$@"

debian/changelog

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

39
* Update to 2.21.2

debian/files

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

presets/examples/23.jsonc

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,45 +11,51 @@
1111
},
1212
"separator": ""
1313
},
14-
"modules": [
14+
"modules": [
1515
{
1616
"type": "kernel",
17-
"key": "Vanilla ",
17+
"key": "[_Kernel___> ",
1818
"keyColor": "blue"
1919
},
2020
{
2121
"type": "packages",
22+
"outputColor": "white",
2223
"key": " [_Packages_> ",
2324
"keyColor": "green"
2425
},
2526
{
2627
"type": "localip",
28+
"outputColor": "white",
2729
"key": " [_Local_IP_> ",
2830
"keyColor": "green"
2931
},
30-
{
31-
"type": "cpu",
32-
"key": " [_CPU______> ",
33-
"keyColor": "magenta"
34-
},
3532
{
3633
"type": "memory",
34+
"format": "[{3}] {1} / {2}",
3735
"key": " [_RAM______> ",
3836
"keyColor": "magenta"
3937
},
4038
{
4139
"type": "swap",
40+
"format": "[{3}] {1} / {2}",
4241
"key": " [_SWAP_____> ",
4342
"keyColor": "magenta"
4443
},
4544
{
4645
"type": "disk",
46+
"format": "[{3}] {1} / {2} {9}",
4747
"key": " [_Disk_____> ",
4848
"keyColor": "magenta"
4949
},
50+
{
51+
"type": "battery",
52+
"format": "[{4}] {5}",
53+
"key": " [_Battery__> ",
54+
"keyColor": "magenta"
55+
},
5056
"break",
5157
{
52-
"type":"colors",
58+
"type": "colors",
5359
"paddingLeft": 9,
5460
"symbol": "circle"
5561
}

src/common/init.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@ void ffInitInstance(void)
5454
#else
5555
// Never use `setlocale(LC_ALL, "")`
5656
setlocale(LC_TIME, "");
57-
setlocale(LC_NUMERIC, "");
58-
#ifdef LC_MESSAGES
59-
setlocale(LC_MESSAGES, "");
60-
#endif
6157
#endif
6258

6359
initState(&instance.state);

src/detection/cpu/cpu.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const char* ffCPUAppleCodeToName(uint32_t code)
3636
case 6030: return "Apple M3 Pro";
3737
case 6031:
3838
case 6034: return "Apple M3 Max";
39+
case 8132: return "Apple M4";
3940
default: return "Apple Silicon";
4041
}
4142
}

src/detection/cpu/cpu.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,30 @@ typedef struct FFCPUResult
3030

3131
const char* ffDetectCPU(const FFCPUOptions* options, FFCPUResult* cpu);
3232
const char* ffCPUAppleCodeToName(uint32_t code);
33+
34+
35+
#if defined(__x86_64__) || defined(__i386__)
36+
37+
#include <cpuid.h>
38+
39+
// WARNING: CPUID may report frequencies of efficient cores
40+
inline static const char* ffCPUDetectSpeedByCpuid(FFCPUResult* cpu)
41+
{
42+
uint32_t base = 0, max = 0, bus = 0, unused = 0;
43+
if (!__get_cpuid(0x16, &base, &max, &bus, &unused))
44+
return "Unsupported instruction";
45+
46+
// cpuid returns 0 MHz when hyper-v is enabled
47+
if (base) cpu->frequencyBase = base;
48+
if (max) cpu->frequencyMax = max;
49+
return NULL;
50+
}
51+
52+
#else
53+
54+
inline static const char* ffCPUDetectSpeedByCpuid(FF_MAYBE_UNUSED FFCPUResult* cpu)
55+
{
56+
return "Unsupported platform";
57+
}
58+
59+
#endif

src/detection/cpu/cpu_bsd.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
3939
}
4040
}
4141

42+
ffCPUDetectSpeedByCpuid(cpu);
43+
4244
for (uint16_t i = 0; i < cpu->coresLogical; ++i)
4345
{
4446
ffStrbufClear(&buffer);

0 commit comments

Comments
 (0)