Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
e35aed7
Packaging: update debian stuff [ci skip]
CarterLi Aug 26, 2024
5a9c315
IO (Unix): fix isDir condition checking; skip hidden files
CarterLi Aug 26, 2024
c0a0700
Completion: update zsh-completion to reflect latest upstream changes …
AtifChy Aug 26, 2024
03c95e5
Shell: improve performance of bash and zsh version detection
CarterLi Aug 27, 2024
67d0dfc
DE (Linux): support unity version detection
CarterLi Aug 27, 2024
df72993
Binary: improve performance
CarterLi Aug 27, 2024
8c51836
Logo (Builtin): update amogos
CarterLi Aug 25, 2024
b22e28b
NetIO: don't print `*` if `defaultRouteOnly` is set
CarterLi Aug 27, 2024
5c8e771
Binary (Linux): fix building without libelf enabled
CarterLi Aug 28, 2024
2010472
Completion: add optional completion support for certain flags (#1219)
AtifChy Aug 28, 2024
5842ad1
Battery: print model name in key
CarterLi Aug 28, 2024
d946cf2
Zpool: add new module
CarterLi Aug 28, 2024
8b9f787
Zpool: fix build on SunOS
CarterLi Aug 28, 2024
e0f8e39
CI: add zpool
CarterLi Aug 28, 2024
f0bc08e
CI: run all modules on FreeBSD and SunOS
CarterLi Aug 28, 2024
f828d3a
Camera (FreeBSD): fix module was incorrectly disabled
CarterLi Aug 28, 2024
66977de
Completion (Zsh): add completion for `--logo-color-{1..9}` (#1222)
AtifChy Aug 29, 2024
de8bbc9
Camera (FreeBSD): fix module was incorrectly disabled (v2)
CarterLi Aug 28, 2024
d25ac86
Logo (Builtin): Add Magix (#1228)
Crystaltrd Aug 30, 2024
d758037
Terminal: improve performance of xfce4-terminal version
CarterLi Aug 29, 2024
10fdc8e
Logo (Builtin): make ubuntu logo colorable
CarterLi Aug 30, 2024
adc03bd
Logo (Builtin): Add Steam Deck Logo (#1229)
libewa Aug 30, 2024
73e9db5
Zpool (SunOS): fix the dlsym error
CarterLi Aug 30, 2024
99e0dc9
Zpool: don't break `-DBINARY_LINK_TYPE=dynamic`
CarterLi Aug 31, 2024
1ab86a8
TerminalTheme: fix hanging on screen 5.0
CarterLi Sep 2, 2024
e427a51
Logo (Builtin): add small Steam Deck
CarterLi Sep 2, 2024
093940e
Logo (Builtin): add Huawei Cloud EulerOS
CarterLi Sep 2, 2024
85d8939
Format: support syntax of padded string
CarterLi Sep 2, 2024
6473524
Presets: use string padding syntax
CarterLi Sep 2, 2024
4355163
Logo (Image): better Windows support
CarterLi Sep 2, 2024
0cf45c1
Release: v2.23.0
CarterLi Sep 3, 2024
2e475d5
JsonSchema: update `zpool`
CarterLi Sep 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,8 @@ jobs:
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On .
cmake --build . --target package --verbose -j4
./fastfetch --list-features
time ./fastfetch
time ./fastfetch --format json
time ./fastfetch -c presets/ci.jsonc --stat false
time ./fastfetch -c presets/ci.jsonc --format json
time ./flashfetch
ldd fastfetch
ctest
Expand Down Expand Up @@ -426,8 +426,8 @@ jobs:
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On .
cmake --build . --target package --verbose -j4
./fastfetch --list-features
time ./fastfetch
time ./fastfetch --format json
time ./fastfetch -c presets/ci.jsonc --stat false
time ./fastfetch -c presets/ci.jsonc --format json
time ./flashfetch
ldd fastfetch
ctest
Expand Down
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
# 2.23.0

Features:
* Support unity version detection (DE, Linux)
* Print model name in Battery keys if available (Battery)
* Add module `Zpool`
* Improve performance (Shell / Terminal, Linux)
* Support syntax of padded strings in `--<module>-format`. `{variable<padlength}` and `{variable>padlength}` are supported.
* If pad length is greater than the length of the variable, the variable will be padded with spaces.
* `fastfetch -l none -s command --command-text 'echo 12345' --command-format 'output({1<20})'` prints `Command: output(12345 )`
* `fastfetch -l none -s command --command-text 'echo 12345' --command-format 'output({1>20})'` prints `Command: output( 12345)`
* If pad length is less than the length of the variable, the variable will be truncated.

Bugfixes:
* Fix broken `--list-presets`
* Update zsh completion script
* Don't print `*` if `defaultRouteOnly` is set (NetIO)
* Fix Camera module incorrectly disabled on FreeBSD (Camera, FreeBSD)
* Fix hanging on screen 5.0 (Terminal)
* Improve image logo support on Windows (Logo, Windows)

Logos:
* Update AmogOS
* Add Magix
* Make ubuntu logo colorable
* Add Steam Deck Logo
* add Huawei Cloud EulerOS

# 2.22.0

Features:
Expand Down
46 changes: 44 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url

project(fastfetch
VERSION 2.22.0
VERSION 2.23.0
LANGUAGES C
DESCRIPTION "Fast neofetch-like system information tool"
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
Expand Down Expand Up @@ -71,6 +71,7 @@ cmake_dependent_option(ENABLE_DDCUTIL "Enable ddcutil" ON "LINUX" OFF)
cmake_dependent_option(ENABLE_DIRECTX_HEADERS "Enable DirectX headers for WSL" ON "LINUX" OFF)
cmake_dependent_option(ENABLE_ELF "Enable libelf" ON "LINUX OR FreeBSD OR ANDROID" OFF)
cmake_dependent_option(ENABLE_THREADS "Enable multithreading" ON "Threads_FOUND" OFF)
cmake_dependent_option(ENABLE_LIBZFS "Enable libzfs" ON "LINUX OR FreeBSD OR SunOS" OFF)

option(ENABLE_SYSTEM_YYJSON "Use system provided (instead of fastfetch embedded) yyjson library" OFF)
option(ENABLE_ASAN "Build fastfetch with ASAN (address sanitizer)" OFF)
Expand Down Expand Up @@ -392,6 +393,7 @@ set(LIBFASTFETCH_SRC
src/modules/wifi/wifi.c
src/modules/wm/wm.c
src/modules/wmtheme/wmtheme.c
src/modules/zpool/zpool.c
src/options/display.c
src/options/modules.c
src/options/logo.c
Expand Down Expand Up @@ -481,6 +483,7 @@ if(LINUX)
src/detection/de/de_linux.c
src/detection/wmtheme/wmtheme_linux.c
src/detection/camera/camera_linux.c
src/detection/zpool/zpool_linux.c
src/util/platform/FFPlatform_unix.c
src/util/binary_linux.c
)
Expand Down Expand Up @@ -543,6 +546,7 @@ elseif(ANDROID)
src/detection/de/de_nosupport.c
src/detection/wmtheme/wmtheme_nosupport.c
src/detection/camera/camera_android.c
src/detection/zpool/zpool_nosupport.c
src/util/platform/FFPlatform_unix.c
src/util/binary_linux.c
)
Expand Down Expand Up @@ -622,6 +626,7 @@ elseif(FreeBSD)
src/detection/de/de_linux.c
src/detection/wmtheme/wmtheme_linux.c
src/detection/camera/camera_linux.c
src/detection/zpool/zpool_linux.c
src/util/platform/FFPlatform_unix.c
src/util/binary_linux.c
)
Expand Down Expand Up @@ -686,6 +691,7 @@ elseif(APPLE)
src/detection/de/de_nosupport.c
src/detection/wmtheme/wmtheme_apple.m
src/detection/camera/camera_apple.m
src/detection/zpool/zpool_nosupport.c
src/util/apple/cf_helpers.c
src/util/apple/osascript.m
src/util/platform/FFPlatform_unix.c
Expand Down Expand Up @@ -750,6 +756,7 @@ elseif(WIN32)
src/detection/de/de_nosupport.c
src/detection/wmtheme/wmtheme_windows.c
src/detection/camera/camera_windows.cpp
src/detection/zpool/zpool_nosupport.c
src/util/windows/getline.c
src/util/windows/com.cpp
src/util/windows/registry.c
Expand Down Expand Up @@ -832,6 +839,7 @@ elseif(SunOS)
src/detection/de/de_linux.c
src/detection/wmtheme/wmtheme_linux.c
src/detection/camera/camera_nosupport.c
src/detection/zpool/zpool_linux.c
src/util/platform/FFPlatform_unix.c
src/util/binary_linux.c
)
Expand Down Expand Up @@ -1091,6 +1099,25 @@ ff_lib_enable(DIRECTX_HEADERS
"DirectX-Headers"
"DirectX-Headers"
)
# The system <libzfs.h> is only usable on SunOS. We provide our local copy of it so it's always available.
if(ENABLE_LIBZFS)
if(BINARY_LINK_TYPE STREQUAL "dlopen")
target_compile_definitions(libfastfetch PRIVATE FF_HAVE_LIBZFS=1)
else()
set(CMAKE_REQUIRED_LIBRARIES_BACKUP ${CMAKE_REQUIRED_LIBRARIES})
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} zfs)
check_function_exists("libzfs_init" LIBZFS_FOUND)
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_BACKUP})
if(NOT LIBZFS_FOUND)
message(STATUS "Library: missing: LIBZFS")
else()
message(STATUS "Library: found LIBZFS")
target_compile_definitions(libfastfetch PRIVATE FF_HAVE_LIBZFS=1)
target_link_libraries(libfastfetch PRIVATE zfs)
endif()
endif()
endif()


