Skip to content

Commit 636126c

Browse files
authored
Merge pull request #1239 from fastfetch-cli/dev
Release: v2.23.0
2 parents 823f2ef + 2e475d5 commit 636126c

Some content is hidden

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

54 files changed

+1108
-216
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,8 @@ jobs:
388388
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On .
389389
cmake --build . --target package --verbose -j4
390390
./fastfetch --list-features
391-
time ./fastfetch
392-
time ./fastfetch --format json
391+
time ./fastfetch -c presets/ci.jsonc --stat false
392+
time ./fastfetch -c presets/ci.jsonc --format json
393393
time ./flashfetch
394394
ldd fastfetch
395395
ctest
@@ -426,8 +426,8 @@ jobs:
426426
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On .
427427
cmake --build . --target package --verbose -j4
428428
./fastfetch --list-features
429-
time ./fastfetch
430-
time ./fastfetch --format json
429+
time ./fastfetch -c presets/ci.jsonc --stat false
430+
time ./fastfetch -c presets/ci.jsonc --format json
431431
time ./flashfetch
432432
ldd fastfetch
433433
ctest

CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
# 2.23.0
2+
3+
Features:
4+
* Support unity version detection (DE, Linux)
5+
* Print model name in Battery keys if available (Battery)
6+
* Add module `Zpool`
7+
* Improve performance (Shell / Terminal, Linux)
8+
* Support syntax of padded strings in `--<module>-format`. `{variable<padlength}` and `{variable>padlength}` are supported.
9+
* If pad length is greater than the length of the variable, the variable will be padded with spaces.
10+
* `fastfetch -l none -s command --command-text 'echo 12345' --command-format 'output({1<20})'` prints `Command: output(12345 )`
11+
* `fastfetch -l none -s command --command-text 'echo 12345' --command-format 'output({1>20})'` prints `Command: output( 12345)`
12+
* If pad length is less than the length of the variable, the variable will be truncated.
13+
14+
Bugfixes:
15+
* Fix broken `--list-presets`
16+
* Update zsh completion script
17+
* Don't print `*` if `defaultRouteOnly` is set (NetIO)
18+
* Fix Camera module incorrectly disabled on FreeBSD (Camera, FreeBSD)
19+
* Fix hanging on screen 5.0 (Terminal)
20+
* Improve image logo support on Windows (Logo, Windows)
21+
22+
Logos:
23+
* Update AmogOS
24+
* Add Magix
25+
* Make ubuntu logo colorable
26+
* Add Steam Deck Logo
27+
* add Huawei Cloud EulerOS
28+
129
# 2.22.0
230

331
Features:

CMakeLists.txt

Lines changed: 44 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.22.0
4+
VERSION 2.23.0
55
LANGUAGES C
66
DESCRIPTION "Fast neofetch-like system information tool"
77
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
@@ -71,6 +71,7 @@ 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)
7272
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)
74+
cmake_dependent_option(ENABLE_LIBZFS "Enable libzfs" ON "LINUX OR FreeBSD OR SunOS" OFF)
7475

