mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
Compare commits
129 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 293576f6d6 | |||
| 0bc725c5f6 | |||
| c1c735001c | |||
| e350cce99e | |||
| 1c24cb3ebb | |||
| 0662af17f4 | |||
| 9fee532cb6 | |||
| 57f88d2167 | |||
| ed879ee53c | |||
| 6eae425679 | |||
| 182c90b22c | |||
| 2c2e0582a9 | |||
| 4216d40696 | |||
| af6f395ba3 | |||
| 3fda6e425a | |||
| 82581aa9e4 | |||
| 6bd515fed4 | |||
| 20970c6b71 | |||
| 532007267c | |||
| 87a4758497 | |||
| 6a9cce62ab | |||
| 2816ea3797 | |||
| 5144081971 | |||
| ccfe961a1f | |||
| 97211df285 | |||
| 4868517d53 | |||
| 2979bfe4ca | |||
| 42fd1a9cd7 | |||
| 36298b8e93 | |||
| 7168cc2ef2 | |||
| c398dc6c07 | |||
| 390801aee7 | |||
| e3f5563f8d | |||
| 4a54b20c68 | |||
| ea3d904bfe | |||
| 67f4b991d7 | |||
| 53922779ba | |||
| 1431cdcc83 | |||
| 968a43cb29 | |||
| 0c522bdc10 | |||
| 5db3c903e5 | |||
| 91c23c533a | |||
| 00721630ce | |||
| 167b130011 | |||
| aca502e9a0 | |||
| 36f18d0961 | |||
| e67a6856ce | |||
| 3a0b132001 | |||
| f63f31db0a | |||
| 96d60184d5 | |||
| 919bd8231e | |||
| 41fed1da5f | |||
| a846780382 | |||
| c10d7a8233 | |||
| cdcc976cd3 | |||
| b52e812c2c | |||
| aa45945b57 | |||
| eea6e81276 | |||
| 0bac93093b | |||
| 7bcb015a06 | |||
| 02bdcd355c | |||
| fa90e01bc5 | |||
| 1dec514129 | |||
| f81d09bddc | |||
| 03916b6a1d | |||
| 5338583c48 | |||
| 6c492882a3 | |||
| 98c7c7ed4f | |||
| a7a96a8954 | |||
| 1a5044add9 | |||
| 7befd71069 | |||
| 3d44a1befe | |||
| 57e734e628 | |||
| 3eadd332bb | |||
| 825db4fead | |||
| ad5be0f0c2 | |||
| 6d22a76946 | |||
| 40e977be31 | |||
| 29d93d5c67 | |||
| 9b2c59936f | |||
| bb02ba0b2e | |||
| 0987f68409 | |||
| 647403fc30 | |||
| 854a7cfeba | |||
| f78f6ceb54 | |||
| 975081aa27 | |||
| b0d3e7ef9e | |||
| 6fe0eb5677 | |||
| 42c03b2383 | |||
| b1319b34e7 | |||
| 5162b4fdec | |||
| 42f647378a | |||
| 97b3938dd5 | |||
| 2e46b5932e | |||
| 4510ef7e1c | |||
| 36bf978dc1 | |||
| 7f999dfaaf | |||
| 6f6a68f7e5 | |||
| 960bbfef59 | |||
| cabd5899f7 | |||
| 730c0d1c92 | |||
| ce6041938a | |||
| 998193b014 | |||
| f8ba138b8d | |||
| 3f9462d7c8 | |||
| 413984963e | |||
| 5aab0e2dd9 | |||
| 1ba5e6e8f7 | |||
| 2a53b012ea | |||
| 5d44efbf62 | |||
| 6ad83af2b5 | |||
| fceb19affe | |||
| ee7d3d471e | |||
| 8e9c571293 | |||
| a44b8264af | |||
| 84a5a4033e | |||
| f2fc92dbf7 | |||
| 2af338f425 | |||
| 41aaaa3429 | |||
| f9597eba39 | |||
| b4cd47cbc4 | |||
| 22de71efeb | |||
| ac654ff346 | |||
| df2fdf05e6 | |||
| 788307e98d | |||
| f93341ac61 | |||
| 3e0d97db2e | |||
| 864e707224 | |||
| c42b68404f |
@@ -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
|
||||||
+32
-17
@@ -5,6 +5,20 @@ on:
|
|||||||
- pull_request
|
- pull_request
|
||||||
|
|
||||||
jobs:
|
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:
|
linux-buildtest:
|
||||||
name: Linux build test
|
name: Linux build test
|
||||||
permissions:
|
permissions:
|
||||||
@@ -32,13 +46,13 @@ jobs:
|
|||||||
run: uname -a
|
run: uname -a
|
||||||
|
|
||||||
- name: install required packages
|
- 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
|
- name: configure project
|
||||||
env:
|
env:
|
||||||
CC: ${{ matrix.compiler.cc }}
|
CC: ${{ matrix.compiler.cc }}
|
||||||
CXX: ${{ matrix.compiler.cxx }}
|
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
|
- name: build project
|
||||||
run: cmake --build .
|
run: cmake --build .
|
||||||
@@ -50,10 +64,10 @@ jobs:
|
|||||||
run: ./fastfetch --list-features
|
run: ./fastfetch --list-features
|
||||||
|
|
||||||
- name: run fastfetch
|
- name: run fastfetch
|
||||||
run: time ./fastfetch -c presets/ci
|
run: time ./fastfetch -c presets/ci.jsonc
|
||||||
|
|
||||||
- name: run fastfetch --format json
|
- 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
|
- name: run flashfetch
|
||||||
run: time ./flashfetch
|
run: time ./flashfetch
|
||||||
@@ -74,12 +88,12 @@ jobs:
|
|||||||
run: uname -a
|
run: uname -a
|
||||||
|
|
||||||
- name: install required packages
|
- 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
|
- name: install linuxbrew packages
|
||||||
run: |
|
run: |
|
||||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
/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
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v2
|
uses: github/codeql-action/init@v2
|
||||||
@@ -99,10 +113,10 @@ jobs:
|
|||||||
run: ./fastfetch --list-features
|
run: ./fastfetch --list-features
|
||||||
|
|
||||||
- name: run fastfetch
|
- name: run fastfetch
|
||||||
run: time ./fastfetch -c presets/ci
|
run: time ./fastfetch -c presets/ci.jsonc
|
||||||
|
|
||||||
- name: run fastfetch --format json
|
- 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
|
- name: run flashfetch
|
||||||
run: time ./flashfetch
|
run: time ./flashfetch
|
||||||
@@ -138,6 +152,7 @@ jobs:
|
|||||||
|
|
||||||
- name: install required packages
|
- name: install required packages
|
||||||
run: |
|
run: |
|
||||||
|
brew uninstall aws-sam-cli azure-cli qemu lima colima gradle kotlin maven pipx aria2 || true
|
||||||
brew update
|
brew update
|
||||||
brew install vulkan-loader vulkan-headers molten-vk imagemagick chafa
|
brew install vulkan-loader vulkan-headers molten-vk imagemagick chafa
|
||||||
|
|
||||||
@@ -159,10 +174,10 @@ jobs:
|
|||||||
run: ./fastfetch --list-features
|
run: ./fastfetch --list-features
|
||||||
|
|
||||||
- name: run fastfetch
|
- name: run fastfetch
|
||||||
run: time ./fastfetch -c presets/ci
|
run: time ./fastfetch -c presets/ci.jsonc
|
||||||
|
|
||||||
- name: run fastfetch --format json
|
- 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
|
- name: run flashfetch
|
||||||
run: time ./flashfetch
|
run: time ./flashfetch
|
||||||
@@ -197,12 +212,12 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
uname -a
|
uname -a
|
||||||
sudo pkg update
|
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 -DSET_TWEAK=Off -DBUILD_TESTS=On .
|
||||||
cmake --build . --target package --verbose
|
cmake --build . --target package --verbose
|
||||||
./fastfetch --list-features
|
./fastfetch --list-features
|
||||||
time ./fastfetch -c presets/ci
|
time ./fastfetch -c presets/ci.jsonc
|
||||||
time ./fastfetch -c presets/ci --format json
|
time ./fastfetch -c presets/ci.jsonc --format json
|
||||||
time ./flashfetch
|
time ./flashfetch
|
||||||
ldd fastfetch
|
ldd fastfetch
|
||||||
ctest
|
ctest
|
||||||
@@ -249,10 +264,10 @@ jobs:
|
|||||||
run: ./fastfetch --list-features
|
run: ./fastfetch --list-features
|
||||||
|
|
||||||
- name: run fastfetch
|
- name: run fastfetch
|
||||||
run: time ./fastfetch -c presets/ci
|
run: time ./fastfetch -c presets/ci.jsonc
|
||||||
|
|
||||||
- name: run fastfetch --format json
|
- 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
|
- name: run flashfetch
|
||||||
run: time ./flashfetch
|
run: time ./flashfetch
|
||||||
@@ -316,10 +331,10 @@ jobs:
|
|||||||
run: cp /clang32/bin/{OpenCL,vulkan-1}.dll .
|
run: cp /clang32/bin/{OpenCL,vulkan-1}.dll .
|
||||||
|
|
||||||
- name: run fastfetch
|
- name: run fastfetch
|
||||||
run: time ./fastfetch -c presets/ci
|
run: time ./fastfetch -c presets/ci.jsonc
|
||||||
|
|
||||||
- name: run fastfetch --format json
|
- 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
|
- name: run flashfetch
|
||||||
run: time ./flashfetch
|
run: time ./flashfetch
|
||||||
|
|||||||
+66
-14
@@ -1,3 +1,55 @@
|
|||||||
|
# 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:
|
||||||
|
* Update the latest mac models (Host, macOS)
|
||||||
|
|
||||||
|
Bugfixes:
|
||||||
|
* Fix local ips detection on Android. Regression from `2.0.0` (LocalIP, Android)
|
||||||
|
* Fix terminal detection on NixOS (Terminal)
|
||||||
|
|
||||||
# 2.2.2
|
# 2.2.2
|
||||||
|
|
||||||
Changes:
|
Changes:
|
||||||
@@ -10,11 +62,11 @@ Features:
|
|||||||
* Improve detection of `Battery`
|
* Improve detection of `Battery`
|
||||||
* Detect cycle count on supported platforms
|
* Detect cycle count on supported platforms
|
||||||
* Detect temperature on Linux when supported
|
* 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
|
* Linux binaries are built with imagemagick7 support
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
* Fix unitialized variables (#609)
|
* Fix uninitialized variables (#609)
|
||||||
* Fix spelling of `--preserve-aspect-ratio` (#614)
|
* Fix spelling of `--preserve-aspect-ratio` (#614)
|
||||||
|
|
||||||
Logos:
|
Logos:
|
||||||
@@ -40,7 +92,7 @@ Changes:
|
|||||||
* Display keys `percent*` and `size*` in JSON config are restructured. e.g. `{ "sizeNdigits": 1 }` is now `{ "size": { "ndigits": 1 } }`
|
* 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)
|
* 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)
|
* 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.
|
* `--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`.
|
* `--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.
|
* `--battery-use-setup-api`: control whether `SetupAPI` should be used on Windows to detect battery info, which supports multi batteries, but slower.
|
||||||
@@ -113,9 +165,9 @@ This release introduces a new output format: JSON result
|
|||||||
|
|
||||||
Changes:
|
Changes:
|
||||||
* Users module detects and prints user login time by default. Specifying `--users-compact` to disable it
|
* 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`
|
* 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.
|
* Custom strings in `--module-key` and `--module-format` are no longer trimmed.
|
||||||
* `/boot` is hidden by default (FreeBSD, Disk)
|
* `/boot` is hidden by default (FreeBSD, Disk)
|
||||||
|
|
||||||
@@ -195,7 +247,7 @@ Features:
|
|||||||
# 2.0.2
|
# 2.0.2
|
||||||
|
|
||||||
Bugfixes:
|
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)
|
* Fix presets not detected by file name (#529)
|
||||||
|
|
||||||
Logo:
|
Logo:
|
||||||
@@ -207,7 +259,7 @@ First stable release of Fastfetch V2
|
|||||||
|
|
||||||
Changes:
|
Changes:
|
||||||
* Unescape strings only when parsing `.conf` files
|
* 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 `\\: *`
|
* 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`
|
* 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`).
|
* Rename `--recache` to `--logo-recache` (which is used for regenerate image logo cache). Remove option shortcut `-r` (alias of `--recache`).
|
||||||
@@ -263,7 +315,7 @@ Features:
|
|||||||
* Better CPU and Host detection for Android (Android)
|
* Better CPU and Host detection for Android (Android)
|
||||||
* Support yakuake terminal version & font detection (Terminal, Linux)
|
* 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 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`.
|
* Support path with environment variables for `--logo-source` and `--load-config`.
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
@@ -351,7 +403,7 @@ Bugfixes:
|
|||||||
* Fix Windows drives detection in WSL (Disk)
|
* Fix Windows drives detection in WSL (Disk)
|
||||||
|
|
||||||
Changes:
|
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.
|
* `--theme-format` no longer supports individual GTK / plasma theme params.
|
||||||
* `--local-ip-*` and `--public-ip-*` have been changed to `--localip-*` and `--publicip-*`
|
* `--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`
|
* `--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`
|
||||||
@@ -374,7 +426,7 @@ Bugfixes:
|
|||||||
* Fix iTerm being detected as iTermServer-* sometimes
|
* Fix iTerm being detected as iTermServer-* sometimes
|
||||||
* Fix sound device volume being incorrectly detected as muted sometimes (Sound)
|
* Fix sound device volume being incorrectly detected as muted sometimes (Sound)
|
||||||
* Fix memleaks reported by LeakSanitizer (Linux)
|
* 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:
|
Logo:
|
||||||
* Update Windows 11 ASCII logo to look more visually consistent (#445)
|
* Update Windows 11 ASCII logo to look more visually consistent (#445)
|
||||||
@@ -410,7 +462,7 @@ Bugfixes:
|
|||||||
* Fix compiling errors (Windows)
|
* Fix compiling errors (Windows)
|
||||||
|
|
||||||
Improvements:
|
Improvements:
|
||||||
* Improve preformance (WmTheme amd Font, Windows and macOS)
|
* Improve performance (WmTheme amd Font, Windows and macOS)
|
||||||
* Enable nonblocking public-ip / weather detection (Android)
|
* Enable nonblocking public-ip / weather detection (Android)
|
||||||
|
|
||||||
# 1.10.2
|
# 1.10.2
|
||||||
@@ -455,7 +507,7 @@ Other:
|
|||||||
|
|
||||||
* Simplified wmtheme output format (Windows)
|
* Simplified wmtheme output format (Windows)
|
||||||
* Improved GPU detection performance on Windows 11
|
* Improved GPU detection performance on Windows 11
|
||||||
* Lastest Mac model identifier support (macOS)
|
* Latest Mac model identifier support (macOS)
|
||||||
|
|
||||||
# 1.9.1
|
# 1.9.1
|
||||||
|
|
||||||
@@ -537,7 +589,7 @@ Bugfixes:
|
|||||||
This release introduces Windows support! Fastfetch now fully support all major desktop OSes (Linux, macOS, Windows and FreeBSD)
|
This release introduces Windows support! Fastfetch now fully support all major desktop OSes (Linux, macOS, Windows and FreeBSD)
|
||||||
|
|
||||||
Notable Changes:
|
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
|
* Caching is removed. Option `--nocache` is removed accordingly
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
@@ -546,7 +598,7 @@ Features:
|
|||||||
* Adds a new flag `--stat`, which prints time usage for individual modules
|
* Adds a new flag `--stat`, which prints time usage for individual modules
|
||||||
* Adds Wifi module which supports Windows and macOS
|
* Adds Wifi module which supports Windows and macOS
|
||||||
* Adds data source option for logo printing
|
* Adds data source option for logo printing
|
||||||
* Detects Homebrew Cellar and Cask seperately
|
* Detects Homebrew Cellar and Cask separately
|
||||||
* Detects WSL version
|
* Detects WSL version
|
||||||
* Detects disk based on mount point
|
* Detects disk based on mount point
|
||||||
* Exposes more chafa configs
|
* Exposes more chafa configs
|
||||||
|
|||||||
+42
-26
@@ -1,7 +1,7 @@
|
|||||||
cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url
|
cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url
|
||||||
|
|
||||||
project(fastfetch
|
project(fastfetch
|
||||||
VERSION 2.2.2
|
VERSION 2.3.0
|
||||||
LANGUAGES C
|
LANGUAGES C
|
||||||
DESCRIPTION "Fast neofetch-like system information tool"
|
DESCRIPTION "Fast neofetch-like system information tool"
|
||||||
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
|
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_XCB "Enable xcb" ON "LINUX OR BSD" OFF)
|
||||||
cmake_dependent_option(ENABLE_XRANDR "Enable xrandr" 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_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_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_DCONF "Enable dconf" ON "LINUX OR BSD" OFF)
|
||||||
cmake_dependent_option(ENABLE_DBUS "Enable dbus-1" 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_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)
|
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(ENABLE_ASAN "Build fastfetch with ASAN (address sanitizer)" OFF)
|
||||||
option(BUILD_TESTS "Build tests" OFF) # Also create test executables
|
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
|
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 #
|
# Text data #
|
||||||
#############
|
#############
|
||||||
|
|
||||||
function(fastfetch_load_text FILENAME OUTVAR)
|
function(fastfetch_encode_c_string STR OUTVAR)
|
||||||
file(READ "${FILENAME}" TEMP)
|
string(REGEX REPLACE "\n$" "" TEMP "${STR}") # Remove trailing newline
|
||||||
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 "\n" "\\n" TEMP "${TEMP}") # Replace newlines with \n
|
||||||
string(REPLACE "\"" "\\\"" TEMP "${TEMP}") # Replace quotes with \"
|
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)
|
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/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.txt DATATEXT_HELP)
|
||||||
fastfetch_load_text(src/data/help_color.txt DATATEXT_HELP_COLOR)
|
fastfetch_load_text(src/data/help_color.txt DATATEXT_HELP_COLOR)
|
||||||
fastfetch_load_text(src/data/help_format.txt DATATEXT_HELP_FORMAT)
|
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)
|
configure_file(src/util/apple/Info.plist.in Info.plist @ONLY)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
string(TIMESTAMP FASTFETCH_BUILD_DATE "%d %B %Y")
|
||||||
|
configure_file(doc/fastfetch.1.in fastfetch.1 @ONLY)
|
||||||
|
|
||||||
####################
|
####################
|
||||||
# Ascii image data #
|
# 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")
|
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})
|
foreach(file ${LOGO_FILES})
|
||||||
fastfetch_load_raw_text("${file}" content)
|
fastfetch_load_text("${file}" content)
|
||||||
get_filename_component(file "${file}" NAME_WLE)
|
get_filename_component(file "${file}" NAME_WLE)
|
||||||
string(TOUPPER "${file}" file)
|
string(TOUPPER "${file}" file)
|
||||||
string(REGEX REPLACE "\\$\\{c([0-9]+)\\}" "$\\1" content "${content}")
|
string(REGEX REPLACE "\\$\\{c([0-9]+)\\}" "$\\1" content "${content}")
|
||||||
@@ -385,6 +393,7 @@ if(LINUX)
|
|||||||
src/detection/disk/disk_linux.c
|
src/detection/disk/disk_linux.c
|
||||||
src/detection/diskio/diskio_linux.c
|
src/detection/diskio/diskio_linux.c
|
||||||
src/detection/displayserver/linux/displayserver_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/wayland.c
|
||||||
src/detection/displayserver/linux/wmde.c
|
src/detection/displayserver/linux/wmde.c
|
||||||
src/detection/displayserver/linux/xcb.c
|
src/detection/displayserver/linux/xcb.c
|
||||||
@@ -496,6 +505,7 @@ elseif(BSD)
|
|||||||
src/detection/disk/disk_bsd.c
|
src/detection/disk/disk_bsd.c
|
||||||
src/detection/diskio/diskio_bsd.c
|
src/detection/diskio/diskio_bsd.c
|
||||||
src/detection/displayserver/linux/displayserver_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/wayland.c
|
||||||
src/detection/displayserver/linux/wmde.c
|
src/detection/displayserver/linux/wmde.c
|
||||||
src/detection/displayserver/linux/xcb.c
|
src/detection/displayserver/linux/xcb.c
|
||||||
@@ -546,7 +556,7 @@ elseif(APPLE)
|
|||||||
src/detection/battery/battery_apple.c
|
src/detection/battery/battery_apple.c
|
||||||
src/detection/bios/bios_apple.c
|
src/detection/bios/bios_apple.c
|
||||||
src/detection/bluetooth/bluetooth_apple.m
|
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/brightness/brightness_apple.c
|
||||||
src/detection/chassis/chassis_nosupport.c
|
src/detection/chassis/chassis_nosupport.c
|
||||||
src/detection/cpu/cpu_apple.c
|
src/detection/cpu/cpu_apple.c
|
||||||
@@ -779,6 +789,10 @@ ff_lib_enable(X11
|
|||||||
"x11"
|
"x11"
|
||||||
"X11"
|
"X11"
|
||||||
)
|
)
|
||||||
|
ff_lib_enable(DRM
|
||||||
|
"libdrm"
|
||||||
|
"Libdrm"
|
||||||
|
)
|
||||||
ff_lib_enable(GIO
|
ff_lib_enable(GIO
|
||||||
"gio-2.0"
|
"gio-2.0"
|
||||||
"GIO"
|
"GIO"
|
||||||
@@ -893,26 +907,23 @@ elseif(APPLE)
|
|||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
target_compile_definitions(libfastfetch PRIVATE -D_WIN32_WINNT=0x0601)
|
target_compile_definitions(libfastfetch PRIVATE -D_WIN32_WINNT=0x0601)
|
||||||
target_link_libraries(libfastfetch
|
target_link_libraries(libfastfetch
|
||||||
PRIVATE "bthprops"
|
|
||||||
PRIVATE "dwmapi"
|
PRIVATE "dwmapi"
|
||||||
PRIVATE "gdi32"
|
PRIVATE "gdi32"
|
||||||
PRIVATE "iphlpapi"
|
PRIVATE "iphlpapi"
|
||||||
PRIVATE "ole32"
|
PRIVATE "ole32"
|
||||||
PRIVATE "oleaut32"
|
PRIVATE "oleaut32"
|
||||||
PRIVATE "opengl32"
|
|
||||||
PRIVATE "ws2_32"
|
PRIVATE "ws2_32"
|
||||||
PRIVATE "ntdll"
|
PRIVATE "ntdll"
|
||||||
PRIVATE "version"
|
PRIVATE "version"
|
||||||
PRIVATE "setupapi"
|
PRIVATE "setupapi"
|
||||||
PRIVATE "hid"
|
PRIVATE "hid"
|
||||||
PRIVATE "wtsapi32"
|
PRIVATE "wtsapi32"
|
||||||
PRIVATE "dxva2"
|
|
||||||
)
|
)
|
||||||
elseif(BSD)
|
elseif(BSD)
|
||||||
target_link_libraries(libfastfetch
|
target_link_libraries(libfastfetch
|
||||||
PRIVATE "m"
|
PRIVATE "m"
|
||||||
PRIVATE "usbhid"
|
PRIVATE "usbhid"
|
||||||
PRIVATE "devstat"
|
PRIVATE "geom"
|
||||||
)
|
)
|
||||||
elseif(ANDROID)
|
elseif(ANDROID)
|
||||||
CHECK_LIBRARY_EXISTS(-l:libandroid-wordexp.a wordexp "" HAVE_LIBANDROID_WORDEXP_STATIC)
|
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}"
|
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/licenses/${CMAKE_PROJECT_NAME}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
install(
|
||||||
|
FILES "${PROJECT_BINARY_DIR}/fastfetch.1"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_MANDIR}"
|
||||||
|
)
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# package target #
|
# package target #
|
||||||
##################
|
##################
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@ Here i just add things that are easy to forget.
|
|||||||
- [ ] ZSH completions
|
- [ ] ZSH completions
|
||||||
- [ ] Fish completions
|
- [ ] Fish completions
|
||||||
- [ ] Make CPU usage detection much faster and more accurate
|
- [ ] 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
|
- [ ] Per session caching
|
||||||
|
|
||||||
### General
|
### General
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
# Fastfetch
|
# Fastfetch
|
||||||
|
|
||||||

|
[](https://github.com/fastfetch-cli/fastfetch/actions)
|
||||||

|
[](https://github.com/fastfetch-cli/fastfetch/blob/dev/LICENSE)
|
||||||

|
[](https://github.com/fastfetch-cli/fastfetch/graphs/contributors)
|
||||||

|
[](https://github.com/fastfetch-cli/fastfetch/blob/dev/CMakeLists.txt#L5)
|
||||||

|
[](https://github.com/fastfetch-cli/fastfetch/commits)
|
||||||

|
[](https://formulae.brew.sh/formula/fastfetch#default)
|
||||||

|
[](https://github.com/fastfetch-cli/fastfetch/releases)
|
||||||

|
[](https://github.com/fastfetch-cli/fastfetch/releases)
|
||||||
[](https://repology.org/project/fastfetch/versions)
|
[](https://repology.org/project/fastfetch/versions)
|
||||||
[](https://repology.org/project/fastfetch/versions)
|
[](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`
|
* 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 <module> --format json`
|
* Find all data that fastfetch detects: `fastfetch -s <module> --format json`
|
||||||
* Display help messages: `fastfetch --help`
|
* 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
|
## Customization
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ Logos can be heavily customized too; see the [logo documentation](https://github
|
|||||||
## FAQ
|
## FAQ
|
||||||
|
|
||||||
Q: Why do you need a very performant version of neofetch?
|
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?
|
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
|
> 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
|
||||||
|
|||||||
+5
-6
@@ -5,7 +5,7 @@ __fastfetch_complete_help()
|
|||||||
local __ff_helps=(
|
local __ff_helps=(
|
||||||
"color"
|
"color"
|
||||||
"format"
|
"format"
|
||||||
"load-config"
|
"config"
|
||||||
"os-format"
|
"os-format"
|
||||||
"host-format"
|
"host-format"
|
||||||
"kernel-format"
|
"kernel-format"
|
||||||
@@ -66,7 +66,7 @@ __fastfetch_complete_path()
|
|||||||
|
|
||||||
__fastfetch_complete_logo()
|
__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()
|
__fastfetch_complete_logo_type()
|
||||||
@@ -182,7 +182,6 @@ __fastfetch_completion()
|
|||||||
"--cpu-temp"
|
"--cpu-temp"
|
||||||
"--gpu-temp"
|
"--gpu-temp"
|
||||||
"--battery-temp"
|
"--battery-temp"
|
||||||
"--display-detect-name"
|
|
||||||
"--display-precise-refresh-rate"
|
"--display-precise-refresh-rate"
|
||||||
"--localip-show-ipv4"
|
"--localip-show-ipv4"
|
||||||
"--localip-show-ipv6"
|
"--localip-show-ipv6"
|
||||||
@@ -218,10 +217,9 @@ __fastfetch_completion()
|
|||||||
"--logo-color-6"
|
"--logo-color-6"
|
||||||
"--logo-color-7"
|
"--logo-color-7"
|
||||||
"--logo-color-8"
|
"--logo-color-8"
|
||||||
|
"--logo-color-9"
|
||||||
"--logo-width"
|
"--logo-width"
|
||||||
"--logo-height"
|
"--logo-height"
|
||||||
"--logo-color-9"
|
|
||||||
"-c"
|
|
||||||
"--color"
|
"--color"
|
||||||
"--color-keys"
|
"--color-keys"
|
||||||
"--color-title"
|
"--color-title"
|
||||||
@@ -360,7 +358,8 @@ __fastfetch_completion()
|
|||||||
)
|
)
|
||||||
|
|
||||||
local FF_OPTIONS_PATH=(
|
local FF_OPTIONS_PATH=(
|
||||||
"--load-config"
|
"-c"
|
||||||
|
"--config"
|
||||||
"--os-file"
|
"--os-file"
|
||||||
"--lib-pci"
|
"--lib-pci"
|
||||||
"--lib-vulkan"
|
"--lib-vulkan"
|
||||||
|
|||||||
Executable
+106
@@ -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)
|
||||||
|
###>
|
||||||
@@ -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 <logo>
|
||||||
|
Set the logo to display
|
||||||
|
.TP
|
||||||
|
|
||||||
|
.B \-s, \-\-structure \fI <structure>
|
||||||
|
Set the structure of the fetch. For details about the structure,
|
||||||
|
see the CONFIGURATION section.
|
||||||
|
|
||||||
|
|
||||||
|
.SS "Config Options"
|
||||||
|
.TP
|
||||||
|
|
||||||
|
.B \-c, \-\-config \fI <config>
|
||||||
|
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
|
||||||
+10
-6
@@ -470,6 +470,10 @@
|
|||||||
"type": "string",
|
"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)"
|
"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": {
|
"gio": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Needed for values that are only stored GSettings (Linux, FreeBSD)"
|
"description": "Needed for values that are only stored GSettings (Linux, FreeBSD)"
|
||||||
@@ -729,15 +733,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"const": "theme",
|
"const": "theme",
|
||||||
"description": "Print current theme information"
|
"description": "Print current theme of desktop environment"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"const": "uptime",
|
"const": "uptime",
|
||||||
"description": "Print system uptime"
|
"description": "Print how long system has been running"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"const": "users",
|
"const": "users",
|
||||||
"description": "List users currently logged in"
|
"description": "Print users currently logged in"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"const": "version",
|
"const": "version",
|
||||||
@@ -844,7 +848,7 @@
|
|||||||
"properties": {
|
"properties": {
|
||||||
"type": {
|
"type": {
|
||||||
"const": "brightness",
|
"const": "brightness",
|
||||||
"description": "Print current brightness / luminance of your monitors"
|
"description": "Print current brightness level of your monitors"
|
||||||
},
|
},
|
||||||
"ddcciSleep": {
|
"ddcciSleep": {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
@@ -1033,7 +1037,7 @@
|
|||||||
"preciseRefreshRate": {
|
"preciseRefreshRate": {
|
||||||
"description": "Set if decimal refresh rates should not be rounded into integers when printing",
|
"description": "Set if decimal refresh rates should not be rounded into integers when printing",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": true
|
"default": false
|
||||||
},
|
},
|
||||||
"key": {
|
"key": {
|
||||||
"$ref": "#/$defs/key"
|
"$ref": "#/$defs/key"
|
||||||
@@ -1059,7 +1063,7 @@
|
|||||||
},
|
},
|
||||||
"folders": {
|
"folders": {
|
||||||
"type": "string",
|
"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": {
|
"showExternal": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
-c all
|
|
||||||
--pipe
|
|
||||||
--show-errors
|
|
||||||
--no-buffer
|
|
||||||
--publicip-timeout 1000
|
|
||||||
--weather-timeout 1000
|
|
||||||
--stat
|
|
||||||
@@ -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"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_common_bar
|
|
||||||
#define FF_INCLUDED_common_bar
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
|
|
||||||
enum
|
enum
|
||||||
@@ -15,5 +12,3 @@ enum
|
|||||||
|
|
||||||
void ffAppendPercentBar(FFstrbuf* buffer, double percent, uint8_t green, uint8_t yellow, uint8_t red);
|
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);
|
void ffAppendPercentNum(FFstrbuf* buffer, double percent, uint8_t green, uint8_t yellow, bool parentheses);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_common_commandoption
|
|
||||||
#define FF_INCLUDED_common_commandoption
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
|
|
||||||
typedef struct FFCustomValue
|
typedef struct FFCustomValue
|
||||||
@@ -17,12 +14,10 @@ typedef struct FFdata
|
|||||||
{
|
{
|
||||||
FFstrbuf structure;
|
FFstrbuf structure;
|
||||||
FFlist customValues; // List of FFCustomValue
|
FFlist customValues; // List of FFCustomValue
|
||||||
bool loadUserConfig;
|
bool configLoaded;
|
||||||
} FFdata;
|
} FFdata;
|
||||||
|
|
||||||
bool ffParseModuleOptions(const char* key, const char* value);
|
bool ffParseModuleOptions(const char* key, const char* value);
|
||||||
void ffPrepareCommandOption(FFdata* data);
|
void ffPrepareCommandOption(FFdata* data);
|
||||||
void ffPrintCommandOption(FFdata* data, yyjson_mut_doc* jsonDoc);
|
void ffPrintCommandOption(FFdata* data, yyjson_mut_doc* jsonDoc);
|
||||||
void ffMigrateCommandOptionToJsonc(FFdata* data, yyjson_mut_doc* jsonDoc);
|
void ffMigrateCommandOptionToJsonc(FFdata* data, yyjson_mut_doc* jsonDoc);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_common_dbus
|
|
||||||
#define FF_INCLUDED_common_dbus
|
|
||||||
|
|
||||||
#ifdef FF_HAVE_DBUS
|
#ifdef FF_HAVE_DBUS
|
||||||
#include <dbus/dbus.h>
|
#include <dbus/dbus.h>
|
||||||
|
|
||||||
@@ -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);
|
void ffDBusGetPropertyString(FFDBusData* dbus, const char* busName, const char* objectPath, const char* interface, const char* property, FFstrbuf* result);
|
||||||
|
|
||||||
#endif // FF_HAVE_DBUS
|
#endif // FF_HAVE_DBUS
|
||||||
#endif // FF_INCLUDED_common_dbus
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_common_font
|
|
||||||
#define FF_INCLUDED_common_font
|
|
||||||
|
|
||||||
#include "util/FFstrbuf.h"
|
#include "util/FFstrbuf.h"
|
||||||
#include "util/FFlist.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 ffFontInitValues(FFfont* font, const char* name, const char* size);
|
||||||
void ffFontInitWithSpace(FFfont* font, const char* rawName);
|
void ffFontInitWithSpace(FFfont* font, const char* rawName);
|
||||||
void ffFontDestroy(FFfont* font);
|
void ffFontDestroy(FFfont* font);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
+2
-2
@@ -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
|
// 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;
|
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
|
// 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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_common_format
|
|
||||||
#define FF_INCLUDED_common_format
|
|
||||||
|
|
||||||
typedef enum FFformatargtype
|
typedef enum FFformatargtype
|
||||||
{
|
{
|
||||||
FF_FORMAT_ARG_TYPE_NULL = 0,
|
FF_FORMAT_ARG_TYPE_NULL = 0,
|
||||||
@@ -27,5 +24,3 @@ typedef struct FFformatarg
|
|||||||
|
|
||||||
void ffFormatAppendFormatArg(FFstrbuf* buffer, const FFformatarg* formatarg);
|
void ffFormatAppendFormatArg(FFstrbuf* buffer, const FFformatarg* formatarg);
|
||||||
void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t numArgs, const FFformatarg* arguments);
|
void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t numArgs, const FFformatarg* arguments);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
+4
-1
@@ -144,7 +144,7 @@ static void destroyState(void)
|
|||||||
ffPlatformDestroy(&instance.state.platform);
|
ffPlatformDestroy(&instance.state.platform);
|
||||||
yyjson_doc_free(instance.state.configDoc);
|
yyjson_doc_free(instance.state.configDoc);
|
||||||
yyjson_mut_doc_free(instance.state.resultDoc);
|
yyjson_mut_doc_free(instance.state.resultDoc);
|
||||||
ffStrbufDestroy(&instance.state.migrateConfigPath);
|
ffStrbufDestroy(&instance.state.genConfigPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffDestroyInstance(void)
|
void ffDestroyInstance(void)
|
||||||
@@ -181,6 +181,9 @@ void ffListFeatures(void)
|
|||||||
#ifdef FF_HAVE_X11
|
#ifdef FF_HAVE_X11
|
||||||
"x11\n"
|
"x11\n"
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef FF_HAVE_DRM
|
||||||
|
"drm\n"
|
||||||
|
#endif
|
||||||
#ifdef FF_HAVE_GIO
|
#ifdef FF_HAVE_GIO
|
||||||
"gio\n"
|
"gio\n"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+8
-9
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_common_io_io
|
|
||||||
#define FF_INCLUDED_common_io_io
|
|
||||||
|
|
||||||
#include "util/FFstrbuf.h"
|
#include "util/FFstrbuf.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@@ -14,6 +11,10 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
typedef int FFNativeFD;
|
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
|
#endif
|
||||||
|
|
||||||
static inline FFNativeFD FFUnixFD2NativeFD(int unixfd)
|
static inline FFNativeFD FFUnixFD2NativeFD(int unixfd)
|
||||||
@@ -52,11 +53,11 @@ static inline ssize_t ffReadFDData(FFNativeFD fd, size_t dataSize, void* data)
|
|||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
return read(fd, data, dataSize);
|
return read(fd, data, dataSize);
|
||||||
#else
|
#else
|
||||||
DWORD readed;
|
DWORD bytesRead;
|
||||||
if(!ReadFile(fd, data, (DWORD)dataSize, &readed, NULL))
|
if(!ReadFile(fd, data, (DWORD)dataSize, &bytesRead, NULL))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return (ssize_t)readed;
|
return (ssize_t)bytesRead;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +103,7 @@ static inline void ffUnsuppressIO(bool* suppressed)
|
|||||||
|
|
||||||
#define FF_SUPPRESS_IO() bool __attribute__((__cleanup__(ffUnsuppressIO), __unused__)) io_suppressed__ = ffSuppressIO(true)
|
#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)
|
static inline bool wrapClose(FFNativeFD* pfd)
|
||||||
{
|
{
|
||||||
@@ -153,5 +154,3 @@ static inline bool wrapClosedir(HANDLE* pdir)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#define FF_AUTO_CLOSE_DIR __attribute__((__cleanup__(wrapClosedir)))
|
#define FF_AUTO_CLOSE_DIR __attribute__((__cleanup__(wrapClosedir)))
|
||||||
|
|
||||||
#endif // FF_INCLUDED_common_io_io
|
|
||||||
|
|||||||
+51
-25
@@ -16,18 +16,18 @@ static void createSubfolders(const char* fileName)
|
|||||||
{
|
{
|
||||||
FF_STRBUF_AUTO_DESTROY path = ffStrbufCreate();
|
FF_STRBUF_AUTO_DESTROY path = ffStrbufCreate();
|
||||||
|
|
||||||
while(*fileName != '\0')
|
char *token = NULL;
|
||||||
|
while((token = strchr(fileName, '/')) != NULL)
|
||||||
{
|
{
|
||||||
ffStrbufAppendC(&path, *fileName);
|
ffStrbufAppendNS(&path, (uint32_t)(token - fileName + 1), fileName);
|
||||||
if(*fileName == '/')
|
mkdir(path.chars, S_IRWXU | S_IRGRP | S_IROTH);
|
||||||
mkdir(path.chars, S_IRWXU | S_IRGRP | S_IROTH);
|
fileName = token + 1;
|
||||||
++fileName;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ffWriteFileData(const char* fileName, size_t dataSize, const void* data)
|
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 openFlagsRights = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
|
||||||
|
|
||||||
int FF_AUTO_CLOSE_FD fd = open(fileName, openFlagsModes, openFlagsRights);
|
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)
|
bool ffAppendFDBuffer(int fd, FFstrbuf* buffer)
|
||||||
{
|
{
|
||||||
ssize_t readed = 0;
|
ssize_t bytesRead = 0;
|
||||||
|
|
||||||
struct stat fileInfo;
|
struct stat fileInfo;
|
||||||
if(fstat(fd, &fileInfo) != 0)
|
if(fstat(fd, &fileInfo) != 0)
|
||||||
return false;
|
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);
|
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(
|
while(
|
||||||
(readed = read(fd, buffer->chars + buffer->length, free)) > 0
|
(bytesRead = read(fd, buffer->chars + buffer->length, free)) > 0
|
||||||
) {
|
) {
|
||||||
buffer->length += (uint32_t) readed;
|
buffer->length += (uint32_t) bytesRead;
|
||||||
if((uint32_t) readed == free)
|
// 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.
|
ffStrbufEnsureFree(buffer, buffer->allocated - 1); // Doubles capacity every round. -1 for the null byte.
|
||||||
free = ffStrbufGetFree(buffer);
|
free = ffStrbufGetFree(buffer);
|
||||||
}
|
}
|
||||||
@@ -72,7 +87,7 @@ bool ffAppendFDBuffer(int fd, FFstrbuf* buffer)
|
|||||||
|
|
||||||
ssize_t ffReadFileData(const char* fileName, size_t dataSize, void* data)
|
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)
|
if(fd == -1)
|
||||||
return -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)
|
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)
|
if(fd == -1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -94,7 +109,7 @@ bool ffPathExists(const char* path, FFPathType type)
|
|||||||
if(stat(path, &fileStat) != 0)
|
if(stat(path, &fileStat) != 0)
|
||||||
return false;
|
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)
|
if(type & FF_PATHTYPE_REGULAR && mode == S_IFREG)
|
||||||
return true;
|
return true;
|
||||||
@@ -153,14 +168,14 @@ const char* ffGetTerminalResponse(const char* request, const char* format, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char buffer[512];
|
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);
|
tcsetattr(STDIN_FILENO, TCSANOW, &oldTerm);
|
||||||
|
|
||||||
if(readed <= 0)
|
if(bytesRead <= 0)
|
||||||
return "read(STDIN_FILENO, buffer, sizeof(buffer) - 1) failed";
|
return "read(STDIN_FILENO, buffer, sizeof(buffer) - 1) failed";
|
||||||
|
|
||||||
buffer[readed] = '\0';
|
buffer[bytesRead] = '\0';
|
||||||
|
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
@@ -184,7 +199,7 @@ bool ffSuppressIO(bool suppress)
|
|||||||
|
|
||||||
origOut = dup(STDOUT_FILENO);
|
origOut = dup(STDOUT_FILENO);
|
||||||
origErr = dup(STDERR_FILENO);
|
origErr = dup(STDERR_FILENO);
|
||||||
nullFile = open("/dev/null", O_WRONLY);
|
nullFile = open("/dev/null", O_WRONLY | O_CLOEXEC);
|
||||||
init = true;
|
init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,7 +214,7 @@ bool ffSuppressIO(bool suppress)
|
|||||||
return true;
|
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);
|
DIR* dir = opendir(folder->chars);
|
||||||
if(dir == NULL)
|
if(dir == NULL)
|
||||||
@@ -207,8 +222,12 @@ void listFilesRecursively(FFstrbuf* folder, uint8_t indentation, const char* fol
|
|||||||
|
|
||||||
uint32_t folderLength = folder->length;
|
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);
|
printf("%s/\n", folderName);
|
||||||
|
}
|
||||||
|
|
||||||
struct dirent* entry;
|
struct dirent* entry;
|
||||||
|
|
||||||
@@ -221,13 +240,20 @@ void listFilesRecursively(FFstrbuf* folder, uint8_t indentation, const char* fol
|
|||||||
|
|
||||||
ffStrbufAppendS(folder, entry->d_name);
|
ffStrbufAppendS(folder, entry->d_name);
|
||||||
ffStrbufAppendC(folder, '/');
|
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);
|
ffStrbufSubstrBefore(folder, folderLength);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(uint8_t i = 0; i < indentation; i++)
|
if (pretty)
|
||||||
fputs(" | ", stdout);
|
{
|
||||||
|
for(uint8_t i = 0; i < indentation; i++)
|
||||||
|
fputs(" | ", stdout);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fputs(folder->chars + baseLength, stdout);
|
||||||
|
}
|
||||||
|
|
||||||
puts(entry->d_name);
|
puts(entry->d_name);
|
||||||
}
|
}
|
||||||
@@ -235,9 +261,9 @@ void listFilesRecursively(FFstrbuf* folder, uint8_t indentation, const char* fol
|
|||||||
closedir(dir);
|
closedir(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffListFilesRecursively(const char* path)
|
void ffListFilesRecursively(const char* path, bool pretty)
|
||||||
{
|
{
|
||||||
FF_STRBUF_AUTO_DESTROY folder = ffStrbufCreateS(path);
|
FF_STRBUF_AUTO_DESTROY folder = ffStrbufCreateS(path);
|
||||||
ffStrbufEnsureEndsWithC(&folder, '/');
|
ffStrbufEnsureEndsWithC(&folder, '/');
|
||||||
listFilesRecursively(&folder, 0, NULL);
|
listFilesRecursively(folder.length, &folder, 0, NULL, pretty);
|
||||||
}
|
}
|
||||||
|
|||||||
+39
-18
@@ -6,12 +6,12 @@
|
|||||||
static void createSubfolders(const char* fileName)
|
static void createSubfolders(const char* fileName)
|
||||||
{
|
{
|
||||||
FF_STRBUF_AUTO_DESTROY path = ffStrbufCreate();
|
FF_STRBUF_AUTO_DESTROY path = ffStrbufCreate();
|
||||||
while(*fileName != '\0')
|
char *token = NULL;
|
||||||
|
while((token = strchr(fileName, '/')) != NULL)
|
||||||
{
|
{
|
||||||
ffStrbufAppendC(&path, *fileName);
|
ffStrbufAppendNS(&path, (uint32_t)(token - fileName + 1), fileName);
|
||||||
if(*fileName == '/')
|
CreateDirectoryA(path.chars, NULL);
|
||||||
CreateDirectoryA(path.chars, NULL);
|
fileName = token + 1;
|
||||||
++fileName;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,22 +32,31 @@ bool ffWriteFileData(const char* fileName, size_t dataSize, const void* data)
|
|||||||
|
|
||||||
bool ffAppendFDBuffer(HANDLE handle, FFstrbuf* buffer)
|
bool ffAppendFDBuffer(HANDLE handle, FFstrbuf* buffer)
|
||||||
{
|
{
|
||||||
DWORD readed = 0;
|
DWORD bytesRead = 0;
|
||||||
|
|
||||||
LARGE_INTEGER fileSize;
|
LARGE_INTEGER fileSize;
|
||||||
if(!GetFileSizeEx(handle, &fileSize))
|
if(!GetFileSizeEx(handle, &fileSize))
|
||||||
fileSize.QuadPart = 0;
|
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);
|
uint32_t free = ffStrbufGetFree(buffer);
|
||||||
|
ssize_t remain = fileSize.QuadPart;
|
||||||
|
|
||||||
bool success;
|
bool success;
|
||||||
while(
|
while(
|
||||||
(success = !!ReadFile(handle, buffer->chars + buffer->length, free, &readed, NULL)) &&
|
(success = !!ReadFile(handle, buffer->chars + buffer->length, free, &bytesRead, NULL)) &&
|
||||||
readed > 0
|
bytesRead > 0
|
||||||
) {
|
) {
|
||||||
buffer->length += (uint32_t) readed;
|
buffer->length += (uint32_t) bytesRead;
|
||||||
if((uint32_t) readed == free)
|
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.
|
ffStrbufEnsureFree(buffer, buffer->allocated - 1); // Doubles capacity every round. -1 for the null byte.
|
||||||
free = ffStrbufGetFree(buffer);
|
free = ffStrbufGetFree(buffer);
|
||||||
}
|
}
|
||||||
@@ -114,16 +123,21 @@ bool ffSuppressIO(bool suppress)
|
|||||||
return false;
|
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;
|
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);
|
printf("%s/\n", folderName);
|
||||||
|
}
|
||||||
|
|
||||||
ffStrbufAppendC(folder, '*');
|
ffStrbufAppendC(folder, '*');
|
||||||
WIN32_FIND_DATAA entry;
|
WIN32_FIND_DATAA entry;
|
||||||
HANDLE hFind = FindFirstFileA(folder->chars, &entry);
|
HANDLE hFind = FindFirstFileA(folder->chars, &entry);
|
||||||
|
ffStrbufTrimRight(folder, '*');
|
||||||
if(hFind == INVALID_HANDLE_VALUE)
|
if(hFind == INVALID_HANDLE_VALUE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -137,24 +151,31 @@ void listFilesRecursively(FFstrbuf* folder, uint8_t indentation, const char* fol
|
|||||||
ffStrbufSubstrBefore(folder, folderLength);
|
ffStrbufSubstrBefore(folder, folderLength);
|
||||||
ffStrbufAppendS(folder, entry.cFileName);
|
ffStrbufAppendS(folder, entry.cFileName);
|
||||||
ffStrbufAppendC(folder, '/');
|
ffStrbufAppendC(folder, '/');
|
||||||
listFilesRecursively(folder, (uint8_t) (indentation + 1), entry.cFileName);
|
listFilesRecursively(baseLength, folder, (uint8_t) (indentation + 1), entry.cFileName, pretty);
|
||||||
ffStrbufSubstrBefore(folder, folderLength);
|
ffStrbufSubstrBefore(folder, folderLength);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(uint8_t i = 0; i < indentation; i++)
|
if (pretty)
|
||||||
fputs(" | ", stdout);
|
{
|
||||||
|
for(uint8_t i = 0; i < indentation; i++)
|
||||||
|
fputs(" | ", stdout);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fputs(folder->chars + baseLength, stdout);
|
||||||
|
}
|
||||||
|
|
||||||
puts(entry.cFileName);
|
puts(entry.cFileName);
|
||||||
} while (FindNextFileA(hFind, &entry));
|
} while (FindNextFileA(hFind, &entry));
|
||||||
FindClose(hFind);
|
FindClose(hFind);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffListFilesRecursively(const char* path)
|
void ffListFilesRecursively(const char* path, bool pretty)
|
||||||
{
|
{
|
||||||
FF_STRBUF_AUTO_DESTROY folder = ffStrbufCreateS(path);
|
FF_STRBUF_AUTO_DESTROY folder = ffStrbufCreateS(path);
|
||||||
ffStrbufEnsureEndsWithC(&folder, '/');
|
ffStrbufEnsureEndsWithC(&folder, '/');
|
||||||
listFilesRecursively(&folder, 0, NULL);
|
listFilesRecursively(folder.length, &folder, 0, NULL, pretty);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* ffGetTerminalResponse(const char* request, const char* format, ...)
|
const char* ffGetTerminalResponse(const char* request, const char* format, ...)
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_common_library
|
|
||||||
#define FF_INCLUDED_common_library
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
#include "util/FFcheckmacros.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);
|
FF_LIBRARY_LOAD_SYMBOL_ADDRESS(library, (varName)->ff ## symbolName, symbolName, returnValue);
|
||||||
|
|
||||||
void* ffLibraryLoad(const FFstrbuf* userProvidedName, ...);
|
void* ffLibraryLoad(const FFstrbuf* userProvidedName, ...);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_common_networking
|
|
||||||
#define FF_INCLUDED_common_networking
|
|
||||||
|
|
||||||
#include "common/thread.h"
|
#include "common/thread.h"
|
||||||
#include "util/FFstrbuf.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 ffNetworkingRecvHttpResponse(&state, buffer, timeout);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ struct yyjson_mut_val;
|
|||||||
typedef struct FFModuleBaseInfo
|
typedef struct FFModuleBaseInfo
|
||||||
{
|
{
|
||||||
const char* name;
|
const char* name;
|
||||||
|
const char* description;
|
||||||
// A dirty polymorphic implementation in C.
|
// A dirty polymorphic implementation in C.
|
||||||
// This is UB, because `void*` is not compatible with `FF*Options*`.
|
// 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
|
// 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(
|
static inline void ffOptionInitModuleBaseInfo(
|
||||||
FFModuleBaseInfo* baseInfo,
|
FFModuleBaseInfo* baseInfo,
|
||||||
const char* name,
|
const char* name,
|
||||||
|
const char* description,
|
||||||
void* parseCommandOptions, // bool (*const parseCommandOptions)(void* options, const char* key, const char* value)
|
void* parseCommandOptions, // bool (*const parseCommandOptions)(void* options, const char* key, const char* value)
|
||||||
void* parseJsonObject, // void (*const parseJsonObject)(void* options, yyjson_val *module)
|
void* parseJsonObject, // void (*const parseJsonObject)(void* options, yyjson_val *module)
|
||||||
void* printModule, // void (*const printModule)(void* options)
|
void* printModule, // void (*const printModule)(void* options)
|
||||||
@@ -34,6 +36,7 @@ static inline void ffOptionInitModuleBaseInfo(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
baseInfo->name = name;
|
baseInfo->name = name;
|
||||||
|
baseInfo->description = description;
|
||||||
baseInfo->parseCommandOptions = (__typeof__(baseInfo->parseCommandOptions)) parseCommandOptions;
|
baseInfo->parseCommandOptions = (__typeof__(baseInfo->parseCommandOptions)) parseCommandOptions;
|
||||||
baseInfo->parseJsonObject = (__typeof__(baseInfo->parseJsonObject)) parseJsonObject;
|
baseInfo->parseJsonObject = (__typeof__(baseInfo->parseJsonObject)) parseJsonObject;
|
||||||
baseInfo->printModule = (__typeof__(baseInfo->printModule)) printModule;
|
baseInfo->printModule = (__typeof__(baseInfo->printModule)) printModule;
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_parsing_h
|
|
||||||
#define FF_INCLUDED_parsing_h
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@@ -24,5 +21,3 @@ int8_t ffVersionCompare(const FFVersion* version1, const FFVersion* version2);
|
|||||||
|
|
||||||
void ffParseSize(uint64_t bytes, FFstrbuf* result);
|
void ffParseSize(uint64_t bytes, FFstrbuf* result);
|
||||||
void ffParseTemperature(double celsius, FFstrbuf* buffer);
|
void ffParseTemperature(double celsius, FFstrbuf* buffer);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ void ffPrintLogoAndKey(const char* moduleName, uint8_t moduleIndex, const FFModu
|
|||||||
{
|
{
|
||||||
ffLogoPrintLine();
|
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)
|
if(moduleName == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_common_printing
|
|
||||||
#define FF_INCLUDED_common_printing
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
#include "common/format.h"
|
#include "common/format.h"
|
||||||
|
|
||||||
@@ -26,5 +23,3 @@ void ffPrintColor(const FFstrbuf* colorValue);
|
|||||||
void ffPrintCharTimes(char c, uint32_t times);
|
void ffPrintCharTimes(char c, uint32_t times);
|
||||||
|
|
||||||
void ffPrintModuleFormatHelp(const char* name, const char* def, uint32_t numArgs, const char* args[]);
|
void ffPrintModuleFormatHelp(const char* name, const char* def, uint32_t numArgs, const char* args[]);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_common_processing
|
|
||||||
#define FF_INCLUDED_common_processing
|
|
||||||
|
|
||||||
#include "util/FFstrbuf.h"
|
#include "util/FFstrbuf.h"
|
||||||
|
|
||||||
const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool useStdErr);
|
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;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -11,49 +11,62 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
|
||||||
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
|
// remove zombie processes
|
||||||
if (*pid > 0)
|
if (*pid > 0)
|
||||||
waitpid(*pid, NULL, 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)
|
const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool useStdErr)
|
||||||
{
|
{
|
||||||
int pipes[2];
|
int pipes[2];
|
||||||
|
const int timeout = instance.config.general.processingTimeout;
|
||||||
|
|
||||||
if(pipe(pipes) == -1)
|
if(ffPipe2(pipes, O_CLOEXEC) == -1)
|
||||||
return "pipe() failed";
|
return "pipe() failed";
|
||||||
|
|
||||||
__attribute__((__cleanup__(waitpid_wrapper))) pid_t childPid = fork();
|
__attribute__((__cleanup__(waitpid_wrapper))) pid_t childPid = fork();
|
||||||
if(childPid == -1)
|
if(childPid == -1)
|
||||||
|
{
|
||||||
|
close(pipes[0]);
|
||||||
|
close(pipes[1]);
|
||||||
return "fork() failed";
|
return "fork() failed";
|
||||||
|
}
|
||||||
|
|
||||||
//Child
|
//Child
|
||||||
if(childPid == 0)
|
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(pipes[1], useStdErr ? STDERR_FILENO : STDOUT_FILENO);
|
||||||
dup2(nullFile, useStdErr ? STDOUT_FILENO : STDERR_FILENO);
|
dup2(nullFile, useStdErr ? STDOUT_FILENO : STDERR_FILENO);
|
||||||
close(pipes[0]);
|
|
||||||
close(pipes[1]);
|
|
||||||
setenv("LANG", "C", 1);
|
setenv("LANG", "C", 1);
|
||||||
execvp(argv[0], argv);
|
execvp(argv[0], argv);
|
||||||
exit(901);
|
_exit(127);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Parent
|
//Parent
|
||||||
close(pipes[1]);
|
close(pipes[1]);
|
||||||
|
|
||||||
int FF_AUTO_CLOSE_FD childPipeFd = pipes[0];
|
int FF_AUTO_CLOSE_FD childPipeFd = pipes[0];
|
||||||
|
char str[FF_PIPE_BUFSIZ];
|
||||||
|
|
||||||
int timeout = instance.config.general.processingTimeout;
|
while(1)
|
||||||
if (timeout >= 0)
|
|
||||||
fcntl(childPipeFd, F_SETFL, fcntl(childPipeFd, F_GETFL) | O_NONBLOCK);
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
{
|
||||||
if (timeout >= 0)
|
if (timeout >= 0)
|
||||||
{
|
{
|
||||||
@@ -70,18 +83,14 @@ const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool use
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char str[FF_PIPE_BUFSIZ];
|
ssize_t nRead = read(childPipeFd, str, FF_PIPE_BUFSIZ);
|
||||||
while (true)
|
if (nRead > 0)
|
||||||
{
|
ffStrbufAppendNS(buffer, (uint32_t) nRead, str);
|
||||||
ssize_t nRead = read(childPipeFd, str, FF_PIPE_BUFSIZ);
|
else if (nRead == 0)
|
||||||
if (nRead > 0)
|
return NULL;
|
||||||
ffStrbufAppendNS(buffer, (uint32_t) nRead, str);
|
else if (nRead < 0)
|
||||||
else if (nRead == 0)
|
break;
|
||||||
return NULL;
|
};
|
||||||
else if (nRead < 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} while (errno == EAGAIN);
|
|
||||||
|
|
||||||
return NULL;
|
return "read(childPipeFd, str, FF_PIPE_BUFSIZ) failed";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
|
||||||
enum { FF_PIPE_BUFSIZ = 4096 };
|
enum { FF_PIPE_BUFSIZ = 8192 };
|
||||||
|
|
||||||
const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool useStdErr)
|
const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool useStdErr)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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
|
// The following functions return true if the file was found, independently if start was found
|
||||||
// Buffers which already contain content are not overwritten
|
// 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)
|
bool ffParsePropFileValues(const char* filename, uint32_t numQueries, FFpropquery* queries)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_common_properties
|
|
||||||
#define FF_INCLUDED_common_properties
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
|
|
||||||
typedef struct FFpropquery
|
typedef struct FFpropquery
|
||||||
@@ -51,5 +48,3 @@ static inline bool ffParsePropFileData(const char* relativeFile, const char* sta
|
|||||||
{
|
{
|
||||||
return ffParsePropFileDataValues(relativeFile, 1, (FFpropquery[]){{start, buffer}});
|
return ffParsePropFileDataValues(relativeFile, 1, (FFpropquery[]){{start, buffer}});
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_common_settings
|
|
||||||
#define FF_INCLUDED_common_settings
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
|
|
||||||
typedef enum FFvarianttype
|
typedef enum FFvarianttype
|
||||||
@@ -38,5 +35,3 @@ bool ffSettingsGetAndroidProperty(const char* propName, FFstrbuf* result);
|
|||||||
#elif defined(__FreeBSD__)
|
#elif defined(__FreeBSD__)
|
||||||
bool ffSettingsGetFreeBSDKenv(const char* propName, FFstrbuf* result);
|
bool ffSettingsGetFreeBSDKenv(const char* propName, FFstrbuf* result);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_common_sysctl
|
|
||||||
#define FF_INCLUDED_common_sysctl
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
#include "util/FFcheckmacros.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 int ffSysctlGetInt(const char* propName, int defaultValue);
|
||||||
FF_C_NODISCARD int64_t ffSysctlGetInt64(const char* propName, int64_t 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);
|
FF_C_NODISCARD void* ffSysctlGetData(int* request, u_int requestLength, size_t* resultLength);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_common_thread
|
|
||||||
#define FF_INCLUDED_common_thread
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
|
|
||||||
#ifdef FF_HAVE_THREADS
|
#ifdef FF_HAVE_THREADS
|
||||||
@@ -82,5 +79,3 @@
|
|||||||
static inline void ffThreadMutexUnlock(FFThreadMutex* mutex) { FF_UNUSED(mutex) }
|
static inline void ffThreadMutexUnlock(FFThreadMutex* mutex) { FF_UNUSED(mutex) }
|
||||||
#define FF_THREAD_ENTRY_DECL_WRAPPER(fn, paramType)
|
#define FF_THREAD_ENTRY_DECL_WRAPPER(fn, paramType)
|
||||||
#endif //FF_HAVE_THREADS
|
#endif //FF_HAVE_THREADS
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_common_time
|
|
||||||
#define FF_INCLUDED_common_time
|
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <synchapi.h>
|
#include <synchapi.h>
|
||||||
@@ -48,5 +45,3 @@ static inline void ffTimeSleep(uint32_t msec)
|
|||||||
nanosleep(&(struct timespec){ msec / 1000, (msec % 1000) * 1000000 }, NULL);
|
nanosleep(&(struct timespec){ msec / 1000, (msec % 1000) * 1000000 }, NULL);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -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
|
|
||||||
@@ -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"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -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
|
|
||||||
+1354
File diff suppressed because it is too large
Load Diff
+3
-185
@@ -1,186 +1,4 @@
|
|||||||
Fastfetch is a neofetch-like tool for fetching system information and displaying them in a pretty way
|
|
||||||
|
|
||||||
Usage: fastfetch <?options>
|
|
||||||
|
|
||||||
Informative options:
|
|
||||||
-h, --help: Show this message
|
|
||||||
-h, --help <command>: 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 <file>: Load a config file or preset (+)
|
|
||||||
--gen-config <type>: Generate a sample config file in the default path. Param `type` can be `jsonc` or deprecated `conf`
|
|
||||||
--gen-config-force <type>: Generate a sample config file in the default path. Overwrite the existing one
|
|
||||||
--migrate-config <?path>: 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 <?value>: Use separate threads to send HTTP requests
|
|
||||||
--escape-bedrock <?value>: On Bedrock Linux, whether to escape the bedrock jail
|
|
||||||
--wmi-timeout <num>: Set the timeout (ms) for WMI queries. Windows only. Default is 5000
|
|
||||||
--processing-timeout <num>: Set the timeout (ms) when waiting for child processes. Default is 1000
|
|
||||||
--ds-force-drm <?value>: Set if only DRM should be used to detect displays. Default is false. Linux only
|
|
||||||
|
|
||||||
Logo options:
|
|
||||||
-l, --logo <logo>: Set the logo; if default, the name of a builtin logo or a path to a file
|
|
||||||
--logo-type <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 <width>: Set the width of the logo (in characters), if it is an image. Required for iTerm image protocol
|
|
||||||
--logo-height <height>: Set the height of the logo (in characters), if it is an image. Required for iTerm image protocol
|
|
||||||
--logo-preserve-aspect-ratio <?value>: 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] <color>: Overwrite a color in the logo
|
|
||||||
--logo-padding <padding>: Set the padding on the left and the right of the logo
|
|
||||||
--logo-padding-left <padding>: Set the padding on the left of the logo
|
|
||||||
--logo-padding-right <padding>: Set the padding on the right of the logo
|
|
||||||
--logo-padding-top <padding>: Set the padding on the top of the logo
|
|
||||||
--logo-print-remaining <?value>: Whether to print the remaining logo, if it has more lines than modules to display
|
|
||||||
--logo-separate <?value>: If true, print modules at bottom of the logo
|
|
||||||
--logo-recache <?value>: If true, regenerate image logo cache
|
|
||||||
--file <file>: Short for --logo-type file --logo <file>
|
|
||||||
--file-raw <file>: Short for --logo-type file-raw --logo <file>
|
|
||||||
--data <data>: Short for --logo-type data --logo <data>
|
|
||||||
--data-raw <data>: Short for --logo-type data-raw --logo <data>
|
|
||||||
--sixel <file>: Short for --logo-type sixel --logo <file>
|
|
||||||
--kitty <file>: Short for --logo-type kitty --logo <file>
|
|
||||||
--iterm <file>: Short for --logo-type iterm --logo <file>
|
|
||||||
--chafa <file>: Short for --logo-type chafa --logo <file>
|
|
||||||
--chafa-fg-only <?value>: Produce character-cell output using foreground colors only. See chafa document for detail
|
|
||||||
--chafa-symbols <str>: Specify character symbols to employ in final output. See chafa document for detail
|
|
||||||
--chafa-canvas-mode <value>: 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 <value>: Set color space used for quantization. 0 for RGB; 1 for DIN99d. See chafa document for detail
|
|
||||||
--chafa-dither-mode <value>: 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 <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 <?value>: Show time usage (in ms) for individual modules
|
|
||||||
--pipe <?value>: Disable logo and all escape sequences
|
|
||||||
--color-keys <color>: Set the color of the keys
|
|
||||||
--color-title <color>: Set the color of the title
|
|
||||||
--color <color>: Set the color of both the keys and title
|
|
||||||
--key-width <num>: Align the width of keys to <num> characters
|
|
||||||
--bright-color <?value>: Set if the keys, title and ASCII logo should be printed in bright color. Default is true
|
|
||||||
--separator <str>: Set the separator between key and value. Default is a colon with a space
|
|
||||||
--set <key=value>: Hard set the value of a key
|
|
||||||
--set-keyless <key=value>: Hard set the value of a key, but don't print the key or the separator
|
|
||||||
--show-errors <?value>: Print occurring errors
|
|
||||||
--disable-linewrap <?value>: Whether to disable line wrap during the run
|
|
||||||
--hide-cursor <?value>: Whether to hide the cursor during the run
|
|
||||||
--binary-prefix <value>: Set the binary prefix to used. Must be IEC, SI or JEDEC. Default is IEC
|
|
||||||
--percent-type <value>: 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 <value>: Set the number of digits to keep after the decimal point when formatting percentage numbers. Default is 0
|
|
||||||
--bar-char-elapsed <str>: Set the character to use in elapsed part. Default is '■'
|
|
||||||
--bar-char-total <str>: Set the character to use in total part. Default is '-'
|
|
||||||
--bar-width <?num>: Set the width of the bar, in number of characters. Default is 10
|
|
||||||
--bar-border <?value>: Whether to show a border around the bar. Default is true
|
|
||||||
--no-buffer <?value>: Set if the stdout application buffer should be disabled. Default is false
|
|
||||||
--size-ndigits <value>: Set the number of digits to keep after the decimal point when formatting sizes
|
|
||||||
--size-max-prefix <value>: Set the largest binary prefix to use when formatting sizes. Default is YB
|
|
||||||
--temperature-unit <value>: Set the unit of the temperature. Must be one of C, F and K. Default is C
|
|
||||||
|
|
||||||
General module options:
|
|
||||||
--<module>-format <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 <module>-format`.
|
|
||||||
|
|
||||||
--<module>-key <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.
|
|
||||||
|
|
||||||
--<module>-key-color <format>: Override the global `--color-keys` option for each specific module.
|
|
||||||
--<module>-key-width <num>: Override the global `--key-width` option for each specific module.
|
|
||||||
|
|
||||||
Library options: Set the path of a library to load
|
|
||||||
--lib-PCI <path>: GPU output
|
|
||||||
--lib-vulkan <path>: Vulkan module & fallback for GPU output
|
|
||||||
--lib-wayland <path>: Better display performance and output in wayland sessions
|
|
||||||
--lib-xcb-randr <path>: X11 sessions for better display detection and faster WM detection
|
|
||||||
--lib-xcb <path>: X11 sessions for better display detection and faster WM detection
|
|
||||||
--lib-Xrandr <path>: X11 sessions for better display detection and faster WM detection
|
|
||||||
--lib-X11 <path>: X11 sessions for better display detection and faster WM detection
|
|
||||||
--lib-gio <path>: Needed for values that are only stored GSettings
|
|
||||||
--lib-DConf <path>: Needed for values that are only stored in DConf + Fallback for GSettings
|
|
||||||
--lib-DBus <path>: Bluetooth, Player & Media detection
|
|
||||||
--lib-XFConf <path>: Needed for XFWM theme and XFCE Terminal font
|
|
||||||
--lib-sqlite3 <path>: Needed for pkg & rpm package count
|
|
||||||
--lib-rpm <path>: Slower fallback for rpm package count
|
|
||||||
--lib-imagemagick <path>: Images in terminal using sixel or kitty graphics protocol
|
|
||||||
--lib-z <path>: Libz. Faster image output when using kitty graphics protocol
|
|
||||||
--lib-chafa <path>: Image output as ascii art
|
|
||||||
--lib-egl <path>: Needed by the OpenGL module for gl context creation
|
|
||||||
--lib-glx <path>: Needed by the OpenGL module for gl context creation
|
|
||||||
--lib-osmesa <path>: Needed by the OpenGL module for gl context creation
|
|
||||||
--lib-opencl <path>: OpenCL module
|
|
||||||
--lib-pulse <path>: Pulseaudio. Used for Sound detection
|
|
||||||
--lib-nm: NetworkManager. Used for Wifi detection
|
|
||||||
--lib-freetype <path>: Used for Termux font detection
|
|
||||||
--lib-ddcutil <path>: Used for brightness detection of external displays
|
|
||||||
|
|
||||||
Module specific options:
|
|
||||||
--title-fqdn <?value>: Set if the title should use fully qualified domain name. Default is false
|
|
||||||
--title-color-user <color>: Set color of the user name (left part). Default is empty (use color of `--color-title`).
|
|
||||||
--title-color-at <color>: Set color of the @ symbol (middle part). Default is empty (use color of `--color-title`)
|
|
||||||
--title-color-host <color>: Set color of the host name (right part). Default is empty (use color of `--color-title`)
|
|
||||||
--chassis-use-wmi <?value>: Set if WMI query should be used on Windows, which detects more information but slower. Default is false
|
|
||||||
--separator-string <str>: Set the string printed by the separator module
|
|
||||||
--os-file <path>: Set the path to the file containing OS information. Linux only
|
|
||||||
--disk-folders <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 <?value>: Set if regular volume should be printed. Default is true
|
|
||||||
--disk-show-external <?value>: Set if external volume should be printed. Default is true
|
|
||||||
--disk-show-hidden <?value>: Set if hidden volumes should be printed. Default is false
|
|
||||||
--disk-show-subvolumes <?value>: Set if subvolumes should be printed. Default is false
|
|
||||||
--disk-show-readonly <?value>: Set if read only volumes should be printed. Default is false
|
|
||||||
--disk-show-unknown <?value>: Set if unknown (unable to detect sizes) volumes should be printed. Default is false
|
|
||||||
--disk-use-available <?value>: Use f_bavail (lpFreeBytesAvailableToCaller for Windows) instead of f_bfree to calculate used bytes. Default is false
|
|
||||||
--diskio-name-prefix <str>: Show disks with given name prefix only. Default is empty
|
|
||||||
--bluetooth-show-disconnected <?value>: Set if disconnected bluetooth devices should be printed. Default is false
|
|
||||||
--packages-winget <?value>: Set if winget package count should be detected. Default is false
|
|
||||||
--display-compact-type <?string>: Set if all displays should be printed in one line. Default is none
|
|
||||||
--display-detect-name <?value>: Set if display name should be detected and printed (if supported). Default is false
|
|
||||||
--display-precise-refresh-rate <?value>: Set if decimal refresh rates should not be rounded into integers when printing. Default is true
|
|
||||||
--brightness-ddcci-sleep <num>: Set the sleep times (in ms) when sending DDC/CI requests. See <https://www.ddcutil.com/performance_options/#option-sleep-multiplier> for detail. Default is 10
|
|
||||||
--sound-type <value>: Set what type of sound devices should be printed. Should be either main, active or all. Default is main
|
|
||||||
--battery-dir <folder>: The directory where the battery folders are. Standard: `/sys/class/power_supply/`. Linux only
|
|
||||||
--battery-use-setup-api <?value>: Set if `SetupAPI` should be used on Windows to detect battery info, which supports multi batteries, but slower. Windows only
|
|
||||||
--cpu-temp <?value>: Detect and display CPU temperature if supported. Default is false
|
|
||||||
--cpu-freq-ndigits <num>: Set the number of digits to keep after the decimal point when printing CPU frequency. Default is 2
|
|
||||||
--cpuusage-separate <?value>: Display CPU usage per CPU logical core, instead of an average result. Default is false
|
|
||||||
--de-slow-version-detection <?value>: Set if DE version should be detected with slow operations. Default is false
|
|
||||||
--gpu-temp <?value>: Detect and display GPU temperature if supported. Default is false
|
|
||||||
--gpu-use-nvml <?value>: Use nvml (NVIDIA Management Library) to detect more detailed GPU information (memory usage, CUDA core count, etc). Default is false
|
|
||||||
--gpu-force-vulkan <?value>: Force using vulkan to detect GPUs, which support video memory usage detection with `--allow-slow-operations`. Default is false
|
|
||||||
--gpu-hide-type <?value>: Specify the type of GPUs should not be printed. Must be `integrated`, `discrete` or `none`. Default is none
|
|
||||||
--battery-temp <?value>: Detect and display Battery temperature if supported. Default is false
|
|
||||||
--localip-show-ipv4 <?value>: Show IPv4 addresses in local ip module. Default is true
|
|
||||||
--localip-show-ipv6 <?value>: Show IPv6 addresses in local ip module. Default is false
|
|
||||||
--localip-show-mac <?value>: Show mac addresses in local ip module. Default is false
|
|
||||||
--localip-show-loop <?value>: Show loop back addresses (127.0.0.1) in local ip module. Default is false
|
|
||||||
--localip-name-prefix <str>: Show interfaces with given interface name prefix only. Default is empty
|
|
||||||
--localip-default-route-only <?value>: Show the interface that is used for default routing only. Default is true
|
|
||||||
--localip-compact <?value>: Show all IPs in one line. Default is false
|
|
||||||
--netio-name-prefix <str>: Show interfaces with given name prefix only. Default is empty
|
|
||||||
--netio-default-route-only <?value>: Show the interfac that is used for default routing only. Default is true
|
|
||||||
--publicip-timeout <num>: Time in milliseconds to wait for the public ip server to respond. Default is disabled (0)
|
|
||||||
--publicip-url <str>: The URL of public IP detection server to be used.
|
|
||||||
--weather-location <str>: Set the location to be used. It must be URI encoded (eg a whitespace must be encoded as `+`).
|
|
||||||
--weather-timeout <num>: Time in milliseconds to wait for the weather server to respond. Default is disabled (0)
|
|
||||||
--weather-output-format <str>: The output weather format to be used. It must be URI encoded.
|
|
||||||
--wm-detect-plugin <?value>: Set if window manager plugin should be detected on supported platforms. Default is false
|
|
||||||
--player-name <str>: The name of the player to use for module Media and Player. Linux only
|
|
||||||
--opengl-library <str>: Set the OpenGL context creation library to use. Must be auto, egl, glx or osmesa. Default is auto
|
|
||||||
--command-shell <str>: Set the shell program to execute the command text. Default is cmd for Windows, /bin/sh for *nix
|
|
||||||
--command-key <str>: Set the module key to display
|
|
||||||
--command-text <str>: Set the command text to be executed
|
|
||||||
--colors-symbol <str>: Set the symbol to be printed by Colors module. Default is block
|
|
||||||
--colors-padding-left <value>: 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"
|
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.
|
If a value starts with a ?, it is optional. An optional boolean value defaults to true if not specified.
|
||||||
A (+) at the end indicates that more help can be printed with --help <option>
|
More detailed help messages for each options can be printed with "-h <option_without_dash_prefix>"
|
||||||
All options can be made permanent with command `fastfetch <options> --migrate-config`
|
All options can be made permanent with command "fastfetch <options> --gen-config"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ Usage: fastfetch --color <color>
|
|||||||
<color> must be a color encoding as ANSI escape sequences. It is inserted between "ESC[" and "m".
|
<color> must be a color encoding as ANSI escape sequences. It is inserted between "ESC[" and "m".
|
||||||
Infos about them can be found here: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters.
|
Infos about them can be found here: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters.
|
||||||
Examples:
|
Examples:
|
||||||
--color 35: sets the color to pink
|
--color 35: sets the color to magenta. `--color magenta` is also supported
|
||||||
--color 4;92: sets the color to bright Green with underline
|
--color 4;92: sets the color to bright Green with underline
|
||||||
--color 5;104: blinking text on a blue background
|
--color 5;104: blinking text on a blue background
|
||||||
If no color is set, the main color of the logo will be used.
|
If no color is set, the main color of the logo will be used.
|
||||||
|
|||||||
@@ -5,5 +5,4 @@ If the file is relative it looks in the following order:
|
|||||||
- relative to the current working directory
|
- relative to the current working directory
|
||||||
- relative to ~/.local/share/fastfetch/presets/
|
- relative to ~/.local/share/fastfetch/presets/
|
||||||
- relative to /usr/share/fastfetch/presets/
|
- relative to /usr/share/fastfetch/presets/
|
||||||
Fastfetch provides some default presets. List them with --print-available-presets.
|
Fastfetch provides some default presets. List them with "fastfetch --list-presets".
|
||||||
Note that this will only print presets fastfetch knows about and not every possible one.
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
A format string is a string that contains placeholders for values.
|
A format string is a string that contains placeholders for values.
|
||||||
These placeholders begin with a '{', containing the index of the value, and end with a '}'.
|
These placeholders begin with a '{', containing the index of the value, and end with a '}'.
|
||||||
For example the format string "Values: {1} ({2})", with the values "First" and "My second val", will produce
|
For example the format string "Values: {1} ({2})", with the values "First" and "My second val", will produce
|
||||||
The format string can contain placeholders in any order and have multiple occurences.
|
The format string can contain placeholders in any order and have multiple occurrences.
|
||||||
To include spaces when setting from the command line, surround the whole string with double quotes (").
|
To include spaces when setting from the command line, surround the whole string with double quotes (").
|
||||||
|
|
||||||
If the value index is missing, meaning the placeholder is "{}", an internal counter sets the value index.
|
If the value index is missing, meaning the placeholder is "{}", an internal counter sets the value index.
|
||||||
@@ -22,7 +22,7 @@ For example to print a fallback for a second value if it is not set, use "{?2}{2
|
|||||||
To stop formatting at any point in the format string, use "{-}".
|
To stop formatting at any point in the format string, use "{-}".
|
||||||
|
|
||||||
To print something with color, start a placeholder with a '#' and then the linux terminal color encoding.
|
To print something with color, start a placeholder with a '#' and then the linux terminal color encoding.
|
||||||
"\\033[" at the start, and an 'm' at the end is automatically added, so don't do that.
|
"\033[" at the start, and an 'm' at the end is automatically added, so don't do that.
|
||||||
A "{#}" is equivalent to a "{#0}" and resets everything to normal.
|
A "{#}" is equivalent to a "{#0}" and resets everything to normal.
|
||||||
For example to print something pink and underline, use "{#4;35}...{#}".
|
For example to print something pink and underline, use "{#4;35}...{#}".
|
||||||
Information about what the numbers mean can be found here: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Sele
|
Information about what the numbers mean can be found here: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Sele
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_detection_battery_battery
|
|
||||||
#define FF_INCLUDED_detection_battery_battery
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
|
|
||||||
#define FF_BATTERY_TEMP_UNSET (0/0.0)
|
#define FF_BATTERY_TEMP_UNSET (0/0.0)
|
||||||
@@ -19,5 +16,3 @@ typedef struct FFBatteryResult
|
|||||||
} FFBatteryResult;
|
} FFBatteryResult;
|
||||||
|
|
||||||
const char* ffDetectBattery(FFBatteryOptions* options, FFlist* results);
|
const char* ffDetectBattery(FFBatteryOptions* options, FFlist* results);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ const char* ffDetectBattery(FF_MAYBE_UNUSED FFBatteryOptions* options, FFlist* r
|
|||||||
if(units == 0)
|
if(units == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
FF_AUTO_CLOSE_FD int acpifd = open("/dev/acpi", O_RDONLY);
|
FF_AUTO_CLOSE_FD int acpifd = open("/dev/acpi", O_RDONLY | O_CLOEXEC);
|
||||||
if(acpifd < 0)
|
if(acpifd < 0)
|
||||||
return "open(\"/dev/acpi\", O_RDONLY) failed";
|
return "open(\"/dev/acpi\", O_RDONLY | O_CLOEXEC) failed";
|
||||||
|
|
||||||
for(int i = 0; i < units; ++i)
|
for(int i = 0; i < units; ++i)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_detection_bios_bios
|
|
||||||
#define FF_INCLUDED_detection_bios_bios
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
|
|
||||||
typedef struct FFBiosResult
|
typedef struct FFBiosResult
|
||||||
@@ -15,5 +12,3 @@ typedef struct FFBiosResult
|
|||||||
} FFBiosResult;
|
} FFBiosResult;
|
||||||
|
|
||||||
const char* ffDetectBios(FFBiosResult* bios);
|
const char* ffDetectBios(FFBiosResult* bios);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_detection_bluetooth_bluetooth
|
|
||||||
#define FF_INCLUDED_detection_bluetooth_bluetooth
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
|
|
||||||
typedef struct FFBluetoothResult
|
typedef struct FFBluetoothResult
|
||||||
@@ -15,5 +12,3 @@ typedef struct FFBluetoothResult
|
|||||||
} FFBluetoothResult;
|
} FFBluetoothResult;
|
||||||
|
|
||||||
const char* ffDetectBluetooth(FFlist* devices /* FFBluetoothResult */);
|
const char* ffDetectBluetooth(FFlist* devices /* FFBluetoothResult */);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,14 +1,20 @@
|
|||||||
#include "bluetooth.h"
|
#include "bluetooth.h"
|
||||||
|
#include "common/library.h"
|
||||||
#include "util/windows/unicode.h"
|
#include "util/windows/unicode.h"
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <bluetoothapis.h>
|
#include <bluetoothapis.h>
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wpointer-sign"
|
#pragma GCC diagnostic ignored "-Wpointer-sign"
|
||||||
|
|
||||||
const char* ffDetectBluetooth(FFlist* devices /* FFBluetoothResult */)
|
const char* ffDetectBluetooth(FFlist* devices /* FFBluetoothResult */)
|
||||||
{
|
{
|
||||||
|
// Actually bluetoothapis.dll, but it's missing on Windows 7
|
||||||
|
FF_LIBRARY_LOAD(bluetoothapis, NULL, "dlopen bthprops.cpl failed", "bthprops.cpl", 1)
|
||||||
|
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(bluetoothapis, BluetoothFindFirstDevice)
|
||||||
|
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(bluetoothapis, BluetoothFindNextDevice)
|
||||||
|
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(bluetoothapis, BluetoothFindDeviceClose)
|
||||||
|
|
||||||
BLUETOOTH_DEVICE_SEARCH_PARAMS btsp = {
|
BLUETOOTH_DEVICE_SEARCH_PARAMS btsp = {
|
||||||
.fReturnConnected = TRUE,
|
.fReturnConnected = TRUE,
|
||||||
.fReturnRemembered = TRUE,
|
.fReturnRemembered = TRUE,
|
||||||
@@ -20,9 +26,14 @@ const char* ffDetectBluetooth(FFlist* devices /* FFBluetoothResult */)
|
|||||||
BLUETOOTH_DEVICE_INFO btdi = {
|
BLUETOOTH_DEVICE_INFO btdi = {
|
||||||
.dwSize = sizeof(btdi)
|
.dwSize = sizeof(btdi)
|
||||||
};
|
};
|
||||||
HBLUETOOTH_DEVICE_FIND hFind = BluetoothFindFirstDevice(&btsp, &btdi);
|
HBLUETOOTH_DEVICE_FIND hFind = ffBluetoothFindFirstDevice(&btsp, &btdi);
|
||||||
if(!hFind)
|
if(!hFind)
|
||||||
return "BluetoothFindFirstDevice() failed or no devices found";
|
{
|
||||||
|
if (GetLastError() == ERROR_NO_MORE_ITEMS)
|
||||||
|
return "No Bluetooth devices found";
|
||||||
|
else
|
||||||
|
return "BluetoothFindFirstDevice() failed";
|
||||||
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
FFBluetoothResult* device = ffListAdd(devices);
|
FFBluetoothResult* device = ffListAdd(devices);
|
||||||
@@ -114,9 +125,9 @@ const char* ffDetectBluetooth(FFlist* devices /* FFBluetoothResult */)
|
|||||||
ffStrbufTrimRight(&device->type, ' ');
|
ffStrbufTrimRight(&device->type, ' ');
|
||||||
ffStrbufTrimRight(&device->type, ',');
|
ffStrbufTrimRight(&device->type, ',');
|
||||||
}
|
}
|
||||||
} while (BluetoothFindNextDevice(hFind, &btdi));
|
} while (ffBluetoothFindNextDevice(hFind, &btdi));
|
||||||
|
|
||||||
|
ffBluetoothFindDeviceClose(hFind);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_detection_board_board
|
|
||||||
#define FF_INCLUDED_detection_board_board
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
|
|
||||||
typedef struct FFBoardResult
|
typedef struct FFBoardResult
|
||||||
@@ -12,6 +9,4 @@ typedef struct FFBoardResult
|
|||||||
FFstrbuf version;
|
FFstrbuf version;
|
||||||
} FFBoardResult;
|
} FFBoardResult;
|
||||||
|
|
||||||
const char* ffDetectBoard(FFBoardResult* result);
|
const char* ffDetectBoard(FFBoardResult* board);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
#include "board.h"
|
||||||
|
|
||||||
|
#include "common/sysctl.h"
|
||||||
|
|
||||||
|
const char* ffDetectBoard(FFBoardResult* result)
|
||||||
|
{
|
||||||
|
const char* error = ffSysctlGetString("hw.model", &result->name);
|
||||||
|
if (error)
|
||||||
|
return error;
|
||||||
|
|
||||||
|
ffStrbufSetStatic(&result->vendor, "Apple");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_detection_brightness_brightness
|
|
||||||
#define FF_INCLUDED_detection_brightness_brightness
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
#include "util/FFlist.h"
|
#include "util/FFlist.h"
|
||||||
|
|
||||||
@@ -13,5 +10,3 @@ typedef struct FFBrightnessResult
|
|||||||
} FFBrightnessResult;
|
} FFBrightnessResult;
|
||||||
|
|
||||||
const char* ffDetectBrightness(FFBrightnessOptions* options, FFlist* result); // list of FFBrightnessResult
|
const char* ffDetectBrightness(FFBrightnessOptions* options, FFlist* result); // list of FFBrightnessResult
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ const char* ffDetectBrightness(FF_MAYBE_UNUSED FFBrightnessOptions* options, FFl
|
|||||||
{
|
{
|
||||||
path[sizeof(path) - 2] = i;
|
path[sizeof(path) - 2] = i;
|
||||||
|
|
||||||
FF_AUTO_CLOSE_FD int blfd = open(path, O_RDONLY);
|
FF_AUTO_CLOSE_FD int blfd = open(path, O_RDONLY | O_CLOEXEC);
|
||||||
if (blfd < 0)
|
if (blfd < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
@@ -96,6 +96,8 @@ static const char* detectWithBacklight(FFlist* result)
|
|||||||
// Try to be compatible with ddcutil 2.0
|
// Try to be compatible with ddcutil 2.0
|
||||||
#if DDCUTIL_VMAJOR >= 2
|
#if DDCUTIL_VMAJOR >= 2
|
||||||
double ddca_set_default_sleep_multiplier(double multiplier); // ddcutil 1.4
|
double ddca_set_default_sleep_multiplier(double multiplier); // ddcutil 1.4
|
||||||
|
#else
|
||||||
|
DDCA_Status ddca_init(const char *libopts, int syslog_level, int opts);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char* detectWithDdcci(FFBrightnessOptions* options, FFlist* result)
|
static const char* detectWithDdcci(FFBrightnessOptions* options, FFlist* result)
|
||||||
@@ -107,11 +109,22 @@ static const char* detectWithDdcci(FFBrightnessOptions* options, FFlist* result)
|
|||||||
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libddcutil, ddca_free_any_vcp_value)
|
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libddcutil, ddca_free_any_vcp_value)
|
||||||
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libddcutil, ddca_close_display)
|
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libddcutil, ddca_close_display)
|
||||||
|
|
||||||
__typeof__(&ddca_set_default_sleep_multiplier) ffddca_set_default_sleep_multiplier = dlsym(libddcutil, "ddca_set_default_sleep_multiplier");
|
__typeof__(&ddca_init) ffddca_init = dlsym(libddcutil, "ddca_init");
|
||||||
if (ffddca_set_default_sleep_multiplier)
|
if (ffddca_init)
|
||||||
ffddca_set_default_sleep_multiplier(options->ddcciSleep / 40.0);
|
{
|
||||||
|
FF_SUPPRESS_IO();
|
||||||
|
// Ref: https://github.com/rockowitz/ddcutil/issues/344
|
||||||
|
if (ffddca_init("--disable-watch-displays", -1 /*DDCA_SYSLOG_NOT_SET*/, 1 /*DDCA_INIT_OPTIONS_DISABLE_CONFIG_FILE*/) < 0)
|
||||||
|
return "ddca_init() failed";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
__typeof__(&ddca_set_default_sleep_multiplier) ffddca_set_default_sleep_multiplier = dlsym(libddcutil, "ddca_set_default_sleep_multiplier");
|
||||||
|
if (ffddca_set_default_sleep_multiplier)
|
||||||
|
ffddca_set_default_sleep_multiplier(options->ddcciSleep / 40.0);
|
||||||
|
|
||||||
libddcutil = NULL; // Don't dlclose libddcutil. See https://github.com/rockowitz/ddcutil/issues/330
|
libddcutil = NULL; // Don't dlclose libddcutil. See https://github.com/rockowitz/ddcutil/issues/330
|
||||||
|
}
|
||||||
|
|
||||||
FF_AUTO_FREE DDCA_Display_Info_List* infoList = NULL;
|
FF_AUTO_FREE DDCA_Display_Info_List* infoList = NULL;
|
||||||
if (ffddca_get_display_info_list2(false, &infoList) < 0)
|
if (ffddca_get_display_info_list2(false, &infoList) < 0)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
#include "brightness.h"
|
#include "brightness.h"
|
||||||
#include "detection/displayserver/displayserver.h"
|
#include "detection/displayserver/displayserver.h"
|
||||||
|
#include "common/library.h"
|
||||||
}
|
}
|
||||||
#include "util/windows/wmi.hpp"
|
#include "util/windows/wmi.hpp"
|
||||||
#include "util/windows/unicode.hpp"
|
#include "util/windows/unicode.hpp"
|
||||||
@@ -36,15 +37,19 @@ static const char* detectWithWmi(FFlist* result)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char* detectWithDdcci(const FFDisplayServerResult* displayServer, FFlist* result)
|
static const char* detectWithDdcci(const FFDisplayServerResult* displayServer, FFlist* result)
|
||||||
{
|
{
|
||||||
|
FF_LIBRARY_LOAD(dxva2, NULL, "dlopen dxva2" FF_LIBRARY_EXTENSION " failed", "dxva2" FF_LIBRARY_EXTENSION, 1)
|
||||||
|
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(dxva2, GetPhysicalMonitorsFromHMONITOR)
|
||||||
|
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(dxva2, GetMonitorBrightness)
|
||||||
|
|
||||||
FF_LIST_FOR_EACH(FFDisplayResult, display, displayServer->displays)
|
FF_LIST_FOR_EACH(FFDisplayResult, display, displayServer->displays)
|
||||||
{
|
{
|
||||||
PHYSICAL_MONITOR physicalMonitor;
|
PHYSICAL_MONITOR physicalMonitor;
|
||||||
if (GetPhysicalMonitorsFromHMONITOR((HMONITOR)(uintptr_t) display->id, 1, &physicalMonitor))
|
if (ffGetPhysicalMonitorsFromHMONITOR((HMONITOR)(uintptr_t) display->id, 1, &physicalMonitor))
|
||||||
{
|
{
|
||||||
DWORD min = 0, curr = 0, max = 0;
|
DWORD min = 0, curr = 0, max = 0;
|
||||||
if (GetMonitorBrightness(physicalMonitor.hPhysicalMonitor, &min, &curr, &max))
|
if (ffGetMonitorBrightness(physicalMonitor.hPhysicalMonitor, &min, &curr, &max))
|
||||||
{
|
{
|
||||||
FFBrightnessResult* brightness = (FFBrightnessResult*) ffListAdd(result);
|
FFBrightnessResult* brightness = (FFBrightnessResult*) ffListAdd(result);
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_detection_chassis_chassis
|
|
||||||
#define FF_INCLUDED_detection_chassis_chassis
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
|
|
||||||
typedef struct FFChassisResult
|
typedef struct FFChassisResult
|
||||||
@@ -14,5 +11,3 @@ typedef struct FFChassisResult
|
|||||||
|
|
||||||
const char* ffDetectChassis(FFChassisResult* result, FFChassisOptions* options);
|
const char* ffDetectChassis(FFChassisResult* result, FFChassisOptions* options);
|
||||||
const char* ffChassisTypeToString(uint32_t type);
|
const char* ffChassisTypeToString(uint32_t type);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_detection_cpu_cpu
|
|
||||||
#define FF_INCLUDED_detection_cpu_cpu
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
|
|
||||||
#define FF_CPU_TEMP_UNSET (0/0.0)
|
#define FF_CPU_TEMP_UNSET (0/0.0)
|
||||||
@@ -23,5 +20,3 @@ typedef struct FFCPUResult
|
|||||||
} FFCPUResult;
|
} FFCPUResult;
|
||||||
|
|
||||||
const char* ffDetectCPU(const FFCPUOptions* options, FFCPUResult* cpu);
|
const char* ffDetectCPU(const FFCPUOptions* options, FFCPUResult* cpu);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_detection_cpuusage_cpuusage
|
|
||||||
#define FF_INCLUDED_detection_cpuusage_cpuusage
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
|
|
||||||
typedef struct FFCpuUsageInfo {
|
typedef struct FFCpuUsageInfo {
|
||||||
@@ -12,5 +9,3 @@ typedef struct FFCpuUsageInfo {
|
|||||||
const char* ffGetCpuUsageInfo(FFlist* cpuTimes);
|
const char* ffGetCpuUsageInfo(FFlist* cpuTimes);
|
||||||
|
|
||||||
const char* ffGetCpuUsageResult(FFlist* result); // list of double
|
const char* ffGetCpuUsageResult(FFlist* result); // list of double
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -7,30 +7,42 @@
|
|||||||
|
|
||||||
const char* ffGetCpuUsageInfo(FFlist* cpuTimes)
|
const char* ffGetCpuUsageInfo(FFlist* cpuTimes)
|
||||||
{
|
{
|
||||||
FF_AUTO_CLOSE_FILE FILE* procStat = fopen("/proc/stat", "r");
|
char buf[PROC_FILE_BUFFSIZ];
|
||||||
if(procStat == NULL)
|
ssize_t nRead = ffReadFileData("/proc/stat", sizeof(buf) - 1, buf);
|
||||||
|
if(nRead < 0)
|
||||||
{
|
{
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
return "Accessing \"/proc/stat\" is restricted on Android O+";
|
return "Accessing \"/proc/stat\" is restricted on Android O+";
|
||||||
#else
|
#else
|
||||||
return "fopen(\"""/proc/stat\", \"r\") == NULL";
|
return "ffReadFileData(\"/proc/stat\", sizeof(buf) - 1, buf) failed";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
buf[nRead] = '\0';
|
||||||
|
|
||||||
// Skip first line
|
// Skip first line
|
||||||
if (fscanf(procStat, "cpu%*[^\n]\n") < 0)
|
char *start = NULL;
|
||||||
return "fscanf() first line failed";
|
if((start = strchr(buf, '\n')) == NULL)
|
||||||
|
return "skip first line failed";
|
||||||
|
++start;
|
||||||
|
|
||||||
uint64_t user = 0, nice = 0, system = 0, idle = 0, iowait = 0, irq = 0, softirq = 0;
|
uint64_t user = 0, nice = 0, system = 0, idle = 0, iowait = 0, irq = 0, softirq = 0;
|
||||||
while (fscanf(procStat, "cpu%*d%" PRIu64 "%" PRIu64 "%" PRIu64 "%" PRIu64 "%" PRIu64 "%" PRIu64 "%" PRIu64 "%*[^\n]\n", &user, &nice, &system, &idle, &iowait, &irq, &softirq) == 7)
|
char *token = NULL;
|
||||||
|
while ((token = strchr(start, '\n')))
|
||||||
{
|
{
|
||||||
uint64_t inUse = user + nice + system;
|
if(sscanf(start, "cpu%*d%" PRIu64 "%" PRIu64 "%" PRIu64 "%" PRIu64 "%" PRIu64 "%" PRIu64 "%" PRIu64 "%*[^\n]\n", &user, &nice, &system, &idle, &iowait, &irq, &softirq) == 7)
|
||||||
uint64_t total = inUse + idle + iowait + irq + softirq;
|
{
|
||||||
|
uint64_t inUse = user + nice + system;
|
||||||
|
uint64_t total = inUse + idle + iowait + irq + softirq;
|
||||||
|
|
||||||
FFCpuUsageInfo* info = (FFCpuUsageInfo*) ffListAdd(cpuTimes);
|
FFCpuUsageInfo* info = (FFCpuUsageInfo*) ffListAdd(cpuTimes);
|
||||||
*info = (FFCpuUsageInfo) {
|
*info = (FFCpuUsageInfo) {
|
||||||
.inUseAll = (uint64_t)inUse,
|
.inUseAll = (uint64_t)inUse,
|
||||||
.totalAll = (uint64_t)total,
|
.totalAll = (uint64_t)total,
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
start = token + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_detection_cursor_cursor
|
|
||||||
#define FF_INCLUDED_detection_cursor_cursor
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
|
|
||||||
typedef struct FFCursorResult
|
typedef struct FFCursorResult
|
||||||
@@ -13,5 +10,3 @@ typedef struct FFCursorResult
|
|||||||
} FFCursorResult;
|
} FFCursorResult;
|
||||||
|
|
||||||
void ffDetectCursor(FFCursorResult* result);
|
void ffDetectCursor(FFCursorResult* result);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ const char* ffDetectDEVersion(const FFstrbuf* deName, FFstrbuf* result, FFDEOpti
|
|||||||
{
|
{
|
||||||
if (ffStrbufEqualS(deName, FF_DE_PRETTY_PLASMA))
|
if (ffStrbufEqualS(deName, FF_DE_PRETTY_PLASMA))
|
||||||
getKDE(result, options);
|
getKDE(result, options);
|
||||||
else if (ffStrbufEqualS(deName, FF_DE_PRETTY_GNOME) || ffStrbufEqualS(deName, FF_DE_PRETTY_GNOME))
|
else if (ffStrbufEqualS(deName, FF_DE_PRETTY_GNOME))
|
||||||
getGnome(result, options);
|
getGnome(result, options);
|
||||||
else if (ffStrbufEqualS(deName, FF_DE_PRETTY_CINNAMON))
|
else if (ffStrbufEqualS(deName, FF_DE_PRETTY_CINNAMON))
|
||||||
getCinnamon(result, options);
|
getCinnamon(result, options);
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_detection_disk_disk
|
|
||||||
#define FF_INCLUDED_detection_disk_disk
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
|
|
||||||
typedef struct FFDisk
|
typedef struct FFDisk
|
||||||
@@ -26,6 +23,4 @@ typedef struct FFDisk
|
|||||||
* Returns a List of FFDisk, sorted alphabetically by mountpoint.
|
* Returns a List of FFDisk, sorted alphabetically by mountpoint.
|
||||||
* If error is not set, disks contains at least one disk.
|
* If error is not set, disks contains at least one disk.
|
||||||
*/
|
*/
|
||||||
const char* ffDetectDisks(FFDiskOptions* options, FFlist* result /* list of FFDisk */);
|
const char* ffDetectDisks(FFDiskOptions* options, FFlist* disks /* list of FFDisk */);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
static bool isPhysicalDevice(const struct mntent* device)
|
static bool isPhysicalDevice(const struct mntent* device)
|
||||||
{
|
{
|
||||||
#ifndef __ANDROID__ //On Android, `/dev` is not accessable, so that the following checks always fail
|
#ifndef __ANDROID__ //On Android, `/dev` is not accessible, so that the following checks always fail
|
||||||
|
|
||||||
//Always show the root path
|
//Always show the root path
|
||||||
if(ffStrEquals(device->mnt_dir, "/"))
|
if(ffStrEquals(device->mnt_dir, "/"))
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ typedef struct FFDiskIOResult
|
|||||||
FFstrbuf name;
|
FFstrbuf name;
|
||||||
FFstrbuf interconnect;
|
FFstrbuf interconnect;
|
||||||
FFDiskIOPhysicalType type;
|
FFDiskIOPhysicalType type;
|
||||||
|
uint64_t size;
|
||||||
FFstrbuf devPath;
|
FFstrbuf devPath;
|
||||||
uint64_t bytesRead;
|
uint64_t bytesRead;
|
||||||
uint64_t readCount;
|
uint64_t readCount;
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ const char* ffDiskIOGetIoCounters(FFlist* result, FFDiskIOOptions* options)
|
|||||||
ffStrbufInitS(&device->name, deviceName);
|
ffStrbufInitS(&device->name, deviceName);
|
||||||
ffStrbufInit(&device->devPath);
|
ffStrbufInit(&device->devPath);
|
||||||
device->type = FF_DISKIO_PHYSICAL_TYPE_UNKNOWN;
|
device->type = FF_DISKIO_PHYSICAL_TYPE_UNKNOWN;
|
||||||
|
device->size = 0;
|
||||||
|
|
||||||
ffCfDictGetInt64(statistics, CFSTR(kIOBlockStorageDriverStatisticsBytesReadKey), (int64_t*) &device->bytesRead);
|
ffCfDictGetInt64(statistics, CFSTR(kIOBlockStorageDriverStatisticsBytesReadKey), (int64_t*) &device->bytesRead);
|
||||||
ffCfDictGetInt64(statistics, CFSTR(kIOBlockStorageDriverStatisticsBytesWrittenKey), (int64_t*) &device->bytesWritten);
|
ffCfDictGetInt64(statistics, CFSTR(kIOBlockStorageDriverStatisticsBytesWrittenKey), (int64_t*) &device->bytesWritten);
|
||||||
@@ -62,6 +63,12 @@ const char* ffDiskIOGetIoCounters(FFlist* result, FFDiskIOOptions* options)
|
|||||||
ffStrbufPrependS(&device->devPath, "/dev/");
|
ffStrbufPrependS(&device->devPath, "/dev/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FF_CFTYPE_AUTO_RELEASE CFNumberRef mediaSize = IORegistryEntryCreateCFProperty(entryPartition, CFSTR(kIOMediaSizeKey), kCFAllocatorDefault, kNilOptions);
|
||||||
|
if (mediaSize)
|
||||||
|
ffCfNumGetInt64(mediaSize, (int64_t*) &device->size);
|
||||||
|
else
|
||||||
|
device->size = 0;
|
||||||
|
|
||||||
ffStrbufInit(&device->interconnect);
|
ffStrbufInit(&device->interconnect);
|
||||||
FF_IOOBJECT_AUTO_RELEASE io_registry_entry_t entryPhysical = 0;
|
FF_IOOBJECT_AUTO_RELEASE io_registry_entry_t entryPhysical = 0;
|
||||||
if (IORegistryEntryGetParentEntry(entryDriver, kIOServicePlane, &entryPhysical) == KERN_SUCCESS)
|
if (IORegistryEntryGetParentEntry(entryDriver, kIOServicePlane, &entryPhysical) == KERN_SUCCESS)
|
||||||
|
|||||||
@@ -1,51 +1,70 @@
|
|||||||
#include "diskio.h"
|
#include "diskio.h"
|
||||||
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#include <devstat.h>
|
#include <devstat.h>
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <sys/disk.h>
|
||||||
|
#include <libgeom.h>
|
||||||
|
|
||||||
const char* ffDiskIOGetIoCounters(FFlist* result, FFDiskIOOptions* options)
|
const char* ffDiskIOGetIoCounters(FFlist* result, FFDiskIOOptions* options)
|
||||||
{
|
{
|
||||||
if (devstat_checkversion(NULL) < 0)
|
struct gmesh geomTree;
|
||||||
return "devstat_checkversion() failed";
|
if (geom_gettree(&geomTree) < 0)
|
||||||
|
return "geom_gettree() failed";
|
||||||
|
|
||||||
struct statinfo stats = {
|
if (geom_stats_open() < 0)
|
||||||
.dinfo = (struct devinfo *)calloc(1, sizeof(struct devinfo)),
|
return "geom_stats_open() failed";
|
||||||
};
|
|
||||||
if (devstat_getdevs(NULL, &stats) < 0)
|
|
||||||
return "devstat_getdevs() failed";
|
|
||||||
|
|
||||||
for (int i = 0; i < stats.dinfo->numdevs; i++)
|
void* snap = geom_stats_snapshot_get();
|
||||||
|
struct devstat* snapIter;
|
||||||
|
while ((snapIter = geom_stats_snapshot_next(snap)) != NULL)
|
||||||
{
|
{
|
||||||
struct devstat* current = &stats.dinfo->devices[i];
|
if (snapIter->device_type & DEVSTAT_TYPE_PASS)
|
||||||
if (current->device_type & DEVSTAT_TYPE_PASS)
|
continue;
|
||||||
|
struct gident* geomId = geom_lookupid(&geomTree, snapIter->id);
|
||||||
|
if (geomId == NULL)
|
||||||
|
continue;
|
||||||
|
if (geomId->lg_what != ISPROVIDER)
|
||||||
|
continue;
|
||||||
|
struct gprovider* provider = (struct gprovider*) geomId->lg_ptr;
|
||||||
|
if (provider->lg_geom->lg_rank != 1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
char deviceName[128];
|
FF_STRBUF_AUTO_DESTROY name = ffStrbufCreateS(provider->lg_name);
|
||||||
snprintf(deviceName, sizeof(deviceName), "%s%d", current->device_name, current->unit_number);
|
FFDiskIOPhysicalType type = FF_DISKIO_PHYSICAL_TYPE_UNKNOWN;
|
||||||
|
for (struct gconfig* ptr = provider->lg_config.lh_first; ptr; ptr = ptr->lg_config.le_next)
|
||||||
|
{
|
||||||
|
if (ffStrEquals(ptr->lg_name, "descr"))
|
||||||
|
ffStrbufSetS(&name, ptr->lg_val);
|
||||||
|
else if (ffStrEquals(ptr->lg_name, "rotationrate") && !ffStrEquals(ptr->lg_val, "unknown"))
|
||||||
|
type = ffStrEquals(ptr->lg_val, "0") ? FF_DISKIO_PHYSICAL_TYPE_SSD : FF_DISKIO_PHYSICAL_TYPE_HDD;
|
||||||
|
}
|
||||||
|
|
||||||
if (options->namePrefix.length && strncmp(deviceName, options->namePrefix.chars, options->namePrefix.length) != 0)
|
if (options->namePrefix.length && !ffStrbufStartsWith(&name, &options->namePrefix))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
FFDiskIOResult* device = (FFDiskIOResult*) ffListAdd(result);
|
FFDiskIOResult* device = (FFDiskIOResult*) ffListAdd(result);
|
||||||
ffStrbufInitS(&device->name, deviceName);
|
ffStrbufInitF(&device->devPath, "/dev/%s", provider->lg_name);
|
||||||
ffStrbufInitF(&device->devPath, "/dev/%s", deviceName);
|
|
||||||
device->type = FF_DISKIO_PHYSICAL_TYPE_UNKNOWN;
|
|
||||||
ffStrbufInit(&device->interconnect);
|
ffStrbufInit(&device->interconnect);
|
||||||
switch (current->device_type & DEVSTAT_TYPE_IF_MASK)
|
switch (snapIter->device_type & DEVSTAT_TYPE_IF_MASK)
|
||||||
{
|
{
|
||||||
case DEVSTAT_TYPE_IF_SCSI: ffStrbufAppendS(&device->interconnect, "SCSI"); break;
|
case DEVSTAT_TYPE_IF_SCSI: ffStrbufAppendS(&device->interconnect, "SCSI"); break;
|
||||||
case DEVSTAT_TYPE_IF_IDE: ffStrbufAppendS(&device->interconnect, "IDE"); break;
|
case DEVSTAT_TYPE_IF_IDE: ffStrbufAppendS(&device->interconnect, "IDE"); break;
|
||||||
case DEVSTAT_TYPE_IF_OTHER: ffStrbufAppendS(&device->interconnect, "OTHER"); break;
|
case DEVSTAT_TYPE_IF_OTHER: ffStrbufAppendS(&device->interconnect, "OTHER"); break;
|
||||||
}
|
}
|
||||||
device->bytesRead = current->bytes[DEVSTAT_READ];
|
device->bytesRead = snapIter->bytes[DEVSTAT_READ];
|
||||||
device->readCount = current->operations[DEVSTAT_READ];
|
device->readCount = snapIter->operations[DEVSTAT_READ];
|
||||||
device->bytesWritten = current->bytes[DEVSTAT_WRITE];
|
device->bytesWritten = snapIter->bytes[DEVSTAT_WRITE];
|
||||||
device->writeCount = current->operations[DEVSTAT_WRITE];
|
device->writeCount = snapIter->operations[DEVSTAT_WRITE];
|
||||||
|
device->size = (uint64_t) provider->lg_mediasize;
|
||||||
|
ffStrbufInitMove(&device->name, &name);
|
||||||
|
device->type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stats.dinfo->mem_ptr)
|
geom_stats_snapshot_free(snap);
|
||||||
free(stats.dinfo->mem_ptr);
|
geom_stats_close();
|
||||||
free(stats.dinfo);
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ const char* ffDiskIOGetIoCounters(FFlist* result, FFDiskIOOptions* options)
|
|||||||
if (part && isdigit(part[strlen("-part")]))
|
if (part && isdigit(part[strlen("-part")]))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (ffStrStartsWith(entry->d_name, "nvme-eui.")) // NVMe drive indentifier
|
if (ffStrStartsWith(entry->d_name, "nvme-eui.")) // NVMe drive identifier
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Other exceptions?
|
// Other exceptions?
|
||||||
@@ -102,6 +102,12 @@ const char* ffDiskIOGetIoCounters(FFlist* result, FFDiskIOOptions* options)
|
|||||||
device->type = ffStrbufEqualS(&buffer, "1") ? FF_DISKIO_PHYSICAL_TYPE_HDD : FF_DISKIO_PHYSICAL_TYPE_SSD;
|
device->type = ffStrbufEqualS(&buffer, "1") ? FF_DISKIO_PHYSICAL_TYPE_HDD : FF_DISKIO_PHYSICAL_TYPE_SSD;
|
||||||
else
|
else
|
||||||
device->type = FF_DISKIO_PHYSICAL_TYPE_UNKNOWN;
|
device->type = FF_DISKIO_PHYSICAL_TYPE_UNKNOWN;
|
||||||
|
|
||||||
|
snprintf(pathSysBlock, PATH_MAX, "/sys/block/%s/size", devName);
|
||||||
|
if (ffReadFileBuffer(pathSysBlock, &buffer))
|
||||||
|
device->size = ffStrbufToUInt(&buffer, 0);
|
||||||
|
else
|
||||||
|
device->size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -82,6 +82,20 @@ const char* ffDiskIOGetIoCounters(FFlist* result, FFDiskIOOptions* options)
|
|||||||
device->type = dspd.IncursSeekPenalty ? FF_DISKIO_PHYSICAL_TYPE_HDD : FF_DISKIO_PHYSICAL_TYPE_SSD;
|
device->type = dspd.IncursSeekPenalty ? FF_DISKIO_PHYSICAL_TYPE_HDD : FF_DISKIO_PHYSICAL_TYPE_SSD;
|
||||||
else
|
else
|
||||||
device->type = FF_DISKIO_PHYSICAL_TYPE_UNKNOWN;
|
device->type = FF_DISKIO_PHYSICAL_TYPE_UNKNOWN;
|
||||||
|
|
||||||
|
DISK_GEOMETRY_EX dge = {};
|
||||||
|
if(DeviceIoControl(
|
||||||
|
hDevice,
|
||||||
|
IOCTL_DISK_GET_DRIVE_GEOMETRY_EX,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
&dge,
|
||||||
|
sizeof(dge),
|
||||||
|
&retSize,
|
||||||
|
NULL))
|
||||||
|
device->size = (uint64_t) dge.DiskSize.QuadPart;
|
||||||
|
else
|
||||||
|
device->size = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_detection_displayserver
|
|
||||||
#define FF_INCLUDED_detection_displayserver
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
|
|
||||||
#define FF_DE_PRETTY_PLASMA "KDE Plasma"
|
#define FF_DE_PRETTY_PLASMA "KDE Plasma"
|
||||||
@@ -85,5 +82,3 @@ bool ffdsAppendDisplay(
|
|||||||
FFDisplayType type,
|
FFDisplayType type,
|
||||||
bool primary,
|
bool primary,
|
||||||
uint64_t id);
|
uint64_t id);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,82 +1,5 @@
|
|||||||
#include "displayserver_linux.h"
|
#include "displayserver_linux.h"
|
||||||
#include "common/io/io.h"
|
#include "common/io/io.h"
|
||||||
#include "util/edidHelper.h"
|
|
||||||
#include "util/stringUtils.h"
|
|
||||||
|
|
||||||
#include <dirent.h>
|
|
||||||
|
|
||||||
static void parseDRM(FFDisplayServerResult* result)
|
|
||||||
{
|
|
||||||
const char* drmDirPath = "/sys/class/drm/";
|
|
||||||
|
|
||||||
DIR* dirp = opendir(drmDirPath);
|
|
||||||
if(dirp == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
FF_STRBUF_AUTO_DESTROY drmDir = ffStrbufCreateA(64);
|
|
||||||
ffStrbufAppendS(&drmDir, drmDirPath);
|
|
||||||
|
|
||||||
uint32_t drmDirLength = drmDir.length;
|
|
||||||
|
|
||||||
struct dirent* entry;
|
|
||||||
while((entry = readdir(dirp)) != NULL)
|
|
||||||
{
|
|
||||||
if(ffStrEquals(entry->d_name, ".") || ffStrEquals(entry->d_name, ".."))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
ffStrbufAppendS(&drmDir, entry->d_name);
|
|
||||||
ffStrbufAppendS(&drmDir, "/modes");
|
|
||||||
|
|
||||||
FILE* modeFile = fopen(drmDir.chars, "r");
|
|
||||||
if(modeFile == NULL)
|
|
||||||
{
|
|
||||||
ffStrbufSubstrBefore(&drmDir, drmDirLength);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t width = 0, height = 0;
|
|
||||||
|
|
||||||
int scanned = fscanf(modeFile, "%ux%u", &width, &height);
|
|
||||||
if(scanned == 2 && width > 0 && height > 0)
|
|
||||||
{
|
|
||||||
ffStrbufSubstrBefore(&drmDir, drmDirLength);
|
|
||||||
ffStrbufAppendS(&drmDir, entry->d_name);
|
|
||||||
ffStrbufAppendS(&drmDir, "/edid");
|
|
||||||
|
|
||||||
FF_STRBUF_AUTO_DESTROY name = ffStrbufCreate();
|
|
||||||
uint8_t edidData[128];
|
|
||||||
if(ffReadFileData(drmDir.chars, sizeof(edidData), edidData) == sizeof(edidData))
|
|
||||||
ffEdidGetName(edidData, &name);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const char* plainName = entry->d_name;
|
|
||||||
if (ffStrStartsWith(plainName, "card"))
|
|
||||||
{
|
|
||||||
const char* tmp = strchr(plainName + strlen("card"), '-');
|
|
||||||
if (tmp) plainName = tmp + 1;
|
|
||||||
}
|
|
||||||
ffStrbufAppendS(&name, plainName);
|
|
||||||
}
|
|
||||||
|
|
||||||
ffdsAppendDisplay(
|
|
||||||
result,
|
|
||||||
width, height,
|
|
||||||
0,
|
|
||||||
0, 0,
|
|
||||||
0,
|
|
||||||
&name,
|
|
||||||
FF_DISPLAY_TYPE_UNKNOWN,
|
|
||||||
false,
|
|
||||||
0
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose(modeFile);
|
|
||||||
ffStrbufSubstrBefore(&drmDir, drmDirLength);
|
|
||||||
}
|
|
||||||
|
|
||||||
closedir(dirp);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ffConnectDisplayServerImpl(FFDisplayServerResult* ds)
|
void ffConnectDisplayServerImpl(FFDisplayServerResult* ds)
|
||||||
{
|
{
|
||||||
@@ -89,7 +12,7 @@ void ffConnectDisplayServerImpl(FFDisplayServerResult* ds)
|
|||||||
|
|
||||||
if (!instance.config.general.dsForceDrm)
|
if (!instance.config.general.dsForceDrm)
|
||||||
{
|
{
|
||||||
//We try wayland as our prefered display server, as it supports the most features.
|
//We try wayland as our preferred display server, as it supports the most features.
|
||||||
//This method can't detect the name of our WM / DE
|
//This method can't detect the name of our WM / DE
|
||||||
ffdsConnectWayland(ds);
|
ffdsConnectWayland(ds);
|
||||||
|
|
||||||
@@ -113,7 +36,7 @@ void ffConnectDisplayServerImpl(FFDisplayServerResult* ds)
|
|||||||
//This display detection method is display server independent.
|
//This display detection method is display server independent.
|
||||||
//Use it if all connections failed
|
//Use it if all connections failed
|
||||||
if(ds->displays.length == 0)
|
if(ds->displays.length == 0)
|
||||||
parseDRM(ds);
|
ffdsConnectDrm(ds);
|
||||||
|
|
||||||
//This fills in missing information about WM / DE by using env vars and iterating processes
|
//This fills in missing information about WM / DE by using env vars and iterating processes
|
||||||
ffdsDetectWMDE(ds);
|
ffdsDetectWMDE(ds);
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ void ffdsConnectXcb(FFDisplayServerResult* result);
|
|||||||
void ffdsConnectXrandr(FFDisplayServerResult* result);
|
void ffdsConnectXrandr(FFDisplayServerResult* result);
|
||||||
void ffdsConnectXlib(FFDisplayServerResult* result);
|
void ffdsConnectXlib(FFDisplayServerResult* result);
|
||||||
|
|
||||||
|
void ffdsConnectDrm(FFDisplayServerResult* result);
|
||||||
|
|
||||||
void ffdsDetectWMDE(FFDisplayServerResult* result);
|
void ffdsDetectWMDE(FFDisplayServerResult* result);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -0,0 +1,293 @@
|
|||||||
|
#include "displayserver_linux.h"
|
||||||
|
#include "common/io/io.h"
|
||||||
|
#include "util/edidHelper.h"
|
||||||
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
|
#include <dirent.h>
|
||||||
|
|
||||||
|
static const char* drmParseSysfs(FFDisplayServerResult* result)
|
||||||
|
{
|
||||||
|
const char* drmDirPath = "/sys/class/drm/";
|
||||||
|
|
||||||
|
FF_AUTO_CLOSE_DIR DIR* dirp = opendir(drmDirPath);
|
||||||
|
if(dirp == NULL)
|
||||||
|
return "opendir(drmDirPath) failed";
|
||||||
|
|
||||||
|
FF_STRBUF_AUTO_DESTROY drmDir = ffStrbufCreateA(64);
|
||||||
|
ffStrbufAppendS(&drmDir, drmDirPath);
|
||||||
|
|
||||||
|
uint32_t drmDirLength = drmDir.length;
|
||||||
|
|
||||||
|
struct dirent* entry;
|
||||||
|
while((entry = readdir(dirp)) != NULL)
|
||||||
|
{
|
||||||
|
if(ffStrEquals(entry->d_name, ".") || ffStrEquals(entry->d_name, ".."))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
ffStrbufAppendS(&drmDir, entry->d_name);
|
||||||
|
uint32_t drmDirWithDnameLength = drmDir.length;
|
||||||
|
|
||||||
|
ffStrbufAppendS(&drmDir, "/enabled");
|
||||||
|
char enabled = 'd'; // disabled
|
||||||
|
ffReadFileData(drmDir.chars, sizeof(enabled), &enabled);
|
||||||
|
if (enabled != 'e') // enabled
|
||||||
|
{
|
||||||
|
ffStrbufSubstrBefore(&drmDir, drmDirLength);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ffStrbufSubstrBefore(&drmDir, drmDirWithDnameLength);
|
||||||
|
ffStrbufAppendS(&drmDir, "/modes");
|
||||||
|
|
||||||
|
char modes[32];
|
||||||
|
if (ffReadFileData(drmDir.chars, sizeof(modes), modes) < 3)
|
||||||
|
{
|
||||||
|
ffStrbufSubstrBefore(&drmDir, drmDirLength);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t width = 0, height = 0;
|
||||||
|
|
||||||
|
int scanned = sscanf(modes, "%ux%u", &width, &height);
|
||||||
|
if(scanned == 2 && width > 0 && height > 0)
|
||||||
|
{
|
||||||
|
ffStrbufSubstrBefore(&drmDir, drmDirLength);
|
||||||
|
ffStrbufAppendS(&drmDir, entry->d_name);
|
||||||
|
ffStrbufAppendS(&drmDir, "/edid");
|
||||||
|
|
||||||
|
FF_STRBUF_AUTO_DESTROY name = ffStrbufCreate();
|
||||||
|
uint8_t edidData[128];
|
||||||
|
if(ffReadFileData(drmDir.chars, sizeof(edidData), edidData) == sizeof(edidData))
|
||||||
|
ffEdidGetName(edidData, &name);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const char* plainName = entry->d_name;
|
||||||
|
if (ffStrStartsWith(plainName, "card"))
|
||||||
|
{
|
||||||
|
const char* tmp = strchr(plainName + strlen("card"), '-');
|
||||||
|
if (tmp) plainName = tmp + 1;
|
||||||
|
}
|
||||||
|
ffStrbufAppendS(&name, plainName);
|
||||||
|
}
|
||||||
|
|
||||||
|
ffdsAppendDisplay(
|
||||||
|
result,
|
||||||
|
width, height,
|
||||||
|
0,
|
||||||
|
0, 0,
|
||||||
|
0,
|
||||||
|
&name,
|
||||||
|
FF_DISPLAY_TYPE_UNKNOWN,
|
||||||
|
false,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
ffStrbufSubstrBefore(&drmDir, drmDirLength);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef FF_HAVE_DRM
|
||||||
|
|
||||||
|
#include "common/library.h"
|
||||||
|
|
||||||
|
#include <xf86drm.h>
|
||||||
|
#include <xf86drmMode.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
// https://gitlab.freedesktop.org/mesa/drm/-/blob/main/xf86drmMode.c#L1785
|
||||||
|
// It's not supported on Ubuntu 20.04
|
||||||
|
static inline const char* drmType2Name(uint32_t connector_type)
|
||||||
|
{
|
||||||
|
/* Keep the strings in sync with the kernel's drm_connector_enum_list in
|
||||||
|
* drm_connector.c. */
|
||||||
|
switch (connector_type)
|
||||||
|
{
|
||||||
|
case DRM_MODE_CONNECTOR_Unknown:
|
||||||
|
return "Unknown";
|
||||||
|
case DRM_MODE_CONNECTOR_VGA:
|
||||||
|
return "VGA";
|
||||||
|
case DRM_MODE_CONNECTOR_DVII:
|
||||||
|
return "DVI-I";
|
||||||
|
case DRM_MODE_CONNECTOR_DVID:
|
||||||
|
return "DVI-D";
|
||||||
|
case DRM_MODE_CONNECTOR_DVIA:
|
||||||
|
return "DVI-A";
|
||||||
|
case DRM_MODE_CONNECTOR_Composite:
|
||||||
|
return "Composite";
|
||||||
|
case DRM_MODE_CONNECTOR_SVIDEO:
|
||||||
|
return "SVIDEO";
|
||||||
|
case DRM_MODE_CONNECTOR_LVDS:
|
||||||
|
return "LVDS";
|
||||||
|
case DRM_MODE_CONNECTOR_Component:
|
||||||
|
return "Component";
|
||||||
|
case DRM_MODE_CONNECTOR_9PinDIN:
|
||||||
|
return "DIN";
|
||||||
|
case DRM_MODE_CONNECTOR_DisplayPort:
|
||||||
|
return "DP";
|
||||||
|
case DRM_MODE_CONNECTOR_HDMIA:
|
||||||
|
return "HDMI-A";
|
||||||
|
case DRM_MODE_CONNECTOR_HDMIB:
|
||||||
|
return "HDMI-B";
|
||||||
|
case DRM_MODE_CONNECTOR_TV:
|
||||||
|
return "TV";
|
||||||
|
case DRM_MODE_CONNECTOR_eDP:
|
||||||
|
return "eDP";
|
||||||
|
case DRM_MODE_CONNECTOR_VIRTUAL:
|
||||||
|
return "Virtual";
|
||||||
|
case DRM_MODE_CONNECTOR_DSI:
|
||||||
|
return "DSI";
|
||||||
|
case DRM_MODE_CONNECTOR_DPI:
|
||||||
|
return "DPI";
|
||||||
|
case DRM_MODE_CONNECTOR_WRITEBACK:
|
||||||
|
return "Writeback";
|
||||||
|
case DRM_MODE_CONNECTOR_SPI:
|
||||||
|
return "SPI";
|
||||||
|
case 20 /*DRM_MODE_CONNECTOR_USB*/:
|
||||||
|
return "USB";
|
||||||
|
default:
|
||||||
|
return "Unsupported";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char* drmConnectLibdrm(FFDisplayServerResult* result)
|
||||||
|
{
|
||||||
|
FF_LIBRARY_LOAD(libdrm, &instance.config.library.libdrm, "dlopen(libdrm)" FF_LIBRARY_EXTENSION " failed", "libdrm" FF_LIBRARY_EXTENSION, 2)
|
||||||
|
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libdrm, drmGetDevices)
|
||||||
|
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libdrm, drmModeGetResources)
|
||||||
|
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libdrm, drmModeGetConnectorCurrent)
|
||||||
|
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libdrm, drmModeGetCrtc)
|
||||||
|
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libdrm, drmModeGetEncoder)
|
||||||
|
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libdrm, drmModeGetProperty)
|
||||||
|
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libdrm, drmModeGetPropertyBlob)
|
||||||
|
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libdrm, drmModeFreeCrtc)
|
||||||
|
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libdrm, drmModeFreeEncoder)
|
||||||
|
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libdrm, drmModeFreeConnector)
|
||||||
|
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libdrm, drmModeFreeProperty)
|
||||||
|
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libdrm, drmModeFreePropertyBlob)
|
||||||
|
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libdrm, drmFreeDevices)
|
||||||
|
|
||||||
|
drmDevice* devices[64];
|
||||||
|
int nDevices = ffdrmGetDevices(devices, sizeof(devices) / sizeof(devices[0]));
|
||||||
|
if (nDevices < 0)
|
||||||
|
return "drmGetDevices() failed";
|
||||||
|
|
||||||
|
for (int iDev = 0; iDev < nDevices; ++iDev)
|
||||||
|
{
|
||||||
|
drmDevice* dev = devices[iDev];
|
||||||
|
|
||||||
|
if (!(dev->available_nodes & (1 << DRM_NODE_PRIMARY)))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const char* path = dev->nodes[DRM_NODE_PRIMARY];
|
||||||
|
FF_AUTO_CLOSE_FD int fd = open(path, O_RDONLY | O_CLOEXEC);
|
||||||
|
if (fd < 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
drmModeRes* res = ffdrmModeGetResources(fd);
|
||||||
|
if (!res)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (int iConn = 0; iConn < res->count_connectors; ++iConn)
|
||||||
|
{
|
||||||
|
drmModeConnector* conn = ffdrmModeGetConnectorCurrent(fd, res->connectors[iConn]);
|
||||||
|
if (!conn)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (conn->connection != DRM_MODE_CONNECTED)
|
||||||
|
goto next_conn;
|
||||||
|
|
||||||
|
drmModeEncoder* encoder = ffdrmModeGetEncoder(fd, conn->encoder_id);
|
||||||
|
if (!encoder)
|
||||||
|
goto next_conn;
|
||||||
|
|
||||||
|
drmModeCrtc* crtc = ffdrmModeGetCrtc(fd, encoder->crtc_id);
|
||||||
|
if (!crtc)
|
||||||
|
goto next_encoder;
|
||||||
|
|
||||||
|
{
|
||||||
|
FF_STRBUF_AUTO_DESTROY name = ffStrbufCreate();
|
||||||
|
|
||||||
|
for (int iProp = 0; iProp < conn->count_props; ++iProp)
|
||||||
|
{
|
||||||
|
drmModePropertyRes *prop = ffdrmModeGetProperty(fd, conn->props[iProp]);
|
||||||
|
if (!prop)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
uint32_t type = prop->flags & (DRM_MODE_PROP_LEGACY_TYPE | DRM_MODE_PROP_EXTENDED_TYPE);
|
||||||
|
if (type == DRM_MODE_PROP_BLOB && ffStrEquals(prop->name, "EDID"))
|
||||||
|
{
|
||||||
|
// Stangely, prop->count_blobs is 0 and prop->blob_ids is NULL
|
||||||
|
drmModePropertyBlobPtr blob = ffdrmModeGetPropertyBlob(fd, (uint32_t) conn->prop_values[iProp]);
|
||||||
|
if (blob->length >= 128)
|
||||||
|
ffEdidGetName(blob->data, &name);
|
||||||
|
ffdrmModeFreePropertyBlob(blob);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ffdrmModeFreeProperty(prop);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name.length == 0)
|
||||||
|
{
|
||||||
|
const char* connectorTypeName = drmType2Name(conn->connector_type);
|
||||||
|
if (connectorTypeName == NULL)
|
||||||
|
connectorTypeName = "Unknown";
|
||||||
|
ffStrbufSetF(&name, "%s-%d", connectorTypeName, iConn);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t refreshRate = crtc->mode.vrefresh;
|
||||||
|
if (refreshRate == 0)
|
||||||
|
{
|
||||||
|
// There are weird cases that we can't get the refresh rate from the CRTC but from the modes
|
||||||
|
for (int iMode = 0; iMode < conn->count_modes; ++iMode)
|
||||||
|
{
|
||||||
|
drmModeModeInfo* mode = &conn->modes[iMode];
|
||||||
|
if (mode->clock == crtc->mode.clock && mode->htotal == crtc->mode.htotal)
|
||||||
|
{
|
||||||
|
refreshRate = mode->vrefresh;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ffdsAppendDisplay(
|
||||||
|
result,
|
||||||
|
crtc->width, crtc->height,
|
||||||
|
refreshRate,
|
||||||
|
0, 0,
|
||||||
|
0,
|
||||||
|
&name,
|
||||||
|
FF_DISPLAY_TYPE_UNKNOWN,
|
||||||
|
false,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
ffdrmModeFreeCrtc(crtc);
|
||||||
|
|
||||||
|
next_encoder:
|
||||||
|
ffdrmModeFreeEncoder(encoder);
|
||||||
|
|
||||||
|
next_conn:
|
||||||
|
ffdrmModeFreeConnector(conn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ffdrmFreeDevices(devices, nDevices);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void ffdsConnectDrm(FFDisplayServerResult* result)
|
||||||
|
{
|
||||||
|
#ifdef FF_HAVE_DRM
|
||||||
|
if (drmConnectLibdrm(result) == NULL)
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
drmParseSysfs(result);
|
||||||
|
}
|
||||||
@@ -333,7 +333,7 @@ void ffdsDetectWMDE(FFDisplayServerResult* result)
|
|||||||
applyPrettyNameIfDE(result, env);
|
applyPrettyNameIfDE(result, env);
|
||||||
|
|
||||||
//If WM was found by connection to the sever, and DE in the environment, we can return
|
//If WM was found by connection to the sever, and DE in the environment, we can return
|
||||||
//This way we never call getFromProcDir(), which has slow initalization time
|
//This way we never call getFromProcDir(), which has slow initialization time
|
||||||
if(result->dePrettyName.length > 0 && result->wmPrettyName.length > 0)
|
if(result->dePrettyName.length > 0 && result->wmPrettyName.length > 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "displayserver_linux.h"
|
#include "displayserver_linux.h"
|
||||||
#include "util/mallocHelper.h"
|
#include "util/mallocHelper.h"
|
||||||
|
#include "common/time.h"
|
||||||
|
|
||||||
#ifdef FF_HAVE_XCB
|
#ifdef FF_HAVE_XCB
|
||||||
#include "common/library.h"
|
#include "common/library.h"
|
||||||
@@ -60,7 +61,7 @@ static void* xcbGetProperty(XcbPropertyData* data, xcb_connection_t* connection,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Why are xcb property strings not null terminated???
|
//Why are xcb property strings not null terminated???
|
||||||
void* replyValue = malloc((size_t) (length + 1));
|
void* replyValue = malloc((size_t)length + 1);
|
||||||
memcpy(replyValue, data->ffxcb_get_property_value(propertyReply), (size_t) length);
|
memcpy(replyValue, data->ffxcb_get_property_value(propertyReply), (size_t) length);
|
||||||
((char*) replyValue)[length] = '\0';
|
((char*) replyValue)[length] = '\0';
|
||||||
|
|
||||||
@@ -159,11 +160,9 @@ void ffdsConnectXcb(FFDisplayServerResult* result)
|
|||||||
|
|
||||||
typedef struct XcbRandrData
|
typedef struct XcbRandrData
|
||||||
{
|
{
|
||||||
FF_LIBRARY_SYMBOL(xcb_randr_get_screen_resources)
|
FF_LIBRARY_SYMBOL(xcb_randr_get_screen_resources_current)
|
||||||
FF_LIBRARY_SYMBOL(xcb_randr_get_screen_resources_reply)
|
FF_LIBRARY_SYMBOL(xcb_randr_get_screen_resources_current_reply)
|
||||||
FF_LIBRARY_SYMBOL(xcb_randr_get_screen_resources_modes_iterator)
|
FF_LIBRARY_SYMBOL(xcb_randr_get_screen_resources_current_modes_iterator)
|
||||||
FF_LIBRARY_SYMBOL(xcb_randr_get_screen_info)
|
|
||||||
FF_LIBRARY_SYMBOL(xcb_randr_get_screen_info_reply)
|
|
||||||
FF_LIBRARY_SYMBOL(xcb_randr_mode_info_next)
|
FF_LIBRARY_SYMBOL(xcb_randr_mode_info_next)
|
||||||
FF_LIBRARY_SYMBOL(xcb_randr_get_monitors)
|
FF_LIBRARY_SYMBOL(xcb_randr_get_monitors)
|
||||||
FF_LIBRARY_SYMBOL(xcb_randr_get_monitors_reply)
|
FF_LIBRARY_SYMBOL(xcb_randr_get_monitors_reply)
|
||||||
@@ -189,9 +188,7 @@ typedef struct XcbRandrData
|
|||||||
XcbPropertyData propData;
|
XcbPropertyData propData;
|
||||||
|
|
||||||
//init per screen
|
//init per screen
|
||||||
uint32_t defaultRefreshRate;
|
xcb_randr_get_screen_resources_current_reply_t* screenResources;
|
||||||
uint32_t defaultRotation;
|
|
||||||
xcb_randr_get_screen_resources_reply_t* screenResources;
|
|
||||||
} XcbRandrData;
|
} XcbRandrData;
|
||||||
|
|
||||||
static bool xcbRandrHandleModeInfo(XcbRandrData* data, xcb_randr_mode_info_t* modeInfo, FFstrbuf* name, uint32_t rotation, bool primary)
|
static bool xcbRandrHandleModeInfo(XcbRandrData* data, xcb_randr_mode_info_t* modeInfo, FFstrbuf* name, uint32_t rotation, bool primary)
|
||||||
@@ -202,7 +199,7 @@ static bool xcbRandrHandleModeInfo(XcbRandrData* data, xcb_randr_mode_info_t* mo
|
|||||||
data->result,
|
data->result,
|
||||||
(uint32_t) modeInfo->width,
|
(uint32_t) modeInfo->width,
|
||||||
(uint32_t) modeInfo->height,
|
(uint32_t) modeInfo->height,
|
||||||
refreshRate == 0 ? data->defaultRefreshRate : refreshRate,
|
refreshRate,
|
||||||
(uint32_t) modeInfo->width,
|
(uint32_t) modeInfo->width,
|
||||||
(uint32_t) modeInfo->height,
|
(uint32_t) modeInfo->height,
|
||||||
rotation,
|
rotation,
|
||||||
@@ -219,7 +216,7 @@ static bool xcbRandrHandleMode(XcbRandrData* data, xcb_randr_mode_t mode, FFstrb
|
|||||||
if(data->screenResources == NULL)
|
if(data->screenResources == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
xcb_randr_mode_info_iterator_t modesIterator = data->ffxcb_randr_get_screen_resources_modes_iterator(data->screenResources);
|
xcb_randr_mode_info_iterator_t modesIterator = data->ffxcb_randr_get_screen_resources_current_modes_iterator(data->screenResources);
|
||||||
|
|
||||||
while(modesIterator.rem > 0)
|
while(modesIterator.rem > 0)
|
||||||
{
|
{
|
||||||
@@ -260,7 +257,7 @@ static bool xcbRandrHandleCrtc(XcbRandrData* data, xcb_randr_crtc_t crtc, FFstrb
|
|||||||
data->result,
|
data->result,
|
||||||
(uint32_t) crtcInfoReply->width,
|
(uint32_t) crtcInfoReply->width,
|
||||||
(uint32_t) crtcInfoReply->height,
|
(uint32_t) crtcInfoReply->height,
|
||||||
data->defaultRefreshRate,
|
0,
|
||||||
(uint32_t) crtcInfoReply->width,
|
(uint32_t) crtcInfoReply->width,
|
||||||
(uint32_t) crtcInfoReply->height,
|
(uint32_t) crtcInfoReply->height,
|
||||||
rotation,
|
rotation,
|
||||||
@@ -334,10 +331,10 @@ static bool xcbRandrHandleMonitor(XcbRandrData* data, xcb_randr_monitor_info_t*
|
|||||||
data->result,
|
data->result,
|
||||||
(uint32_t) monitor->width,
|
(uint32_t) monitor->width,
|
||||||
(uint32_t) monitor->height,
|
(uint32_t) monitor->height,
|
||||||
data->defaultRefreshRate,
|
0,
|
||||||
(uint32_t) monitor->width,
|
(uint32_t) monitor->width,
|
||||||
(uint32_t) monitor->height,
|
(uint32_t) monitor->height,
|
||||||
data->defaultRotation,
|
0,
|
||||||
&name,
|
&name,
|
||||||
FF_DISPLAY_TYPE_UNKNOWN,
|
FF_DISPLAY_TYPE_UNKNOWN,
|
||||||
!!monitor->primary,
|
!!monitor->primary,
|
||||||
@@ -370,38 +367,10 @@ static bool xcbRandrHandleMonitors(XcbRandrData* data, xcb_screen_t* screen)
|
|||||||
|
|
||||||
static void xcbRandrHandleScreen(XcbRandrData* data, xcb_screen_t* screen)
|
static void xcbRandrHandleScreen(XcbRandrData* data, xcb_screen_t* screen)
|
||||||
{
|
{
|
||||||
//Init screen info. This is used to get the default refresh rate. If this fails, default refresh rate is simply 0.
|
|
||||||
xcb_randr_get_screen_info_cookie_t screenInfoCookie = data->ffxcb_randr_get_screen_info(data->connection, screen->root);
|
|
||||||
xcb_randr_get_screen_info_reply_t* screenInfoReply = data->ffxcb_randr_get_screen_info_reply(data->connection, screenInfoCookie, NULL);
|
|
||||||
|
|
||||||
if(screenInfoReply != NULL)
|
|
||||||
{
|
|
||||||
data->defaultRefreshRate = screenInfoReply->rate;
|
|
||||||
switch (screenInfoReply->rotation)
|
|
||||||
{
|
|
||||||
case XCB_RANDR_ROTATION_ROTATE_90:
|
|
||||||
data->defaultRotation = 90;
|
|
||||||
break;
|
|
||||||
case XCB_RANDR_ROTATION_ROTATE_180:
|
|
||||||
data->defaultRotation = 180;
|
|
||||||
break;
|
|
||||||
case XCB_RANDR_ROTATION_ROTATE_270:
|
|
||||||
data->defaultRotation = 270;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
data->defaultRotation = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
free(screenInfoReply);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
data->defaultRefreshRate = 0;
|
|
||||||
data->defaultRotation = 0;
|
|
||||||
}
|
|
||||||
//Init screen resources. They are used to iterate over all modes. xcbRandrHandleMode checks for " == NULL", to fail as late as possible.
|
//Init screen resources. They are used to iterate over all modes. xcbRandrHandleMode checks for " == NULL", to fail as late as possible.
|
||||||
xcb_randr_get_screen_resources_cookie_t screenResourcesCookie = data->ffxcb_randr_get_screen_resources(data->connection, screen->root);
|
xcb_randr_get_screen_resources_current_cookie_t screenResourcesCookie = data->ffxcb_randr_get_screen_resources_current(data->connection, screen->root);
|
||||||
data->screenResources = data->ffxcb_randr_get_screen_resources_reply(data->connection, screenResourcesCookie, NULL);
|
|
||||||
|
data->screenResources = data->ffxcb_randr_get_screen_resources_current_reply(data->connection, screenResourcesCookie, NULL);
|
||||||
|
|
||||||
//With all the initialisation done, start the detection
|
//With all the initialisation done, start the detection
|
||||||
bool ret = xcbRandrHandleMonitors(data, screen);
|
bool ret = xcbRandrHandleMonitors(data, screen);
|
||||||
@@ -416,10 +385,10 @@ static void xcbRandrHandleScreen(XcbRandrData* data, xcb_screen_t* screen)
|
|||||||
data->result,
|
data->result,
|
||||||
(uint32_t) screen->width_in_pixels,
|
(uint32_t) screen->width_in_pixels,
|
||||||
(uint32_t) screen->height_in_pixels,
|
(uint32_t) screen->height_in_pixels,
|
||||||
data->defaultRefreshRate,
|
0,
|
||||||
(uint32_t) screen->width_in_pixels,
|
(uint32_t) screen->width_in_pixels,
|
||||||
(uint32_t) screen->height_in_pixels,
|
(uint32_t) screen->height_in_pixels,
|
||||||
data->defaultRotation,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
FF_DISPLAY_TYPE_UNKNOWN,
|
FF_DISPLAY_TYPE_UNKNOWN,
|
||||||
false,
|
false,
|
||||||
@@ -440,11 +409,9 @@ void ffdsConnectXcbRandr(FFDisplayServerResult* result)
|
|||||||
|
|
||||||
FF_LIBRARY_LOAD_SYMBOL_VAR(xcbRandr, data, xcb_intern_atom,)
|
FF_LIBRARY_LOAD_SYMBOL_VAR(xcbRandr, data, xcb_intern_atom,)
|
||||||
FF_LIBRARY_LOAD_SYMBOL_VAR(xcbRandr, data, xcb_intern_atom_reply,)
|
FF_LIBRARY_LOAD_SYMBOL_VAR(xcbRandr, data, xcb_intern_atom_reply,)
|
||||||
FF_LIBRARY_LOAD_SYMBOL_VAR(xcbRandr, data, xcb_randr_get_screen_resources,)
|
FF_LIBRARY_LOAD_SYMBOL_VAR(xcbRandr, data, xcb_randr_get_screen_resources_current,)
|
||||||
FF_LIBRARY_LOAD_SYMBOL_VAR(xcbRandr, data, xcb_randr_get_screen_resources_reply,)
|
FF_LIBRARY_LOAD_SYMBOL_VAR(xcbRandr, data, xcb_randr_get_screen_resources_current_reply,)
|
||||||
FF_LIBRARY_LOAD_SYMBOL_VAR(xcbRandr, data, xcb_randr_get_screen_resources_modes_iterator,)
|
FF_LIBRARY_LOAD_SYMBOL_VAR(xcbRandr, data, xcb_randr_get_screen_resources_current_modes_iterator,)
|
||||||
FF_LIBRARY_LOAD_SYMBOL_VAR(xcbRandr, data, xcb_randr_get_screen_info,)
|
|
||||||
FF_LIBRARY_LOAD_SYMBOL_VAR(xcbRandr, data, xcb_randr_get_screen_info_reply,)
|
|
||||||
FF_LIBRARY_LOAD_SYMBOL_VAR(xcbRandr, data, xcb_randr_mode_info_next,)
|
FF_LIBRARY_LOAD_SYMBOL_VAR(xcbRandr, data, xcb_randr_mode_info_next,)
|
||||||
FF_LIBRARY_LOAD_SYMBOL_VAR(xcbRandr, data, xcb_randr_get_monitors,)
|
FF_LIBRARY_LOAD_SYMBOL_VAR(xcbRandr, data, xcb_randr_get_monitors,)
|
||||||
FF_LIBRARY_LOAD_SYMBOL_VAR(xcbRandr, data, xcb_randr_get_monitors_reply,)
|
FF_LIBRARY_LOAD_SYMBOL_VAR(xcbRandr, data, xcb_randr_get_monitors_reply,)
|
||||||
@@ -464,17 +431,21 @@ void ffdsConnectXcbRandr(FFDisplayServerResult* result)
|
|||||||
|
|
||||||
bool propertyDataInitialized = xcbInitPropertyData(xcbRandr, &data.propData);
|
bool propertyDataInitialized = xcbInitPropertyData(xcbRandr, &data.propData);
|
||||||
|
|
||||||
|
|
||||||
data.connection = ffxcb_connect(NULL, NULL);
|
data.connection = ffxcb_connect(NULL, NULL);
|
||||||
if(data.connection == NULL)
|
if(data.connection == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
data.result = result;
|
data.result = result;
|
||||||
|
|
||||||
xcb_screen_iterator_t iterator = ffxcb_setup_roots_iterator(ffxcb_get_setup(data.connection));
|
xcb_screen_iterator_t iterator = ffxcb_setup_roots_iterator(ffxcb_get_setup(data.connection));
|
||||||
|
|
||||||
|
|
||||||
if(iterator.rem > 0 && propertyDataInitialized)
|
if(iterator.rem > 0 && propertyDataInitialized)
|
||||||
xcbDetectWMfromEWMH(&data.propData, data.connection, iterator.data->root, result);
|
xcbDetectWMfromEWMH(&data.propData, data.connection, iterator.data->root, result);
|
||||||
|
|
||||||
|
|
||||||
while(iterator.rem > 0)
|
while(iterator.rem > 0)
|
||||||
{
|
{
|
||||||
xcbRandrHandleScreen(&data, iterator.data);
|
xcbRandrHandleScreen(&data, iterator.data);
|
||||||
@@ -483,6 +454,7 @@ void ffdsConnectXcbRandr(FFDisplayServerResult* result)
|
|||||||
|
|
||||||
ffxcb_disconnect(data.connection);
|
ffxcb_disconnect(data.connection);
|
||||||
|
|
||||||
|
|
||||||
//If wayland hasn't set this, connection failed for it. So we are running only a X Server, not XWayland.
|
//If wayland hasn't set this, connection failed for it. So we are running only a X Server, not XWayland.
|
||||||
if(result->wmProtocolName.length == 0)
|
if(result->wmProtocolName.length == 0)
|
||||||
ffStrbufSetS(&result->wmProtocolName, FF_WM_PROTOCOL_X11);
|
ffStrbufSetS(&result->wmProtocolName, FF_WM_PROTOCOL_X11);
|
||||||
|
|||||||
@@ -117,11 +117,9 @@ typedef struct XrandrData
|
|||||||
FF_LIBRARY_SYMBOL(XInternAtom)
|
FF_LIBRARY_SYMBOL(XInternAtom)
|
||||||
FF_LIBRARY_SYMBOL(XGetAtomName);
|
FF_LIBRARY_SYMBOL(XGetAtomName);
|
||||||
FF_LIBRARY_SYMBOL(XFree);
|
FF_LIBRARY_SYMBOL(XFree);
|
||||||
FF_LIBRARY_SYMBOL(XRRGetScreenInfo)
|
|
||||||
FF_LIBRARY_SYMBOL(XRRConfigCurrentConfiguration)
|
|
||||||
FF_LIBRARY_SYMBOL(XRRConfigCurrentRate)
|
FF_LIBRARY_SYMBOL(XRRConfigCurrentRate)
|
||||||
FF_LIBRARY_SYMBOL(XRRGetMonitors)
|
FF_LIBRARY_SYMBOL(XRRGetMonitors)
|
||||||
FF_LIBRARY_SYMBOL(XRRGetScreenResources)
|
FF_LIBRARY_SYMBOL(XRRGetScreenResourcesCurrent)
|
||||||
FF_LIBRARY_SYMBOL(XRRGetOutputInfo)
|
FF_LIBRARY_SYMBOL(XRRGetOutputInfo)
|
||||||
FF_LIBRARY_SYMBOL(XRRGetOutputProperty)
|
FF_LIBRARY_SYMBOL(XRRGetOutputProperty)
|
||||||
FF_LIBRARY_SYMBOL(XRRGetCrtcInfo)
|
FF_LIBRARY_SYMBOL(XRRGetCrtcInfo)
|
||||||
@@ -129,15 +127,12 @@ typedef struct XrandrData
|
|||||||
FF_LIBRARY_SYMBOL(XRRFreeOutputInfo)
|
FF_LIBRARY_SYMBOL(XRRFreeOutputInfo)
|
||||||
FF_LIBRARY_SYMBOL(XRRFreeScreenResources)
|
FF_LIBRARY_SYMBOL(XRRFreeScreenResources)
|
||||||
FF_LIBRARY_SYMBOL(XRRFreeMonitors)
|
FF_LIBRARY_SYMBOL(XRRFreeMonitors)
|
||||||
FF_LIBRARY_SYMBOL(XRRFreeScreenConfigInfo)
|
|
||||||
|
|
||||||
//Init once
|
//Init once
|
||||||
Display* display;
|
Display* display;
|
||||||
FFDisplayServerResult* result;
|
FFDisplayServerResult* result;
|
||||||
|
|
||||||
//Init per screen
|
//Init per screen
|
||||||
uint32_t defaultRefreshRate;
|
|
||||||
uint32_t defaultRotation;
|
|
||||||
XRRScreenResources* screenResources;
|
XRRScreenResources* screenResources;
|
||||||
} XrandrData;
|
} XrandrData;
|
||||||
|
|
||||||
@@ -151,7 +146,7 @@ static double xrandrHandleMode(XrandrData* data, RRMode mode)
|
|||||||
return (double) modeInfo->dotClock / (double) (modeInfo->hTotal * modeInfo->vTotal);
|
return (double) modeInfo->dotClock / (double) (modeInfo->hTotal * modeInfo->vTotal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return data->defaultRefreshRate;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool xrandrHandleCrtc(XrandrData* data, RRCrtc crtc, FFstrbuf* name, bool primary)
|
static bool xrandrHandleCrtc(XrandrData* data, RRCrtc crtc, FFstrbuf* name, bool primary)
|
||||||
@@ -246,10 +241,10 @@ static bool xrandrHandleMonitor(XrandrData* data, XRRMonitorInfo* monitorInfo)
|
|||||||
data->result,
|
data->result,
|
||||||
(uint32_t) monitorInfo->width,
|
(uint32_t) monitorInfo->width,
|
||||||
(uint32_t) monitorInfo->height,
|
(uint32_t) monitorInfo->height,
|
||||||
data->defaultRefreshRate,
|
0,
|
||||||
(uint32_t) monitorInfo->width,
|
(uint32_t) monitorInfo->width,
|
||||||
(uint32_t) monitorInfo->height,
|
(uint32_t) monitorInfo->height,
|
||||||
data->defaultRotation,
|
0,
|
||||||
&name,
|
&name,
|
||||||
FF_DISPLAY_TYPE_UNKNOWN,
|
FF_DISPLAY_TYPE_UNKNOWN,
|
||||||
!!monitorInfo->primary,
|
!!monitorInfo->primary,
|
||||||
@@ -279,39 +274,8 @@ static bool xrandrHandleMonitors(XrandrData* data, Screen* screen)
|
|||||||
|
|
||||||
static void xrandrHandleScreen(XrandrData* data, Screen* screen)
|
static void xrandrHandleScreen(XrandrData* data, Screen* screen)
|
||||||
{
|
{
|
||||||
//Init screen configuration. This is used to get the default refresh rate. If this fails, default refresh rate is simply 0.
|
|
||||||
XRRScreenConfiguration* screenConfiguration = data->ffXRRGetScreenInfo(data->display, RootWindowOfScreen(screen));
|
|
||||||
|
|
||||||
if(screenConfiguration != NULL)
|
|
||||||
{
|
|
||||||
data->defaultRefreshRate = (uint32_t) data->ffXRRConfigCurrentRate(screenConfiguration);
|
|
||||||
Rotation rotation = 0;
|
|
||||||
data->ffXRRConfigCurrentConfiguration(screenConfiguration, &rotation);
|
|
||||||
switch (rotation)
|
|
||||||
{
|
|
||||||
case RR_Rotate_90:
|
|
||||||
data->defaultRotation = 90;
|
|
||||||
break;
|
|
||||||
case RR_Rotate_180:
|
|
||||||
data->defaultRotation = 180;
|
|
||||||
break;
|
|
||||||
case RR_Rotate_270:
|
|
||||||
data->defaultRotation = 270;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
data->defaultRotation = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
data->ffXRRFreeScreenConfigInfo(screenConfiguration);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
data->defaultRefreshRate = 0;
|
|
||||||
data->defaultRotation = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Init screen resources
|
//Init screen resources
|
||||||
data->screenResources = data->ffXRRGetScreenResources(data->display, RootWindowOfScreen(screen));
|
data->screenResources = data->ffXRRGetScreenResourcesCurrent(data->display, RootWindowOfScreen(screen));
|
||||||
|
|
||||||
bool ret = xrandrHandleMonitors(data, screen);
|
bool ret = xrandrHandleMonitors(data, screen);
|
||||||
|
|
||||||
@@ -325,10 +289,10 @@ static void xrandrHandleScreen(XrandrData* data, Screen* screen)
|
|||||||
data->result,
|
data->result,
|
||||||
(uint32_t) WidthOfScreen(screen),
|
(uint32_t) WidthOfScreen(screen),
|
||||||
(uint32_t) HeightOfScreen(screen),
|
(uint32_t) HeightOfScreen(screen),
|
||||||
data->defaultRefreshRate,
|
0,
|
||||||
(uint32_t) WidthOfScreen(screen),
|
(uint32_t) WidthOfScreen(screen),
|
||||||
(uint32_t) HeightOfScreen(screen),
|
(uint32_t) HeightOfScreen(screen),
|
||||||
data->defaultRotation,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
FF_DISPLAY_TYPE_UNKNOWN,
|
FF_DISPLAY_TYPE_UNKNOWN,
|
||||||
false,
|
false,
|
||||||
@@ -348,11 +312,9 @@ void ffdsConnectXrandr(FFDisplayServerResult* result)
|
|||||||
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XInternAtom,);
|
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XInternAtom,);
|
||||||
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XGetAtomName,);
|
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XGetAtomName,);
|
||||||
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XFree,);
|
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XFree,);
|
||||||
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XRRGetScreenInfo,)
|
|
||||||
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XRRConfigCurrentRate,);
|
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XRRConfigCurrentRate,);
|
||||||
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XRRConfigCurrentConfiguration,);
|
|
||||||
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XRRGetMonitors,);
|
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XRRGetMonitors,);
|
||||||
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XRRGetScreenResources,);
|
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XRRGetScreenResourcesCurrent,);
|
||||||
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XRRGetOutputInfo,);
|
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XRRGetOutputInfo,);
|
||||||
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XRRGetOutputProperty,);
|
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XRRGetOutputProperty,);
|
||||||
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XRRGetCrtcInfo,);
|
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XRRGetCrtcInfo,);
|
||||||
@@ -360,7 +322,6 @@ void ffdsConnectXrandr(FFDisplayServerResult* result)
|
|||||||
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XRRFreeOutputInfo,);
|
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XRRFreeOutputInfo,);
|
||||||
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XRRFreeScreenResources,);
|
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XRRFreeScreenResources,);
|
||||||
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XRRFreeMonitors,);
|
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XRRFreeMonitors,);
|
||||||
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XRRFreeScreenConfigInfo,);
|
|
||||||
|
|
||||||
X11PropertyData propertyData;
|
X11PropertyData propertyData;
|
||||||
bool propertyDataInitialized = x11InitPropertyData(xrandr, &propertyData);
|
bool propertyDataInitialized = x11InitPropertyData(xrandr, &propertyData);
|
||||||
@@ -388,7 +349,7 @@ void ffdsConnectXrandr(FFDisplayServerResult* result)
|
|||||||
|
|
||||||
void ffdsConnectXrandr(FFDisplayServerResult* result)
|
void ffdsConnectXrandr(FFDisplayServerResult* result)
|
||||||
{
|
{
|
||||||
//Do nothing here. There are more x11 implementaions to come.
|
//Do nothing here. There are more x11 implementations to come.
|
||||||
FF_UNUSED(result);
|
FF_UNUSED(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_detection_font_font
|
|
||||||
#define FF_INCLUDED_detection_font_font
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
|
|
||||||
#define FF_DETECT_FONT_NUM_FONTS 4
|
#define FF_DETECT_FONT_NUM_FONTS 4
|
||||||
@@ -20,5 +17,3 @@ typedef struct FFFontResult
|
|||||||
} FFFontResult;
|
} FFFontResult;
|
||||||
|
|
||||||
const char* ffDetectFont(FFFontResult* font);
|
const char* ffDetectFont(FFFontResult* font);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_detection_gamepad_gamepad
|
|
||||||
#define FF_INCLUDED_detection_gamepad_gamepad
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
|
|
||||||
typedef struct FFGamepadDevice
|
typedef struct FFGamepadDevice
|
||||||
@@ -12,5 +9,3 @@ typedef struct FFGamepadDevice
|
|||||||
} FFGamepadDevice;
|
} FFGamepadDevice;
|
||||||
|
|
||||||
const char* ffDetectGamepad(FFlist* devices /* List of FFGamepadDevice */);
|
const char* ffDetectGamepad(FFlist* devices /* List of FFGamepadDevice */);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ const char* ffDetectGamepad(FFlist* devices /* List of FFGamepadDevice */)
|
|||||||
report_desc_t repDesc = hid_get_report_desc(fd);
|
report_desc_t repDesc = hid_get_report_desc(fd);
|
||||||
if (!repDesc) continue;
|
if (!repDesc) continue;
|
||||||
|
|
||||||
int repId = hid_get_report_id(fd);
|
int reportId = hid_get_report_id(fd);
|
||||||
|
|
||||||
struct hid_data* hData = hid_start_parse(repDesc, 0, repId);
|
struct hid_data* hData = hid_start_parse(repDesc, 0, reportId);
|
||||||
if (hData)
|
if (hData)
|
||||||
{
|
{
|
||||||
struct hid_item hItem;
|
struct hid_item hItem;
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_detection_gpu_gpu
|
|
||||||
#define FF_INCLUDED_detection_gpu_gpu
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
|
|
||||||
#define FF_GPU_TEMP_UNSET (0/0.0)
|
#define FF_GPU_TEMP_UNSET (0/0.0)
|
||||||
@@ -42,5 +39,3 @@ const char* ffDetectGPU(const FFGPUOptions* options, FFlist* result);
|
|||||||
const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus);
|
const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus);
|
||||||
|
|
||||||
const char* ffGetGPUVendorString(unsigned vendorId);
|
const char* ffGetGPUVendorString(unsigned vendorId);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ FF_MAYBE_UNUSED static void pciDetectType(FFGPUResult* gpu)
|
|||||||
//and their memory sizes are usually smaller than 1GB.
|
//and their memory sizes are usually smaller than 1GB.
|
||||||
if (gpu->dedicated.total != FF_GPU_VMEM_SIZE_UNSET)
|
if (gpu->dedicated.total != FF_GPU_VMEM_SIZE_UNSET)
|
||||||
{
|
{
|
||||||
gpu->type = gpu->dedicated.total > 1024 * 1024 * 1024 // 1GB
|
gpu->type = gpu->dedicated.total > (uint64_t)1024 * 1024 * 1024 // 1GB
|
||||||
? FF_GPU_TYPE_DISCRETE
|
? FF_GPU_TYPE_DISCRETE
|
||||||
: FF_GPU_TYPE_INTEGRATED;
|
: FF_GPU_TYPE_INTEGRATED;
|
||||||
}
|
}
|
||||||
@@ -252,7 +252,7 @@ static void pciHandleDevice(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist*
|
|||||||
}, "libnvidia-ml.so");
|
}, "libnvidia-ml.so");
|
||||||
|
|
||||||
if (gpu->dedicated.total != FF_GPU_VMEM_SIZE_UNSET)
|
if (gpu->dedicated.total != FF_GPU_VMEM_SIZE_UNSET)
|
||||||
gpu->type = gpu->dedicated.total > 1024 * 1024 * 1024 ? FF_GPU_TYPE_DISCRETE : FF_GPU_TYPE_INTEGRATED;
|
gpu->type = gpu->dedicated.total > (uint64_t)1024 * 1024 * 1024 ? FF_GPU_TYPE_DISCRETE : FF_GPU_TYPE_INTEGRATED;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_detection_gtkqt_gtkqt
|
|
||||||
#define FF_INCLUDED_detection_gtkqt_gtkqt
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
|
|
||||||
typedef struct FFGTKResult
|
typedef struct FFGTKResult
|
||||||
@@ -28,5 +25,3 @@ const FFGTKResult* ffDetectGTK2(void);
|
|||||||
const FFGTKResult* ffDetectGTK4(void);
|
const FFGTKResult* ffDetectGTK4(void);
|
||||||
const FFGTKResult* ffDetectGTK3(void);
|
const FFGTKResult* ffDetectGTK3(void);
|
||||||
const FFQtResult* ffDetectQt(void);
|
const FFQtResult* ffDetectQt(void);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_detection_host_host
|
|
||||||
#define FF_INCLUDED_detection_host_host
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
|
|
||||||
typedef struct FFHostResult
|
typedef struct FFHostResult
|
||||||
@@ -14,6 +11,4 @@ typedef struct FFHostResult
|
|||||||
FFstrbuf sysVendor;
|
FFstrbuf sysVendor;
|
||||||
} FFHostResult;
|
} FFHostResult;
|
||||||
|
|
||||||
const char* ffDetectHost(FFHostResult* result);
|
const char* ffDetectHost(FFHostResult* host);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
#include "host.h"
|
#include "host.h"
|
||||||
#include "common/sysctl.h"
|
#include "common/sysctl.h"
|
||||||
|
#include "util/apple/cf_helpers.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
static const char* getProductName(const FFstrbuf* hwModel)
|
#include <IOKit/IOKitLib.h>
|
||||||
|
|
||||||
|
static const char* getProductNameWithHwModel(const FFstrbuf* hwModel)
|
||||||
{
|
{
|
||||||
// Macbook Pro: https://support.apple.com/en-us/HT201300
|
// Macbook Pro: https://support.apple.com/en-us/HT201300
|
||||||
// Macbook Air: https://support.apple.com/en-us/HT201862
|
// Macbook Air: https://support.apple.com/en-us/HT201862
|
||||||
@@ -108,6 +111,15 @@ static const char* getProductName(const FFstrbuf* hwModel)
|
|||||||
else if(ffStrbufStartsWithS(hwModel, "Mac"))
|
else if(ffStrbufStartsWithS(hwModel, "Mac"))
|
||||||
{
|
{
|
||||||
const char* version = hwModel->chars + strlen("Mac");
|
const char* version = hwModel->chars + strlen("Mac");
|
||||||
|
if(ffStrEquals(version, "15,3")) return "MacBook Pro (14-inch, Nov 2023, Two Thunderbolt / USB 4 ports)";
|
||||||
|
if(ffStrEquals(version, "15,4")) return "iMac (24-inch, 2023, Two Thunderbolt / USB 4 ports)";
|
||||||
|
if(ffStrEquals(version, "15,5")) return "iMac (24-inch, 2023, Two Thunderbolt / USB 4 ports, Two USB 3 ports)";
|
||||||
|
if(ffStrEquals(version, "15,6") ||
|
||||||
|
ffStrEquals(version, "15,8") ||
|
||||||
|
ffStrEquals(version, "15,10")) return "MacBook Pro (14-inch, Nov 2023, Three Thunderbolt 4 ports)";
|
||||||
|
if(ffStrEquals(version, "15,7") ||
|
||||||
|
ffStrEquals(version, "15,9") ||
|
||||||
|
ffStrEquals(version, "15,11")) return "MacBook Pro (16-inch, Nov 2023, Three Thunderbolt 4 ports)";
|
||||||
if(ffStrEquals(version, "14,15")) return "MacBook Air (15-inch, M2, 2023)";
|
if(ffStrEquals(version, "14,15")) return "MacBook Air (15-inch, M2, 2023)";
|
||||||
if(ffStrEquals(version, "14,14")) return "Mac Studio (M2 Ultra, 2023, Two Thunderbolt 4 front ports)";
|
if(ffStrEquals(version, "14,14")) return "Mac Studio (M2 Ultra, 2023, Two Thunderbolt 4 front ports)";
|
||||||
if(ffStrEquals(version, "14,13")) return "Mac Studio (M2 Max, 2023, Two USB-C front ports)";
|
if(ffStrEquals(version, "14,13")) return "Mac Studio (M2 Max, 2023, Two USB-C front ports)";
|
||||||
@@ -152,15 +164,45 @@ static const char* getProductName(const FFstrbuf* hwModel)
|
|||||||
if(ffStrEquals(version, "10,1")) return "iMac (27/21.5-inch, Late 2009)";
|
if(ffStrEquals(version, "10,1")) return "iMac (27/21.5-inch, Late 2009)";
|
||||||
if(ffStrEquals(version, "9,1")) return "iMac (24/20-inch, Early 2009)";
|
if(ffStrEquals(version, "9,1")) return "iMac (24/20-inch, Early 2009)";
|
||||||
}
|
}
|
||||||
return hwModel->chars;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* getProductNameWithIokit(FFstrbuf* result)
|
||||||
|
{
|
||||||
|
io_iterator_t iterator;
|
||||||
|
if(IOServiceGetMatchingServices(MACH_PORT_NULL, IOServiceNameMatching("product"), &iterator) != kIOReturnSuccess)
|
||||||
|
return "IOServiceGetMatchingServices() failed";
|
||||||
|
|
||||||
|
io_registry_entry_t registryEntry;
|
||||||
|
while((registryEntry = IOIteratorNext(iterator)) != 0)
|
||||||
|
{
|
||||||
|
FF_CFTYPE_AUTO_RELEASE CFMutableDictionaryRef properties = NULL;
|
||||||
|
if(IORegistryEntryCreateCFProperties(registryEntry, &properties, kCFAllocatorDefault, kNilOptions) != kIOReturnSuccess)
|
||||||
|
{
|
||||||
|
IOObjectRelease(registryEntry);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ffCfDictGetString(properties, CFSTR("product-name"), result))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
IOObjectRelease(registryEntry);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* ffDetectHost(FFHostResult* host)
|
const char* ffDetectHost(FFHostResult* host)
|
||||||
{
|
{
|
||||||
ffStrbufAppendS(&host->sysVendor, "Apple");
|
ffStrbufSetStatic(&host->sysVendor, "Apple");
|
||||||
|
|
||||||
const char* error = ffSysctlGetString("hw.model", &host->productFamily);
|
const char* error = ffSysctlGetString("hw.model", &host->productFamily);
|
||||||
if (error) return error;
|
if (error) return error;
|
||||||
ffStrbufAppendS(&host->productName, getProductName(&host->productFamily));
|
|
||||||
|
ffStrbufSetStatic(&host->productName, getProductNameWithHwModel(&host->productFamily));
|
||||||
|
if (host->productName.length == 0)
|
||||||
|
getProductNameWithIokit(&host->productName);
|
||||||
|
if (host->productName.length == 0)
|
||||||
|
ffStrbufSet(&host->productName, &host->productFamily);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_detection_icons
|
|
||||||
#define FF_INCLUDED_detection_icons
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
|
|
||||||
const char* ffDetectIcons(FFstrbuf* result);
|
const char* ffDetectIcons(FFstrbuf* result);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_detection_internal
|
|
||||||
#define FF_INCLUDED_detection_internal
|
|
||||||
|
|
||||||
#include "common/thread.h"
|
#include "common/thread.h"
|
||||||
|
|
||||||
#define FF_DETECTION_INTERNAL_GUARD(ResultType, ...) \
|
#define FF_DETECTION_INTERNAL_GUARD(ResultType, ...) \
|
||||||
@@ -12,6 +9,4 @@
|
|||||||
return &result; \
|
return &result; \
|
||||||
init = true; \
|
init = true; \
|
||||||
__VA_ARGS__; \
|
__VA_ARGS__; \
|
||||||
return &result; \
|
return &result;
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_detection_libc_libc
|
|
||||||
#define FF_INCLUDED_detection_libc_libc
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
|
|
||||||
typedef struct FFLibcResult
|
typedef struct FFLibcResult
|
||||||
@@ -12,5 +9,3 @@ typedef struct FFLibcResult
|
|||||||
} FFLibcResult;
|
} FFLibcResult;
|
||||||
|
|
||||||
const char* ffDetectLibc(FFLibcResult* result);
|
const char* ffDetectLibc(FFLibcResult* result);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_detection_lm_lm
|
|
||||||
#define FF_INCLUDED_detection_lm_lm
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
|
|
||||||
typedef struct FFLMResult
|
typedef struct FFLMResult
|
||||||
@@ -13,5 +10,3 @@ typedef struct FFLMResult
|
|||||||
} FFLMResult;
|
} FFLMResult;
|
||||||
|
|
||||||
const char* ffDetectLM(FFLMResult* result);
|
const char* ffDetectLM(FFLMResult* result);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_detection_locale_locale
|
|
||||||
#define FF_INCLUDED_detection_locale_locale
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
|
|
||||||
void ffDetectLocale(FFstrbuf* result);
|
void ffDetectLocale(FFstrbuf* result);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_detection_localip_localip
|
|
||||||
#define FF_INCLUDED_detection_localip_localip
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
|
|
||||||
typedef struct FFLocalIpResult
|
typedef struct FFLocalIpResult
|
||||||
@@ -15,5 +12,3 @@ typedef struct FFLocalIpResult
|
|||||||
} FFLocalIpResult;
|
} FFLocalIpResult;
|
||||||
|
|
||||||
const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results);
|
const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_detection_media
|
|
||||||
#define FF_INCLUDED_detection_media
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
|
|
||||||
typedef struct FFMediaResult
|
typedef struct FFMediaResult
|
||||||
@@ -18,5 +15,3 @@ typedef struct FFMediaResult
|
|||||||
} FFMediaResult;
|
} FFMediaResult;
|
||||||
|
|
||||||
const FFMediaResult* ffDetectMedia();
|
const FFMediaResult* ffDetectMedia();
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_detection_memory_memory
|
|
||||||
#define FF_INCLUDED_detection_memory_memory
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
|
|
||||||
typedef struct FFMemoryResult
|
typedef struct FFMemoryResult
|
||||||
@@ -11,6 +8,4 @@ typedef struct FFMemoryResult
|
|||||||
uint64_t bytesTotal;
|
uint64_t bytesTotal;
|
||||||
} FFMemoryResult;
|
} FFMemoryResult;
|
||||||
|
|
||||||
const char* ffDetectMemory(FFMemoryResult* result);
|
const char* ffDetectMemory(FFMemoryResult* ram);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -11,17 +11,12 @@ const char* ffDetectMemory(FFMemoryResult* ram)
|
|||||||
if (sysctl((int[]){ CTL_HW, HW_MEMSIZE }, 2, &ram->bytesTotal, &length, NULL, 0))
|
if (sysctl((int[]){ CTL_HW, HW_MEMSIZE }, 2, &ram->bytesTotal, &length, NULL, 0))
|
||||||
return "Failed to read hw.memsize";
|
return "Failed to read hw.memsize";
|
||||||
|
|
||||||
uint32_t pagesize;
|
|
||||||
length = sizeof(pagesize);
|
|
||||||
if (sysctl((int[]){ CTL_HW, HW_PAGESIZE }, 2, &pagesize, &length, NULL, 0))
|
|
||||||
return "Failed to read hw.pagesize";
|
|
||||||
|
|
||||||
mach_msg_type_number_t count = HOST_VM_INFO64_COUNT;
|
mach_msg_type_number_t count = HOST_VM_INFO64_COUNT;
|
||||||
vm_statistics64_data_t vmstat;
|
vm_statistics64_data_t vmstat;
|
||||||
if(host_statistics64(mach_host_self(), HOST_VM_INFO64, (host_info64_t) (&vmstat), &count) != KERN_SUCCESS)
|
if(host_statistics64(mach_host_self(), HOST_VM_INFO64, (host_info64_t) (&vmstat), &count) != KERN_SUCCESS)
|
||||||
return "Failed to read host_statistics64";
|
return "Failed to read host_statistics64";
|
||||||
|
|
||||||
ram->bytesUsed = ((uint64_t) vmstat.active_count + vmstat.wire_count) * pagesize;
|
ram->bytesUsed = ((uint64_t) vmstat.active_count + vmstat.wire_count) * instance.state.platform.pageSize;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,17 +7,12 @@ const char* ffDetectMemory(FFMemoryResult* ram)
|
|||||||
if (sysctl((int[]){ CTL_HW, HW_PHYSMEM }, 2, &ram->bytesTotal, &length, NULL, 0))
|
if (sysctl((int[]){ CTL_HW, HW_PHYSMEM }, 2, &ram->bytesTotal, &length, NULL, 0))
|
||||||
return "Failed to read hw.physmem";
|
return "Failed to read hw.physmem";
|
||||||
|
|
||||||
uint32_t pageSize;
|
|
||||||
length = sizeof(pageSize);
|
|
||||||
if (sysctl((int[]){ CTL_HW, HW_PAGESIZE }, 2, &pageSize, &length, NULL, 0))
|
|
||||||
return "Failed to read hw.pagesize";
|
|
||||||
|
|
||||||
// vm.stats.vm.* are int values
|
// vm.stats.vm.* are int values
|
||||||
int32_t pagesFree = ffSysctlGetInt("vm.stats.vm.v_free_count", 0)
|
int32_t pagesFree = ffSysctlGetInt("vm.stats.vm.v_free_count", 0)
|
||||||
+ ffSysctlGetInt("vm.stats.vm.v_inactive_count", 0)
|
+ ffSysctlGetInt("vm.stats.vm.v_inactive_count", 0)
|
||||||
+ ffSysctlGetInt("vm.stats.vm.v_cache_count", 0);
|
+ ffSysctlGetInt("vm.stats.vm.v_cache_count", 0);
|
||||||
|
|
||||||
ram->bytesUsed = ram->bytesTotal - (uint64_t) pagesFree * pageSize;
|
ram->bytesUsed = ram->bytesTotal - (uint64_t) pagesFree * instance.state.platform.pageSize;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,42 +1,45 @@
|
|||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
|
#include "common/io/io.h"
|
||||||
#include "util/mallocHelper.h"
|
#include "util/mallocHelper.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <inttypes.h>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
const char* ffDetectMemory(FFMemoryResult* ram)
|
const char* ffDetectMemory(FFMemoryResult* ram)
|
||||||
{
|
{
|
||||||
FILE* meminfo = fopen("/proc/meminfo", "r");
|
char buf[PROC_FILE_BUFFSIZ];
|
||||||
if(meminfo == NULL)
|
ssize_t nRead = ffReadFileData("/proc/meminfo", sizeof(buf) - 1, buf);
|
||||||
return "Failed to open /proc/meminfo";
|
if(nRead < 0)
|
||||||
|
return "ffReadFileData(\"/proc/meminfo\", sizeof(buf)-1, buf)";
|
||||||
|
buf[nRead] = '\0';
|
||||||
|
|
||||||
char* FF_AUTO_FREE line = NULL;
|
uint64_t memTotal = 0,
|
||||||
size_t len = 0;
|
|
||||||
|
|
||||||
uint32_t memTotal = 0,
|
|
||||||
shmem = 0,
|
shmem = 0,
|
||||||
memFree = 0,
|
memFree = 0,
|
||||||
buffers = 0,
|
buffers = 0,
|
||||||
cached = 0,
|
cached = 0,
|
||||||
sReclaimable = 0;
|
sReclaimable = 0;
|
||||||
|
|
||||||
while (getline(&line, &len, meminfo) != EOF)
|
char *token = NULL;
|
||||||
{
|
if((token = strstr(buf, "MemTotal:")) != NULL)
|
||||||
if(!sscanf(line, "MemTotal: %u", &memTotal))
|
memTotal = strtoul(token + strlen("MemTotal:"), NULL, 10);
|
||||||
if(!sscanf(line, "Shmem: %u", &shmem))
|
|
||||||
if(!sscanf(line, "MemFree: %u", &memFree))
|
|
||||||
if(!sscanf(line, "Buffers: %u", &buffers))
|
|
||||||
if(!sscanf(line, "Cached: %u", &cached))
|
|
||||||
sscanf(line, "SReclaimable: %u", &sReclaimable);
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose(meminfo);
|
if((token = strstr(buf, "MemFree:")) != NULL)
|
||||||
|
memFree = strtoul(token + strlen("MemFree:"), NULL, 10);
|
||||||
|
|
||||||
ram->bytesTotal = memTotal * (uint64_t) 1024;
|
if((token = strstr(buf, "Buffers:")) != NULL)
|
||||||
if(ram->bytesTotal == 0)
|
buffers = strtoul(token + strlen("Buffers:"), NULL, 10);
|
||||||
return "Failed to read MemTotal";
|
|
||||||
else
|
if((token = strstr(buf, "Cached:")) != NULL)
|
||||||
ram->bytesUsed = (memTotal + shmem - memFree - buffers - cached - sReclaimable) * (uint64_t) 1024;
|
cached = strtoul(token + strlen("Cached:"), NULL, 10);
|
||||||
|
|
||||||
|
if((token = strstr(buf, "Shmem:")) != NULL)
|
||||||
|
shmem = strtoul(token + strlen("Shmem:"), NULL, 10);
|
||||||
|
|
||||||
|
if((token = strstr(buf, "SReclaimable:")) != NULL)
|
||||||
|
sReclaimable = strtoul(token + strlen("SReclaimable:"), NULL, 10);
|
||||||
|
|
||||||
|
ram->bytesTotal = memTotal * 1024lu;
|
||||||
|
ram->bytesUsed = (memTotal + shmem - memFree - buffers - cached - sReclaimable) * 1024lu;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,18 @@ const char* ffDetectMonitor(FFlist* results)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
ffStrbufAppendS(&drmDir, entry->d_name);
|
ffStrbufAppendS(&drmDir, entry->d_name);
|
||||||
|
uint32_t drmDirWithDnameLength = drmDir.length;
|
||||||
|
|
||||||
|
ffStrbufAppendS(&drmDir, "/enabled");
|
||||||
|
char enabled = 'd'; // disabled
|
||||||
|
ffReadFileData(drmDir.chars, sizeof(enabled), &enabled);
|
||||||
|
if (enabled != 'e') // enabled
|
||||||
|
{
|
||||||
|
ffStrbufSubstrBefore(&drmDir, drmDirLength);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ffStrbufSubstrBefore(&drmDir, drmDirWithDnameLength);
|
||||||
ffStrbufAppendS(&drmDir, "/edid");
|
ffStrbufAppendS(&drmDir, "/edid");
|
||||||
|
|
||||||
uint8_t edidData[512];
|
uint8_t edidData[512];
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_detection_opencl_opencl
|
|
||||||
#define FF_INCLUDED_detection_opencl_opencl
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
|
|
||||||
typedef struct FFOpenCLResult
|
typedef struct FFOpenCLResult
|
||||||
@@ -13,5 +10,3 @@ typedef struct FFOpenCLResult
|
|||||||
} FFOpenCLResult;
|
} FFOpenCLResult;
|
||||||
|
|
||||||
const char* ffDetectOpenCL(FFOpenCLResult* result);
|
const char* ffDetectOpenCL(FFOpenCLResult* result);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_detection_opengl_opengl
|
|
||||||
#define FF_INCLUDED_detection_opengl_opengl
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
|
|
||||||
typedef struct FFOpenGLResult
|
typedef struct FFOpenGLResult
|
||||||
@@ -14,5 +11,3 @@ typedef struct FFOpenGLResult
|
|||||||
} FFOpenGLResult;
|
} FFOpenGLResult;
|
||||||
|
|
||||||
const char* ffDetectOpenGL(FFOpenGLOptions* options, FFOpenGLResult* result);
|
const char* ffDetectOpenGL(FFOpenGLOptions* options, FFOpenGLResult* result);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "fastfetch.h"
|
|
||||||
#include "common/printing.h"
|
|
||||||
#include "opengl.h"
|
#include "opengl.h"
|
||||||
|
#include "common/library.h"
|
||||||
|
#include "common/printing.h"
|
||||||
|
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
@@ -8,23 +8,34 @@
|
|||||||
#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
|
#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char* glHandleResult(FFOpenGLResult* result)
|
typedef struct WGLData
|
||||||
{
|
{
|
||||||
ffStrbufAppendS(&result->version, (const char*) glGetString(GL_VERSION));
|
FFOpenGLResult* result;
|
||||||
ffStrbufAppendS(&result->renderer, (const char*) glGetString(GL_RENDERER));
|
const char* error;
|
||||||
ffStrbufAppendS(&result->vendor, (const char*) glGetString(GL_VENDOR));
|
|
||||||
ffStrbufAppendS(&result->slv, (const char*) glGetString(GL_SHADING_LANGUAGE_VERSION));
|
FF_LIBRARY_SYMBOL(glGetString)
|
||||||
|
FF_LIBRARY_SYMBOL(wglMakeCurrent)
|
||||||
|
FF_LIBRARY_SYMBOL(wglCreateContext)
|
||||||
|
FF_LIBRARY_SYMBOL(wglDeleteContext)
|
||||||
|
} WGLData;
|
||||||
|
|
||||||
|
static const char* glHandleResult(WGLData* wglData)
|
||||||
|
{
|
||||||
|
ffStrbufAppendS(&wglData->result->version, (const char*) wglData->ffglGetString(GL_VERSION));
|
||||||
|
ffStrbufAppendS(&wglData->result->renderer, (const char*) wglData->ffglGetString(GL_RENDERER));
|
||||||
|
ffStrbufAppendS(&wglData->result->vendor, (const char*) wglData->ffglGetString(GL_VENDOR));
|
||||||
|
ffStrbufAppendS(&wglData->result->slv, (const char*) wglData->ffglGetString(GL_SHADING_LANGUAGE_VERSION));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* wglHandleContext(FFOpenGLResult* result, HDC hdc, HGLRC context)
|
static const char* wglHandleContext(WGLData* wglData, HDC hdc, HGLRC context)
|
||||||
{
|
{
|
||||||
if(wglMakeCurrent(hdc, context) == FALSE)
|
if(wglData->ffwglMakeCurrent(hdc, context) == FALSE)
|
||||||
return "wglMakeCurrent() failed";
|
return "wglMakeCurrent() failed";
|
||||||
return glHandleResult(result);
|
return glHandleResult(wglData);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* wglHandlePixelFormat(FFOpenGLResult* result, HWND hWnd)
|
static const char* wglHandlePixelFormat(WGLData* wglData, HWND hWnd)
|
||||||
{
|
{
|
||||||
PIXELFORMATDESCRIPTOR pfd =
|
PIXELFORMATDESCRIPTOR pfd =
|
||||||
{
|
{
|
||||||
@@ -51,29 +62,23 @@ const char* wglHandlePixelFormat(FFOpenGLResult* result, HWND hWnd)
|
|||||||
if(SetPixelFormat(hdc, ChoosePixelFormat(hdc, &pfd), &pfd) == FALSE)
|
if(SetPixelFormat(hdc, ChoosePixelFormat(hdc, &pfd), &pfd) == FALSE)
|
||||||
return "SetPixelFormat() failed";
|
return "SetPixelFormat() failed";
|
||||||
|
|
||||||
HGLRC context = wglCreateContext(hdc);
|
HGLRC context = wglData->ffwglCreateContext(hdc);
|
||||||
if(context == NULL)
|
if(context == NULL)
|
||||||
return "wglCreateContext() failed";
|
return "wglCreateContext() failed";
|
||||||
|
|
||||||
const char* error = wglHandleContext(result, hdc, context);
|
const char* error = wglHandleContext(wglData, hdc, context);
|
||||||
wglDeleteContext(context);
|
wglData->ffwglDeleteContext(context);
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct WGLData
|
static LRESULT CALLBACK wglHandleWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
|
||||||
FFOpenGLResult* result;
|
|
||||||
const char* error;
|
|
||||||
} WGLData;
|
|
||||||
|
|
||||||
LRESULT CALLBACK wglHandleWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
||||||
{
|
{
|
||||||
switch(message)
|
switch(message)
|
||||||
{
|
{
|
||||||
case WM_CREATE: {
|
case WM_CREATE: {
|
||||||
WGLData* wglData = (WGLData*)((CREATESTRUCT*)lParam)->lpCreateParams;
|
WGLData* wglData = (WGLData*)((CREATESTRUCT*)lParam)->lpCreateParams;
|
||||||
wglData->error = wglHandlePixelFormat(wglData->result, hWnd);
|
wglData->error = wglHandlePixelFormat(wglData, hWnd);
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -84,6 +89,15 @@ LRESULT CALLBACK wglHandleWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM
|
|||||||
|
|
||||||
const char* ffDetectOpenGL(FF_MAYBE_UNUSED FFOpenGLOptions* options, FFOpenGLResult* result)
|
const char* ffDetectOpenGL(FF_MAYBE_UNUSED FFOpenGLOptions* options, FFOpenGLResult* result)
|
||||||
{
|
{
|
||||||
|
FF_LIBRARY_LOAD(opengl32, NULL, "dlopen opengl32" FF_LIBRARY_EXTENSION " failed", "opengl32" FF_LIBRARY_EXTENSION, 1);
|
||||||
|
|
||||||
|
WGLData data = { .result = result };
|
||||||
|
|
||||||
|
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(opengl32, data, glGetString);
|
||||||
|
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(opengl32, data, wglMakeCurrent);
|
||||||
|
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(opengl32, data, wglCreateContext);
|
||||||
|
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(opengl32, data, wglDeleteContext);
|
||||||
|
|
||||||
MSG msg = {0};
|
MSG msg = {0};
|
||||||
WNDCLASSW wc = {
|
WNDCLASSW wc = {
|
||||||
.lpfnWndProc = wglHandleWndProc,
|
.lpfnWndProc = wglHandleWndProc,
|
||||||
@@ -95,7 +109,6 @@ const char* ffDetectOpenGL(FF_MAYBE_UNUSED FFOpenGLOptions* options, FFOpenGLRes
|
|||||||
if(!RegisterClassW(&wc))
|
if(!RegisterClassW(&wc))
|
||||||
return "RegisterClassW() failed";
|
return "RegisterClassW() failed";
|
||||||
|
|
||||||
WGLData data = { .result = result };
|
|
||||||
HWND hWnd = CreateWindowW(wc.lpszClassName, L"ogl_version_check", 0, 0, 0, 1, 1, NULL, NULL, NULL, &data);
|
HWND hWnd = CreateWindowW(wc.lpszClassName, L"ogl_version_check", 0, 0, 0, 1, 1, NULL, NULL, NULL, &data);
|
||||||
|
|
||||||
while(GetMessageW(&msg, hWnd, 0, 0) > 0)
|
while(GetMessageW(&msg, hWnd, 0, 0) > 0)
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FF_INCLUDED_detection_os_os
|
|
||||||
#define FF_INCLUDED_detection_os_os
|
|
||||||
|
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
|
|
||||||
typedef struct FFOSResult
|
typedef struct FFOSResult
|
||||||
@@ -20,5 +17,3 @@ typedef struct FFOSResult
|
|||||||
} FFOSResult;
|
} FFOSResult;
|
||||||
|
|
||||||
const FFOSResult* ffDetectOS();
|
const FFOSResult* ffDetectOS();
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user