if(ENABLE_THREADS)
target_compile_definitions(libfastfetch PRIVATE FF_HAVE_THREADS)
Expand Down Expand Up @@ -1153,6 +1180,8 @@ elseif(SunOS)
PRIVATE "socket"
PRIVATE "kstat"
PRIVATE "proc"
PRIVATE "zfs"
PRIVATE "nvpair"
)
elseif(ANDROID)
CHECK_LIBRARY_EXISTS(-l:libandroid-wordexp.a wordexp "" HAVE_LIBANDROID_WORDEXP_STATIC)
Expand Down Expand Up @@ -1196,11 +1225,16 @@ if(WIN32)
endif()
set(CMAKE_CXX_STANDARD 17)
endif()
if(LINUX)
if(FreeBSD)
set(CMAKE_REQUIRED_INCLUDES "/usr/local/include" "/usr/include")
endif()
if(LINUX OR FreeBSD)
CHECK_INCLUDE_FILE("linux/videodev2.h" HAVE_LINUX_VIDEODEV2)
if(HAVE_LINUX_VIDEODEV2)
target_compile_definitions(libfastfetch PRIVATE FF_HAVE_LINUX_VIDEODEV2=1)
endif()
endif()
if(LINUX)
CHECK_INCLUDE_FILE("linux/wireless.h" HAVE_LINUX_WIRELESS)
if(HAVE_LINUX_WIRELESS)
target_compile_definitions(libfastfetch PRIVATE FF_HAVE_LINUX_WIRELESS=1)
Expand Down Expand Up @@ -1308,9 +1342,17 @@ if (BUILD_TESTS)
PRIVATE libfastfetch
)