7576
option(ENABLE_SYSTEM_YYJSON "Use system provided (instead of fastfetch embedded) yyjson library" OFF)
7677
option(ENABLE_ASAN "Build fastfetch with ASAN (address sanitizer)" OFF)
@@ -392,6 +393,7 @@ set(LIBFASTFETCH_SRC
392393
src/modules/wifi/wifi.c
393394
src/modules/wm/wm.c
394395
src/modules/wmtheme/wmtheme.c
396+
src/modules/zpool/zpool.c
395397
src/options/display.c
396398
src/options/modules.c
397399
src/options/logo.c
@@ -481,6 +483,7 @@ if(LINUX)
481483
src/detection/de/de_linux.c
482484
src/detection/wmtheme/wmtheme_linux.c
483485
src/detection/camera/camera_linux.c
486+
src/detection/zpool/zpool_linux.c
484487
src/util/platform/FFPlatform_unix.c
485488
src/util/binary_linux.c
486489
)
@@ -543,6 +546,7 @@ elseif(ANDROID)
543546
src/detection/de/de_nosupport.c
544547
src/detection/wmtheme/wmtheme_nosupport.c
545548
src/detection/camera/camera_android.c
549+
src/detection/zpool/zpool_nosupport.c
546550
src/util/platform/FFPlatform_unix.c
547551
src/util/binary_linux.c
548552
)
@@ -622,6 +626,7 @@ elseif(FreeBSD)
622626
src/detection/de/de_linux.c
623627
src/detection/wmtheme/wmtheme_linux.c
624628
src/detection/camera/camera_linux.c
629+
src/detection/zpool/zpool_linux.c
625630
src/util/platform/FFPlatform_unix.c
626631
src/util/binary_linux.c
627632
)
@@ -686,6 +691,7 @@ elseif(APPLE)
686691
src/detection/de/de_nosupport.c
687692
src/detection/wmtheme/wmtheme_apple.m
688693
src/detection/camera/camera_apple.m
694+
src/detection/zpool/zpool_nosupport.c
689695
src/util/apple/cf_helpers.c
690696
src/util/apple/osascript.m
691697
src/util/platform/FFPlatform_unix.c
@@ -750,6 +756,7 @@ elseif(WIN32)
750756
src/detection/de/de_nosupport.c
751757
src/detection/wmtheme/wmtheme_windows.c
752758
src/detection/camera/camera_windows.cpp
759+
src/detection/zpool/zpool_nosupport.c
753760
src/util/windows/getline.c
754761
src/util/windows/com.cpp
755762
src/util/windows/registry.c
@@ -832,6 +839,7 @@ elseif(SunOS)
832839
src/detection/de/de_linux.c
833840
src/detection/wmtheme/wmtheme_linux.c
834841
src/detection/camera/camera_nosupport.c
842+
src/detection/zpool/zpool_linux.c
835843
src/util/platform/FFPlatform_unix.c
836844
src/util/binary_linux.c
837845
)
@@ -1091,6 +1099,25 @@ ff_lib_enable(DIRECTX_HEADERS
10911099
"DirectX-Headers"
10921100
"DirectX-Headers"
10931101
)
1102+
# The system <libzfs.h> is only usable on SunOS. We provide our local copy of it so it's always available.
1103+
if(ENABLE_LIBZFS)
1104+
if(BINARY_LINK_TYPE STREQUAL "dlopen")
1105+
target_compile_definitions(libfastfetch PRIVATE FF_HAVE_LIBZFS=1)
1106+
else()
1107+
set(CMAKE_REQUIRED_LIBRARIES_BACKUP ${CMAKE_REQUIRED_LIBRARIES})
1108+
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} zfs)
1109+
check_function_exists("libzfs_init" LIBZFS_FOUND)
1110+
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_BACKUP})
1111+
if(NOT LIBZFS_FOUND)
1112+
message(STATUS "Library: missing: LIBZFS")
1113+
else()
1114+
message(STATUS "Library: found LIBZFS")
1115+
target_compile_definitions(libfastfetch PRIVATE FF_HAVE_LIBZFS=1)
1116+
target_link_libraries(libfastfetch PRIVATE zfs)
1117+
endif()
1118+
endif()
1119+
endif()
1120+
10941121

