diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 000000000..0dce5c469 --- /dev/null +++ b/.codespellrc @@ -0,0 +1,5 @@ +[codespell] +check-filenames = +builtin = clear,rare,usage,informal +skip = */.git,*/cmake-build-*,*/.idea,*/completions,*/presets,*/screenshots,*/tests,*/3rdparty,*/logo/ascii +ignore-words-list = iterm,compiletime,unknwn,pengwin,siduction,master,sur,doas diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d046a3e5e..48639d0aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,20 @@ on: - pull_request jobs: + spellcheck: + runs-on: ubuntu-latest + + steps: + - name: checkout repository + uses: actions/checkout@v3 + + - name: Install codespell + shell: bash + run: sudo apt update && sudo apt install -y codespell + + - name: Run Spellchecker + run: codespell + linux-buildtest: name: Linux build test permissions: @@ -32,13 +46,13 @@ jobs: run: uname -a - name: install required packages - run: sudo apt-get update && sudo apt-get install -y musl-dev musl-tools linux-headers-generic libpci-dev libvulkan-dev libwayland-dev libxrandr-dev libxcb-randr0-dev libdconf-dev libdbus-1-dev libmagickcore-dev libxfconf-0-dev libsqlite3-dev rpm librpm-dev libzstd-dev libegl-dev libglx-dev libosmesa6-dev ocl-icd-opencl-dev libnm-dev libpulse-dev directx-headers-dev + run: sudo apt-get update && sudo apt-get install -y musl-dev musl-tools linux-headers-generic libpci-dev libvulkan-dev libwayland-dev libxrandr-dev libxcb-randr0-dev libdconf-dev libdbus-1-dev libmagickcore-dev libxfconf-0-dev libsqlite3-dev librpm-dev libegl-dev libglx-dev libosmesa6-dev ocl-icd-opencl-dev libnm-dev libpulse-dev directx-headers-dev libdrm-dev - name: configure project env: CC: ${{ matrix.compiler.cc }} CXX: ${{ matrix.compiler.cxx }} - run: cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_LIBPCI=${{ matrix.enableFeatures }} -DENABLE_VULKAN=${{ matrix.enableFeatures }} -DENABLE_WAYLAND=${{ matrix.enableFeatures }} -DENABLE_XCB_RANDR=${{ matrix.enableFeatures }} -DENABLE_XCB=${{ matrix.enableFeatures }} -DENABLE_XRANDR=${{ matrix.enableFeatures }} -DENABLE_X11=${{ matrix.enableFeatures }} -DENABLE_GIO=${{ matrix.enableFeatures }} -DENABLE_DCONF=${{ matrix.enableFeatures }} -DENABLE_DBUS=${{ matrix.enableFeatures }} -DENABLE_XFCONF=${{ matrix.enableFeatures }} -DENABLE_SQLITE3=${{ matrix.enableFeatures }} -DENABLE_RPM=${{ matrix.enableFeatures }} -DENABLE_IMAGEMAGICK7=${{ matrix.enableFeatures }} -DENABLE_IMAGEMAGICK6=${{ matrix.enableFeatures }} -DENABLE_CHAFA=${{ matrix.enableFeatures }} -DENABLE_ZLIB=${{ matrix.enableFeatures }} -DENABLE_EGL=${{ matrix.enableFeatures }} -DENABLE_GLX=${{ matrix.enableFeatures }} -DENABLE_OSMESA=${{ matrix.enableFeatures }} -DENABLE_OPENCL=${{ matrix.enableFeatures }} -DENABLE_LIBNM=${{ matrix.enableFeatures }} -DENABLE_PULSE=${{ matrix.enableFeatures }} -DENABLE_DIRECTX_HEADERS=${{ matrix.enableFeatures }} . + run: cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_LIBPCI=${{ matrix.enableFeatures }} -DENABLE_VULKAN=${{ matrix.enableFeatures }} -DENABLE_WAYLAND=${{ matrix.enableFeatures }} -DENABLE_XCB_RANDR=${{ matrix.enableFeatures }} -DENABLE_XCB=${{ matrix.enableFeatures }} -DENABLE_XRANDR=${{ matrix.enableFeatures }} -DENABLE_X11=${{ matrix.enableFeatures }} -DENABLE_GIO=${{ matrix.enableFeatures }} -DENABLE_DCONF=${{ matrix.enableFeatures }} -DENABLE_DBUS=${{ matrix.enableFeatures }} -DENABLE_XFCONF=${{ matrix.enableFeatures }} -DENABLE_SQLITE3=${{ matrix.enableFeatures }} -DENABLE_RPM=${{ matrix.enableFeatures }} -DENABLE_IMAGEMAGICK7=${{ matrix.enableFeatures }} -DENABLE_IMAGEMAGICK6=${{ matrix.enableFeatures }} -DENABLE_CHAFA=${{ matrix.enableFeatures }} -DENABLE_ZLIB=${{ matrix.enableFeatures }} -DENABLE_EGL=${{ matrix.enableFeatures }} -DENABLE_GLX=${{ matrix.enableFeatures }} -DENABLE_OSMESA=${{ matrix.enableFeatures }} -DENABLE_OPENCL=${{ matrix.enableFeatures }} -DENABLE_LIBNM=${{ matrix.enableFeatures }} -DENABLE_PULSE=${{ matrix.enableFeatures }} -DENABLE_DIRECTX_HEADERS=${{ matrix.enableFeatures }} -DENABLE_DRM=${{ matrix.enableFeatures }} . - name: build project run: cmake --build . @@ -50,10 +64,10 @@ jobs: run: ./fastfetch --list-features - name: run fastfetch - run: time ./fastfetch -c presets/ci + run: time ./fastfetch -c presets/ci.jsonc - name: run fastfetch --format json - run: time ./fastfetch -c presets/ci --format json + run: time ./fastfetch -c presets/ci.jsonc --format json - name: run flashfetch run: time ./flashfetch @@ -74,12 +88,12 @@ jobs: run: uname -a - name: install required packages - run: sudo apt-get update && sudo apt-get install -y libpci-dev libvulkan-dev libwayland-dev libxrandr-dev libxcb-randr0-dev libdconf-dev libdbus-1-dev libmagickcore-dev libxfconf-0-dev libsqlite3-dev rpm librpm-dev libzstd-dev libegl-dev libglx-dev libosmesa6-dev ocl-icd-opencl-dev libnm-dev libpulse-dev directx-headers-dev + run: sudo apt-get update && sudo apt-get install -y libpci-dev libvulkan-dev libwayland-dev libxrandr-dev libxcb-randr0-dev libdconf-dev libdbus-1-dev libmagickcore-dev libxfconf-0-dev libsqlite3-dev librpm-dev libegl-dev libglx-dev libosmesa6-dev ocl-icd-opencl-dev libnm-dev libpulse-dev libdrm-dev directx-headers-dev - name: install linuxbrew packages run: | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - /home/linuxbrew/.linuxbrew/bin/brew install imagemagick --ignore-dependencies + /home/linuxbrew/.linuxbrew/bin/brew install imagemagick ddcutil --ignore-dependencies - name: Initialize CodeQL uses: github/codeql-action/init@v2 @@ -99,10 +113,10 @@ jobs: run: ./fastfetch --list-features - name: run fastfetch - run: time ./fastfetch -c presets/ci + run: time ./fastfetch -c presets/ci.jsonc - name: run fastfetch --format json - run: time ./fastfetch -c presets/ci --format json + run: time ./fastfetch -c presets/ci.jsonc --format json - name: run flashfetch run: time ./flashfetch @@ -138,6 +152,7 @@ jobs: - name: install required packages run: | + brew uninstall aws-sam-cli azure-cli qemu lima colima gradle kotlin maven pipx aria2 || true brew update brew install vulkan-loader vulkan-headers molten-vk imagemagick chafa @@ -159,10 +174,10 @@ jobs: run: ./fastfetch --list-features - name: run fastfetch - run: time ./fastfetch -c presets/ci + run: time ./fastfetch -c presets/ci.jsonc - name: run fastfetch --format json - run: time ./fastfetch -c presets/ci --format json + run: time ./fastfetch -c presets/ci.jsonc --format json - name: run flashfetch run: time ./flashfetch @@ -197,12 +212,12 @@ jobs: run: | uname -a sudo pkg update - sudo pkg install -y cmake git pkgconf binutils pciutils wayland vulkan-headers vulkan-loader libxcb libXrandr libX11 glib dconf dbus sqlite3-tcl xfce4-conf ImageMagick6 ImageMagick7 chafa egl libosmesa opencl ocl-icd pulseaudio + sudo pkg install -y cmake git pkgconf binutils pciutils wayland vulkan-headers vulkan-loader libxcb libXrandr libX11 libdrm glib dconf dbus sqlite3-tcl xfce4-conf ImageMagick6 ImageMagick7 chafa egl libosmesa opencl ocl-icd pulseaudio cmake -DSET_TWEAK=Off -DBUILD_TESTS=On . cmake --build . --target package --verbose ./fastfetch --list-features - time ./fastfetch -c presets/ci - time ./fastfetch -c presets/ci --format json + time ./fastfetch -c presets/ci.jsonc + time ./fastfetch -c presets/ci.jsonc --format json time ./flashfetch ldd fastfetch ctest @@ -249,10 +264,10 @@ jobs: run: ./fastfetch --list-features - name: run fastfetch - run: time ./fastfetch -c presets/ci + run: time ./fastfetch -c presets/ci.jsonc - name: run fastfetch --format json - run: time ./fastfetch -c presets/ci --format json + run: time ./fastfetch -c presets/ci.jsonc --format json - name: run flashfetch run: time ./flashfetch @@ -316,10 +331,10 @@ jobs: run: cp /clang32/bin/{OpenCL,vulkan-1}.dll . - name: run fastfetch - run: time ./fastfetch -c presets/ci + run: time ./fastfetch -c presets/ci.jsonc - name: run fastfetch --format json - run: time ./fastfetch -c presets/ci --format json + run: time ./fastfetch -c presets/ci.jsonc --format json - name: run flashfetch run: time ./flashfetch diff --git a/CHANGELOG.md b/CHANGELOG.md index bab497143..0bee76694 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,46 @@ +# 2.3.0 + +Config related changes: +* The deprecated flag `--gen-config conf` is removed +* Flag `--gen-config` now does the same thing as `--migrate-config`, which can be used as config migration and default config file generation. Flag `--migrate-config` is removed +* Fastfetch now searches for config files in the order of `fastfetch --list-config-paths`, and won't load other config if one is found. +* The undocumented flag `--load-user-config` is removed. As an alternative, `--config none` can be used to disable loading config files. +* `--config` (previously named `--load-config`) is now supported for command line arguments only. If specified, other config files won't be loaded, which works like other programs. +* Config files will always be loaded before other command line flags being parsed. That is to say, command line flags will always override options defined in config files. +* the value of GPUType `integrated` contained a typo and was fixed. Existing config files may need to be updated. + +We are deprecating flags based config files (will be removed in v3.0.0). We suggest you migrate to json based config files. + +Features: +* Support Oils and elvish shell version detection (Shell) +* Support Windows Server Core (Windows) +* Better ddcutil 2.x compatibility (Brightness, Linux) +* Add completion support for fish (natively) and nushell (via [carapace-bin](https://github.com/rsteube/carapace-bin)) +* Support nix in macOS (Packages, macOS) +* Print module description for `--list-modules` +* Support `alacritty.toml` (TerminalFont) +* Support board detection on macOS. It simplily prints machine model identifier as for now (Board, macOS) +* Add general method to query product name (Host, macOS) +* Use `libdrm` as a better fall back for detecting displays, which correctly detects current mode; supports refresh rate detection and maybe also faster than using `/sys/class/drm` (Display, Linux) +* Support physical disk size detection (DiskIO) +* Support physical disk name and type detection (DiskIO, FreeBSD) + +Bugfixes: +* End `va_list` before returning (@VoltrexKeyva) +* Don't use background color when printing blocks (Color) +* Fix lots of typos +* Fix compatibility with Linux containers (Linux) +* Don't report disabled monitors when using DRM (Linux) +* Fix bad performance in some cases when using X11 (Display, Linux) +* Fix some memory leaks +* Fix used swap space detection (Swap, FreeBSD) +* Don't leak fds to child processes (Linux) +* Fix possible issues when reading procfs (Linux) + +Logos: +* Add Adelie, Ironclad +* Update parch + # 2.2.3 Features: @@ -19,11 +62,11 @@ Features: * Improve detection of `Battery` * Detect cycle count on supported platforms * Detect temperature on Linux when supported - * Status detection on macOS has been adjusted to be consistant with other platforms + * Status detection on macOS has been adjusted to be consistent with other platforms * Linux binaries are built with imagemagick7 support Bugfixes: -* Fix unitialized variables (#609) +* Fix uninitialized variables (#609) * Fix spelling of `--preserve-aspect-ratio` (#614) Logos: @@ -49,7 +92,7 @@ Changes: * Display keys `percent*` and `size*` in JSON config are restructured. e.g. `{ "sizeNdigits": 1 }` is now `{ "size": { "ndigits": 1 } }` * With the introduction of `--migrate-config`, the old flag based config file is deprecated, and will be removed in 3.0.0 (next major version) * Support of `--gen-config conf` is deprecated accordingly, and will be removed in 2.3.0 (next minor version) -* The global flag `--allow-slow-operations` is splitted into some explicit flags in differnet modules +* The global flag `--allow-slow-operations` is split into some explicit flags in different modules * `--packages-winget`: control whether `winget` packages count should be detected. Note it's a very slow operation, please enable it with caution. * `--chassis-use-wmi`: control whether `WMI` query should be used to detect chassis type, which detects more information, but slower. This flag only affects `--chassis-format` and `--format json`. * `--battery-use-setup-api`: control whether `SetupAPI` should be used on Windows to detect battery info, which supports multi batteries, but slower. @@ -122,9 +165,9 @@ This release introduces a new output format: JSON result Changes: * Users module detects and prints user login time by default. Specifying `--users-compact` to disable it -* Fastfetch now requires yyjson 0.8.0 or later, which is embeded in fastfetch source tree. If you build fastfetch with `-DENABLE_SYSTEM_YYJSON` cmake option, you must upgrade your yyjson package +* Fastfetch now requires yyjson 0.8.0 or later, which is embedded in fastfetch source tree. If you build fastfetch with `-DENABLE_SYSTEM_YYJSON` cmake option, you must upgrade your yyjson package * Reduced information supported by `--terminal-format`, `--shell-format` -* Some config presets (`devinfo` and `verbose`) are obseleted and removed. They are barely maintained and can be replaced with `--format json` now. +* Some config presets (`devinfo` and `verbose`) are obsolete and removed. They are barely maintained and can be replaced with `--format json` now. * Custom strings in `--module-key` and `--module-format` are no longer trimmed. * `/boot` is hidden by default (FreeBSD, Disk) @@ -204,7 +247,7 @@ Features: # 2.0.2 Bugfixes: -* Workarund [a compiler bug of GCC](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85282) (Windows) +* Workaround [a compiler bug of GCC](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85282) (Windows) * Fix presets not detected by file name (#529) Logo: @@ -216,7 +259,7 @@ First stable release of Fastfetch V2 Changes: * Unescape strings only when parsing `.conf` files - * Previously: `$ NO_CONFIG=1 fastfetch --os-key \\\\ -s os -l none` prints `\: *`. Note the backslashs are unescaped twice (once by shell and once by fastfetch). + * Previously: `$ NO_CONFIG=1 fastfetch --os-key \\\\ -s os -l none` prints `\: *`. Note the backslashes are unescaped twice (once by shell and once by fastfetch). * Now: `$ NO_CONFIG=1 fastfetch --os-key \\\\ -s os -l none` prints `\\: *` * Remove option shortcut `-c` (alias of `--color`), which is more commonly used as alias of `--config` * Rename `--recache` to `--logo-recache` (which is used for regenerate image logo cache). Remove option shortcut `-r` (alias of `--recache`). @@ -272,7 +315,7 @@ Features: * Better CPU and Host detection for Android (Android) * Support yakuake terminal version & font detection (Terminal, Linux) * Add new option `--bright-color` which can be used to disable the default bright color of keys, title and ASCII logo. -* Add module `Monitor` which prints physical parameters (native resolutions and demensions) of connected monitors +* Add module `Monitor` which prints physical parameters (native resolutions and dimensions) of connected monitors * Support path with environment variables for `--logo-source` and `--load-config`. Bugfixes: @@ -360,7 +403,7 @@ Bugfixes: * Fix Windows drives detection in WSL (Disk) Changes: -* In order to make Icons module consistant between different platforms, `--icons-format` no longer supports individual GTK / QT icon params. +* In order to make Icons module consistent between different platforms, `--icons-format` no longer supports individual GTK / QT icon params. * `--theme-format` no longer supports individual GTK / plasma theme params. * `--local-ip-*` and `--public-ip-*` have been changed to `--localip-*` and `--publicip-*` * `--localip-compact-type` is no longer supported. Fastfetch now display IPs as `--localip-compat-type multiline` by default, with `--local-compact true` can be set as an alias of `--localip-compact-type oneline` @@ -383,7 +426,7 @@ Bugfixes: * Fix iTerm being detected as iTermServer-* sometimes * Fix sound device volume being incorrectly detected as muted sometimes (Sound) * Fix memleaks reported by LeakSanitizer (Linux) -* Fix potential memory curruption bug in unicode.c (Windows) +* Fix potential memory corruption bug in unicode.c (Windows) Logo: * Update Windows 11 ASCII logo to look more visually consistent (#445) @@ -419,7 +462,7 @@ Bugfixes: * Fix compiling errors (Windows) Improvements: -* Improve preformance (WmTheme amd Font, Windows and macOS) +* Improve performance (WmTheme amd Font, Windows and macOS) * Enable nonblocking public-ip / weather detection (Android) # 1.10.2 @@ -464,7 +507,7 @@ Other: * Simplified wmtheme output format (Windows) * Improved GPU detection performance on Windows 11 -* Lastest Mac model identifier support (macOS) +* Latest Mac model identifier support (macOS) # 1.9.1 @@ -546,7 +589,7 @@ Bugfixes: This release introduces Windows support! Fastfetch now fully support all major desktop OSes (Linux, macOS, Windows and FreeBSD) Notable Changes: -* Bios / Board / Chassis modules are splitted against Host module for performance reasons +* Bios / Board / Chassis modules are split against Host module for performance reasons * Caching is removed. Option `--nocache` is removed accordingly Features: @@ -555,7 +598,7 @@ Features: * Adds a new flag `--stat`, which prints time usage for individual modules * Adds Wifi module which supports Windows and macOS * Adds data source option for logo printing -* Detects Homebrew Cellar and Cask seperately +* Detects Homebrew Cellar and Cask separately * Detects WSL version * Detects disk based on mount point * Exposes more chafa configs diff --git a/CMakeLists.txt b/CMakeLists.txt index 06e5e4f59..9a065c60b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url project(fastfetch - VERSION 2.2.3 + VERSION 2.3.0 LANGUAGES C DESCRIPTION "Fast neofetch-like system information tool" HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch" @@ -49,6 +49,7 @@ cmake_dependent_option(ENABLE_XCB_RANDR "Enable xcb-randr" ON "LINUX OR BSD" OFF cmake_dependent_option(ENABLE_XCB "Enable xcb" ON "LINUX OR BSD" OFF) cmake_dependent_option(ENABLE_XRANDR "Enable xrandr" ON "LINUX OR BSD" OFF) cmake_dependent_option(ENABLE_X11 "Enable x11" ON "LINUX OR BSD" OFF) +cmake_dependent_option(ENABLE_DRM "Enable libdrm" ON "LINUX OR BSD" OFF) cmake_dependent_option(ENABLE_GIO "Enable gio-2.0" ON "LINUX OR BSD" OFF) cmake_dependent_option(ENABLE_DCONF "Enable dconf" ON "LINUX OR BSD" OFF) cmake_dependent_option(ENABLE_DBUS "Enable dbus-1" ON "LINUX OR BSD" OFF) @@ -71,7 +72,7 @@ cmake_dependent_option(ENABLE_DIRECTX_HEADERS "Enable DirectX headers for WSL" O cmake_dependent_option(ENABLE_THREADS "Enable multithreading" ON "Threads_FOUND" OFF) cmake_dependent_option(ENABLE_PCI_MEMORY "Enable detecting GPU memory size with libpci" OFF "LINUX OR BSD" OFF) -option(ENABLE_SYSTEM_YYJSON "Use system provided (instead of fastfetch embeded) yyjson library" 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) option(BUILD_TESTS "Build tests" OFF) # Also create test executables option(SET_TWEAK "Add tweak to project version" ON) # This is set to off by github actions for release builds @@ -204,19 +205,32 @@ endif() # Text data # ############# -function(fastfetch_load_text FILENAME OUTVAR) - file(READ "${FILENAME}" TEMP) - string(REGEX REPLACE "\n$" "" TEMP "${TEMP}") # Remove trailing newline +function(fastfetch_encode_c_string STR OUTVAR) + string(REGEX REPLACE "\n$" "" TEMP "${STR}") # Remove trailing newline + string(REPLACE "\\" "\\\\" TEMP "${TEMP}") # Escape backslashes string(REPLACE "\n" "\\n" TEMP "${TEMP}") # Replace newlines with \n string(REPLACE "\"" "\\\"" TEMP "${TEMP}") # Replace quotes with \" - string(REPLACE "$\\" "" TEMP "${TEMP}") # Remove $\, so we can unescape some things - set("${OUTVAR}" "${TEMP}" PARENT_SCOPE) + set(${OUTVAR} "\"${TEMP}\"" PARENT_SCOPE) +endfunction(fastfetch_encode_c_string) + +function(fastfetch_load_text FILENAME OUTVAR) + file(READ "${FILENAME}" TEMP) + fastfetch_encode_c_string("${TEMP}" TEMP) + set(${OUTVAR} "${TEMP}" PARENT_SCOPE) endfunction(fastfetch_load_text) +find_package(Python) +if(Python_FOUND) + # Minify JSON string. `io.open(0,encoding='utf-8')` is needed to avoid encoding issues on Windows + execute_process(COMMAND ${Python_EXECUTABLE} -c "import io,json,sys;json.dump(json.load(io.open(0,encoding='utf-8')),sys.stdout,separators=(',', ':'),ensure_ascii=False)" + INPUT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/src/data/help.json" + OUTPUT_VARIABLE DATATEXT_JSON_HELP) +else() + file(READ "src/data/help.json" TEMP) +endif() + +fastfetch_encode_c_string("${DATATEXT_JSON_HELP}" DATATEXT_JSON_HELP) fastfetch_load_text(src/data/structure.txt DATATEXT_STRUCTURE) -fastfetch_load_text(src/data/config_system.txt DATATEXT_CONFIG_SYSTEM) -fastfetch_load_text(src/data/config_user.txt DATATEXT_CONFIG_USER) -fastfetch_load_text(src/data/config_user.jsonc DATATEXT_CONFIG_USER_JSONC) fastfetch_load_text(src/data/help.txt DATATEXT_HELP) fastfetch_load_text(src/data/help_color.txt DATATEXT_HELP_COLOR) fastfetch_load_text(src/data/help_format.txt DATATEXT_HELP_FORMAT) @@ -228,23 +242,17 @@ if(APPLE) configure_file(src/util/apple/Info.plist.in Info.plist @ONLY) endif() +string(TIMESTAMP FASTFETCH_BUILD_DATE "%d %B %Y") +configure_file(doc/fastfetch.1.in fastfetch.1 @ONLY) + #################### # Ascii image data # #################### -function(fastfetch_load_raw_text FILENAME OUTVAR) - file(READ "${FILENAME}" TEMP) - string(REGEX REPLACE "\n$" "" TEMP "${TEMP}") # Remove trailing newline - string(REPLACE "\\" "\\\\" TEMP "${TEMP}") # Escape backslashes - string(REPLACE "\n" "\\n" TEMP "${TEMP}") # Replace newlines with \n - string(REPLACE "\"" "\\\"" TEMP "${TEMP}") # Replace quotes with \" - set(${OUTVAR} "\"${TEMP}\"" PARENT_SCOPE) -endfunction(fastfetch_load_raw_text) - file(GLOB LOGO_FILES "src/logo/ascii/*.txt") -set(LOGO_BUILTIN_H "#pragma once\n\n") +set(LOGO_BUILTIN_H "#pragma once\n#pragma GCC diagnostic ignored \"-Wtrigraphs\"\n\n") foreach(file ${LOGO_FILES}) - fastfetch_load_raw_text("${file}" content) + fastfetch_load_text("${file}" content) get_filename_component(file "${file}" NAME_WLE) string(TOUPPER "${file}" file) string(REGEX REPLACE "\\$\\{c([0-9]+)\\}" "$\\1" content "${content}") @@ -385,6 +393,7 @@ if(LINUX) src/detection/disk/disk_linux.c src/detection/diskio/diskio_linux.c src/detection/displayserver/linux/displayserver_linux.c + src/detection/displayserver/linux/drm.c src/detection/displayserver/linux/wayland.c src/detection/displayserver/linux/wmde.c src/detection/displayserver/linux/xcb.c @@ -496,6 +505,7 @@ elseif(BSD) src/detection/disk/disk_bsd.c src/detection/diskio/diskio_bsd.c src/detection/displayserver/linux/displayserver_linux.c + src/detection/displayserver/linux/drm.c src/detection/displayserver/linux/wayland.c src/detection/displayserver/linux/wmde.c src/detection/displayserver/linux/xcb.c @@ -546,7 +556,7 @@ elseif(APPLE) src/detection/battery/battery_apple.c src/detection/bios/bios_apple.c src/detection/bluetooth/bluetooth_apple.m - src/detection/board/board_nosupport.c + src/detection/board/board_apple.c src/detection/brightness/brightness_apple.c src/detection/chassis/chassis_nosupport.c src/detection/cpu/cpu_apple.c @@ -779,6 +789,10 @@ ff_lib_enable(X11 "x11" "X11" ) +ff_lib_enable(DRM + "libdrm" + "Libdrm" +) ff_lib_enable(GIO "gio-2.0" "GIO" @@ -893,26 +907,23 @@ elseif(APPLE) elseif(WIN32) target_compile_definitions(libfastfetch PRIVATE -D_WIN32_WINNT=0x0601) target_link_libraries(libfastfetch - PRIVATE "bthprops" PRIVATE "dwmapi" PRIVATE "gdi32" PRIVATE "iphlpapi" PRIVATE "ole32" PRIVATE "oleaut32" - PRIVATE "opengl32" PRIVATE "ws2_32" PRIVATE "ntdll" PRIVATE "version" PRIVATE "setupapi" PRIVATE "hid" PRIVATE "wtsapi32" - PRIVATE "dxva2" ) elseif(BSD) target_link_libraries(libfastfetch PRIVATE "m" PRIVATE "usbhid" - PRIVATE "devstat" + PRIVATE "geom" ) elseif(ANDROID) CHECK_LIBRARY_EXISTS(-l:libandroid-wordexp.a wordexp "" HAVE_LIBANDROID_WORDEXP_STATIC) @@ -1039,6 +1050,11 @@ install( DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/licenses/${CMAKE_PROJECT_NAME}" ) +install( + FILES "${PROJECT_BINARY_DIR}/fastfetch.1" + DESTINATION "${CMAKE_INSTALL_MANDIR}" +) + ################## # package target # ################## diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 09da516fa..ae4668a78 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -16,7 +16,7 @@ Here i just add things that are easy to forget. - [ ] ZSH completions - [ ] Fish completions - [ ] Make CPU usage detection much faster and more accurate -- [ ] Detect CPU usage in a common detection methode and expose it both to the cpuUsage module and the cpu format string +- [ ] Detect CPU usage in a common detection method and expose it both to the cpuUsage module and the cpu format string - [ ] Per session caching ### General diff --git a/README.md b/README.md index a2b283864..a606dc872 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ # Fastfetch -![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/fastfetch-cli/fastfetch/ci.yml) -![GitHub license](https://img.shields.io/github/license/fastfetch-cli/fastfetch) -![GitHub contributors](https://img.shields.io/github/contributors/fastfetch-cli/fastfetch) -![GitHub top language](https://img.shields.io/github/languages/top/fastfetch-cli/fastfetch?logo=c&label=) -![GitHub commit activity (branch)](https://img.shields.io/github/commit-activity/m/fastfetch-cli/fastfetch) -![homebrew downloads](https://img.shields.io/homebrew/installs/dm/fastfetch?logo=homebrew) -![GitHub all releases](https://img.shields.io/github/downloads/fastfetch-cli/fastfetch/total?logo=github) -![GitHub release (with filter)](https://img.shields.io/github/v/release/fastfetch-cli/fastfetch?logo=github) +[![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/fastfetch-cli/fastfetch/ci.yml)](https://github.com/fastfetch-cli/fastfetch/actions) +[![GitHub license](https://img.shields.io/github/license/fastfetch-cli/fastfetch)](https://github.com/fastfetch-cli/fastfetch/blob/dev/LICENSE) +[![GitHub contributors](https://img.shields.io/github/contributors/fastfetch-cli/fastfetch)](https://github.com/fastfetch-cli/fastfetch/graphs/contributors) +[![GitHub top language](https://img.shields.io/github/languages/top/fastfetch-cli/fastfetch?logo=c&label=)](https://github.com/fastfetch-cli/fastfetch/blob/dev/CMakeLists.txt#L5) +[![GitHub commit activity (branch)](https://img.shields.io/github/commit-activity/m/fastfetch-cli/fastfetch)](https://github.com/fastfetch-cli/fastfetch/commits) +[![homebrew downloads](https://img.shields.io/homebrew/installs/dm/fastfetch?logo=homebrew)](https://formulae.brew.sh/formula/fastfetch#default) +[![GitHub all releases](https://img.shields.io/github/downloads/fastfetch-cli/fastfetch/total?logo=github)](https://github.com/fastfetch-cli/fastfetch/releases) +[![GitHub release (with filter)](https://img.shields.io/github/v/release/fastfetch-cli/fastfetch?logo=github)](https://github.com/fastfetch-cli/fastfetch/releases) [![latest packaged version(s)](https://repology.org/badge/latest-versions/fastfetch.svg)](https://repology.org/project/fastfetch/versions) [![Packaging status](https://repology.org/badge/tiny-repos/fastfetch.svg)](https://repology.org/project/fastfetch/versions) @@ -62,7 +62,7 @@ See Wiki: https://github.com/fastfetch-cli/fastfetch/wiki/Building * Run it with [all supported modules](https://github.com/fastfetch-cli/fastfetch/wiki/Support+Status#available-modules) and find what you interest: `fastfetch -c all.jsonc` * Find all data that fastfetch detects: `fastfetch -s --format json` * Display help messages: `fastfetch --help` -* Generate config file based on command line arguments: `fastfetch --arg1 --arg2 --migrate-config` +* Generate config file based on command line arguments: `fastfetch --arg1 --arg2 --gen-config` ## Customization @@ -85,7 +85,7 @@ Logos can be heavily customized too; see the [logo documentation](https://github ## FAQ Q: Why do you need a very performant version of neofetch? -> I like putting neofetch in my ~/.bashrc to have a system overwiew whenever I use the terminal, but the slow speed annoyed me, so I created this. Also neofetch didn't output everything correctly (e.g Font is displayed as "[Plasma], Noto Sans, 10 [GTK2/3]") and writing my own tool gave me the possibility to fine tune it to run perfectly on at least my configuration. +> I like putting neofetch in my ~/.bashrc to have a system overview whenever I use the terminal, but the slow speed annoyed me, so I created this. Also neofetch didn't output everything correctly (e.g Font is displayed as "[Plasma], Noto Sans, 10 [GTK2/3]") and writing my own tool gave me the possibility to fine tune it to run perfectly on at least my configuration. Q: It does not display [*] correctly for me, what can I do? > This is most likely because your system is not implemented (yet). At the moment I am focusing more on making the core app better, than adding more configurations. Feel free to open a pull request if you want to add support for your configuration diff --git a/completions/bash b/completions/bash index 9a59d7116..c6e7b26dc 100644 --- a/completions/bash +++ b/completions/bash @@ -5,7 +5,7 @@ __fastfetch_complete_help() local __ff_helps=( "color" "format" - "load-config" + "config" "os-format" "host-format" "kernel-format" @@ -66,7 +66,7 @@ __fastfetch_complete_path() __fastfetch_complete_logo() { - COMPREPLY=($(compgen -W "$(fastfetch --list-logos-autocompletion)" -- "$CURRENT_WORD")) + COMPREPLY=($(compgen -W "$(fastfetch --list-logos autocompletion)" -- "$CURRENT_WORD")) } __fastfetch_complete_logo_type() @@ -182,7 +182,6 @@ __fastfetch_completion() "--cpu-temp" "--gpu-temp" "--battery-temp" - "--display-detect-name" "--display-precise-refresh-rate" "--localip-show-ipv4" "--localip-show-ipv6" @@ -218,10 +217,9 @@ __fastfetch_completion() "--logo-color-6" "--logo-color-7" "--logo-color-8" + "--logo-color-9" "--logo-width" "--logo-height" - "--logo-color-9" - "-c" "--color" "--color-keys" "--color-title" @@ -360,7 +358,8 @@ __fastfetch_completion() ) local FF_OPTIONS_PATH=( - "--load-config" + "-c" + "--config" "--os-file" "--lib-pci" "--lib-vulkan" diff --git a/completions/fish b/completions/fish new file mode 100755 index 000000000..aed0dccbc --- /dev/null +++ b/completions/fish @@ -0,0 +1,106 @@ +#!/usr/bin/env fish + +if not test -x fastfetch + return +end + +complete -c fastfetch -f + +function __fastfetch_complete_bool + echo -e "true\tBool" + echo -e "false\tBool" +end + +function __fastfetch_complete_color + echo -e "black\tColor" + echo -e "red\tColor" + echo -e "green\tColor" + echo -e "yellow\tColor" + echo -e "blue\tColor" + echo -e "magenta\tColor" + echo -e "cyan\tColor" + echo -e "white\tColor" + echo -e "default\tColor" +end + +function __fastfetch_complete_command + for line in (fastfetch --list-modules autocompletion) + set -l pair (string split -m 2 : $line) + set -l module (string lower $pair[1]) + + echo -e "$module-format\tModule format" + end + echo -e "format\tCustom format" + echo -e "color\tColor format" +end + +function __fastfetch_complete_config + for line in (fastfetch --list-presets autocompletion) + echo -e "$line\tPreset" + end + echo -e "none\tDisable loading config file" +end + +function __fastfetch_complete_logo + for line in (fastfetch --list-logos autocompletion) + echo -e "$line\tBuiltin logo" + end + echo -e "none\tDon't print logo" + echo -e "small\tPrint small ascii logo if available" +end + +function __fastfetch_complete_structure + for line in (fastfetch --list-modules autocompletion) + set -l pair (string split -m 2 : $line) + echo -e "$pair[1]\t$pair[2]" + end +end + +string match -r -a -g "^###> ?(.*)" < (status -f) | string collect | python3 | source + +###> #!/usr/bin/env python3 +###> +###> import json, subprocess, sys +###> +###> def main(): +###> data: dict[str, list[dict]] = json.loads(subprocess.check_output(['fastfetch', '--help-raw'])) +###> +###> for key in data: +###> for flag in data[key]: +###> if flag.get('pseudo', False): +###> continue +###> +###> command_prefix: str = f'complete -c fastfetch -d "{flag["desc"]}" -l "{flag["long"]}"'; +###> if 'short' in flag: +###> command_prefix += f' -o "{flag["short"]}"' +###> +###> if 'arg' in flag: +###> type: str = flag['arg']['type']; +###> if type == 'bool': +###> print(f'{command_prefix} -x -a "(__fastfetch_complete_bool)"') +###> elif type == 'color': +###> print(f'{command_prefix} -x -a "(__fastfetch_complete_color)"') +###> elif type == 'command': +###> print(f'{command_prefix} -x -a "(__fastfetch_complete_command)"') +###> elif type == 'config': +###> print(f'{command_prefix} -x -a "(__fastfetch_complete_config)"') +###> elif type == 'enum': +###> temp: str = ' '.join(map(lambda x: f"{x[0]}\\t{x[1]}", flag["arg"]["enum"].items())) +###> print(f'{command_prefix} -x -a "{temp}"') +###> elif type == 'logo': +###> print(f'{command_prefix} -x -a "(__fastfetch_complete_logo)"') +###> elif type == 'structure': +###> print(f'{command_prefix} -x -a "(__fish_complete_list : __fastfetch_complete_structure)"') +###> elif type == 'path': +###> print(f'{command_prefix} -r -F') +###> else: +###> print(f'{command_prefix} -x') +###> else: +###> print(f'{command_prefix} -f') +###> +###> if __name__ == "__main__": +###> try: +###> main() +###> except: +###> sys.exit(1) +###> diff --git a/doc/fastfetch.1.in b/doc/fastfetch.1.in new file mode 100644 index 000000000..5acbfd995 --- /dev/null +++ b/doc/fastfetch.1.in @@ -0,0 +1,134 @@ +.TH FASTFETCH 1 "@FASTFETCH_BUILD_DATE@" "@CMAKE_PROJECT_NAME@ @CMAKE_PROJECT_VERSION@" + +.SH NAME +fastfetch \- a neofetch\-like tool for fetching system information and +displaying them in a pretty way + +.SH SYNOPSIS + +.B fastfetch +.I [options...] + +.SH DESCRIPTION + +Fastfetch is a neofetch\-like tool for fetching system information and +displaying them in a pretty way. It is written mainly in C, with performance +and customizability in mind. +Currently, Linux, Android, FreeBSD, MacOS and Windows 7+ are supported. + +.SH "EXIT STATUS" + +On successful execution, fastfetch returns zero. If any error happened, +the exit code will be non\-zero. + +.SH OPTIONS + +.SS "Informative Options" +.TP + +.B \-h, \-\-help \fI [command] +Show help output, displaying all available options or help for given command +.TP + +.B \-v, \-\-version +Show version of fastfetch +.TP + +.B \-\-list\-config\-paths +List search paths of config files +.TP + +.B \-\-list\-data\-paths +List search paths of presets and logos +.TP + +.B \-\-list\-logos +List available logos, they can be loaded with \fI \-\-logo +.TP + +.B \-\-list\-modules +List available modules +.TP + +.B \-\-list\-presets +List available presets, they can be loaded with \fI \-\-config +.TP + +.B \-\-list\-features +List the supported features fastfetch was compiled with +.TP + +.B \-\-print\-logos +Print available logos +.TP + +.B \-\-print\-structure +Print the default structure + + +.SS "Display Options" +.TP + +.B \-l, \-\-logo \fI +Set the logo to display +.TP + +.B \-s, \-\-structure \fI +Set the structure of the fetch. For details about the structure, +see the CONFIGURATION section. + + +.SS "Config Options" +.TP + +.B \-c, \-\-config \fI +Use the specified config file or preset. If "none", disable further config +loading. For details about config files, see the CONFIGURATION section +.TP + +.B \-\-gen\-config \fI [file] +Generate a config file with options specified on the command line. +If \fI file \fR is specified, the configuration will written to the +file, otherwise it will be written to stdout. +.TP + +.B \-\-gen\-config\-force \fI [file] +Same as \fB \-\-gen\-config\fR, but overwrites existing config +.TP + + +To list all options, use \fB \-\-help\fR this will also print all available module options. + +.SH CONFIGURATION +.SS "Fetch Structure" +The structure of a fetch describes the modules that should be included in +the output. It consists of a string of modules, separated by a colon (:). +To list all available modules, use \fB \-\-list\-modules \fR + +.SS "Config Files" + +fastfetch supports two types of config files. The legacy +configuration files and a JSONC based format. + +A JSONC config file is a JSON file that also supports comments with (//). Those +files must have the extension '.jsonc'. You can migrate a legacy config +file to the JSONC format by using \fB\-\-gen\-config\fR. + +The specified configuration/preset files are searched in the following order: + +1. relative to the current working directory + +2. relative to ~/.local/share/fastfetch/presets/ + +3. relative to /usr/share/fastfetch/presets/ + +When both a '.jsonc' and a '.conf' file with the same name is found, +the '.jsonc' file is preferred. + +Fastfetch provides some default presets. List them with \fB \-\-print\-available\-presets\fR. + +.SH "SEE ALSO" +.BR neofetch (1) + +.SH BUGS +Please report bugs to:\fI https://github.com/fastfetch\-cli/fastfetch/issues \fR diff --git a/doc/json_schema.json b/doc/json_schema.json index 886823d5a..091770f46 100644 --- a/doc/json_schema.json +++ b/doc/json_schema.json @@ -470,6 +470,10 @@ "type": "string", "description": "X11 sessions for better display detection and faster WM detection.\nThe *randr ones provide multi monitor support The libxcb* ones usually have better performance.\n (Linux, FreeBSD)" }, + "drm": { + "type": "string", + "description": "Used for fast resolution and refresh rate detection (Linux)" + }, "gio": { "type": "string", "description": "Needed for values that are only stored GSettings (Linux, FreeBSD)" @@ -729,15 +733,15 @@ }, { "const": "theme", - "description": "Print current theme information" + "description": "Print current theme of desktop environment" }, { "const": "uptime", - "description": "Print system uptime" + "description": "Print how long system has been running" }, { "const": "users", - "description": "List users currently logged in" + "description": "Print users currently logged in" }, { "const": "version", @@ -844,7 +848,7 @@ "properties": { "type": { "const": "brightness", - "description": "Print current brightness / luminance of your monitors" + "description": "Print current brightness level of your monitors" }, "ddcciSleep": { "type": "integer", @@ -1033,7 +1037,7 @@ "preciseRefreshRate": { "description": "Set if decimal refresh rates should not be rounded into integers when printing", "type": "boolean", - "default": true + "default": false }, "key": { "$ref": "#/$defs/key" @@ -1059,7 +1063,7 @@ }, "folders": { "type": "string", - "description": "A colon (semicolon on Windows) separated list of folder paths for the disk output\nDefault: \"/:/home\" (\"C:\\\\;D:\\\\ ...\" on Windows)" + "description": "A colon (semicolon on Windows) separated list of folder paths for the disk output\nDefault: auto detection using mount-points" }, "showExternal": { "type": "boolean", diff --git a/presets/ci b/presets/ci deleted file mode 100644 index d8327be7a..000000000 --- a/presets/ci +++ /dev/null @@ -1,7 +0,0 @@ --c all ---pipe ---show-errors ---no-buffer ---publicip-timeout 1000 ---weather-timeout 1000 ---stat diff --git a/presets/ci.jsonc b/presets/ci.jsonc new file mode 100644 index 000000000..766a08bb5 --- /dev/null +++ b/presets/ci.jsonc @@ -0,0 +1,69 @@ +{ + "$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json", + "display": { + "stat": true, + "pipe": true, + "showErrors": true, + "noBuffer": true + }, + "modules": [ + "title", + "separator", + "os", + "host", + "bios", + "board", + "chassis", + "kernel", + "uptime", + "processes", + "packages", + "shell", + "display", + "brightness", + "monitor", + "lm", + "de", + "wm", + "wmtheme", + "theme", + "icons", + "font", + "cursor", + "wallpaper", + "terminal", + "terminalfont", + "terminalsize", + "cpu", + "cpuusage", + "gpu", + "memory", + "swap", + "disk", + "battery", + "poweradapter", + "player", + "media", + "publicip", + "localip", + "wifi", + "datetime", + "locale", + "vulkan", + "opengl", + "opencl", + "users", + "bluetooth", + "sound", + "gamepad", + { + "type": "weather", + "timeout": 1000 + }, + "netio", + "diskio", + "version", + "break", + "colors" + ] +} diff --git a/src/common/bar.h b/src/common/bar.h index d35276cef..c77234ae6 100644 --- a/src/common/bar.h +++ b/src/common/bar.h @@ -1,8 +1,5 @@ #pragma once -#ifndef FF_INCLUDED_common_bar -#define FF_INCLUDED_common_bar - #include "fastfetch.h" enum @@ -15,5 +12,3 @@ enum void ffAppendPercentBar(FFstrbuf* buffer, double percent, uint8_t green, uint8_t yellow, uint8_t red); void ffAppendPercentNum(FFstrbuf* buffer, double percent, uint8_t green, uint8_t yellow, bool parentheses); - -#endif diff --git a/src/common/commandoption.h b/src/common/commandoption.h index c20d0f81f..1736a4f12 100644 --- a/src/common/commandoption.h +++ b/src/common/commandoption.h @@ -1,8 +1,5 @@ #pragma once -#ifndef FF_INCLUDED_common_commandoption -#define FF_INCLUDED_common_commandoption - #include "fastfetch.h" typedef struct FFCustomValue @@ -17,12 +14,10 @@ typedef struct FFdata { FFstrbuf structure; FFlist customValues; // List of FFCustomValue - bool loadUserConfig; + bool configLoaded; } FFdata; bool ffParseModuleOptions(const char* key, const char* value); void ffPrepareCommandOption(FFdata* data); void ffPrintCommandOption(FFdata* data, yyjson_mut_doc* jsonDoc); void ffMigrateCommandOptionToJsonc(FFdata* data, yyjson_mut_doc* jsonDoc); - -#endif diff --git a/src/common/dbus.h b/src/common/dbus.h index bf112e244..8c9be36c2 100644 --- a/src/common/dbus.h +++ b/src/common/dbus.h @@ -1,8 +1,5 @@ #pragma once -#ifndef FF_INCLUDED_common_dbus -#define FF_INCLUDED_common_dbus - #ifdef FF_HAVE_DBUS #include @@ -54,4 +51,3 @@ DBusMessage* ffDBusGetProperty(FFDBusData* dbus, const char* busName, const char void ffDBusGetPropertyString(FFDBusData* dbus, const char* busName, const char* objectPath, const char* interface, const char* property, FFstrbuf* result); #endif // FF_HAVE_DBUS -#endif // FF_INCLUDED_common_dbus diff --git a/src/common/font.h b/src/common/font.h index 58b3841ae..5ececb2f6 100644 --- a/src/common/font.h +++ b/src/common/font.h @@ -1,8 +1,5 @@ #pragma once -#ifndef FF_INCLUDED_common_font -#define FF_INCLUDED_common_font - #include "util/FFstrbuf.h" #include "util/FFlist.h" @@ -21,5 +18,3 @@ void ffFontInitCopy(FFfont* font, const char* name); void ffFontInitValues(FFfont* font, const char* name, const char* size); void ffFontInitWithSpace(FFfont* font, const char* rawName); void ffFontDestroy(FFfont* font); - -#endif diff --git a/src/common/format.c b/src/common/format.c index b5092c6c7..a381c2094 100644 --- a/src/common/format.c +++ b/src/common/format.c @@ -203,7 +203,7 @@ void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t n } // fastforward to the end of the if without printing the in between - i = ffStrbufNextIndexS(formatstr, i, "{?}") + 2; // 2 is the length of "{?}" - 1 because the loop will increament it again directly after continue + i = ffStrbufNextIndexS(formatstr, i, "{?}") + 2; // 2 is the length of "{?}" - 1 because the loop will increment it again directly after continue continue; } @@ -229,7 +229,7 @@ void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t n } // fastforward to the end of the if without printing the in between - i = ffStrbufNextIndexS(formatstr, i, "{/}") + 2; // 2 is the length of "{/}" - 1 because the loop will increament it again directly after continue + i = ffStrbufNextIndexS(formatstr, i, "{/}") + 2; // 2 is the length of "{/}" - 1 because the loop will increment it again directly after continue continue; } diff --git a/src/common/format.h b/src/common/format.h index 3e7c751f2..969de6c36 100644 --- a/src/common/format.h +++ b/src/common/format.h @@ -1,8 +1,5 @@ #pragma once -#ifndef FF_INCLUDED_common_format -#define FF_INCLUDED_common_format - typedef enum FFformatargtype { FF_FORMAT_ARG_TYPE_NULL = 0, @@ -27,5 +24,3 @@ typedef struct FFformatarg void ffFormatAppendFormatArg(FFstrbuf* buffer, const FFformatarg* formatarg); void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t numArgs, const FFformatarg* arguments); - -#endif diff --git a/src/common/init.c b/src/common/init.c index 5c5b2307a..41a79b5ac 100644 --- a/src/common/init.c +++ b/src/common/init.c @@ -144,7 +144,7 @@ static void destroyState(void) ffPlatformDestroy(&instance.state.platform); yyjson_doc_free(instance.state.configDoc); yyjson_mut_doc_free(instance.state.resultDoc); - ffStrbufDestroy(&instance.state.migrateConfigPath); + ffStrbufDestroy(&instance.state.genConfigPath); } void ffDestroyInstance(void) @@ -181,6 +181,9 @@ void ffListFeatures(void) #ifdef FF_HAVE_X11 "x11\n" #endif + #ifdef FF_HAVE_DRM + "drm\n" + #endif #ifdef FF_HAVE_GIO "gio\n" #endif diff --git a/src/common/io/io.h b/src/common/io/io.h index 78c94ad9f..c311feb76 100644 --- a/src/common/io/io.h +++ b/src/common/io/io.h @@ -1,8 +1,5 @@ #pragma once -#ifndef FF_INCLUDED_common_io_io -#define FF_INCLUDED_common_io_io - #include "util/FFstrbuf.h" #ifdef _WIN32 @@ -14,6 +11,10 @@ #include #include typedef int FFNativeFD; + // procfs's file can be changed between read calls such as /proc/meminfo and /proc/uptime. + // one safe way to read correct data is reading the whole file in a single read syscall + // 8192 comes from procps-ng: https://gitlab.com/procps-ng/procps/-/blob/master/library/meminfo.c?ref_type=heads#L39 + #define PROC_FILE_BUFFSIZ 8192 #endif static inline FFNativeFD FFUnixFD2NativeFD(int unixfd) @@ -52,11 +53,11 @@ static inline ssize_t ffReadFDData(FFNativeFD fd, size_t dataSize, void* data) #ifndef _WIN32 return read(fd, data, dataSize); #else - DWORD readed; - if(!ReadFile(fd, data, (DWORD)dataSize, &readed, NULL)) + DWORD bytesRead; + if(!ReadFile(fd, data, (DWORD)dataSize, &bytesRead, NULL)) return -1; - return (ssize_t)readed; + return (ssize_t)bytesRead; #endif } @@ -102,7 +103,7 @@ static inline void ffUnsuppressIO(bool* suppressed) #define FF_SUPPRESS_IO() bool __attribute__((__cleanup__(ffUnsuppressIO), __unused__)) io_suppressed__ = ffSuppressIO(true) -void ffListFilesRecursively(const char* path); +void ffListFilesRecursively(const char* path, bool pretty); static inline bool wrapClose(FFNativeFD* pfd) { @@ -153,5 +154,3 @@ static inline bool wrapClosedir(HANDLE* pdir) } #endif #define FF_AUTO_CLOSE_DIR __attribute__((__cleanup__(wrapClosedir))) - -#endif // FF_INCLUDED_common_io_io diff --git a/src/common/io/io_unix.c b/src/common/io/io_unix.c index db5f3c65b..e4b9e62e1 100644 --- a/src/common/io/io_unix.c +++ b/src/common/io/io_unix.c @@ -16,18 +16,18 @@ static void createSubfolders(const char* fileName) { FF_STRBUF_AUTO_DESTROY path = ffStrbufCreate(); - while(*fileName != '\0') + char *token = NULL; + while((token = strchr(fileName, '/')) != NULL) { - ffStrbufAppendC(&path, *fileName); - if(*fileName == '/') - mkdir(path.chars, S_IRWXU | S_IRGRP | S_IROTH); - ++fileName; + ffStrbufAppendNS(&path, (uint32_t)(token - fileName + 1), fileName); + mkdir(path.chars, S_IRWXU | S_IRGRP | S_IROTH); + fileName = token + 1; } } bool ffWriteFileData(const char* fileName, size_t dataSize, const void* data) { - int openFlagsModes = O_WRONLY | O_CREAT | O_TRUNC; + int openFlagsModes = O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC; int openFlagsRights = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH; int FF_AUTO_CLOSE_FD fd = open(fileName, openFlagsModes, openFlagsRights); @@ -44,20 +44,35 @@ bool ffWriteFileData(const char* fileName, size_t dataSize, const void* data) bool ffAppendFDBuffer(int fd, FFstrbuf* buffer) { - ssize_t readed = 0; + ssize_t bytesRead = 0; struct stat fileInfo; if(fstat(fd, &fileInfo) != 0) return false; - ffStrbufEnsureFree(buffer, fileInfo.st_size > 0 ? (uint32_t)fileInfo.st_size : 31); + if (fileInfo.st_size > 0) + { + // optimize for files has a fixed length, + // file can be very large, only keep necessary memory to save time and resources. + ffStrbufEnsureFixedLengthFree(buffer, (uint32_t)fileInfo.st_size); + } + else + ffStrbufEnsureFree(buffer, 31); uint32_t free = ffStrbufGetFree(buffer); + // procfs file's st_size is always zero + // choose a signed int type so that can store a native number + ssize_t remain = fileInfo.st_size; while( - (readed = read(fd, buffer->chars + buffer->length, free)) > 0 + (bytesRead = read(fd, buffer->chars + buffer->length, free)) > 0 ) { - buffer->length += (uint32_t) readed; - if((uint32_t) readed == free) + buffer->length += (uint32_t) bytesRead; + // if remain > 0, it means there is some data left in the file. + // if remain == 0, it means reading has completed, no need to grow up the buffer. + // if remain < 0, we are reading a file from procfs/sysfs and its st_size is zero, + // we cannot detect how many data remains in the file, we only can call ffStrbufEnsureFree and read again. + remain -= bytesRead; + if((uint32_t) bytesRead == free && remain != 0) ffStrbufEnsureFree(buffer, buffer->allocated - 1); // Doubles capacity every round. -1 for the null byte. free = ffStrbufGetFree(buffer); } @@ -72,7 +87,7 @@ bool ffAppendFDBuffer(int fd, FFstrbuf* buffer) ssize_t ffReadFileData(const char* fileName, size_t dataSize, void* data) { - int FF_AUTO_CLOSE_FD fd = open(fileName, O_RDONLY); + int FF_AUTO_CLOSE_FD fd = open(fileName, O_RDONLY | O_CLOEXEC); if(fd == -1) return -1; @@ -81,7 +96,7 @@ ssize_t ffReadFileData(const char* fileName, size_t dataSize, void* data) bool ffAppendFileBuffer(const char* fileName, FFstrbuf* buffer) { - int FF_AUTO_CLOSE_FD fd = open(fileName, O_RDONLY); + int FF_AUTO_CLOSE_FD fd = open(fileName, O_RDONLY | O_CLOEXEC); if(fd == -1) return false; @@ -94,7 +109,7 @@ bool ffPathExists(const char* path, FFPathType type) if(stat(path, &fileStat) != 0) return false; - int mode = fileStat.st_mode & S_IFMT; + unsigned int mode = fileStat.st_mode & S_IFMT; if(type & FF_PATHTYPE_REGULAR && mode == S_IFREG) return true; @@ -153,14 +168,14 @@ const char* ffGetTerminalResponse(const char* request, const char* format, ...) } char buffer[512]; - ssize_t readed = read(STDIN_FILENO, buffer, sizeof(buffer) - 1); + ssize_t bytesRead = read(STDIN_FILENO, buffer, sizeof(buffer) - 1); tcsetattr(STDIN_FILENO, TCSANOW, &oldTerm); - if(readed <= 0) + if(bytesRead <= 0) return "read(STDIN_FILENO, buffer, sizeof(buffer) - 1) failed"; - buffer[readed] = '\0'; + buffer[bytesRead] = '\0'; va_list args; va_start(args, format); @@ -184,7 +199,7 @@ bool ffSuppressIO(bool suppress) origOut = dup(STDOUT_FILENO); origErr = dup(STDERR_FILENO); - nullFile = open("/dev/null", O_WRONLY); + nullFile = open("/dev/null", O_WRONLY | O_CLOEXEC); init = true; } @@ -199,7 +214,7 @@ bool ffSuppressIO(bool suppress) return true; } -void listFilesRecursively(FFstrbuf* folder, uint8_t indentation, const char* folderName) +void listFilesRecursively(uint32_t baseLength, FFstrbuf* folder, uint8_t indentation, const char* folderName, bool pretty) { DIR* dir = opendir(folder->chars); if(dir == NULL) @@ -207,8 +222,12 @@ void listFilesRecursively(FFstrbuf* folder, uint8_t indentation, const char* fol uint32_t folderLength = folder->length; - if(folderName != NULL) + if(pretty && folderName != NULL) + { + for(uint8_t i = 0; i < indentation - 1; i++) + fputs(" | ", stdout); printf("%s/\n", folderName); + } struct dirent* entry; @@ -221,13 +240,20 @@ void listFilesRecursively(FFstrbuf* folder, uint8_t indentation, const char* fol ffStrbufAppendS(folder, entry->d_name); ffStrbufAppendC(folder, '/'); - listFilesRecursively(folder, (uint8_t) (indentation + 1), entry->d_name); + listFilesRecursively(baseLength, folder, (uint8_t) (indentation + 1), entry->d_name, pretty); ffStrbufSubstrBefore(folder, folderLength); continue; } - for(uint8_t i = 0; i < indentation; i++) - fputs(" | ", stdout); + if (pretty) + { + for(uint8_t i = 0; i < indentation; i++) + fputs(" | ", stdout); + } + else + { + fputs(folder->chars + baseLength, stdout); + } puts(entry->d_name); } @@ -235,9 +261,9 @@ void listFilesRecursively(FFstrbuf* folder, uint8_t indentation, const char* fol closedir(dir); } -void ffListFilesRecursively(const char* path) +void ffListFilesRecursively(const char* path, bool pretty) { FF_STRBUF_AUTO_DESTROY folder = ffStrbufCreateS(path); ffStrbufEnsureEndsWithC(&folder, '/'); - listFilesRecursively(&folder, 0, NULL); + listFilesRecursively(folder.length, &folder, 0, NULL, pretty); } diff --git a/src/common/io/io_windows.c b/src/common/io/io_windows.c index c4c26145b..f4a3747aa 100644 --- a/src/common/io/io_windows.c +++ b/src/common/io/io_windows.c @@ -6,12 +6,12 @@ static void createSubfolders(const char* fileName) { FF_STRBUF_AUTO_DESTROY path = ffStrbufCreate(); - while(*fileName != '\0') + char *token = NULL; + while((token = strchr(fileName, '/')) != NULL) { - ffStrbufAppendC(&path, *fileName); - if(*fileName == '/') - CreateDirectoryA(path.chars, NULL); - ++fileName; + ffStrbufAppendNS(&path, (uint32_t)(token - fileName + 1), fileName); + CreateDirectoryA(path.chars, NULL); + fileName = token + 1; } } @@ -32,22 +32,31 @@ bool ffWriteFileData(const char* fileName, size_t dataSize, const void* data) bool ffAppendFDBuffer(HANDLE handle, FFstrbuf* buffer) { - DWORD readed = 0; + DWORD bytesRead = 0; LARGE_INTEGER fileSize; if(!GetFileSizeEx(handle, &fileSize)) fileSize.QuadPart = 0; - - ffStrbufEnsureFree(buffer, fileSize.QuadPart > 0 ? (uint32_t)fileSize.QuadPart : 31); + + if (fileSize.QuadPart > 0) + { + // optimize for files has a fixed length, + // file can be very large, only keep necessary memory to save time and resources. + ffStrbufEnsureFixedLengthFree(buffer, (uint32_t)fileSize.QuadPart); + } + else + ffStrbufEnsureFree(buffer, 31); uint32_t free = ffStrbufGetFree(buffer); + ssize_t remain = fileSize.QuadPart; bool success; while( - (success = !!ReadFile(handle, buffer->chars + buffer->length, free, &readed, NULL)) && - readed > 0 + (success = !!ReadFile(handle, buffer->chars + buffer->length, free, &bytesRead, NULL)) && + bytesRead > 0 ) { - buffer->length += (uint32_t) readed; - if((uint32_t) readed == free) + buffer->length += (uint32_t) bytesRead; + remain -= (ssize_t)bytesRead; + if((uint32_t) bytesRead == free && remain != 0) ffStrbufEnsureFree(buffer, buffer->allocated - 1); // Doubles capacity every round. -1 for the null byte. free = ffStrbufGetFree(buffer); } @@ -114,16 +123,21 @@ bool ffSuppressIO(bool suppress) return false; } -void listFilesRecursively(FFstrbuf* folder, uint8_t indentation, const char* folderName) +void listFilesRecursively(uint32_t baseLength, FFstrbuf* folder, uint8_t indentation, const char* folderName, bool pretty) { uint32_t folderLength = folder->length; - if(folderName != NULL) + if(pretty && folderName != NULL) + { + for(uint8_t i = 0; i < indentation - 1; i++) + fputs(" | ", stdout); printf("%s/\n", folderName); + } ffStrbufAppendC(folder, '*'); WIN32_FIND_DATAA entry; HANDLE hFind = FindFirstFileA(folder->chars, &entry); + ffStrbufTrimRight(folder, '*'); if(hFind == INVALID_HANDLE_VALUE) return; @@ -137,24 +151,31 @@ void listFilesRecursively(FFstrbuf* folder, uint8_t indentation, const char* fol ffStrbufSubstrBefore(folder, folderLength); ffStrbufAppendS(folder, entry.cFileName); ffStrbufAppendC(folder, '/'); - listFilesRecursively(folder, (uint8_t) (indentation + 1), entry.cFileName); + listFilesRecursively(baseLength, folder, (uint8_t) (indentation + 1), entry.cFileName, pretty); ffStrbufSubstrBefore(folder, folderLength); continue; } - for(uint8_t i = 0; i < indentation; i++) - fputs(" | ", stdout); + if (pretty) + { + for(uint8_t i = 0; i < indentation; i++) + fputs(" | ", stdout); + } + else + { + fputs(folder->chars + baseLength, stdout); + } puts(entry.cFileName); } while (FindNextFileA(hFind, &entry)); FindClose(hFind); } -void ffListFilesRecursively(const char* path) +void ffListFilesRecursively(const char* path, bool pretty) { FF_STRBUF_AUTO_DESTROY folder = ffStrbufCreateS(path); ffStrbufEnsureEndsWithC(&folder, '/'); - listFilesRecursively(&folder, 0, NULL); + listFilesRecursively(folder.length, &folder, 0, NULL, pretty); } const char* ffGetTerminalResponse(const char* request, const char* format, ...) diff --git a/src/common/library.h b/src/common/library.h index 1721ea8d3..5a283bc2e 100644 --- a/src/common/library.h +++ b/src/common/library.h @@ -1,8 +1,5 @@ #pragma once -#ifndef FF_INCLUDED_common_library -#define FF_INCLUDED_common_library - #include "fastfetch.h" #include "util/FFcheckmacros.h" @@ -74,5 +71,3 @@ static inline void ffLibraryUnload(void** handle) FF_LIBRARY_LOAD_SYMBOL_ADDRESS(library, (varName)->ff ## symbolName, symbolName, returnValue); void* ffLibraryLoad(const FFstrbuf* userProvidedName, ...); - -#endif diff --git a/src/common/networking.h b/src/common/networking.h index f27850477..1fb4589d9 100644 --- a/src/common/networking.h +++ b/src/common/networking.h @@ -1,8 +1,5 @@ #pragma once -#ifndef FF_INCLUDED_common_networking -#define FF_INCLUDED_common_networking - #include "common/thread.h" #include "util/FFstrbuf.h" @@ -35,5 +32,3 @@ static inline bool ffNetworkingGetHttp(const char* host, const char* path, uint3 return ffNetworkingRecvHttpResponse(&state, buffer, timeout); return false; } - -#endif diff --git a/src/common/option.h b/src/common/option.h index 401f7a33b..a76c9e623 100644 --- a/src/common/option.h +++ b/src/common/option.h @@ -10,6 +10,7 @@ struct yyjson_mut_val; typedef struct FFModuleBaseInfo { const char* name; + const char* description; // A dirty polymorphic implementation in C. // This is UB, because `void*` is not compatible with `FF*Options*`. // However we can't do it better unless we move to C++, so that `option` becomes a `this` pointer @@ -25,6 +26,7 @@ typedef struct FFModuleBaseInfo static inline void ffOptionInitModuleBaseInfo( FFModuleBaseInfo* baseInfo, const char* name, + const char* description, void* parseCommandOptions, // bool (*const parseCommandOptions)(void* options, const char* key, const char* value) void* parseJsonObject, // void (*const parseJsonObject)(void* options, yyjson_val *module) void* printModule, // void (*const printModule)(void* options) @@ -34,6 +36,7 @@ static inline void ffOptionInitModuleBaseInfo( ) { baseInfo->name = name; + baseInfo->description = description; baseInfo->parseCommandOptions = (__typeof__(baseInfo->parseCommandOptions)) parseCommandOptions; baseInfo->parseJsonObject = (__typeof__(baseInfo->parseJsonObject)) parseJsonObject; baseInfo->printModule = (__typeof__(baseInfo->printModule)) printModule; diff --git a/src/common/parsing.h b/src/common/parsing.h index deb555c01..e98883b06 100644 --- a/src/common/parsing.h +++ b/src/common/parsing.h @@ -1,8 +1,5 @@ #pragma once -#ifndef FF_INCLUDED_parsing_h -#define FF_INCLUDED_parsing_h - #include "fastfetch.h" #include @@ -24,5 +21,3 @@ int8_t ffVersionCompare(const FFVersion* version1, const FFVersion* version2); void ffParseSize(uint64_t bytes, FFstrbuf* result); void ffParseTemperature(double celsius, FFstrbuf* buffer); - -#endif diff --git a/src/common/printing.c b/src/common/printing.c index 21df19cb3..90830568c 100644 --- a/src/common/printing.c +++ b/src/common/printing.c @@ -6,7 +6,7 @@ void ffPrintLogoAndKey(const char* moduleName, uint8_t moduleIndex, const FFModu { ffLogoPrintLine(); - //This is used by --set-keyless, in this case we wan't neither the module name nor the separator + //This is used by --set-keyless, in this case we want neither the module name nor the separator if(moduleName == NULL) return; diff --git a/src/common/printing.h b/src/common/printing.h index d9925757c..5b8d1b6ad 100644 --- a/src/common/printing.h +++ b/src/common/printing.h @@ -1,8 +1,5 @@ #pragma once -#ifndef FF_INCLUDED_common_printing -#define FF_INCLUDED_common_printing - #include "fastfetch.h" #include "common/format.h" @@ -26,5 +23,3 @@ void ffPrintColor(const FFstrbuf* colorValue); void ffPrintCharTimes(char c, uint32_t times); void ffPrintModuleFormatHelp(const char* name, const char* def, uint32_t numArgs, const char* args[]); - -#endif diff --git a/src/common/processing.h b/src/common/processing.h index 380c2a36e..98b9fe09f 100644 --- a/src/common/processing.h +++ b/src/common/processing.h @@ -1,8 +1,5 @@ #pragma once -#ifndef FF_INCLUDED_common_processing -#define FF_INCLUDED_common_processing - #include "util/FFstrbuf.h" const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool useStdErr); @@ -28,5 +25,3 @@ static inline const char* ffProcessAppendStdErr(FFstrbuf* buffer, char* const ar } return error; } - -#endif diff --git a/src/common/processing_linux.c b/src/common/processing_linux.c index 81bf2eda2..fe312e587 100644 --- a/src/common/processing_linux.c +++ b/src/common/processing_linux.c @@ -11,49 +11,62 @@ #include #include -enum { FF_PIPE_BUFSIZ = 4096 }; +enum { FF_PIPE_BUFSIZ = 8192 }; -static inline void waitpid_wrapper(pid_t* pid) +static inline void waitpid_wrapper(const pid_t* pid) { // remove zombie processes if (*pid > 0) waitpid(*pid, NULL, 0); } +static inline int ffPipe2(int *fds, int flags) +{ + #ifdef __APPLE__ + if(pipe(fds) == -1) + return -1; + fcntl(fds[0], F_SETFL, fcntl(fds[0], F_GETFL) | flags); + fcntl(fds[1], F_SETFL, fcntl(fds[1], F_GETFL) | flags); + return 0; + #else + return pipe2(fds, flags); + #endif +} + const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool useStdErr) { int pipes[2]; + const int timeout = instance.config.general.processingTimeout; - if(pipe(pipes) == -1) + if(ffPipe2(pipes, O_CLOEXEC) == -1) return "pipe() failed"; __attribute__((__cleanup__(waitpid_wrapper))) pid_t childPid = fork(); if(childPid == -1) + { + close(pipes[0]); + close(pipes[1]); return "fork() failed"; + } //Child if(childPid == 0) { - int nullFile = open("/dev/null", O_WRONLY); + int nullFile = open("/dev/null", O_WRONLY | O_CLOEXEC); dup2(pipes[1], useStdErr ? STDERR_FILENO : STDOUT_FILENO); dup2(nullFile, useStdErr ? STDOUT_FILENO : STDERR_FILENO); - close(pipes[0]); - close(pipes[1]); setenv("LANG", "C", 1); execvp(argv[0], argv); - exit(901); + _exit(127); } //Parent close(pipes[1]); int FF_AUTO_CLOSE_FD childPipeFd = pipes[0]; + char str[FF_PIPE_BUFSIZ]; - int timeout = instance.config.general.processingTimeout; - if (timeout >= 0) - fcntl(childPipeFd, F_SETFL, fcntl(childPipeFd, F_GETFL) | O_NONBLOCK); - - do + while(1) { if (timeout >= 0) { @@ -70,18 +83,14 @@ const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool use } } - char str[FF_PIPE_BUFSIZ]; - while (true) - { - ssize_t nRead = read(childPipeFd, str, FF_PIPE_BUFSIZ); - if (nRead > 0) - ffStrbufAppendNS(buffer, (uint32_t) nRead, str); - else if (nRead == 0) - return NULL; - else if (nRead < 0) - break; - } - } while (errno == EAGAIN); + ssize_t nRead = read(childPipeFd, str, FF_PIPE_BUFSIZ); + if (nRead > 0) + ffStrbufAppendNS(buffer, (uint32_t) nRead, str); + else if (nRead == 0) + return NULL; + else if (nRead < 0) + break; + }; - return NULL; + return "read(childPipeFd, str, FF_PIPE_BUFSIZ) failed"; } diff --git a/src/common/processing_windows.c b/src/common/processing_windows.c index 5f44d5210..398194b34 100644 --- a/src/common/processing_windows.c +++ b/src/common/processing_windows.c @@ -4,7 +4,7 @@ #include -enum { FF_PIPE_BUFSIZ = 4096 }; +enum { FF_PIPE_BUFSIZ = 8192 }; const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool useStdErr) { diff --git a/src/common/properties.c b/src/common/properties.c index c91f107eb..f5180aa11 100644 --- a/src/common/properties.c +++ b/src/common/properties.c @@ -91,7 +91,7 @@ bool ffParsePropLines(const char* lines, const char* start, FFstrbuf* buffer) // The following functions return true if the file was found, independently if start was found // Buffers which already contain content are not overwritten -// The last occurence of start in the first file will be the one used +// The last occurrence of start in the first file will be the one used bool ffParsePropFileValues(const char* filename, uint32_t numQueries, FFpropquery* queries) { diff --git a/src/common/properties.h b/src/common/properties.h index 8b65e419c..69ea5ddf4 100644 --- a/src/common/properties.h +++ b/src/common/properties.h @@ -1,8 +1,5 @@ #pragma once -#ifndef FF_INCLUDED_common_properties -#define FF_INCLUDED_common_properties - #include "fastfetch.h" typedef struct FFpropquery @@ -51,5 +48,3 @@ static inline bool ffParsePropFileData(const char* relativeFile, const char* sta { return ffParsePropFileDataValues(relativeFile, 1, (FFpropquery[]){{start, buffer}}); } - -#endif diff --git a/src/common/settings.h b/src/common/settings.h index 212727fe9..0b87bb33e 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -1,8 +1,5 @@ #pragma once -#ifndef FF_INCLUDED_common_settings -#define FF_INCLUDED_common_settings - #include "fastfetch.h" typedef enum FFvarianttype @@ -38,5 +35,3 @@ bool ffSettingsGetAndroidProperty(const char* propName, FFstrbuf* result); #elif defined(__FreeBSD__) bool ffSettingsGetFreeBSDKenv(const char* propName, FFstrbuf* result); #endif - -#endif diff --git a/src/common/sysctl.h b/src/common/sysctl.h index 562e625d5..2a210de86 100644 --- a/src/common/sysctl.h +++ b/src/common/sysctl.h @@ -1,8 +1,5 @@ #pragma once -#ifndef FF_INCLUDED_common_sysctl -#define FF_INCLUDED_common_sysctl - #include "fastfetch.h" #include "util/FFcheckmacros.h" @@ -13,5 +10,3 @@ const char* ffSysctlGetString(const char* propName, FFstrbuf* result); FF_C_NODISCARD int ffSysctlGetInt(const char* propName, int defaultValue); FF_C_NODISCARD int64_t ffSysctlGetInt64(const char* propName, int64_t defaultValue); FF_C_NODISCARD void* ffSysctlGetData(int* request, u_int requestLength, size_t* resultLength); - -#endif diff --git a/src/common/thread.h b/src/common/thread.h index 55b4c5be7..2fd328cf4 100644 --- a/src/common/thread.h +++ b/src/common/thread.h @@ -1,8 +1,5 @@ #pragma once -#ifndef FF_INCLUDED_common_thread -#define FF_INCLUDED_common_thread - #include "fastfetch.h" #ifdef FF_HAVE_THREADS @@ -82,5 +79,3 @@ static inline void ffThreadMutexUnlock(FFThreadMutex* mutex) { FF_UNUSED(mutex) } #define FF_THREAD_ENTRY_DECL_WRAPPER(fn, paramType) #endif //FF_HAVE_THREADS - -#endif diff --git a/src/common/time.h b/src/common/time.h index 8da249448..4dd00f0e3 100644 --- a/src/common/time.h +++ b/src/common/time.h @@ -1,8 +1,5 @@ #pragma once -#ifndef FF_INCLUDED_common_time -#define FF_INCLUDED_common_time - #include #ifdef _WIN32 #include @@ -48,5 +45,3 @@ static inline void ffTimeSleep(uint32_t msec) nanosleep(&(struct timespec){ msec / 1000, (msec % 1000) * 1000000 }, NULL); #endif } - -#endif diff --git a/src/data/config_system.txt b/src/data/config_system.txt deleted file mode 100644 index 46f58c043..000000000 --- a/src/data/config_system.txt +++ /dev/null @@ -1,16 +0,0 @@ -# Fastfetch system configuration -# This file sets the default config for all users of the system. - -# For more information about how configuration files work, -# see ~/.config/fastfetch/config.conf. -# All options that can be put there (or passed as argument) can be put here too. - -# Use fastfetch --print-config-system > /etc/fastfetch/config.conf -# to overwrite this file with the current default file. - -# User config option -# Sets if fastfetch should load user provided configuration. -# If this is off, fastfetch ignores the user config file and any passed arguments -# Must be true or false -# Default is true. -#--load-user-config true diff --git a/src/data/config_user.jsonc b/src/data/config_user.jsonc deleted file mode 100644 index 029f768e5..000000000 --- a/src/data/config_user.jsonc +++ /dev/null @@ -1,41 +0,0 @@ -// ~/.config/fastfetch/config.jsonc -// See https://github.com/fastfetch-cli/fastfetch/wiki/Configuration for more details -// See *.jsonc in https://github.com/fastfetch-cli/fastfetch/tree/dev/presets/examples for more examples -{ - "$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json", - "logo": { - "padding": { - "top": 2 - } - }, - "modules": [ - "title", - "separator", - "os", - "host", - "kernel", - "uptime", - "packages", - "shell", - "display", - "de", - "wm", - "wmtheme", - "theme", - "icons", - "font", - "cursor", - "terminal", - "terminalfont", - "cpu", - "gpu", - "memory", - "disk", - "localip", - "battery", - "poweradapter", - "locale", - "break", - "colors" - ] -} diff --git a/src/data/config_user.txt b/src/data/config_user.txt deleted file mode 100644 index c8a257ec5..000000000 --- a/src/data/config_user.txt +++ /dev/null @@ -1,519 +0,0 @@ -# Fastfetch configuration -# Write every argument in different lines. -# Direct arguments will overwrite the corresponding ones in this file. -# Argument keys are not case sensitive. -# Whitespaces are trimmed at the beginning and the end. -# Empty lines or lines starting with # are ignored. - -# This file was shipped with $" FASTFETCH_PROJECT_VERSION $". -# Use fastfetch --gen-config-force to overwrite this file with the current defaults - -# Below some often usefull options are listed. Uncomment and modify them so they take affect. -# Note that there are a lot more options than the ones listed here, take a look at "fastfetch --help". -# Of course all of them can be made persistent here too. - -# Config option: -# Load additional config files. -# Some are shipped with fastfetch, list them with "fastfetch --list-presets". -# Must be a path to a config file or the name of a shipped preset. -# The config file is completely loaded before continuing in the current file, so the placement of this option matters, as later options overwrite already set ones. -# Can be used multiple times to load multiple config files / presets. -#--load-config /path/to/config.txt - -# Structure option: -# Sets the modules to use and their order. -# Must be a list of module names, separated by colons. -# List available modules with "fastfetch --list-modules". -# Get the default structure with "fastfetch --print-structure". -#--structure $" FASTFETCH_DATATEXT_STRUCTURE $" - -# Multithreading option: -# Sets if fastfetch should use multiple threads to detect the values. -# Must be true or false. -# Default is true. -#--multithreading true - -# Print stat option: -# Sets if fastfetch should print time usage (in ms) for individual modules -# If true, it will also enable --show-errors -# Must be true or false. -# Default is false. -#--stat true - -# Slow operations option: -# Sets if fastfetch is allowed to use known slow operations to detect more / better values. -# Must be true or false. -# Default is false. -#--allow-slow-operations false - -# Linewrap option: -# Sets if fastfetch should disable linewrap during the run. -# Must be true or false. -# Default is true. -#--disable-linewrap true - -# Cursor option: -# Sets if fastfetch should hide the console cursor during the run. -# Must be true or false. -# Default is true. -#--hide-cursor true - -# Processing timeout option: -# Sets the timeout (ms) when waiting for child processes -# Must be an integer. -# Default is 1000 -#--processing-timeout 1000 - -# WMI timeout option: -# Sets the timeout (ms) for WMI queries. Windows only -# Must be an integer. -# Default is 5000 -#--wmi-timeout 5000 - -# Logo option: -# Sets the logo to use. -# List available logos with "fastfetch --list-logos". -# Print available logos with "fastfetch --print-logos". -# Must be the name of an available logo or a path to a text file containing a custom logo. -# Default is the current distribution. -#--logo arch - -# Logo type option: -# Sets the logo type to use. -# Must be auto, builtin, file, file-raw, data, data-raw, sixel, kitty or chafa. -# Default is auto. -#--logo-type auto - -# Logo width option: -# Sets the width of the logo (in characters) if the logo is an image. -# Must be a positive integer. -# Default is 65. -#--logo-width 65 - -# Logo height option: -# Sets the height of the logo (in characters) if the logo is an image. -# Must be a positive integer. -# Default is 0 (keeps aspect ration). -#--logo-height 0 - -# Logo color options: -# Overwrite a color in the logo. Also works for user provided logos. -# In the user logo, they replace $[1-9]. Use $$ to print a single $ sign. -# Must be linux console color codes or the name of a color. -# Default is the one specified by the logo. -# Use "fastfetch --help color" to learn more and see examples. -# Valid index range is [1-9]. -#--logo-color-1 red -#--logo-color-2 32 -# [...] -#--logo-color-9 yellow - -# Logo padding option: -# Adds a padding to the left and the right side of the logo. -# Must be a positive integer. -# Default is 0. -#--logo-padding 0 - -# Logo padding left option: -# Adds a padding to the left side of the logo. -# Must be a positive integer. -# Default is 0. -#--logo-padding-left 0 - -# Logo padding right option: -# Adds a padding to the right side of the logo. -# Must be a positive integer. -# Default is 0. -#--logo-padding-right 0 - -# Logo padding top option: -# Adds a padding to the top side of the logo. -# Must be a positive integer. -# Default is 0. -#--logo-padding-top 0 - -# Logo print remaining option: -# Sets if the remaining logo should be printed, it is has more lines than modules to show. -# Must be true or false. -# Default is true. -#--logo-print-remaining true - -# Color keys option: -# Sets the color of the keys. -# Must be linux console color codes or the name of a color. -# Default is the key color of the logo. -# Use "fastfetch --help color" to learn more and see examples. -#--color-keys magenta - -# Color title option: -# Sets the color of the title. -# Must be linux console color codes or the name of a color. -# Default is the title color of the logo. -# Use "fastfetch --help color" to learn more and see examples. -#--color-title magenta - -# Binary prefix option: -# Sets the binary prefix to use. -# Must be a IEC, SI or JEDEC. -# Default is IEC. -#--binary-prefix IEC - -# Size number of digits option: -# Sets the number of digits to keep after the decimal point when formatting sizes. -# Must be an possitive integer. -# Default is 2. -#--size-ndigits 2 - -# Size max prefix option: -# Sets the largest binary prefix to use when formatting sizes. -# Must be one of B, kB, MB, GB, TB, PB, EB, ZB, YB -# Default is YB. -#--size-max-prefix YB - -# Disable output buffer option: -# Sets if the stdout application buffer should be disabled. -# Must be true or false. -# Default is false. -#--no-buffer false - -# Title FQDN option: -# Sets if the title should use the fully qualified domain name. -# Must be true or false. -# Default is false. -#--title-fqdn false - -# Title user color option: -# Sets color of the user name (left part). -# Default is empty (use color of `--color-title`). -#--title-color-user - -# Title at color option: -# Sets color of the @ symbol (middle part). -# Default is empty (use color of `--color-title`). -#--title-color-at - -# Title host color option: -# Sets color of the host name (right part). -# Default is empty (use color of `--color-title`). -#--title-color-host - -# Separator option: -# Sets the string placed between a key and its value. -# Can be any string. -# Default is ": ". -#--separator ": " - -# Separator string option: -# Sets the string printed by the "separator" module (usually between title and rest of output) -# Must be any string. It is repated / cut to fit perfectly. -# Default is "-" -#--separator-string - - -# Public IP URL option: -# Sets the URL of public IP detection server to be used. -# Only HTTP protocol is supported, and the value should not contain "http://" prefix. -# Default is "ipinfo.io/ip". -#--publicip-url "ipinfo.io/ip" - -# Public IP timeout option: -# Sets the time to wait for the public ip server to respond. -# Must be a positive integer. -# Default is 0 (disabled). -#--publicip-timeout 0 - -# Weather location option: -# Sets the location to be used. It must be URI encoded (eg a whitespace must be encoded as `+`). -# Default is empty (guessing by public IP) -#--weather-location "Location" - -# Weather output format option: -# Sets the weather format to be used. It must be URI encoded. -# See: https://github.com/chubin/wttr.in#one-line-output -# Default is "%t+-+%C+(%l)". -#--weather-output-format "%t+-+%C+(%l)" - -# Weather timeout option: -# Sets the time to wait for the weather server (wttr.in) to respond. -# Must be a positive integer. -# Default is 0 (disabled). -#--weather-timeout 0 - -# OS file option -# Sets the path to the file containing the operating system information. -# Should be a valid path to an existing file. -# Default is /etc/os-release. -#--os-file /etc/os-release - -# Player name option -# Sets the name of the player. This is also used in song detection -# Must be the exact name of the player or a dbus address (e.g. org.mpris.MediaPlayer2.spotify) -# Default is the first match starting with org.mpris.MediaPlayer2. -#--player-name spotify - -# Display server force DRM option -# Sets if fastfetch should only use `/sys/class/drm` to detect displays if you get issues with the default behavior. -# Note DRM doesn't support refresh rate or scaled resolution detection. -# Only supported on Linux. -# Must be true or false. -# Default is false. -#--ds-force-drm false - -# Escape bedrock option -# Sets if fastfetch should escape the bedrock jail, if it detectes that it is running in one -# Must be true or false. -# Default is true. -#--escape-bedrock true - -# OpenGL option -# Sets with opengl context creation library to use -# Must be either auto, egl, glx or osmesa -# Default is auto. -#--opengl-library auto - -# GPU hide options -# Sets whether to hide certain gpu types -# Must be either true or false -# Default is false. -#--gpu-hide-integrated -#--gpu-hide-discrete - -# GPU detection options -# Forces using vulkan to detect GPUs -# which support video memory usage detection with `--allow-slow-operations` -# Must be either true or false -# Default is false. -#--gpu-force-vulkan - -# Disk show options -# Sets if certain types of disk should be printed -# Must be either true or false -# Default is false except for --disk-show-external. -#--disk-show-external true -#--disk-show-hidden false -#--disk-show-subvolumes false -#--disk-show-unknown false - -# Disk option -# A colon (semicolon on Windows) separated list of folder paths for the disk output -# This option override `--disk-show-*` options above -# Must be a string -# Default is "/:/home" ("C:\\;D:\\ ..." on Windows). -#--disk-folders /:/home - -# Bluetooth show disconnected option -# Sets if disconnected bluetooth devices should be printed -# Must be either true or false -# Default is false. -#--bluetooth-show-disconnected false - -# Display compact output option -# Sets if all displays should be printed in one line -# Must be either original (print pixel resolution) or scaled (print scaled resolution) -# Default is none. -#--display-compact-type none - -# Display detect name option -# Sets if display name should be detected and printed (if supported) -# Must be either true of false -# Default is false. -#--display-detect-name none - -# Display precise refresh rate option -# Sets if decimal refresh rates should not be rounded into integers when printing -# Must be either true (keep decimals) of false (round into integers) -# Default is false. -#--display-precise-refresh-rate false - -# Sound show all option -# Sets if all sound devices should be printed -# Must be either main, active or all. Default is main -# Default is main. -#--sound-type main - -# Percentage output type option -# Applies to all modules that prints percentage values. Currently memory, swap, disk, battery and CPU usage are supported. -# Only works with default format ( without --module-format option ). -# 0: prints none; 1: prints percent number only; 2: prints bar only; 3: prints both percent number and bar; 6: prints bar and hide other texts; 9: prints colored number -#--percent-type 1 - -# Key options: -# Sets the displayed key of a module -# Can be any string. Some of theme take an argument like a format string. See "fastfetch --help format" for help. -#--os-key OS -#--host-key Host -#--chassis-key Chassis -#--kernel-key Kernel -#--uptime-key Uptime -#--processes-key Processes -#--packages-key Packages -#--shell-key Shell -#--display-key Display {1} -#--brightness-key Brightness ({1}) -#--monitor-key Monitor -#--de-key DE -#--wm-key WM -#--wmtheme-key WM Theme -#--theme-key Theme -#--icons-key Icons -#--font-key Font -#--cursor-key Cursor -#--terminal-key Terminal -#--terminalfont-key Terminal Font -#--cpu-key CPU -#--cpuusage-key CPU Usage -#--gpu-key GPU {1} -#--memory-key Memory -#--swap-key Swap -#--disk-key Disk ({1}) -#--battery-key Battery {1} -#--poweradapter-key Power Adapter {1} -#--lm-key LM -#--locale-key Locale -#--localip-key Local IP ({1}) -#--netio-key Network IO ({1}) -#--publicip-key Public IP -#--wifi-key Wifi -#--weather-key Weather -#--player-key Media Player -#--media-key Media -#--datetime-key Date Time -#--version-key Version -#--vulkan-key Vulkan -#--opengl-key OpenGL -#--opencl-key OpenCL -#--users-key Users -#--bluetooth-key Bluetooth -#--sound-key Sound -#--gamepad-key Gamepad -#--wallpaper-key Wallpaper - -# Format options: -# Sets the format string for module values. -# For information on format strings, see "fastfetch --help format". -# To see the parameter they take and their default value, see "fastfetch --help *-format", e.g. "fastfetch --help os-format". -# An empty format string (As they are currently below) will behave as if it was not set. -#--title-format -#--os-format -#--host-format -#--chassis-format -#--kernel-format -#--uptime-format -#--processes-format -#--packages-format -#--shell-format -#--display-format -#--brightness-format -#--de-format -#--wm-format -#--wmtheme-format -#--theme-format -#--icons-format -#--font-format -#--cursor-format -#--terminal-format -#--terminalfont-format -#--cpu-format -#--cpuusage-format -#--gpu-format -#--memory-format -#--swap-format -#--disk-format -#--battery-format -#--poweradapter-format -#--lm-format -#--locale-format -#--localip-format -#--netio-format -#--publicip-format -#--weather-format -#--monitor-format -#--player-format -#--media-format -#--datetime-format -#--version-format -#--vulkan-format -#--opengl-format -#--opencl-format -#--users-format -#--bluetooth-format -#--sound-format -#--gamepad-format -#--wallpaper-format - -# Key color options: -# Overrides the global `--color-keys` for one specified module -#--title-key-color -#--os-key-color -#--host-key-color -#--chassis-key-color -#--kernel-key-color -#--uptime-key-color -#--processes-key-color -#--packages-key-color -#--shell-key-color -#--display-key-color -#--brightness-key-color -#--de-key-color -#--wm-key-color -#--wmtheme-key-color -#--theme-key-color -#--icons-key-color -#--font-key-color -#--cursor-key-color -#--terminal-key-color -#--terminalfont-key-color -#--cpu-key-color -#--cpuusage-key-color -#--gpu-key-color -#--memory-key-color -#--swap-key-color -#--disk-key-color -#--battery-key-color -#--poweradapter-key-color -#--lm-key-color -#--locale-key-color -#--localip-key-color -#--netio-key-color -#--publicip-key-color -#--weather-key-color -#--monitor-key-color -#--player-key-color -#--media-key-color -#--datetime-key-color -#--version-key-color -#--vulkan-key-color -#--opengl-key-color -#--opencl-key-color -#--users-key-color -#--bluetooth-key-color -#--sound-key-color -#--gamepad-key-color -#--wallpaper-key-color - -# Library options: -# Sets an user specific path to a library to load. -# Must be a valid path to a library. -#--lib-PCI /usr/lib/libpci.so -#--lib-vulkan /usr/lib/libvulkan.so (libMoltenVK.dylib on macOS) -#--lib-wayland /usr/lib/libwayland-client.so -#--lib-xcb-randr /usr/lib/libxcb-randr.so -#--lib-xcb /usr/lib/libxcb.so -#--lib-Xrandr /usr/lib/libXrandr.so -#--lib-X11 /usr/lib/libX11.so -#--lib-gio /usr/lib/libgio-2.0.so -#--lib-DConf /usr/lib/libdconf.so -#--lib-DBus /usr/lib/libdbus-1.so -#--lib-XFConf /usr/lib/libxfconf-0.so -#--lib-sqlite3 /usr/lib/libsqlite3.so -#--lib-rpm /usr/lib/librpm.so -#--lib-imagemagick /usr/lib/libMagickCore-7.Q16HDRI.so -#--lib-z /usr/lib/libz.so -#--lib-chafa /usr/lib/libchafa.so -#--lib-egl /usr/lib/libEGL.so -#--lib-glx /usr/lib/libGLX.so -#--lib-osmesa /usr/lib/libOSMesa.so -#--lib-opencl /usr/lib/libOpenCL.so -#--lib-freetype /data/data/com.termux/files/usr/lib -#--lib-pulse /usr/lib/libpulse.so -#--lib-ddcutil /usr/lib/libddcutil.so -#--lib-nm /usr/lib/libnm.so diff --git a/src/data/help.json b/src/data/help.json new file mode 100644 index 000000000..b643b6771 --- /dev/null +++ b/src/data/help.json @@ -0,0 +1,1354 @@ +{ + "Informative": [ + { + "short": "h", + "long": "help", + "desc": "Show this message, or help for a specific command", + "arg": { + "type": "command", + "optional": true + } + }, + { + "short": "v", + "long": "version", + "desc": "Show the full version of fastfetch" + }, + { + "long": "version-raw", + "desc": "Show the raw version string (major.minor.patch)" + }, + { + "long": "list-config-paths", + "desc": "List search paths of config files" + }, + { + "long": "list-data-paths", + "desc": "List search paths of presets and logos" + }, + { + "long": "list-logos", + "desc": "List available logos" + }, + { + "long": "list-modules", + "desc": "List available modules" + }, + { + "long": "list-presets", + "desc": "List presets fastfetch knows about", + "remark": "Presets can be loaded with \"--config \"" + }, + { + "long": "list-features", + "desc": "List the supported features fastfetch was compiled with", + "remark": "Mainly for development" + }, + { + "long": "print-logos", + "desc": "Print available logos" + }, + { + "long": "print-structure", + "desc": "Print the default structure" + } + ], + "Config": [ + { + "short": "c", + "long": "config", + "desc": "Specify the config file or preset to be loaded", + "remark": "The file will be searched in the order of \"fastfetch --list-config-paths\". If \"none\", disable further config loading. See also https://github.com/fastfetch-cli/fastfetch/wiki/Configuration for more info", + "arg": { + "type": "config" + } + }, + { + "long": "gen-config", + "desc": "Generate a config file to specified path with options specified in the command line (if any)", + "remark": "Defaults to \"~/.config/fastfetch/config.jsonc\". Will Print the generated config if is \"-\"", + "arg": { + "type": "path", + "optional": true + } + }, + { + "long": "gen-config-force", + "desc": "Generate a config file to specified path. Overwrite the existing one", + "remark": "Defaults to \"~/.config/fastfetch/config.jsonc\"", + "arg": { + "type": "path", + "optional": true + } + } + ], + "pseudo": [ + { + "long": "thread", + "desc": "Use separate threads to send HTTP requests", + "arg": { + "type": "bool", + "optional": true, + "default": true + } + }, + { + "long": "escape-bedrock", + "desc": "On Bedrock Linux, whether to escape the bedrock jail", + "remark": "Linux only", + "arg": { + "type": "bool", + "optional": true, + "default": true + } + }, + { + "long": "wmi-timeout", + "desc": "Set the timeout (ms) for WMI queries", + "remark": "Windows only", + "arg": { + "type": "num", + "default": 5000 + } + }, + { + "long": "processing-timeout", + "desc": "Set the timeout (ms) when waiting for child processes", + "arg": { + "type": "num", + "default": 1000 + } + }, + { + "long": "ds-force-drm", + "desc": "Set if only DRM should be used to detect displays", + "remark": "Use this option if you encountered problems with other detection method. Linux only", + "arg": { + "type": "bool", + "optional": true, + "default": false + } + } + ], + "Logo": [ + { + "short": "l", + "long": "logo", + "desc": "Set the logo source", + "remark": "Should be the name of a builtin logo, or a path to an image file. See also https://github.com/fastfetch-cli/fastfetch/wiki/Logo-options", + "arg": { + "type": "logo" + } + }, + { + "long": "logo-type", + "desc": "Set the type of the logo given in \"--logo\"", + "remark": "See also https://github.com/fastfetch-cli/fastfetch/wiki/Logo-options", + "arg": { + "type": "enum", + "enum": { + "auto": "If something is given, first try builtin, then file. Otherwise detect logo", + "builtin": "Builtin ascii art", + "small": "Builtin ascii art, small version", + "file": "Text file, printed with color code replacement", + "file-raw": "Text file, printed as is", + "data": "Text data, printed with color code replacement", + "data-raw": "Text data, printed as is", + "sixel": "Image file, printed as sixel codes", + "kitty": "Image file, printed as kitty graphics protocol", + "kitty_direct": "Image file, tell the terminal emulator to read image data from the specified file (Supported by kitty and wezterm)", + "iterm": "Image file, printed as iterm graphics protocol", + "chafa": "Image file, printed as ascii art using libchafa", + "raw": "Image file, printed as raw binary string", + "none": "Disable logo printing" + } + } + }, + { + "long": "logo-width", + "desc": "Set the width of the logo (in characters), if it is an image", + "remark": "Required for iTerm image protocol", + "arg": { + "type": "num" + } + }, + { + "long": "logo-height", + "desc": "Set the height of the logo (in characters), if it is an image", + "remark": "Required for iTerm image protocol", + "arg": { + "type": "num" + } + }, + { + "long": "logo-preserve-aspect-ratio", + "desc": "Set if the logo should fill the specified width and height as much as possible without stretching", + "remark": "Supported by iTerm image protocol only", + "arg": { + "type": "bool", + "optional": true, + "default": false + } + }, + { + "long": "logo-color-[1-9]", + "desc": "Overwrite a color in the logo", + "arg": { + "type": "color" + }, + "pseudo": true + }, + { + "long": "logo-padding", + "desc": "Set the padding on the left and the right of the logo", + "arg": { + "type": "num" + } + }, + { + "long": "logo-padding-left", + "desc": "Set the padding on the left of the logo", + "arg": { + "type": "num" + } + }, + { + "long": "logo-padding-right", + "desc": "Set the padding on the right of the logo", + "arg": { + "type": "num" + } + }, + { + "long": "logo-padding-top", + "desc": "Set the padding on the top of the logo", + "arg": { + "type": "num" + } + }, + { + "long": "logo-print-remaining", + "desc": "Whether to print the remaining logo, if it has more lines than modules to display", + "arg": { + "type": "bool", + "optional": true, + "default": true + } + }, + { + "long": "logo-separate", + "desc": "If true, print modules at bottom of the logo", + "arg": { + "type": "bool", + "optional": true, + "default": false + } + }, + { + "long": "logo-recache", + "desc": "If true, regenerate image logo cache", + "arg": { + "type": "bool", + "optional": true, + "default": false + } + }, + { + "long": "file", + "desc": "Short for --logo-type file --logo ", + "remark": "See \"--help logo-type\" for more info", + "arg": { + "type": "path" + } + }, + { + "long": "file-raw", + "desc": "Short for --logo-type file-raw --logo ", + "remark": "See \"--help logo-type\" for more info", + "arg": { + "type": "path" + } + }, + { + "long": "data", + "desc": "Short for --logo-type data --logo ", + "remark": "See \"--help logo-type\" for more info", + "arg": { + "type": "data" + } + }, + { + "long": "data-raw", + "desc": "Short for --logo-type data-raw --logo ", + "remark": "See \"--help logo-type\" for more info", + "arg": { + "type": "data" + } + }, + { + "long": "raw", + "desc": "Short for --logo-type raw --logo ", + "remark": "See \"--help logo-type\" for more info", + "arg": { + "type": "path" + } + }, + { + "long": "sixel", + "desc": "Short for --logo-type sixel --logo ", + "remark": "See \"--help logo-type\" for more info", + "arg": { + "type": "path" + } + }, + { + "long": "kitty", + "desc": "Short for --logo-type kitty --logo ", + "remark": "See \"--help logo-type\" for more info", + "arg": { + "type": "path" + } + }, + { + "long": "kitty-direct", + "desc": "Short for --logo-type kitty-direct --logo ", + "remark": "See \"--help logo-type\" for more info", + "arg": { + "type": "path" + } + }, + { + "long": "iterm", + "desc": "Short for --logo-type iterm --logo ", + "remark": "See \"--help logo-type\" for more info", + "arg": { + "type": "path" + } + }, + { + "long": "chafa", + "desc": "Short for --logo-type chafa --logo ", + "remark": "See \"--help logo-type\" for more info", + "arg": { + "type": "path" + } + }, + { + "long": "chafa-fg-only", + "desc": "Produce character-cell output using foreground colors only", + "remark": "See chafa document for detail", + "arg": { + "type": "bool", + "optional": true, + "default": false + } + }, + { + "long": "chafa-symbols", + "desc": "Specify character symbols to employ in final output", + "remark": "See chafa document for detail", + "arg": { + "type": "str" + } + }, + { + "long": "chafa-canvas-mode", + "desc": "Determine how colors are used in the output", + "remark": "This value maps the int value of enum ChafaCanvasMode. See chafa document for detail", + "arg": { + "type": "enum", + "enum": { + "TRUECOLOR": "Truecolor", + "INDEXED_256": "256 colors", + "INDEXED_240": "256 colors, but avoid using the lower 16 whose values vary between terminal environments", + "INDEXED_16": "16 colors using the aixterm ANSI extension", + "FGBG_BGFG": "Default foreground and background colors, plus inversion", + "FGBG": "Default foreground and background colors. No ANSI codes will be used", + "INDEXED_8": "8 colors, compatible with original ANSI X3.64", + "INDEXED_16_8": "16 FG colors (8 of which enabled with bold/bright) and 8 BG colors" + } + } + }, + { + "long": "chafa-color-space", + "desc": "Set color space used for quantization", + "remark": "This value maps the int value of enum ChafaColorSpace. See chafa document for detail", + "arg": { + "type": "enum", + "enum": { + "RGB": "RGB color space. Fast but imprecise", + "DIN99D": "DIN99d color space. Slower, but good perceptual color precision" + } + } + }, + { + "long": "chafa-dither-mode", + "desc": "Set output dither mode (No effect with 24-bit color)", + "remark": "This value maps the int value of enum ChafaDitherMode. See chafa document for detail", + "arg": { + "type": "enum", + "enum": { + "NONE": "No dithering", + "ORDERED": "Ordered dithering (Bayer or similar)", + "DIFFUSION": "Error diffusion dithering (Floyd-Steinberg or similar)" + } + } + } + ], + "Display": [ + { + "short": "s", + "long": "structure", + "desc": "Set the structure of the fetch", + "remark": "Must be a colon separated list of keys. Use \"fastfetch --list-modules\" to see the ones available", + "arg": { + "type": "structure", + "default": "\"fastfetch --print-structure\"" + } + }, + { + "long": "stat", + "desc": "Show time usage (in ms) for individual modules", + "arg": { + "type": "bool", + "optional": true, + "default": false + } + }, + { + "long": "pipe", + "desc": "Disable logo and all escape sequences", + "remark": "Auto detection based on isatty(1)", + "arg": { + "type": "bool", + "optional": true + } + }, + { + "long": "color-keys", + "desc": "Set the color of the keys", + "arg": { + "type": "color" + } + }, + { + "long": "color-title", + "desc": "Set the color of the title", + "arg": { + "type": "color" + } + }, + { + "long": "color", + "desc": "Set the color of both the keys and title", + "remark": "Shortcut of \"--color-keys \" and \"--color-title \"", + "arg": { + "type": "color" + } + }, + { + "long": "key-width", + "desc": "Align the width of keys to characters", + "arg": { + "type": "num" + } + }, + { + "long": "bright-color", + "desc": "Set if the keys, title and ASCII logo should be printed in bright color", + "arg": { + "type": "bool", + "optional": true, + "default": true + } + }, + { + "long": "separator", + "desc": "Set the separator between key and value", + "arg": { + "type": "str", + "default": ": " + } + }, + { + "long": "set", + "desc": "Hard set the value of a key", + "remark": "Deprecated. Use \"Custom\" module instead", + "arg": { + "type": "key=value" + } + }, + { + "long": "set-keyless", + "desc": "Hard set the value of a key, but don't print the key or the separator", + "remark": "Deprecated. Use \"Custom\" module instead", + "arg": { + "type": "key=value" + } + }, + { + "long": "show-errors", + "desc": "Print occurring errors", + "arg": { + "type": "bool", + "optional": true, + "default": false + } + }, + { + "long": "disable-linewrap", + "desc": "Whether to disable line wrap during the run", + "arg": { + "type": "bool", + "optional": true, + "default": true + } + }, + { + "long": "hide-cursor", + "desc": "Whether to hide the cursor during the run", + "arg": { + "type": "bool", + "optional": true, + "default": true + } + }, + { + "long": "binary-prefix", + "desc": "Set the binary prefix to used", + "arg": { + "type": "enum", + "enum": { + "IEC": "1024 Bytes = 1 KiB, 1024 KiB = 1 MiB, ...", + "SI": "1000 Bytes = 1 KB, 1000 KB = 1 MB, ...", + "JEDEC": "1024 Bytes = 1 kB, 1024 kB = 1 MB, ..." + }, + "default": "IEC" + } + }, + { + "long": "percent-type", + "desc": "Set the percentage output type", + "remark": "1 for percentage number, 2 for bar, 3 for both, 6 for bar only, 9 for colored number", + "arg": { + "type": "num", + "default": 9 + } + }, + { + "long": "percent-ndigits", + "desc": "Set the number of digits to keep after the decimal point when formatting percentage numbers", + "arg": { + "type": "num", + "default": 0 + } + }, + { + "long": "bar-char-elapsed", + "desc": "Set the character to use in elapsed part", + "arg": { + "type": "str", + "default": "■" + } + }, + { + "long": "bar-char-total", + "desc": "Set the character to use in total part", + "arg": { + "type": "str", + "default": "-" + } + }, + { + "long": "bar-width", + "desc": "Set the width of the bar, in number of characters", + "arg": { + "type": "num", + "default": 10 + } + }, + { + "long": "bar-border", + "desc": "Whether to show a border around the bar", + "arg": { + "type": "bool", + "optional": true, + "default": true + } + }, + { + "long": "no-buffer", + "desc": "Set if the stdout application buffer should be disabled", + "arg": { + "type": "bool", + "optional": true, + "default": false + } + }, + { + "long": "size-ndigits", + "desc": "Set the number of digits to keep after the decimal point when formatting sizes", + "arg": { + "type": "num" + } + }, + { + "long": "size-max-prefix", + "desc": "Set the largest binary prefix to use when formatting sizes", + "arg": { + "type": "enum", + "enum": { + "B": "Bytes", + "kB": "KiB", + "MB": "MiB", + "GB": "GiB", + "TB": "TiB", + "PB": "PiB", + "EB": "EiB", + "ZB": "ZiB", + "YB": "YiB" + }, + "default": "YB" + } + }, + { + "long": "temperature-unit", + "desc": "Set the unit of the temperature", + "arg": { + "type": "enum", + "enum": { + "C": "Celsius", + "F": "Fahrenheit", + "K": "Kelvin" + }, + "default": "C" + } + } + ], + "Library path": [ + { + "long": "lib-pci", + "desc": "Pciutils. Used for GPU output", + "arg": { + "type": "path" + } + }, + { + "long": "lib-vulkan", + "desc": "Vulkan module & fallback for GPU output", + "arg": { + "type": "path" + } + }, + { + "long": "lib-wayland", + "desc": "Better display performance and output in wayland sessions", + "arg": { + "type": "path" + } + }, + { + "long": "lib-xcb-randr", + "desc": "X11 sessions for better display detection and faster WM detection", + "arg": { + "type": "path" + } + }, + { + "long": "lib-xcb", + "desc": "X11 sessions for better display detection and faster WM detection", + "arg": { + "type": "path" + } + }, + { + "long": "lib-xrandr", + "desc": "X11 sessions for better display detection and faster WM detection", + "arg": { + "type": "path" + } + }, + { + "long": "lib-x11", + "desc": "X11 sessions for better display detection and faster WM detection", + "arg": { + "type": "path" + } + }, + { + "long": "lib-drm", + "desc": "Used for fast resolution and refresh rate detection", + "remark": "Linux only", + "arg": { + "type": "path" + } + }, + { + "long": "lib-gio", + "desc": "Needed for values that are only stored GSettings", + "arg": { + "type": "path" + } + }, + { + "long": "lib-dconf", + "desc": "Needed for values that are only stored in DConf + Fallback for GSettings", + "arg": { + "type": "path" + } + }, + { + "long": "lib-dbus", + "desc": "Bluetooth, Player & Media detection", + "arg": { + "type": "path" + } + }, + { + "long": "lib-xfconf", + "desc": "Needed for XFWM theme and XFCE Terminal font", + "arg": { + "type": "path" + } + }, + { + "long": "lib-sqlite3", + "desc": "Needed for pkg & rpm package count", + "arg": { + "type": "path" + } + }, + { + "long": "lib-rpm", + "desc": "Slower fallback for rpm package count", + "arg": { + "type": "path" + } + }, + { + "long": "lib-imagemagick", + "desc": "Images in terminal using sixel or kitty graphics protocol", + "arg": { + "type": "path" + } + }, + { + "long": "lib-z", + "desc": "Libz. Faster image output when using kitty graphics protocol", + "arg": { + "type": "path" + } + }, + { + "long": "lib-chafa", + "desc": "Image output as ascii art", + "arg": { + "type": "path" + } + }, + { + "long": "lib-egl", + "desc": "Needed by the OpenGL module for gl context creation", + "arg": { + "type": "path" + } + }, + { + "long": "lib-glx", + "desc": "Needed by the OpenGL module for gl context creation", + "arg": { + "type": "path" + } + }, + { + "long": "lib-osmesa", + "desc": "Needed by the OpenGL module for gl context creation", + "arg": { + "type": "path" + } + }, + { + "long": "lib-opencl", + "desc": "OpenCL module", + "arg": { + "type": "path" + } + }, + { + "long": "lib-pulse", + "desc": "Pulseaudio. Used for Sound detection", + "arg": { + "type": "path" + } + }, + { + "long": "lib-nm", + "desc": "NetworkManager. Used for Wifi detection", + "arg": { + "type": "path" + } + }, + { + "long": "lib-freetype", + "desc": "Used for Termux font detection", + "arg": { + "type": "path" + } + }, + { + "long": "lib-ddcutil", + "desc": "Used for brightness detection of external displays", + "arg": { + "type": "path" + } + } + ], + "Module specific": [ + { + "long": "title-fqdn", + "desc": "Set if the title should use fully qualified domain name", + "arg": { + "type": "bool", + "optional": true, + "default": false + } + }, + { + "long": "title-color-user", + "desc": "Set color of the user name (left part)", + "arg": { + "type": "color", + "default": "Use color of \"--color-title\"" + } + }, + { + "long": "title-color-at", + "desc": "Set color of the @ symbol (middle part)", + "arg": { + "type": "color", + "default": "Use color of \"--color-title\"" + } + }, + { + "long": "title-color-host", + "desc": "Set color of the host name (right part)", + "arg": { + "type": "color", + "default": "default" + } + }, + { + "long": "chassis-use-wmi", + "desc": "Set if WMI query should be used on Windows", + "remark": "WMI query detects more information but is slower. Windows only", + "arg": { + "type": "bool", + "optional": true, + "default": false + } + }, + { + "long": "separator-string", + "desc": "Set the string printed by the separator module", + "arg": { + "type": "str", + "default": "-" + } + }, + { + "long": "os-file", + "desc": "Set the additional file path which containing OS information", + "remark": "Linux only", + "arg": { + "type": "path" + } + }, + { + "long": "disk-folders", + "desc": "A colon (semicolon on Windows) separated list of folder paths for the disk output", + "arg": { + "type": "path", + "default": "Auto detection using mount-points" + } + }, + { + "long": "disk-show-regular", + "desc": "Set if regular volume should be printed", + "arg": { + "type": "bool", + "optional": true, + "default": true + } + }, + { + "long": "disk-show-external", + "desc": "Set if external volume should be printed", + "arg": { + "type": "bool", + "optional": true, + "default": true + } + }, + { + "long": "disk-show-hidden", + "desc": "Set if hidden volumes should be printed", + "arg": { + "type": "bool", + "optional": true, + "default": false + } + }, + { + "long": "disk-show-subvolumes", + "desc": "Set if subvolumes should be printed", + "arg": { + "type": "bool", + "optional": true, + "default": false + } + }, + { + "long": "disk-show-readonly", + "desc": "Set if read only volumes should be printed", + "arg": { + "type": "bool", + "optional": true, + "default": true + } + }, + { + "long": "disk-show-unknown", + "desc": "Set if unknown (unable to detect sizes) volumes should be printed", + "arg": { + "type": "bool", + "optional": true, + "default": false + } + }, + { + "long": "disk-use-available", + "desc": "Use f_bavail (lpFreeBytesAvailableToCaller for Windows) instead of f_bfree to calculate used bytes", + "remark": "Maybe required for macOS to print correct results", + "arg": { + "type": "bool", + "optional": true, + "default": false + } + }, + { + "long": "diskio-name-prefix", + "desc": "Show disks with given name prefix only", + "arg": { + "type": "str" + } + }, + { + "long": "bluetooth-show-disconnected", + "desc": "Set if disconnected bluetooth devices should be printed", + "arg": { + "type": "bool", + "optional": true, + "default": false + } + }, + { + "long": "packages-winget", + "desc": "Set if winget package count should be detected", + "remark": "This option is extremely slow. You may need to increase value of '--processing-timeout' to make it actually work", + "arg": { + "type": "bool", + "optional": true, + "default": false + } + }, + { + "long": "display-compact-type", + "desc": "Set if all displays should be printed in one line", + "arg": { + "type": "enum", + "enum": { + "none": "Disable this compact mode", + "original": "Print original resolutions", + "scaled": "Print scaled resolutions" + }, + "default": "none" + } + }, + { + "long": "display-precise-refresh-rate", + "desc": "Set if decimal refresh rates should not be rounded into integers when printing", + "arg": { + "type": "bool", + "optional": true, + "default": false + } + }, + { + "long": "brightness-ddcci-sleep", + "desc": "Set the sleep times (in ms) when sending DDC/CI requests", + "remark": "See for detail", + "arg": { + "type": "num", + "default": 10 + } + }, + { + "long": "sound-type", + "desc": "Set what type of sound devices should be printed", + "arg": { + "type": "enum", + "enum": { + "main": "Print only main sound devices", + "active": "Print only active sound devices", + "all": "Print all sound devices" + }, + "default": "main" + } + }, + { + "long": "battery-dir", + "desc": "The directory where the battery folders are", + "remark": "Linux only", + "arg": { + "type": "path", + "default": "/sys/class/power_supply/" + } + }, + { + "long": "battery-use-setup-api", + "desc": "Set if \"SetupAPI\" should be used on Windows to detect battery info", + "remark": "SetupAPI supports multi batteries, but slower. Windows only", + "arg": { + "type": "bool", + "optional": true, + "default": false + } + }, + { + "long": "cpu-temp", + "desc": "Detect and display CPU temperature if supported", + "arg": { + "type": "bool", + "optional": true, + "default": false + } + }, + { + "long": "cpu-freq-ndigits", + "desc": "Set the number of digits to keep after the decimal point when printing CPU frequency", + "arg": { + "type": "num", + "default": 2 + } + }, + { + "long": "cpuusage-separate", + "desc": "Display CPU usage per CPU logical core, instead of an average result", + "arg": { + "type": "bool", + "optional": true, + "default": false + } + }, + { + "long": "de-slow-version-detection", + "desc": "Set if DE version should be detected with slow operations", + "remark": "Usually is not necessary. Linux only", + "arg": { + "type": "bool", + "optional": true, + "default": false + } + }, + { + "long": "gpu-temp", + "desc": "Detect and display GPU temperature if supported", + "arg": { + "type": "bool", + "optional": true, + "default": false + } + }, + { + "long": "gpu-use-nvml", + "desc": "Use nvml (NVIDIA Management Library) to detect more detailed GPU information", + "remark": "Detects memory usage, CUDA core count, etc. Requires NVIDIA proprietary driver installed", + "arg": { + "type": "bool", + "optional": true, + "default": false + } + }, + { + "long": "gpu-force-vulkan", + "desc": "Force using vulkan to detect GPUs", + "remark": "Vulkan supports video memory usage detection", + "arg": { + "type": "bool", + "optional": true, + "default": false + } + }, + { + "long": "gpu-hide-type", + "desc": "Specify the type of GPUs should not be printed", + "arg": { + "type": "enum", + "enum": { + "integrated": "Hide integrated GPUs", + "discrete": "Hide discrete GPUs", + "none": "Do not hide any GPUs" + }, + "default": "none" + } + }, + { + "long": "battery-temp", + "desc": "Detect and display Battery temperature if supported", + "arg": { + "type": "bool", + "optional": true, + "default": false + } + }, + { + "long": "localip-show-ipv4", + "desc": "Show IPv4 addresses in local ip module", + "arg": { + "type": "bool", + "optional": true, + "default": true + } + }, + { + "long": "localip-show-ipv6", + "desc": "Show IPv6 addresses in local ip module", + "arg": { + "type": "bool", + "optional": true, + "default": false + } + }, + { + "long": "localip-show-mac", + "desc": "Show mac addresses in local ip module", + "arg": { + "type": "bool", + "optional": true, + "default": false + } + }, + { + "long": "localip-show-loop", + "desc": "Show loop back addresses (127.0.0.1) in local ip module", + "arg": { + "type": "bool", + "optional": true, + "default": false + } + }, + { + "long": "localip-name-prefix", + "desc": "Show interfaces with given interface name prefix only", + "arg": { + "type": "str" + } + }, + { + "long": "localip-default-route-only", + "desc": "Show the interface that is used for default routing only", + "remark": "Doesn't work on Android", + "arg": { + "type": "bool", + "optional": true, + "default": true + } + }, + { + "long": "localip-compact", + "desc": "Show all IPs in one line", + "arg": { + "type": "bool", + "optional": true, + "default": false + } + }, + { + "long": "netio-name-prefix", + "desc": "Show interfaces with given name prefix only", + "arg": { + "type": "str" + } + }, + { + "long": "netio-default-route-only", + "desc": "Show the interfac that is used for default routing only", + "remark": "Doesn't work on Android", + "arg": { + "type": "bool", + "optional": true, + "default": true + } + }, + { + "long": "publicip-timeout", + "desc": "Time in milliseconds to wait for the public ip server to respond", + "remark": "0 to disable timeout", + "arg": { + "type": "num", + "default": 0 + } + }, + { + "long": "publicip-url", + "desc": "The URL of public IP detection server to be used", + "arg": { + "type": "str" + } + }, + { + "long": "weather-location", + "desc": "Set the location to be used", + "remark": "Must be URI encoded (e.g. a whitespace must be encoded as \"+\")", + "arg": { + "type": "str" + } + }, + { + "long": "weather-timeout", + "desc": "Time in milliseconds to wait for the weather server to respond", + "remark": "0 to disable timeout", + "arg": { + "type": "num", + "default": 0 + } + }, + { + "long": "weather-output-format", + "desc": "The output weather format to be used", + "remark": "Must be URI encoded", + "arg": { + "type": "str" + } + }, + { + "long": "wm-detect-plugin", + "desc": "Set if window manager plugin should be detected on supported platforms", + "arg": { + "type": "bool", + "optional": true, + "default": false + } + }, + { + "long": "player-name", + "desc": "The name of the player to use for module Media and Player", + "remark": "Linux only", + "arg": { + "type": "str" + } + }, + { + "long": "opengl-library", + "desc": "Set the OpenGL context creation library to use", + "arg": { + "type": "enum", + "enum": { + "auto": "Auto detection", + "egl": "EGL", + "glx": "GLX", + "osmesa": "OSMesa" + }, + "default": "auto" + } + }, + { + "long": "command-shell", + "desc": "Set the shell program to execute the command text", + "arg": { + "type": "str", + "default": "\"cmd\" for Windows; \"/bin/sh\" for *nix" + } + }, + { + "long": "command-key", + "desc": "Set the module key to display", + "arg": { + "type": "str" + } + }, + { + "long": "command-text", + "desc": "Set the command text to be executed", + "arg": { + "type": "str" + } + }, + { + "long": "colors-symbol", + "desc": "Set the symbol to be printed by Colors module", + "arg": { + "type": "enum", + "enum": { + "block": "███", + "circle": "●", + "diamond": "◆", + "triangle": "▲", + "square": "■", + "star": "★" + }, + "default": "block" + } + }, + { + "long": "colors-padding-left", + "desc": "Set the number of white spaces to print before the symbol", + "arg": { + "type": "num", + "default": 0 + } + } + ], + "General module": [ + { + "long": "-format", + "desc": [ + "Set the format string to use for each specific module", + "To see how a format string works, use \"fastfetch -h format\".", + "To see help about a specific format string, use \"fastfetch -h -format\"" + ], + "arg": { + "type": "format" + }, + "pseudo": true + }, + { + "long": "-key", + "desc": [ + "Set the key to use for each specific module.", + "For modules which print multiple lines, the string is parsed", + "as a format string with the index as first character" + ], + "arg": { + "type": "key" + }, + "pseudo": true + }, + { + "long": "-key-color", + "desc": "Override the global \"--color-keys\" option for each specific module", + "arg": { + "type": "color" + }, + "pseudo": true + }, + { + "long": "-key-width", + "desc": "Override the global \"--key-width\" option for each specific module", + "arg": { + "type": "num" + }, + "pseudo": true + } + ] +} diff --git a/src/data/help.txt b/src/data/help.txt index 7d5d1b9c6..0d478fb1d 100644 --- a/src/data/help.txt +++ b/src/data/help.txt @@ -1,186 +1,4 @@ -Fastfetch is a neofetch-like tool for fetching system information and displaying them in a pretty way - -Usage: fastfetch - -Informative options: - -h, --help: Show this message - -h, --help : Show help for a specific command - -v, --version: Show the version of fastfetch - --list-config-paths: List search paths of config files - --list-data-paths: List search paths of presets and logos - --list-logos: List available logos - --list-modules: List available modules - --list-presets: List presets fastfetch knows about; they can be loaded with --load-config (+) - --list-features: List the supported features fastfetch was compiled with (mainly for development) - --print-logos: Print available logos - --print-config-system: Print the default system config - --print-config-user: Print the default user config - --print-structure: Print the default structure - -Config options: - -c, --load-config : Load a config file or preset (+) - --gen-config : Generate a sample config file in the default path. Param `type` can be `jsonc` or deprecated `conf` - --gen-config-force : Generate a sample config file in the default path. Overwrite the existing one - --migrate-config : Migrate old flag based config file to new JSONC format. Optional param `path` is the file path that new file should be write to - -General options: - --thread : Use separate threads to send HTTP requests - --escape-bedrock : On Bedrock Linux, whether to escape the bedrock jail - --wmi-timeout : Set the timeout (ms) for WMI queries. Windows only. Default is 5000 - --processing-timeout : Set the timeout (ms) when waiting for child processes. Default is 1000 - --ds-force-drm : Set if only DRM should be used to detect displays. Default is false. Linux only - -Logo options: - -l, --logo : Set the logo; if default, the name of a builtin logo or a path to a file - --logo-type : Set the type of the logo given; must be auto, builtin, file, file-raw, data, data-raw, sixel, kitty, iterm or chafa - --logo-width : Set the width of the logo (in characters), if it is an image. Required for iTerm image protocol - --logo-height : Set the height of the logo (in characters), if it is an image. Required for iTerm image protocol - --logo-preserve-aspect-ratio : Set if the logo should fill the specified width and height as much as possible without stretching. Supported by iTerm image protocol - --logo-color-[1-9] : Overwrite a color in the logo - --logo-padding : Set the padding on the left and the right of the logo - --logo-padding-left : Set the padding on the left of the logo - --logo-padding-right : Set the padding on the right of the logo - --logo-padding-top : Set the padding on the top of the logo - --logo-print-remaining : Whether to print the remaining logo, if it has more lines than modules to display - --logo-separate : If true, print modules at bottom of the logo - --logo-recache : If true, regenerate image logo cache - --file : Short for --logo-type file --logo - --file-raw : Short for --logo-type file-raw --logo - --data : Short for --logo-type data --logo - --data-raw : Short for --logo-type data-raw --logo - --sixel : Short for --logo-type sixel --logo - --kitty : Short for --logo-type kitty --logo - --iterm : Short for --logo-type iterm --logo - --chafa : Short for --logo-type chafa --logo - --chafa-fg-only : Produce character-cell output using foreground colors only. See chafa document for detail - --chafa-symbols : Specify character symbols to employ in final output. See chafa document for detail - --chafa-canvas-mode : Determine how colors are used in the output. This value maps the int value of enum ChafaCanvasMode. See chafa document for detail - --chafa-color-space : Set color space used for quantization. 0 for RGB; 1 for DIN99d. See chafa document for detail - --chafa-dither-mode : Set output dither mode (No effect with 24-bit color). This value maps the int value of enum ChafaDitherMode. See chafa document for detail - -Display options: - -s,--structure : Set the structure of the fetch. Must be a colon separated list of keys. Use `fastfetch --list-modules` to see the ones available. - --stat : Show time usage (in ms) for individual modules - --pipe : Disable logo and all escape sequences - --color-keys : Set the color of the keys - --color-title : Set the color of the title - --color : Set the color of both the keys and title - --key-width : Align the width of keys to characters - --bright-color : Set if the keys, title and ASCII logo should be printed in bright color. Default is true - --separator : Set the separator between key and value. Default is a colon with a space - --set : Hard set the value of a key - --set-keyless : Hard set the value of a key, but don't print the key or the separator - --show-errors : Print occurring errors - --disable-linewrap : Whether to disable line wrap during the run - --hide-cursor : Whether to hide the cursor during the run - --binary-prefix : Set the binary prefix to used. Must be IEC, SI or JEDEC. Default is IEC - --percent-type : Set the percentage output type. 1 for percentage number, 2 for bar, 3 for both, 6 for bar only, 9 for colored number. Default is 9 - --percent-ndigits : Set the number of digits to keep after the decimal point when formatting percentage numbers. Default is 0 - --bar-char-elapsed : Set the character to use in elapsed part. Default is '■' - --bar-char-total : Set the character to use in total part. Default is '-' - --bar-width : Set the width of the bar, in number of characters. Default is 10 - --bar-border : Whether to show a border around the bar. Default is true - --no-buffer : Set if the stdout application buffer should be disabled. Default is false - --size-ndigits : Set the number of digits to keep after the decimal point when formatting sizes - --size-max-prefix : Set the largest binary prefix to use when formatting sizes. Default is YB - --temperature-unit : Set the unit of the temperature. Must be one of C, F and K. Default is C - -General module options: - ---format : Set the format string to use for each specific module. - To see how a format string works, use `fastfetch --help format`. - To see help about a specific format string, use `fastfetch --help -format`. - - ---key : Set the key to use for each specific module. - For modules which print multiple lines, the string is parsed as a format string with the index as first character. - - ---key-color : Override the global `--color-keys` option for each specific module. - ---key-width : Override the global `--key-width` option for each specific module. - -Library options: Set the path of a library to load - --lib-PCI : GPU output - --lib-vulkan : Vulkan module & fallback for GPU output - --lib-wayland : Better display performance and output in wayland sessions - --lib-xcb-randr : X11 sessions for better display detection and faster WM detection - --lib-xcb : X11 sessions for better display detection and faster WM detection - --lib-Xrandr : X11 sessions for better display detection and faster WM detection - --lib-X11 : X11 sessions for better display detection and faster WM detection - --lib-gio : Needed for values that are only stored GSettings - --lib-DConf : Needed for values that are only stored in DConf + Fallback for GSettings - --lib-DBus : Bluetooth, Player & Media detection - --lib-XFConf : Needed for XFWM theme and XFCE Terminal font - --lib-sqlite3 : Needed for pkg & rpm package count - --lib-rpm : Slower fallback for rpm package count - --lib-imagemagick : Images in terminal using sixel or kitty graphics protocol - --lib-z : Libz. Faster image output when using kitty graphics protocol - --lib-chafa : Image output as ascii art - --lib-egl : Needed by the OpenGL module for gl context creation - --lib-glx : Needed by the OpenGL module for gl context creation - --lib-osmesa : Needed by the OpenGL module for gl context creation - --lib-opencl : OpenCL module - --lib-pulse : Pulseaudio. Used for Sound detection - --lib-nm: NetworkManager. Used for Wifi detection - --lib-freetype : Used for Termux font detection - --lib-ddcutil : Used for brightness detection of external displays - -Module specific options: - --title-fqdn : Set if the title should use fully qualified domain name. Default is false - --title-color-user : Set color of the user name (left part). Default is empty (use color of `--color-title`). - --title-color-at : Set color of the @ symbol (middle part). Default is empty (use color of `--color-title`) - --title-color-host : Set color of the host name (right part). Default is empty (use color of `--color-title`) - --chassis-use-wmi : Set if WMI query should be used on Windows, which detects more information but slower. Default is false - --separator-string : Set the string printed by the separator module - --os-file : Set the path to the file containing OS information. Linux only - --disk-folders : A colon (semicolon on Windows) separated list of folder paths for the disk output. Default is "/:/home" ("C:\\;D:\\ ..." on Windows) - --disk-show-regular : Set if regular volume should be printed. Default is true - --disk-show-external : Set if external volume should be printed. Default is true - --disk-show-hidden : Set if hidden volumes should be printed. Default is false - --disk-show-subvolumes : Set if subvolumes should be printed. Default is false - --disk-show-readonly : Set if read only volumes should be printed. Default is false - --disk-show-unknown : Set if unknown (unable to detect sizes) volumes should be printed. Default is false - --disk-use-available : Use f_bavail (lpFreeBytesAvailableToCaller for Windows) instead of f_bfree to calculate used bytes. Default is false - --diskio-name-prefix : Show disks with given name prefix only. Default is empty - --bluetooth-show-disconnected : Set if disconnected bluetooth devices should be printed. Default is false - --packages-winget : Set if winget package count should be detected. Default is false - --display-compact-type : Set if all displays should be printed in one line. Default is none - --display-detect-name : Set if display name should be detected and printed (if supported). Default is false - --display-precise-refresh-rate : Set if decimal refresh rates should not be rounded into integers when printing. Default is true - --brightness-ddcci-sleep : Set the sleep times (in ms) when sending DDC/CI requests. See for detail. Default is 10 - --sound-type : Set what type of sound devices should be printed. Should be either main, active or all. Default is main - --battery-dir : The directory where the battery folders are. Standard: `/sys/class/power_supply/`. Linux only - --battery-use-setup-api : Set if `SetupAPI` should be used on Windows to detect battery info, which supports multi batteries, but slower. Windows only - --cpu-temp : Detect and display CPU temperature if supported. Default is false - --cpu-freq-ndigits : Set the number of digits to keep after the decimal point when printing CPU frequency. Default is 2 - --cpuusage-separate : Display CPU usage per CPU logical core, instead of an average result. Default is false - --de-slow-version-detection : Set if DE version should be detected with slow operations. Default is false - --gpu-temp : Detect and display GPU temperature if supported. Default is false - --gpu-use-nvml : Use nvml (NVIDIA Management Library) to detect more detailed GPU information (memory usage, CUDA core count, etc). Default is false - --gpu-force-vulkan : Force using vulkan to detect GPUs, which support video memory usage detection with `--allow-slow-operations`. Default is false - --gpu-hide-type : Specify the type of GPUs should not be printed. Must be `integrated`, `discrete` or `none`. Default is none - --battery-temp : Detect and display Battery temperature if supported. Default is false - --localip-show-ipv4 : Show IPv4 addresses in local ip module. Default is true - --localip-show-ipv6 : Show IPv6 addresses in local ip module. Default is false - --localip-show-mac : Show mac addresses in local ip module. Default is false - --localip-show-loop : Show loop back addresses (127.0.0.1) in local ip module. Default is false - --localip-name-prefix : Show interfaces with given interface name prefix only. Default is empty - --localip-default-route-only : Show the interface that is used for default routing only. Default is true on non-android platforms - --localip-compact : Show all IPs in one line. Default is false - --netio-name-prefix : Show interfaces with given name prefix only. Default is empty - --netio-default-route-only : Show the interfac that is used for default routing only. Default is true on non-android platforms - --publicip-timeout : Time in milliseconds to wait for the public ip server to respond. Default is disabled (0) - --publicip-url : The URL of public IP detection server to be used. - --weather-location : Set the location to be used. It must be URI encoded (eg a whitespace must be encoded as `+`). - --weather-timeout : Time in milliseconds to wait for the weather server to respond. Default is disabled (0) - --weather-output-format : The output weather format to be used. It must be URI encoded. - --wm-detect-plugin : Set if window manager plugin should be detected on supported platforms. Default is false - --player-name : The name of the player to use for module Media and Player. Linux only - --opengl-library : Set the OpenGL context creation library to use. Must be auto, egl, glx or osmesa. Default is auto - --command-shell : Set the shell program to execute the command text. Default is cmd for Windows, /bin/sh for *nix - --command-key : Set the module key to display - --command-text : Set the command text to be executed - --colors-symbol : Set the symbol to be printed by Colors module. Default is block - --colors-padding-left : Set the number of white spaces to print before the symbol. Default is 0 - Parsing is not case sensitive. E.g. "--lib-PCI" is equal to "--Lib-Pci" -If a value starts with a ?, it is optional. "true" will be used if not set. -A (+) at the end indicates that more help can be printed with --help