add_executable(fastfetch-test-format
tests/format.c
)
target_link_libraries(fastfetch-test-format
PRIVATE libfastfetch
)

enable_testing()
add_test(NAME test-strbuf COMMAND fastfetch-test-strbuf)
add_test(NAME test-list COMMAND fastfetch-test-list)
add_test(NAME test-format COMMAND fastfetch-test-format)
endif()

##################
Expand Down
55 changes: 32 additions & 23 deletions completions/fastfetch.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
function _fastfetch() {
local state

local -a opts
opts=(${(f)"$(
python <<EOF
local -a opts=("${(f)$(
python3 <<EOF
import json
import subprocess
import sys
Expand All @@ -18,38 +17,44 @@ def main():

for key in data:
for flag in data[key]:
if flag["long"] == "logo-color-[1-9]":
for i in range(1, 10):
command_prefix = f"--logo-color-{i}[{flag["desc"]} ({i})]"
print_command(command_prefix, flag)
continue

if flag.get("pseudo", False):
continue

if "short" in flag:
command_prefix = f"""-{flag["short"]}[{flag["desc"]}]"""
command_prefix = f"-{flag["short"]}[{flag["desc"]}]"
print_command(command_prefix, flag)

if "long" in flag:
command_prefix = f"""--{flag["long"]}[{flag["desc"]}]"""
command_prefix = f"--{flag["long"]}[{flag["desc"]}]"
print_command(command_prefix, flag)


def print_command(command_prefix: str, flag: dict):
if "arg" in flag:
type: str = flag["arg"]["type"]
if type == "bool":
print(f"{command_prefix}:bool:(true false)")
print(f"{command_prefix}::bool:(true false)")
elif type == "color":
print(f"{command_prefix}:color:(black red green yellow blue magenta cyan white default)")
print(f"{command_prefix}:color:->colors")
elif type == "command":
print(f"{command_prefix}:module:->modules")
print(f"{command_prefix}::module:->modules")
elif type == "config":
print(f"{command_prefix}:presets:->presets")
print(f"{command_prefix}:preset:->presets")
elif type == "enum":
temp: str = " ".join(flag["arg"]["enum"])
print(f'{command_prefix}:type:( {temp} )')
print(f'{command_prefix}:type:({temp})')
elif type == "logo":
print(f"{command_prefix}:logo:->logo")
print(f"{command_prefix}:logo:->logos")
elif type == "structure":
print(f"{command_prefix}:structure:->structure")
print(f"{command_prefix}:structure:->structures")
elif type == "path":
print(f"{command_prefix}:path:_files -/")
print(f"{command_prefix}::path:_files")
else:
print(f"{command_prefix}:")
else:
Expand All @@ -62,30 +67,34 @@ if __name__ == "__main__":
except Exception:
sys.exit(1)
EOF
)"})
)}")

_arguments -C "$opts[@]"
_arguments "$opts[@]"

case $state in
colors)
local -a colors=(black red green yellow blue magenta cyan white default)
_describe 'color' colors
;;
modules)
local -a modules=( ${(f)"$(fastfetch --list-modules autocompletion)"} )
modules=( ${(L)^modules%%:*}-format format color )
local -a modules=("${(f)$(fastfetch --list-modules autocompletion)}")
modules=(${(L)^modules[@]%%:*}-format format color)
_describe 'module' modules
;;
presets)
local -a presets=(
${$(fastfetch --list-presets autocompletion):#.*}
"${(f)$(fastfetch --list-presets autocompletion)}"
"none:Disable loading config file"
)
_describe 'preset' presets
_describe 'preset' presets || _files
;;
structure)
local -a structures=( ${(f)"$(fastfetch --list-modules autocompletion)"} )
structures)
local -a structures=("${(f)$(fastfetch --list-modules autocompletion)}")
_describe 'structure' structures
;;
logo)
logos)
local -a logos=(
$(fastfetch --list-logos autocompletion)
"${(f)$(fastfetch --list-logos autocompletion)}"
"none:Don't print logo"
"small:Print small ascii logo if available"
)
Expand Down
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
fastfetch (2.22.0) jammy; urgency=medium