10951122
if(ENABLE_THREADS)
10961123
target_compile_definitions(libfastfetch PRIVATE FF_HAVE_THREADS)
@@ -1153,6 +1180,8 @@ elseif(SunOS)
11531180
PRIVATE "socket"
11541181
PRIVATE "kstat"
11551182
PRIVATE "proc"
1183+
PRIVATE "zfs"
1184+
PRIVATE "nvpair"
11561185
)
11571186
elseif(ANDROID)
11581187
CHECK_LIBRARY_EXISTS(-l:libandroid-wordexp.a wordexp "" HAVE_LIBANDROID_WORDEXP_STATIC)
@@ -1196,11 +1225,16 @@ if(WIN32)
11961225
endif()
11971226
set(CMAKE_CXX_STANDARD 17)
11981227
endif()
1199-
if(LINUX)
1228+
if(FreeBSD)
1229+
set(CMAKE_REQUIRED_INCLUDES "/usr/local/include" "/usr/include")
1230+
endif()
1231+
if(LINUX OR FreeBSD)
12001232
CHECK_INCLUDE_FILE("linux/videodev2.h" HAVE_LINUX_VIDEODEV2)
12011233
if(HAVE_LINUX_VIDEODEV2)
12021234
target_compile_definitions(libfastfetch PRIVATE FF_HAVE_LINUX_VIDEODEV2=1)
12031235
endif()
1236+
endif()
1237+
if(LINUX)
12041238
CHECK_INCLUDE_FILE("linux/wireless.h" HAVE_LINUX_WIRELESS)
12051239
if(HAVE_LINUX_WIRELESS)
12061240
target_compile_definitions(libfastfetch PRIVATE FF_HAVE_LINUX_WIRELESS=1)
@@ -1308,9 +1342,17 @@ if (BUILD_TESTS)
13081342
PRIVATE libfastfetch
13091343
)
13101344

1345+
add_executable(fastfetch-test-format
1346+
tests/format.c
1347+
)
1348+
target_link_libraries(fastfetch-test-format
1349+
PRIVATE libfastfetch
1350+
)
1351+
13111352
enable_testing()
13121353
add_test(NAME test-strbuf COMMAND fastfetch-test-strbuf)
13131354
add_test(NAME test-list COMMAND fastfetch-test-list)
1355+
add_test(NAME test-format COMMAND fastfetch-test-format)
13141356
endif()
13151357

13161358
##################