* Update to 2.22.0

-- Carter Li <[email protected]> Mon, 26 Aug 2024 18:53:35 +0800

fastfetch (2.21.3) jammy; urgency=medium

* Update to 2.21.3
Expand Down
2 changes: 1 addition & 1 deletion debian/files
Original file line number Diff line number Diff line change
@@ -1 +1 @@
fastfetch_2.21.3_source.buildinfo universe/utils optional
fastfetch_2.22.0_source.buildinfo universe/utils optional
7 changes: 6 additions & 1 deletion doc/json_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,8 @@
"weather",
"wm",
"wifi",
"wmtheme"
"wmtheme",
"zpool"
]
},
{
Expand Down Expand Up @@ -993,6 +994,10 @@
{
"const": "wmtheme",
"description": "Print current theme of window manager"
},
{
"const": "zpool",
"description": "Print ZFS storage pools"
}
]
},
Expand Down
1 change: 1 addition & 0 deletions presets/all.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"physicalmemory",
"swap",
"disk",
"zpool",
"battery",
"poweradapter",
"player",
Expand Down
1 change: 1 addition & 0 deletions presets/ci.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"physicalmemory",
"swap",
"disk",
"zpool",
"battery",
"poweradapter",
"player",
Expand Down
3 changes: 1 addition & 2 deletions presets/examples/20.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@
{
"type": "loadavg",
"compact": false,
// {duration} is not fixed length, hack it
"key": "│ LOAD \u001b[s{duration}m\u001b[u\u001b[6C│{$1}"
"key": "│ LOAD {duration>2}m │{$1}" // pad duration to 2 chars
},
{
"type": "custom",
Expand Down
Loading