completions/fastfetch.zsh

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
function _fastfetch() {
44
local state
55

6-
local -a opts
7-
opts=(${(f)"$(
8-
python <<EOF
6+
local -a opts=("${(f)$(
7+
python3 <<EOF
98
import json
109
import subprocess
1110
import sys
@@ -18,38 +17,44 @@ def main():
1817
1918
for key in data:
2019
for flag in data[key]:
20+
if flag["long"] == "logo-color-[1-9]":
21+
for i in range(1, 10):
22+
command_prefix = f"--logo-color-{i}[{flag["desc"]} ({i})]"
23+
print_command(command_prefix, flag)
24+
continue
25+
2126
if flag.get("pseudo", False):
2227
continue
2328
2429
if "short" in flag:
25-
command_prefix = f"""-{flag["short"]}[{flag["desc"]}]"""
30+
command_prefix = f"-{flag["short"]}[{flag["desc"]}]"
2631
print_command(command_prefix, flag)
2732
2833
if "long" in flag:
29-
command_prefix = f"""--{flag["long"]}[{flag["desc"]}]"""
34+
command_prefix = f"--{flag["long"]}[{flag["desc"]}]"
3035
print_command(command_prefix, flag)
3136
3237
3338
def print_command(command_prefix: str, flag: dict):
3439
if "arg" in flag:
3540
type: str = flag["arg"]["type"]
3641
if type == "bool":
37-
print(f"{command_prefix}:bool:(true false)")
42+
print(f"{command_prefix}::bool:(true false)")
3843
elif type == "color":
39-
print(f"{command_prefix}:color:(black red green yellow blue magenta cyan white default)")
44+
print(f"{command_prefix}:color:->colors")
4045
elif type == "command":
41-
print(f"{command_prefix}:module:->modules")
46+
print(f"{command_prefix}::module:->modules")
4247
elif type == "config":
43-
print(f"{command_prefix}:presets:->presets")
48+
print(f"{command_prefix}:preset:->presets")
4449
elif type == "enum":
4550
temp: str = " ".join(flag["arg"]["enum"])
46-
print(f'{command_prefix}:type:( {temp} )')
51+
print(f'{command_prefix}:type:({temp})')
4752
elif type == "logo":
48-
print(f"{command_prefix}:logo:->logo")
53+
print(f"{command_prefix}:logo:->logos")
4954
elif type == "structure":
50-
print(f"{command_prefix}:structure:->structure")
55+
print(f"{command_prefix}:structure:->structures")
5156
elif type == "path":
52-
print(f"{command_prefix}:path:_files -/")
57+
print(f"{command_prefix}::path:_files")
5358
else:
5459
print(f"{command_prefix}:")
5560
else:
@@ -62,30 +67,34 @@ if __name__ == "__main__":
6267
except Exception:
6368
sys.exit(1)
6469
EOF
65-
)"})
70+
)}")
6671

67-
_arguments -C "$opts[@]"
72+
_arguments "$opts[@]"
6873

6974
case $state in
75+
colors)
76+
local -a colors=(black red green yellow blue magenta cyan white default)
77+
_describe 'color' colors
78+
;;
7079
modules)
71-
local -a modules=( ${(f)"$(fastfetch --list-modules autocompletion)"} )
72-
modules=( ${(L)^modules%%:*}-format format color )
80+
local -a modules=("${(f)$(fastfetch --list-modules autocompletion)}")
81+
modules=(${(L)^modules[@]%%:*}-format format color)
7382
_describe 'module' modules
7483
;;
7584
presets)
7685
local -a presets=(
77-
${$(fastfetch --list-presets autocompletion):#.*}
86+
"${(f)$(fastfetch --list-presets autocompletion)}"
7887
"none:Disable loading config file"
7988
)
80-
_describe 'preset' presets
89+
_describe 'preset' presets || _files
8190
;;
82-
structure)
83-
local -a structures=( ${(f)"$(fastfetch --list-modules autocompletion)"} )
91+
structures)
92+
local -a structures=("${(f)$(fastfetch --list-modules autocompletion)}")
8493
_describe 'structure' structures
8594
;;
86-
logo)
95+
logos)
8796
local -a logos=(
88-
$(fastfetch --list-logos autocompletion)
97+
"${(f)$(fastfetch --list-logos autocompletion)}"
8998
"none:Don't print logo"
9099
"small:Print small ascii logo if available"
91100
)

debian/changelog

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

39
* Update to 2.21.3

debian/files

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

doc/json_schema.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,8 @@
820820
"weather",
821821
"wm",
822822
"wifi",
823-
"wmtheme"
823+
"wmtheme",
824+
"zpool"
824825
]
825826
},
826827
{
@@ -993,6 +994,10 @@
993994
{
994995
"const": "wmtheme",
995996
"description": "Print current theme of window manager"
997+
},
998+
{
999+
"const": "zpool",
1000+
"description": "Print ZFS storage pools"
9961001
}
9971002
]
9981003
},

presets/all.jsonc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"physicalmemory",
5555
"swap",
5656
"disk",
57+
"zpool",
5758
"battery",
5859
"poweradapter",
5960
"player",

presets/ci.jsonc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"physicalmemory",
5757
"swap",
5858
"disk",
59+
"zpool",
5960
"battery",
6061
"poweradapter",
6162
"player",

presets/examples/20.jsonc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@
111111
{
112112
"type": "loadavg",
113113
"compact": false,
114-
// {duration} is not fixed length, hack it
115-
"key": "│ LOAD \u001b[s{duration}m\u001b[u\u001b[6C│{$1}"
114+
"key": "│ LOAD {duration>2}m │{$1}" // pad duration to 2 chars
116115
},
117116
{
118117
"type": "custom",

0 commit comments

Comments
 (0)