mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:14:37 +02:00
Compare commits
81 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8b0c32a35f | |||
| db269d29e8 | |||
| f9f628eae6 | |||
| 92e9fbf2eb | |||
| db6e4f4bfc | |||
| b662db452f | |||
| 0d2ccb5fe5 | |||
| d33b5d60b6 | |||
| ef5d12395b | |||
| e18c261054 | |||
| 8851821484 | |||
| 3489cc8fe8 | |||
| 28bc97b92b | |||
| dbc5a7961e | |||
| 5f43f63990 | |||
| b775fe7486 | |||
| 60eaa326a2 | |||
| 672d4ad543 | |||
| 96e9e61437 | |||
| dbc6f70f19 | |||
| dfc9bc265c | |||
| 2ce511c4d3 | |||
| 99415a3841 | |||
| 244625d26a | |||
| 840434e709 | |||
| 72afa9ef99 | |||
| 7400f14322 | |||
| 85654316c7 | |||
| 8ecd58dd14 | |||
| 65c7f68c31 | |||
| bf6d0f871a | |||
| 3cd7c6c916 | |||
| 3227e934de | |||
| b66a009046 | |||
| 6ef4f62d5b | |||
| c038024108 | |||
| df49a01827 | |||
| 924c670915 | |||
| be89dff12a | |||
| c1807a1108 | |||
| b569acbb5d | |||
| 6e571a3163 | |||
| 01e78e2179 | |||
| 1b219a9d5c | |||
| 0ac01003b2 | |||
| a36bdfabd0 | |||
| 570abb194a | |||
| 4e00f37be9 | |||
| 334afc9838 | |||
| 64f9e53a36 | |||
| b94c6ab8d5 | |||
| 38ea333644 | |||
| efbdaf7aaf | |||
| aee7b37fc8 | |||
| 664460cd34 | |||
| a66e1b2e6d | |||
| 8000574a82 | |||
| 2eae5a86d2 | |||
| 75da934815 | |||
| ac71ebcad9 | |||
| 383a6c8a05 | |||
| 8e79fde0d9 | |||
| 4f4622eab9 | |||
| a2327b7350 | |||
| b76ada7f30 | |||
| 59b568a6d0 | |||
| 3d6bd26e59 | |||
| 4e17688b7c | |||
| f34548621f | |||
| 7a2e071081 | |||
| de7b57d807 | |||
| 6de9d0c024 | |||
| 8f69533f30 | |||
| d463853aeb | |||
| 1047d1cf6e | |||
| 0bfa12c38c | |||
| c8e4962cfd | |||
| 171005b6a3 | |||
| 8526f4a021 | |||
| 3e5d129248 | |||
| 6e98db3bf3 |
+22
-32
@@ -35,7 +35,7 @@ jobs:
|
||||
run: uname -a
|
||||
|
||||
- name: configure project
|
||||
run: cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_INSTALL_PREFIX=/usr . -DENABLE_VULKAN=OFF -DENABLE_WAYLAND=OFF -DENABLE_XCB_RANDR=OFF -DENABLE_XCB=OFF -DENABLE_XRANDR=OFF -DENABLE_X11=OFF -DENABLE_DRM=OFF -DENABLE_DRM_AMDGPU=OFF -DENABLE_GIO=OFF -DENABLE_DCONF=OFF -DENABLE_DBUS=OFF -DENABLE_XFCONF=OFF -DENABLE_SQLITE3=OFF -DENABLE_RPM=OFF -DENABLE_IMAGEMAGICK7=OFF -DENABLE_IMAGEMAGICK6=OFF -DENABLE_CHAFA=OFF -DENABLE_ZLIB=OFF -DENABLE_EGL=OFF -DENABLE_GLX=OFF -DENABLE_OSMESA=OFF -DENABLE_OPENCL=OFF -DENABLE_FREETYPE=OFF -DENABLE_PULSE=OFF -DENABLE_DDCUTIL=OFF -DENABLE_ELF=OFF -DENABLE_DIRECTX_HEADERS=OFF -DENABLE_THREADS=OFF
|
||||
run: cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_INSTALL_PREFIX=/usr . -DENABLE_VULKAN=OFF -DENABLE_WAYLAND=OFF -DENABLE_XCB_RANDR=OFF -DENABLE_XCB=OFF -DENABLE_XRANDR=OFF -DENABLE_X11=OFF -DENABLE_DRM=OFF -DENABLE_DRM_AMDGPU=OFF -DENABLE_GIO=OFF -DENABLE_DCONF=OFF -DENABLE_DBUS=OFF -DENABLE_XFCONF=OFF -DENABLE_SQLITE3=OFF -DENABLE_RPM=OFF -DENABLE_IMAGEMAGICK7=OFF -DENABLE_IMAGEMAGICK6=OFF -DENABLE_CHAFA=OFF -DENABLE_ZLIB=OFF -DENABLE_EGL=OFF -DENABLE_GLX=OFF -DENABLE_OPENCL=OFF -DENABLE_FREETYPE=OFF -DENABLE_PULSE=OFF -DENABLE_DDCUTIL=OFF -DENABLE_ELF=OFF -DENABLE_DIRECTX_HEADERS=OFF -DENABLE_THREADS=OFF
|
||||
|
||||
- name: build project
|
||||
run: cmake --build . --target package --verbose -j4
|
||||
@@ -80,7 +80,7 @@ jobs:
|
||||
run: cat /proc/cpuinfo
|
||||
|
||||
- name: install required packages
|
||||
run: sudo apt-get update && sudo apt-get install -y 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 libpulse-dev libdrm-dev libelf-dev directx-headers-dev
|
||||
run: sudo apt-get update && sudo apt-get install -y 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 ocl-icd-opencl-dev libpulse-dev libdrm-dev libelf-dev directx-headers-dev
|
||||
|
||||
- name: install linuxbrew packages
|
||||
run: |
|
||||
@@ -149,7 +149,7 @@ jobs:
|
||||
run: cat /proc/cpuinfo
|
||||
|
||||
- name: install required packages
|
||||
run: sudo apt-get update && sudo apt-get install -y 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 libpulse-dev libdrm-dev libelf-dev directx-headers-dev libchafa-dev libddcutil-dev rpm
|
||||
run: sudo apt-get update && sudo apt-get install -y 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 ocl-icd-opencl-dev libpulse-dev libdrm-dev libelf-dev directx-headers-dev libchafa-dev libddcutil-dev rpm
|
||||
|
||||
- name: configure project
|
||||
run: cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On -DENABLE_EMBEDDED_AMDGPUIDS=On -DCMAKE_INSTALL_PREFIX=/usr .
|
||||
@@ -187,7 +187,7 @@ jobs:
|
||||
|
||||
linux-armv7l:
|
||||
name: Linux-armv7l
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
security-events: write
|
||||
contents: read
|
||||
@@ -196,7 +196,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: run VM
|
||||
uses: uraimo/run-on-arch-action@v2
|
||||
uses: uraimo/run-on-arch-action@v3
|
||||
id: runcmd
|
||||
with:
|
||||
arch: armv7
|
||||
@@ -208,7 +208,7 @@ jobs:
|
||||
# CMake installed by apt has bug `list sub-command REMOVE_ITEM requires two or more arguments`
|
||||
wget --no-check-certificate https://apt.kitware.com/ubuntu/pool/main/c/cmake/{cmake_3.29.2-0kitware1ubuntu20.04.1_armhf.deb,cmake-data_3.29.2-0kitware1ubuntu20.04.1_all.deb}
|
||||
dpkg -i *.deb
|
||||
apt-get install -y make g++ 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 libpulse-dev libdrm-dev libelf-dev directx-headers-dev rpm
|
||||
apt-get install -y make g++ 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 ocl-icd-opencl-dev libpulse-dev libdrm-dev libelf-dev directx-headers-dev rpm
|
||||
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_INSTALL_PREFIX=/usr .
|
||||
cmake --build . --target package --verbose -j4
|
||||
./fastfetch --list-features
|
||||
@@ -226,7 +226,7 @@ jobs:
|
||||
|
||||
linux-armv6l:
|
||||
name: Linux-armv6l
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
security-events: write
|
||||
contents: read
|
||||
@@ -235,7 +235,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: run VM
|
||||
uses: uraimo/run-on-arch-action@v2
|
||||
uses: uraimo/run-on-arch-action@v3
|
||||
id: runcmd
|
||||
with:
|
||||
arch: armv6
|
||||
@@ -244,7 +244,7 @@ jobs:
|
||||
run: |
|
||||
uname -a
|
||||
apt-get update && apt-get install -y wget
|
||||
apt-get install -y cmake make g++ 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 libpulse-dev libdrm-dev libelf-dev directx-headers-dev rpm
|
||||
apt-get install -y cmake make g++ 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 ocl-icd-opencl-dev libpulse-dev libdrm-dev libelf-dev directx-headers-dev rpm
|
||||
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_INSTALL_PREFIX=/usr .
|
||||
cmake --build . --target package --verbose -j4
|
||||
./fastfetch --list-features
|
||||
@@ -262,7 +262,7 @@ jobs:
|
||||
|
||||
linux-riscv64:
|
||||
name: Linux-riscv64
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
security-events: write
|
||||
contents: read
|
||||
@@ -271,7 +271,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: run VM
|
||||
uses: uraimo/run-on-arch-action@v2
|
||||
uses: uraimo/run-on-arch-action@v3
|
||||
id: runcmd
|
||||
with:
|
||||
arch: riscv64
|
||||
@@ -279,7 +279,7 @@ jobs:
|
||||
githubToken: ${{ github.token }}
|
||||
run: |
|
||||
uname -a
|
||||
apt-get update && apt-get install -y cmake make g++ 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 libpulse-dev libdrm-dev libddcutil-dev libchafa-dev libelf-dev directx-headers-dev rpm
|
||||
apt-get update && apt-get install -y cmake make g++ 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 ocl-icd-opencl-dev libpulse-dev libdrm-dev libddcutil-dev libchafa-dev libelf-dev directx-headers-dev rpm
|
||||
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_INSTALL_PREFIX=/usr .
|
||||
cmake --build . --target package --verbose -j4
|
||||
./fastfetch --list-features
|
||||
@@ -297,7 +297,7 @@ jobs:
|
||||
|
||||
linux-ppc64le:
|
||||
name: Linux-ppc64le
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
security-events: write
|
||||
contents: read
|
||||
@@ -306,7 +306,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: run VM
|
||||
uses: uraimo/run-on-arch-action@v2
|
||||
uses: uraimo/run-on-arch-action@v3
|
||||
id: runcmd
|
||||
with:
|
||||
arch: ppc64le
|
||||
@@ -314,7 +314,7 @@ jobs:
|
||||
githubToken: ${{ github.token }}
|
||||
run: |
|
||||
uname -a
|
||||
apt-get update && apt-get install -y cmake make g++ 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 libpulse-dev libdrm-dev libchafa-dev libelf-dev directx-headers-dev rpm
|
||||
apt-get update && apt-get install -y cmake make g++ 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 ocl-icd-opencl-dev libpulse-dev libdrm-dev libchafa-dev libelf-dev directx-headers-dev rpm
|
||||
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_INSTALL_PREFIX=/usr .
|
||||
cmake --build . --target package --verbose -j4
|
||||
./fastfetch --list-features
|
||||
@@ -332,7 +332,7 @@ jobs:
|
||||
|
||||
linux-s390x:
|
||||
name: Linux-s390x
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
security-events: write
|
||||
contents: read
|
||||
@@ -341,7 +341,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: run VM
|
||||
uses: uraimo/run-on-arch-action@v2
|
||||
uses: uraimo/run-on-arch-action@v3
|
||||
id: runcmd
|
||||
with:
|
||||
arch: s390x
|
||||
@@ -349,7 +349,7 @@ jobs:
|
||||
githubToken: ${{ github.token }}
|
||||
run: |
|
||||
uname -a
|
||||
apt-get update && apt-get install -y cmake make g++ 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 libpulse-dev libdrm-dev libchafa-dev libelf-dev directx-headers-dev rpm
|
||||
apt-get update && apt-get install -y cmake make g++ 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 ocl-icd-opencl-dev libpulse-dev libdrm-dev libchafa-dev libelf-dev directx-headers-dev rpm
|
||||
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_INSTALL_PREFIX=/usr .
|
||||
cmake --build . --target package --verbose -j4
|
||||
./fastfetch --list-features
|
||||
@@ -373,8 +373,6 @@ jobs:
|
||||
|
||||
- name: setup alpine linux
|
||||
uses: jirutka/setup-alpine@master
|
||||
with:
|
||||
branch: v3.19
|
||||
|
||||
- name: install dependencies
|
||||
run: |
|
||||
@@ -422,20 +420,12 @@ jobs:
|
||||
run: |
|
||||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install --overwrite vulkan-loader vulkan-headers molten-vk imagemagick chafa
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3
|
||||
with:
|
||||
languages: c
|
||||
|
||||
- name: configure project
|
||||
run: cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_OSX_ARCHITECTURES='arm64;x86_64' .
|
||||
|
||||
- name: build project
|
||||
run: cmake --build . --target package --verbose -j4
|
||||
|
||||
- name: perform CodeQL analysis
|
||||
uses: github/codeql-action/analyze@v3
|
||||
|
||||
- name: list features
|
||||
run: ./fastfetch --list-features
|
||||
|
||||
@@ -514,7 +504,7 @@ jobs:
|
||||
run: |
|
||||
uname -a
|
||||
sudo pkg update
|
||||
sudo pkg install -y cmake git pkgconf binutils wayland vulkan-headers vulkan-loader libxcb libXrandr libX11 libdrm glib dconf dbus sqlite3-tcl xfce4-conf egl libosmesa opencl ocl-icd v4l_compat chafa
|
||||
sudo pkg install -y cmake git pkgconf binutils wayland vulkan-headers vulkan-loader libxcb libXrandr libX11 libdrm glib dconf dbus sqlite3-tcl xfce4-conf egl opencl ocl-icd v4l_compat chafa
|
||||
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On -DENABLE_EMBEDDED_AMDGPUIDS=On .
|
||||
cmake --build . --target package --verbose -j4
|
||||
./fastfetch --list-features
|
||||
@@ -547,7 +537,7 @@ jobs:
|
||||
prepare: |
|
||||
uname -a
|
||||
pkg update
|
||||
pkg install -y cmake git pkgconf binutils wayland vulkan-headers vulkan-loader libxcb libXrandr libX11 libdrm glib dconf dbus sqlite3-tcl xfce4-conf egl libosmesa opencl ocl-icd v4l_compat chafa libelf
|
||||
pkg install -y cmake git pkgconf binutils wayland vulkan-headers vulkan-loader libxcb libXrandr libX11 libdrm glib dconf dbus sqlite3-tcl xfce4-conf egl opencl ocl-icd v4l_compat chafa libelf
|
||||
|
||||
run: |
|
||||
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On -DENABLE_EMBEDDED_AMDGPUIDS=On .
|
||||
@@ -585,7 +575,7 @@ jobs:
|
||||
version: '7.6'
|
||||
run: |
|
||||
uname -a
|
||||
sudo pkg_add -r cmake git pkgconf wayland vulkan-headers vulkan-loader glib2 dconf dbus sqlite3 xfconf imagemagick chafa pulseaudio hwdata
|
||||
sudo pkg_add -r cmake git pkgconf wayland vulkan-headers vulkan-loader glib2 dconf dbus sqlite3 xfconf imagemagick chafa
|
||||
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On -DENABLE_EMBEDDED_AMDGPUIDS=On .
|
||||
cmake --build . --target package --verbose -j4
|
||||
./fastfetch --list-features
|
||||
@@ -621,7 +611,7 @@ jobs:
|
||||
version: '10.1'
|
||||
run: |
|
||||
uname -a
|
||||
sudo pkgin -y install cmake git pkgconf wayland vulkan-headers dconf dbus sqlite3 ImageMagick pulseaudio opencl-headers ocl-icd
|
||||
sudo pkgin -y install cmake git pkgconf wayland vulkan-headers dconf dbus sqlite3 ImageMagick opencl-headers ocl-icd
|
||||
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On -DENABLE_EMBEDDED_AMDGPUIDS=On .
|
||||
cmake --build . --target package --verbose -j4
|
||||
./fastfetch --list-features
|
||||
|
||||
@@ -1,3 +1,55 @@
|
||||
# 2.39.1
|
||||
|
||||
Bugfixes:
|
||||
* Fix a regression that PublicIP detection fails randomly (PublicIP, #1629)
|
||||
|
||||
# 2.39.0
|
||||
|
||||
Changes:
|
||||
* OSMesa backend for OpenGL detection is removed (#1618)
|
||||
* Fastfetch no longer tries to use the private framework `Apple80211` to acquire SSID for Wifi module, which is only useful for macOS Sonoma (Wifi, macOS)
|
||||
|
||||
Features:
|
||||
* Improve accuracy of HDR support on Windows 11 24H2 (Display, Windows)
|
||||
* Improve performance of SSID detection on macOS Sequoia (Wifi, macOS, #1597)
|
||||
* Support warp terminal version detection on Windows (Terminal, Windows)
|
||||
* Support default route detection on OpenBSD & DragonFly BSD (LocalIP, OpenBSD / DragonFly)
|
||||
* Improve bash completion script
|
||||
* Improve performance of networking (PublicIP / Weather)
|
||||
* Support pkgsrc package manager detection on Linux (Packages, Linux)
|
||||
|
||||
Logo:
|
||||
* Add Common Torizon OS
|
||||
* Change FoxOS to WolfOS
|
||||
* Add Bredos
|
||||
* Add NetBSD2
|
||||
|
||||
# 2.38.0
|
||||
|
||||
Bugfixes:
|
||||
* Fix empty battery slots handling (Battery, Haiku, #1575)
|
||||
* Fix `{day-pretty}` output in custom format (DateTime, Windows)
|
||||
* Fix VanillaOS detection (OS, Linux)
|
||||
* Fix secure boot testing (Bootmgr, Linux, #1584)
|
||||
* Fix the SI unit "kB" in help message (#1589)
|
||||
* Fix segfault on macOS 10.15 when using the binary downloaded from Github Releases (Camera, macOS, #1594)
|
||||
|
||||
Features:
|
||||
* Support Chassis module in macOS (Chassis, macOS)
|
||||
* Allow customize key format with kernel name and distro name (OS)
|
||||
* Add missing `{icon}` in custom key format (Battery)
|
||||
* Add missing `{mountpoint}` and `{mount-from}` in custom output format (Disk, #1577)
|
||||
* Support percentage num & bar in custom format (GPU, #1583)
|
||||
* Support `pisi` package manager detection (Packages, Linux)
|
||||
* Support termite terminal font detection (TerminalFont, Linux)
|
||||
* Report monitor type in Brightness module (Brightness)
|
||||
|
||||
Logo:
|
||||
* Add `opensuse-tumbleweed_small`
|
||||
* Add `Bedrock_small`
|
||||
* Add `fastfetch`
|
||||
* Remove some unnecessary distro names
|
||||
|
||||
# 2.37.0
|
||||
|
||||
Changes:
|
||||
|
||||
+14
-18
@@ -1,7 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url
|
||||
|
||||
project(fastfetch
|
||||
VERSION 2.37.0
|
||||
VERSION 2.39.1
|
||||
LANGUAGES C
|
||||
DESCRIPTION "Fast neofetch-like system information tool"
|
||||
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
|
||||
@@ -74,7 +74,6 @@ cmake_dependent_option(ENABLE_CHAFA "Enable chafa" ON "ENABLE_IMAGEMAGICK6 OR EN
|
||||
cmake_dependent_option(ENABLE_ZLIB "Enable zlib" ON "ENABLE_IMAGEMAGICK6 OR ENABLE_IMAGEMAGICK7" OFF)
|
||||
cmake_dependent_option(ENABLE_EGL "Enable egl" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR ANDROID OR WIN32 OR SunOS OR Haiku" OFF)
|
||||
cmake_dependent_option(ENABLE_GLX "Enable glx" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR ANDROID OR SunOS" OFF)
|
||||
cmake_dependent_option(ENABLE_OSMESA "Enable osmesa" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS OR Haiku" OFF)
|
||||
cmake_dependent_option(ENABLE_OPENCL "Enable opencl" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR WIN32 OR ANDROID OR SunOS OR Haiku" OFF)
|
||||
cmake_dependent_option(ENABLE_FREETYPE "Enable freetype" ON "ANDROID" OFF)
|
||||
cmake_dependent_option(ENABLE_PULSE "Enable pulse" ON "LINUX OR SunOS" OFF)
|
||||
@@ -103,7 +102,7 @@ if(NOT BINARY_LINK_TYPE IN_LIST BINARY_LINK_TYPE_OPTIONS)
|
||||
message(FATAL_ERROR "BINARY_LINK_TYPE must be one of ${BINARY_LINK_TYPE_OPTIONS}")
|
||||
endif()
|
||||
|
||||
set(PACKAGE_MANAGERS AM APK BREW CHOCO DPKG EMERGE EOPKG FLATPAK GUIX LINGLONG LPKG LPKGBUILD MACPORTS NIX OPKG PACMAN PACSTALL PALUDIS PKG PKGTOOL RPM SCOOP SNAP SORCERY WINGET XBPS)
|
||||
set(PACKAGE_MANAGERS AM APK BREW CHOCO DPKG EMERGE EOPKG FLATPAK GUIX LINGLONG LPKG LPKGBUILD MACPORTS NIX OPKG PACMAN PACSTALL PALUDIS PISI PKG PKGTOOL RPM SCOOP SNAP SORCERY WINGET XBPS)
|
||||
foreach(package_manager ${PACKAGE_MANAGERS})
|
||||
if(package_manager STREQUAL "WINGET")
|
||||
option(PACKAGES_DISABLE_${package_manager} "Disable ${package_manager} package manager detection by default" ON)
|
||||
@@ -365,6 +364,7 @@ set(LIBFASTFETCH_SRC
|
||||
src/common/library.c
|
||||
src/common/modules.c
|
||||
src/common/netif/netif.c
|
||||
src/common/networking/networking_common.c
|
||||
src/common/option.c
|
||||
src/common/parsing.c
|
||||
src/common/printing.c
|
||||
@@ -493,7 +493,7 @@ if(LINUX)
|
||||
src/common/dbus.c
|
||||
src/common/io/io_unix.c
|
||||
src/common/netif/netif_linux.c
|
||||
src/common/networking_linux.c
|
||||
src/common/networking/networking_linux.c
|
||||
src/common/processing_linux.c
|
||||
src/detection/battery/battery_linux.c
|
||||
src/detection/bios/bios_linux.c
|
||||
@@ -574,7 +574,7 @@ elseif(ANDROID)
|
||||
list(APPEND LIBFASTFETCH_SRC
|
||||
src/common/io/io_unix.c
|
||||
src/common/netif/netif_linux.c
|
||||
src/common/networking_linux.c
|
||||
src/common/networking/networking_linux.c
|
||||
src/common/processing_linux.c
|
||||
src/detection/battery/battery_android.c
|
||||
src/detection/bios/bios_android.c
|
||||
@@ -640,7 +640,7 @@ elseif(FreeBSD)
|
||||
src/common/dbus.c
|
||||
src/common/io/io_unix.c
|
||||
src/common/netif/netif_bsd.c
|
||||
src/common/networking_linux.c
|
||||
src/common/networking/networking_linux.c
|
||||
src/common/processing_linux.c
|
||||
src/common/sysctl.c
|
||||
src/detection/battery/battery_bsd.c
|
||||
@@ -731,7 +731,7 @@ elseif(NetBSD)
|
||||
src/common/dbus.c
|
||||
src/common/io/io_unix.c
|
||||
src/common/netif/netif_bsd.c
|
||||
src/common/networking_linux.c
|
||||
src/common/networking/networking_linux.c
|
||||
src/common/processing_linux.c
|
||||
src/common/sysctl.c
|
||||
src/detection/battery/battery_nbsd.c
|
||||
@@ -813,7 +813,7 @@ elseif(OpenBSD)
|
||||
src/common/dbus.c
|
||||
src/common/io/io_unix.c
|
||||
src/common/netif/netif_bsd.c
|
||||
src/common/networking_linux.c
|
||||
src/common/networking/networking_linux.c
|
||||
src/common/processing_linux.c
|
||||
src/common/sysctl.c
|
||||
src/detection/battery/battery_obsd.c
|
||||
@@ -894,7 +894,7 @@ elseif(APPLE)
|
||||
list(APPEND LIBFASTFETCH_SRC
|
||||
src/common/io/io_unix.c
|
||||
src/common/netif/netif_bsd.c
|
||||
src/common/networking_linux.c
|
||||
src/common/networking/networking_linux.c
|
||||
src/common/processing_linux.c
|
||||
src/common/sysctl.c
|
||||
src/detection/battery/battery_apple.c
|
||||
@@ -905,7 +905,7 @@ elseif(APPLE)
|
||||
src/detection/bootmgr/bootmgr_apple.c
|
||||
src/detection/brightness/brightness_apple.c
|
||||
src/detection/btrfs/btrfs_nosupport.c
|
||||
src/detection/chassis/chassis_nosupport.c
|
||||
src/detection/chassis/chassis_apple.c
|
||||
src/detection/cpu/cpu_apple.c
|
||||
src/detection/cpucache/cpucache_apple.c
|
||||
src/detection/cpuusage/cpuusage_apple.c
|
||||
@@ -965,7 +965,7 @@ elseif(WIN32)
|
||||
list(APPEND LIBFASTFETCH_SRC
|
||||
src/common/io/io_windows.c
|
||||
src/common/netif/netif_windows.c
|
||||
src/common/networking_windows.c
|
||||
src/common/networking/networking_windows.c
|
||||
src/common/processing_windows.c
|
||||
src/detection/battery/battery_windows.c
|
||||
src/detection/bios/bios_windows.c
|
||||
@@ -1034,13 +1034,14 @@ elseif(WIN32)
|
||||
src/util/windows/version.c
|
||||
src/util/platform/FFPlatform_windows.c
|
||||
src/util/binary_windows.c
|
||||
src/util/debug_windows.c
|
||||
)
|
||||
elseif(SunOS)
|
||||
list(APPEND LIBFASTFETCH_SRC
|
||||
src/common/dbus.c
|
||||
src/common/io/io_unix.c
|
||||
src/common/netif/netif_bsd.c
|
||||
src/common/networking_linux.c
|
||||
src/common/networking/networking_linux.c
|
||||
src/common/processing_linux.c
|
||||
src/detection/battery/battery_nosupport.c
|
||||
src/detection/bios/bios_windows.c
|
||||
@@ -1121,7 +1122,7 @@ elseif(Haiku)
|
||||
src/common/dbus.c
|
||||
src/common/io/io_unix.c
|
||||
src/common/netif/netif_haiku.c
|
||||
src/common/networking_linux.c
|
||||
src/common/networking/networking_linux.c
|
||||
src/common/processing_linux.c
|
||||
src/detection/battery/battery_haiku.c
|
||||
src/detection/bios/bios_windows.c
|
||||
@@ -1478,10 +1479,6 @@ else()
|
||||
"GL"
|
||||
)
|
||||
endif()
|
||||
ff_lib_enable(OSMESA
|
||||
"osmesa"
|
||||
"OSMesa"
|
||||
)
|
||||
ff_lib_enable(OPENCL
|
||||
"OpenCL"
|
||||
"OpenCL"
|
||||
@@ -1575,7 +1572,6 @@ elseif(APPLE)
|
||||
PRIVATE "-F /System/Library/PrivateFrameworks"
|
||||
PRIVATE "-weak_framework DisplayServices"
|
||||
PRIVATE "-weak_framework MediaRemote"
|
||||
PRIVATE "-weak_framework Apple80211"
|
||||
)
|
||||
elseif(WIN32)
|
||||
target_link_libraries(libfastfetch
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
[](https://repology.org/project/fastfetch/versions)
|
||||
[](https://repology.org/project/fastfetch/versions)
|
||||
|
||||
Fastfetch is a [neofetch](https://github.com/dylanaraps/neofetch)-like tool for fetching system information and displaying it prettily. It is written mainly in C, with performance and customizability in mind. Currently, Linux, Android, FreeBSD, macOS, SunOS and Windows 7+ are supported.
|
||||
Fastfetch is a [neofetch](https://github.com/dylanaraps/neofetch)-like tool for fetching system information and displaying it prettily. It is written mainly in C, with performance and customizability in mind. Currently, Linux, macOS, Windows 7+, Android, FreeBSD, OpenBSD, NetBSD, DragonFly, Haiku and SunOS are supported.
|
||||
|
||||
<img src="screenshots/example1.png" width="49%" align="left" />
|
||||
<img src="https://upload.wikimedia.org/wikipedia/commons/2/24/Transparent_Square_Tiles_Texture.png" width="49%" height="16px" align="left" />
|
||||
|
||||
+119
-428
@@ -1,430 +1,121 @@
|
||||
__fastfetch_complete_help()
|
||||
{
|
||||
local __ff_helps=(
|
||||
"color"
|
||||
"format"
|
||||
"config"
|
||||
"os-format"
|
||||
"host-format"
|
||||
"kernel-format"
|
||||
"uptime-format"
|
||||
"processes-format"
|
||||
"packages-format"
|
||||
"shell-format"
|
||||
"display-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"
|
||||
"locale-format"
|
||||
"localip-format"
|
||||
"publicip-format"
|
||||
"player-format"
|
||||
"media-format"
|
||||
"datetime-format"
|
||||
"date-format"
|
||||
"time-format"
|
||||
"vulkan-format"
|
||||
"opengl-format"
|
||||
"opencl-format"
|
||||
"bluetooth-format"
|
||||
)
|
||||
COMPREPLY=($(compgen -W "${__ff_helps[*]}" -- "$CURRENT_WORD"))
|
||||
#!/usr/bin/env bash
|
||||
|
||||
_fastfetch() {
|
||||
# Use Bash built-in variables directly
|
||||
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
local prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
|
||||
# Check if Python is available
|
||||
if ! command -v python3 &>/dev/null; then
|
||||
return
|
||||
fi
|
||||
|
||||
# Handle standard completion cases
|
||||
case "$prev" in
|
||||
--color|--color-keys|--color-title|--color-output|--color-separator|--*-color|--*-key-color|--*-output-color|--logo-color-[1-9]|--percent-color-*|--temp-color-*)
|
||||
local -a colors=("black" "red" "green" "yellow" "blue" "magenta" "cyan" "white" "default")
|
||||
COMPREPLY=($(compgen -W "${colors[*]}" -- "$cur"))
|
||||
return
|
||||
;;
|
||||
--logo|-l)
|
||||
local -a logos
|
||||
readarray -t logos < <(fastfetch --list-logos autocompletion 2>/dev/null)
|
||||
logos+=("none" "small")
|
||||
COMPREPLY=($(compgen -W "${logos[*]}" -- "$cur"))
|
||||
return
|
||||
;;
|
||||
--config|-c)
|
||||
local -a presets
|
||||
readarray -t presets < <(fastfetch --list-presets autocompletion 2>/dev/null)
|
||||
presets+=("none")
|
||||
COMPREPLY=($(compgen -W "${presets[*]}" -- "$cur"))
|
||||
# Also allow file path completion
|
||||
if type _filedir &>/dev/null; then
|
||||
_filedir
|
||||
elif type compgen &>/dev/null; then
|
||||
COMPREPLY+=($(compgen -f -- "$cur"))
|
||||
fi
|
||||
return
|
||||
;;
|
||||
--structure|-s)
|
||||
# Get all module names in lowercase only
|
||||
local -a structures
|
||||
readarray -t structures < <(fastfetch --list-modules autocompletion 2>/dev/null | cut -d':' -f1 | tr '[:upper:]' '[:lower:]')
|
||||
COMPREPLY=($(compgen -W "${structures[*]}" -- "$cur"))
|
||||
return
|
||||
;;
|
||||
--help|-h)
|
||||
local -a modules
|
||||
readarray -t modules < <(fastfetch --list-modules autocompletion 2>/dev/null)
|
||||
# Convert to lowercase and keep only module names
|
||||
local -a module_names=()
|
||||
for module in "${modules[@]}"; do
|
||||
module_names+=($(echo "$module" | cut -d':' -f1 | tr '[:upper:]' '[:lower:]')-format)
|
||||
done
|
||||
module_names+=("format" "color")
|
||||
COMPREPLY=($(compgen -W "${module_names[*]}" -- "$cur"))
|
||||
return
|
||||
;;
|
||||
--format)
|
||||
COMPREPLY=($(compgen -W "json default" -- "$cur"))
|
||||
return
|
||||
;;
|
||||
--*-format)
|
||||
# Format string completion, handle spaces
|
||||
return
|
||||
;;
|
||||
--*path*|--*file*|--gen-config*|--*data*)
|
||||
# File path completion
|
||||
if type _filedir &>/dev/null; then
|
||||
_filedir
|
||||
elif type compgen &>/dev/null; then
|
||||
COMPREPLY=($(compgen -f -- "$cur"))
|
||||
fi
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
# If not a special option, generate all possible options
|
||||
if [[ "$cur" == -* ]]; then
|
||||
local -a opts
|
||||
readarray -t opts < <(python3 - "$cur" <<'EOF'
|
||||
import json
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
def main(current):
|
||||
try:
|
||||
# Use fastfetch --help-raw to get option data
|
||||
output = subprocess.check_output(['fastfetch', '--help-raw'], stderr=subprocess.DEVNULL)
|
||||
data = json.loads(output)
|
||||
|
||||
for category in data.values():
|
||||
for flag in category:
|
||||
if flag.get("pseudo", False):
|
||||
continue
|
||||
|
||||
if "short" in flag:
|
||||
print(f"-{flag['short']}")
|
||||
|
||||
if "long" in flag:
|
||||
if flag["long"] == "logo-color-[1-9]":
|
||||
for i in range(1, 10):
|
||||
print(f"--logo-color-{i}")
|
||||
else:
|
||||
print(f"--{flag['long']}")
|
||||
except Exception:
|
||||
# If error occurs, return no options
|
||||
pass
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1])
|
||||
EOF
|
||||
)
|
||||
COMPREPLY=($(compgen -W "${opts[*]}" -- "$cur"))
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
__fastfetch_complete_bool()
|
||||
{
|
||||
COMPREPLY=($(compgen -W "true false" -- "$CURRENT_WORD"))
|
||||
}
|
||||
|
||||
__fastfetch_complete_string()
|
||||
{
|
||||
if [[ $CURRENT_WORD != "" ]]; then
|
||||
COMPREPLY=("$CURRENT_WORD")
|
||||
fi
|
||||
}
|
||||
|
||||
__fastfetch_complete_path()
|
||||
{
|
||||
COMPREPLY=($(compgen -A file -- "$CURRENT_WORD"))
|
||||
}
|
||||
|
||||
__fastfetch_complete_logo()
|
||||
{
|
||||
COMPREPLY=($(compgen -W "$(fastfetch --list-logos autocompletion)" -- "$CURRENT_WORD"))
|
||||
}
|
||||
|
||||
__fastfetch_complete_logo_type()
|
||||
{
|
||||
local __ff_logo_types=(
|
||||
"auto"
|
||||
"builtin"
|
||||
"file"
|
||||
"raw"
|
||||
"sixel"
|
||||
"kitty"
|
||||
"chafa"
|
||||
)
|
||||
COMPREPLY=($(compgen -W "${__ff_logo_types[*]}" -- "$CURRENT_WORD"))
|
||||
}
|
||||
|
||||
__fastfetch_complete_binary_prefix()
|
||||
{
|
||||
local __ff_size_binary_prefixes=(
|
||||
"iec"
|
||||
"si"
|
||||
"jedec"
|
||||
)
|
||||
COMPREPLY=($(compgen -W "${__ff_size_binary_prefixes[*]}" -- "$CURRENT_WORD"))
|
||||
}
|
||||
|
||||
__fastfetch_complete_gl()
|
||||
{
|
||||
local __ff_gl_types=(
|
||||
"auto"
|
||||
"egl"
|
||||
"glx"
|
||||
"osmesa"
|
||||
)
|
||||
COMPREPLY=($(compgen -W "${__ff_gl_types[*]}" -- "$CURRENT_WORD"))
|
||||
}
|
||||
|
||||
__fastfetch_complete_option()
|
||||
{
|
||||
local FF_OPTIONS_ALL=(
|
||||
"${FF_OPTIONS_BOOL[@]}"
|
||||
"${FF_OPTIONS_STRING[@]}"
|
||||
"${FF_OPTIONS_PATH[@]}"
|
||||
"${FF_OPTIONS_LOGO[@]}"
|
||||
"${FF_OPTIONS_LOGO_TYPE[@]}"
|
||||
"${FF_OPTIONS_BINARY_PREFIX[@]}"
|
||||
"${FF_OPTIONS_OPENGL[@]}"
|
||||
)
|
||||
|
||||
if [[ $WORD_COUND -lt 3 ]]; then
|
||||
FF_OPTIONS_ALL+=(
|
||||
"${FF_OPTIONS_SINGLE[@]}"
|
||||
"${FF_OPTIONS_HELP[@]}"
|
||||
)
|
||||
fi
|
||||
|
||||
for ff_word in ${COMP_WORDS[@]}; do
|
||||
if [[ $ff_word == $CURRENT_WORD ]]; then
|
||||
break
|
||||
fi
|
||||
|
||||
FF_OPTIONS_ALL=("${FF_OPTIONS_ALL[@]/$ff_word}")
|
||||
done
|
||||
|
||||
COMPREPLY=($(compgen -W "${FF_OPTIONS_ALL[*]}" -- "$CURRENT_WORD"))
|
||||
}
|
||||
|
||||
__fastfetch_previous_matches()
|
||||
{
|
||||
for ff_option in "$@"; do
|
||||
if [[ $ff_option == "$PREVIOUS_WORD" ]]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
__fastfetch_completion()
|
||||
{
|
||||
local CURRENT_WORD="${COMP_WORDS[$COMP_CWORD]}"
|
||||
local PREVIOUS_WORD="${COMP_WORDS[$COMP_CWORD - 1]}"
|
||||
local WORD_COUND="${#COMP_WORDS[@]}"
|
||||
|
||||
local FF_OPTIONS_SINGLE=(
|
||||
"-v"
|
||||
"--version"
|
||||
"--list-logos"
|
||||
"--list-modules"
|
||||
"--list-presets"
|
||||
"--list-features"
|
||||
"--print-logos"
|
||||
"--print-config-system"
|
||||
"--print-config-user"
|
||||
"--print-structure"
|
||||
"--gen-config"
|
||||
"--gen-config-force"
|
||||
)
|
||||
|
||||
local FF_OPTIONS_HELP=(
|
||||
"-h"
|
||||
"--help"
|
||||
)
|
||||
|
||||
local FF_OPTIONS_BOOL=(
|
||||
"-r"
|
||||
"--show-errors"
|
||||
"--logo-print-remaining"
|
||||
"--multithreading"
|
||||
"--stat"
|
||||
"--allow-slow-operations"
|
||||
"--disable-linewrap"
|
||||
"--hide-cursor"
|
||||
"--cpu-temp"
|
||||
"--gpu-temp"
|
||||
"--battery-temp"
|
||||
"--display-precise-refresh-rate"
|
||||
"--localip-show-ipv4"
|
||||
"--localip-show-ipv6"
|
||||
"--localip-show-flags"
|
||||
"--localip-show-loop"
|
||||
"--localip-show-mtu"
|
||||
"--localip-show-speed"
|
||||
"--localip-name-prefix"
|
||||
"--localip-compact-type"
|
||||
"--escape-bedrock"
|
||||
"--pipe"
|
||||
"--title-fqdn"
|
||||
"--disk-folders"
|
||||
"--disk-show-external"
|
||||
"--disk-show-hidden"
|
||||
"--disk-show-subvolumes"
|
||||
"--gpu-hide-integrated"
|
||||
"--gpu-hide-discrete"
|
||||
"--gpu-force-method"
|
||||
"--disk-show-unknown"
|
||||
"--bluetooth-show-disconnected"
|
||||
)
|
||||
|
||||
local FF_OPTIONS_STRING=(
|
||||
"--logo-type"
|
||||
"--logo-padding"
|
||||
"--logo-padding-left"
|
||||
"--logo-padding-right"
|
||||
"--logo-padding-top"
|
||||
"--logo-color-1"
|
||||
"--logo-color-2"
|
||||
"--logo-color-3"
|
||||
"--logo-color-4"
|
||||
"--logo-color-5"
|
||||
"--logo-color-6"
|
||||
"--logo-color-7"
|
||||
"--logo-color-8"
|
||||
"--logo-color-9"
|
||||
"--logo-width"
|
||||
"--logo-height"
|
||||
"--color"
|
||||
"--color-keys"
|
||||
"--color-title"
|
||||
"--display-compact-type"
|
||||
"--separator"
|
||||
"-s"
|
||||
"--structure"
|
||||
"--player-name"
|
||||
"--percent-type"
|
||||
"--publicip-url"
|
||||
"--publicip-timeout"
|
||||
"--weather-output-format"
|
||||
"--weather-timeout"
|
||||
"--os-key"
|
||||
"--os-format"
|
||||
"--os-key-color"
|
||||
"--host-key"
|
||||
"--host-format"
|
||||
"--host-key-color"
|
||||
"--kernel-key"
|
||||
"--kernel-format"
|
||||
"--kernel-key-color"
|
||||
"--uptime-key"
|
||||
"--uptime-format"
|
||||
"--uptime-key-color"
|
||||
"--processes-key"
|
||||
"--processes-format"
|
||||
"--processes-key-color"
|
||||
"--packages-key"
|
||||
"--packages-format"
|
||||
"--packages-key-color"
|
||||
"--shell-key"
|
||||
"--shell-format"
|
||||
"--shell-key-color"
|
||||
"--display-key"
|
||||
"--display-format"
|
||||
"--display-key-color"
|
||||
"--de-key"
|
||||
"--de-format"
|
||||
"--de-key-color"
|
||||
"--wm-key"
|
||||
"--wm-format"
|
||||
"--wm-key-color"
|
||||
"--wmtheme-key"
|
||||
"--wmtheme-format"
|
||||
"--wmtheme-key-color"
|
||||
"--theme-key"
|
||||
"--theme-format"
|
||||
"--theme-key-color"
|
||||
"--icons-key"
|
||||
"--icons-format"
|
||||
"--icons-key-color"
|
||||
"--font-key"
|
||||
"--font-format"
|
||||
"--font-key-color"
|
||||
"--cursor-key"
|
||||
"--cursor-format"
|
||||
"--cursor-key-color"
|
||||
"--terminal-key"
|
||||
"--terminal-format"
|
||||
"--terminal-key-color"
|
||||
"--terminalfont-key"
|
||||
"--terminalfont-format"
|
||||
"--terminalfont-key-color"
|
||||
"--cpu-key"
|
||||
"--cpu-format"
|
||||
"--cpu-key-color"
|
||||
"--cpu-useage-key"
|
||||
"--cpu-useage-format"
|
||||
"--cpu-useage-key-color"
|
||||
"--gpu-key"
|
||||
"--gpu-format"
|
||||
"--gpu-key-color"
|
||||
"--memory-key"
|
||||
"--memory-format"
|
||||
"--memory-key-color"
|
||||
"--swap-key"
|
||||
"--swap-format"
|
||||
"--swap-key-color"
|
||||
"--disk-key"
|
||||
"--disk-format"
|
||||
"--disk-key-color"
|
||||
"--battery-key"
|
||||
"--battery-format"
|
||||
"--battery-key-color"
|
||||
"--poweradapter-key"
|
||||
"--poweradapter-format"
|
||||
"--poweradapter-key-color"
|
||||
"--locale-key"
|
||||
"--locale-format"
|
||||
"--locale-key-color"
|
||||
"--localip-key"
|
||||
"--localip-format"
|
||||
"--localip-key-color"
|
||||
"--publicip-key"
|
||||
"--publicip-format"
|
||||
"--publicip-key-color"
|
||||
"--wifi-key"
|
||||
"--wifi-format"
|
||||
"--wifi-key-color"
|
||||
"--weather-key"
|
||||
"--weather-format"
|
||||
"--weather-key-color"
|
||||
"--player-key"
|
||||
"--player-format"
|
||||
"--player-key-color"
|
||||
"--media-key"
|
||||
"--media-format"
|
||||
"--media-key-color"
|
||||
"--datetime-key"
|
||||
"--datetime-format"
|
||||
"--datetime-key-color"
|
||||
"--date-key"
|
||||
"--date-format"
|
||||
"--date-key-color"
|
||||
"--time-key"
|
||||
"--time-format"
|
||||
"--time-key-color"
|
||||
"--vulkan-key"
|
||||
"--vulkan-format"
|
||||
"--vulkan-key-color"
|
||||
"--opengl-key"
|
||||
"--opengl-format"
|
||||
"--opengl-key-color"
|
||||
"--opencl-key"
|
||||
"--opencl-format"
|
||||
"--opencl-key-color"
|
||||
"--users-key"
|
||||
"--users-format"
|
||||
"--users-key-color"
|
||||
"--users-myself-only"
|
||||
"--bluetooth-key"
|
||||
"--bluetooth-format"
|
||||
"--bluetooth-key-color"
|
||||
)
|
||||
|
||||
local FF_OPTIONS_PATH=(
|
||||
"-c"
|
||||
"--config"
|
||||
"--lib-vulkan"
|
||||
"--lib-wayland"
|
||||
"--lib-xcb-randr"
|
||||
"--lib-xcb"
|
||||
"--lib-xrandr"
|
||||
"--lib-X11"
|
||||
"--lib-gio"
|
||||
"--lib-dconf"
|
||||
"--lib-dbus"
|
||||
"--lib-xfconf"
|
||||
"--lib-sqlite3"
|
||||
"--lib-rpm"
|
||||
"--lib-imagemagick"
|
||||
"--lib-z"
|
||||
"--lib-chafa"
|
||||
"--lib-egl"
|
||||
"--lib-glx"
|
||||
"--lib-osmesa"
|
||||
"--lib-opencl"
|
||||
"--lib-pulse"
|
||||
"--lib-ddcutil"
|
||||
"--lib-nm"
|
||||
)
|
||||
|
||||
local FF_OPTIONS_LOGO=(
|
||||
"-l"
|
||||
"--logo"
|
||||
)
|
||||
|
||||
local FF_OPTIONS_LOGO_TYPE=(
|
||||
"--logo-type"
|
||||
)
|
||||
|
||||
local FF_OPTIONS_BINARY_PREFIX=(
|
||||
"--binary-prefix"
|
||||
)
|
||||
|
||||
local FF_OPTIONS_OPENGL=(
|
||||
"--opengl-type"
|
||||
)
|
||||
|
||||
if __fastfetch_previous_matches "${FF_OPTIONS_SINGLE[@]}"; then
|
||||
return
|
||||
elif [[ $WORD_COUND -gt 3 && ( ${COMP_WORDS[$COMP_CWORD - 2]} == "--help" || ${COMP_WORDS[$COMP_CWORD - 2]} == "-h" ) ]]; then
|
||||
return
|
||||
elif [[ $CURRENT_WORD == "-"* ]]; then
|
||||
__fastfetch_complete_option
|
||||
elif __fastfetch_previous_matches "${FF_OPTIONS_HELP[@]}"; then
|
||||
__fastfetch_complete_help
|
||||
elif __fastfetch_previous_matches "${FF_OPTIONS_BOOL[@]}"; then
|
||||
__fastfetch_complete_bool
|
||||
elif __fastfetch_previous_matches "${FF_OPTIONS_STRING[@]}"; then
|
||||
__fastfetch_complete_string
|
||||
elif __fastfetch_previous_matches "${FF_OPTIONS_PATH[@]}"; then
|
||||
__fastfetch_complete_path
|
||||
elif __fastfetch_previous_matches "${FF_OPTIONS_LOGO[@]}"; then
|
||||
__fastfetch_complete_logo
|
||||
elif __fastfetch_previous_matches "${FF_OPTIONS_LOGO_TYPE[@]}"; then
|
||||
__fastfetch_complete_logo_type
|
||||
elif __fastfetch_previous_matches "${FF_OPTIONS_BINARY_PREFIX[@]}"; then
|
||||
__fastfetch_complete_binary_prefix
|
||||
elif __fastfetch_previous_matches "${FF_OPTIONS_OPENGL[@]}"; then
|
||||
__fastfetch_complete_gl
|
||||
else
|
||||
__fastfetch_complete_option
|
||||
fi
|
||||
}
|
||||
|
||||
complete -F __fastfetch_completion fastfetch
|
||||
# Register completion
|
||||
complete -F _fastfetch fastfetch
|
||||
|
||||
Vendored
+24
@@ -1,3 +1,27 @@
|
||||
fastfetch (2.39.0ubuntu1) jammy; urgency=medium
|
||||
|
||||
* Remove unwanted debugging code
|
||||
|
||||
-- Carter Li <zhangsongcui@live.cn> Thu, 20 Mar 2025 10:39:22 +0800
|
||||
|
||||
fastfetch (2.39.0) jammy; urgency=medium
|
||||
|
||||
* Update to 2.39.0
|
||||
|
||||
-- Carter Li <zhangsongcui@live.cn> Thu, 20 Mar 2025 10:35:18 +0800
|
||||
|
||||
fastfetch (2.38.0) jammy; urgency=medium
|
||||
|
||||
* Update to 2.38.0
|
||||
|
||||
-- Carter Li <zhangsongcui@live.cn> Wed, 05 Mar 2025 14:56:24 +0800
|
||||
|
||||
fastfetch (2.37.0) jammy; urgency=medium
|
||||
|
||||
* Update to 2.37.0
|
||||
|
||||
-- Carter Li <zhangsongcui@live.cn> Wed, 19 Feb 2025 15:43:42 +0800
|
||||
|
||||
fastfetch (2.36.1) jammy; urgency=medium
|
||||
|
||||
* Update to 2.36.1
|
||||
|
||||
Vendored
+1
-1
@@ -2,7 +2,7 @@ Source: fastfetch
|
||||
Section: universe/utils
|
||||
Priority: optional
|
||||
Maintainer: Carter Li <zhangsongcui@live.cn>
|
||||
Build-Depends: 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, libpulse-dev, libdrm-dev, libddcutil-dev, libchafa-dev, directx-headers-dev, pkgconf, cmake (>= 3.12), debhelper (>= 11.2), dh-cmake, dh-cmake-compat (= 1), dh-sequence-cmake, dh-sequence-ctest, ninja-build
|
||||
Build-Depends: 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, ocl-icd-opencl-dev, libpulse-dev, libdrm-dev, libddcutil-dev, libchafa-dev, directx-headers-dev, pkgconf, cmake (>= 3.12), debhelper (>= 11.2), dh-cmake, dh-cmake-compat (= 1), dh-sequence-cmake, dh-sequence-ctest, ninja-build
|
||||
Standards-Version: 4.0.0
|
||||
Homepage: https://github.com/fastfetch-cli/fastfetch
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
fastfetch_2.36.1_source.buildinfo universe/utils optional
|
||||
fastfetch_2.39.0ubuntu1_source.buildinfo universe/utils optional
|
||||
|
||||
@@ -183,7 +183,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"diskFormat": {
|
||||
"description": "Output format of the module `Disk`. See `-h format` for formatting syntax\n 1. {size-used}: Size used\n 2. {size-total}: Size total\n 3. {size-percentage}: Size percentage num\n 4. {files-used}: Files used\n 5. {files-total}: Files total\n 6. {files-percentage}: Files percentage num\n 7. {is-external}: True if external volume\n 8. {is-hidden}: True if hidden volume\n 9. {filesystem}: Filesystem\n 10. {name}: Label / name\n 11. {is-readonly}: True if read-only\n 12. {create-time}: Create time in local timezone\n 13. {size-percentage-bar}: Size percentage bar\n 14. {files-percentage-bar}: Files percentage bar\n 15. {days}: Days after creation\n 16. {hours}: Hours after creation\n 17. {minutes}: Minutes after creation\n 18. {seconds}: Seconds after creation\n 19. {milliseconds}: Milliseconds after creation",
|
||||
"description": "Output format of the module `Disk`. See `-h format` for formatting syntax\n 1. {size-used}: Size used\n 2. {size-total}: Size total\n 3. {size-percentage}: Size percentage num\n 4. {files-used}: Files used\n 5. {files-total}: Files total\n 6. {files-percentage}: Files percentage num\n 7. {is-external}: True if external volume\n 8. {is-hidden}: True if hidden volume\n 9. {filesystem}: Filesystem\n 10. {name}: Label / name\n 11. {is-readonly}: True if read-only\n 12. {create-time}: Create time in local timezone\n 13. {size-percentage-bar}: Size percentage bar\n 14. {files-percentage-bar}: Files percentage bar\n 15. {days}: Days after creation\n 16. {hours}: Hours after creation\n 17. {minutes}: Minutes after creation\n 18. {seconds}: Seconds after creation\n 19. {milliseconds}: Milliseconds after creation\n 20. {mountpoint}: Mount point / drive letter\n 21. {mount-from}: Mount from (device path)",
|
||||
"type": "string"
|
||||
},
|
||||
"diskioFormat": {
|
||||
@@ -207,7 +207,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"gpuFormat": {
|
||||
"description": "Output format of the module `GPU`. See `-h format` for formatting syntax\n 1. {vendor}: GPU vendor\n 2. {name}: GPU name\n 3. {driver}: GPU driver\n 4. {temperature}: GPU temperature\n 5. {core-count}: GPU core count\n 6. {type}: GPU type\n 7. {dedicated-total}: GPU total dedicated memory\n 8. {dedicated-used}: GPU used dedicated memory\n 9. {shared-total}: GPU total shared memory\n 10. {shared-used}: GPU used shared memory\n 11. {platform-api}: The platform API used when detecting the GPU\n 12. {frequency}: Current frequency in GHz\n 13. {index}: GPU vendor specific index",
|
||||
"description": "Output format of the module `GPU`. See `-h format` for formatting syntax\n 1. {vendor}: GPU vendor\n 2. {name}: GPU name\n 3. {driver}: GPU driver\n 4. {temperature}: GPU temperature\n 5. {core-count}: GPU core count\n 6. {type}: GPU type\n 7. {dedicated-total}: GPU total dedicated memory\n 8. {dedicated-used}: GPU used dedicated memory\n 9. {shared-total}: GPU total shared memory\n 10. {shared-used}: GPU used shared memory\n 11. {platform-api}: The platform API used when detecting the GPU\n 12. {frequency}: Current frequency in GHz\n 13. {index}: GPU vendor specific index\n 14. {dedicated-percentage-num}: Dedicated memory usage percentage num\n 15. {dedicated-percentage-bar}: Dedicated memory usage percentage bar\n 16. {shared-percentage-num}: Shared memory usage percentage num\n 17. {shared-percentage-bar}: Shared memory usage percentage bar\n 18. {core-usage-num}: Core usage percentage num (supports Nvidia & Apple GPU only)\n 19. {core-usage-bar}: Core usage percentage bar (supports Nvidia & Apple GPU only)",
|
||||
"type": "string"
|
||||
},
|
||||
"hostFormat": {
|
||||
@@ -279,7 +279,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"packagesFormat": {
|
||||
"description": "Output format of the module `Packages`. See `-h format` for formatting syntax\n 1. {all}: Number of all packages\n 2. {pacman}: Number of pacman packages\n 3. {pacman-branch}: Pacman branch on manjaro\n 4. {dpkg}: Number of dpkg packages\n 5. {rpm}: Number of rpm packages\n 6. {emerge}: Number of emerge packages\n 7. {eopkg}: Number of eopkg packages\n 8. {xbps}: Number of xbps packages\n 9. {nix-system}: Number of nix-system packages\n 10. {nix-user}: Number of nix-user packages\n 11. {nix-default}: Number of nix-default packages\n 12. {apk}: Number of apk packages\n 13. {pkg}: Number of pkg packages\n 14. {flatpak-system}: Number of flatpak-system app packages\n 15. {flatpak-user}: Number of flatpak-user app packages\n 16. {snap}: Number of snap packages\n 17. {brew}: Number of brew packages\n 18. {brew-cask}: Number of brew-cask packages\n 19. {macports}: Number of macports packages\n 20. {scoop}: Number of scoop packages\n 21. {choco}: Number of choco packages\n 22. {pkgtool}: Number of pkgtool packages\n 23. {paludis}: Number of paludis packages\n 24. {winget}: Number of winget packages\n 25. {opkg}: Number of opkg packages\n 26. {am-system}: Number of am-system packages\n 27. {sorcery}: Number of sorcery packages\n 28. {lpkg}: Number of lpkg packages\n 29. {lpkgbuild}: Number of lpkgbuild packages\n 30. {guix-system}: Number of guix-system packages\n 31. {guix-user}: Number of guix-user packages\n 32. {guix-home}: Number of guix-home packages\n 33. {linglong}: Number of linglong packages\n 34. {pacstall}: Number of pacstall packages\n 35. {mport}: Number of mport packages\n 36. {qi}: Number of qi packages\n 37. {am-user}: Number of am-user (aka appman) packages\n 38. {pkgsrc}: Number of pkgsrc packages\n 39. {nix-all}: Total number of all nix packages\n 40. {flatpak-all}: Total number of all flatpak app packages\n 41. {brew-all}: Total number of all brew packages\n 42. {guix-all}: Total number of all guix packages",
|
||||
"description": "Output format of the module `Packages`. See `-h format` for formatting syntax\n 1. {all}: Number of all packages\n 2. {pacman}: Number of pacman packages\n 3. {pacman-branch}: Pacman branch on manjaro\n 4. {dpkg}: Number of dpkg packages\n 5. {rpm}: Number of rpm packages\n 6. {emerge}: Number of emerge packages\n 7. {eopkg}: Number of eopkg packages\n 8. {xbps}: Number of xbps packages\n 9. {nix-system}: Number of nix-system packages\n 10. {nix-user}: Number of nix-user packages\n 11. {nix-default}: Number of nix-default packages\n 12. {apk}: Number of apk packages\n 13. {pkg}: Number of pkg packages\n 14. {flatpak-system}: Number of flatpak-system app packages\n 15. {flatpak-user}: Number of flatpak-user app packages\n 16. {snap}: Number of snap packages\n 17. {brew}: Number of brew packages\n 18. {brew-cask}: Number of brew-cask packages\n 19. {macports}: Number of macports packages\n 20. {scoop}: Number of scoop packages\n 21. {choco}: Number of choco packages\n 22. {pkgtool}: Number of pkgtool packages\n 23. {paludis}: Number of paludis packages\n 24. {winget}: Number of winget packages\n 25. {opkg}: Number of opkg packages\n 26. {am-system}: Number of am-system packages\n 27. {sorcery}: Number of sorcery packages\n 28. {lpkg}: Number of lpkg packages\n 29. {lpkgbuild}: Number of lpkgbuild packages\n 30. {guix-system}: Number of guix-system packages\n 31. {guix-user}: Number of guix-user packages\n 32. {guix-home}: Number of guix-home packages\n 33. {linglong}: Number of linglong packages\n 34. {pacstall}: Number of pacstall packages\n 35. {mport}: Number of mport packages\n 36. {qi}: Number of qi packages\n 37. {am-user}: Number of am-user (aka appman) packages\n 38. {pkgsrc}: Number of pkgsrc packages\n 39. {hpkg-system}: Number of hpkg-system packages\n 40. {hpkg-user}: Number of hpkg-user packages\n 41. {pisi}: Number of pisi packages\n 42. {nix-all}: Total number of all nix packages\n 43. {flatpak-all}: Total number of all flatpak app packages\n 44. {brew-all}: Total number of all brew packages\n 45. {guix-all}: Total number of all guix packages\n 46. {hpkg-all}: Total number of all hpkg packages",
|
||||
"type": "string"
|
||||
},
|
||||
"physicaldiskFormat": {
|
||||
@@ -786,11 +786,11 @@
|
||||
},
|
||||
{
|
||||
"const": "si",
|
||||
"description": "1000 Bytes = 1 KB, 1000 KB = 1 MB, ..."
|
||||
"description": "1000 Bytes = 1 kB, 1000 kB = 1 MB, ..."
|
||||
},
|
||||
{
|
||||
"const": "jedec",
|
||||
"description": "1024 Bytes = 1 kB, 1024 K = 1 MB, ..."
|
||||
"description": "1024 Bytes = 1 KB, 1024 KB = 1 MB, ..."
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -2563,8 +2563,7 @@
|
||||
"enum": [
|
||||
"auto",
|
||||
"egl",
|
||||
"glx",
|
||||
"osmesa"
|
||||
"glx"
|
||||
],
|
||||
"default": "auto"
|
||||
},
|
||||
@@ -2652,6 +2651,7 @@
|
||||
"pacman",
|
||||
"pacstall",
|
||||
"paludis",
|
||||
"pisi",
|
||||
"pkg",
|
||||
"pkgtool",
|
||||
"qi",
|
||||
|
||||
@@ -0,0 +1,241 @@
|
||||
// Based on #1576
|
||||
{
|
||||
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
|
||||
"display": {
|
||||
"color": {
|
||||
"keys": "blue"
|
||||
},
|
||||
"separator": "",
|
||||
"constants": [
|
||||
"──────────────────────────────────────────────",
|
||||
"\u001b[47D",
|
||||
"\u001b[47C",
|
||||
"\u001b[46C"
|
||||
],
|
||||
"brightColor": false
|
||||
},
|
||||
"modules": [
|
||||
{
|
||||
"type": "version",
|
||||
"key": "┌───────────────┬─{$1}┐\u001b[41D",
|
||||
"format": "\u001b[1m{#keys} {1} - {2} "
|
||||
},
|
||||
{
|
||||
"type": "os",
|
||||
"key": "│ {icon} \u001b[s{sysname}\u001b[u\u001b[10C│{$3}│{$2}"
|
||||
},
|
||||
{
|
||||
"type": "datetime",
|
||||
"key": "│ {icon} Fetched │{$3}│{$2}",
|
||||
"format": "{year}-{month-pretty}-{day-pretty} {hour-pretty}:{minute-pretty}:{second-pretty} {timezone-name}"
|
||||
},
|
||||
{
|
||||
"type": "locale",
|
||||
"key": "│ {icon} Locale │{$3}│{$2}"
|
||||
},
|
||||
|
||||
// Hardware
|
||||
{
|
||||
"type": "custom",
|
||||
"key": "│{#cyan}┌──────────────┬{$1}┐{#keys}│\u001b[37D",
|
||||
"format": "{#bright_cyan} Hardware "
|
||||
},
|
||||
{
|
||||
"type": "chassis",
|
||||
"key": "│{#cyan}│ {icon} Chassis │{$4}│{#keys}│{$2}"
|
||||
},
|
||||
{
|
||||
"type": "memory",
|
||||
"key": "│{#cyan}│ {icon} RAM │{$4}│{#keys}│{$2}"
|
||||
},
|
||||
{
|
||||
"type": "swap",
|
||||
"key": "│{#cyan}│ {icon} SWAP │{$4}│{#keys}│{$2}"
|
||||
},
|
||||
{
|
||||
"type": "cpu",
|
||||
"key": "│{#cyan}│ {icon} CPU │{$4}│{#keys}│{$2}",
|
||||
"showPeCoreCount": true
|
||||
},
|
||||
{
|
||||
"type": "gpu",
|
||||
"key": "│{#cyan}│ {icon} GPU │{$4}│{#keys}│{$2}"
|
||||
},
|
||||
{
|
||||
"type": "disk",
|
||||
"key": "│{#cyan}│ {icon} Disk │{$4}│{#keys}│{$2}",
|
||||
"format": "{size-used} \/ {size-total} ({size-percentage}) - {filesystem}",
|
||||
},
|
||||
{
|
||||
"type": "battery",
|
||||
"key": "│{#cyan}│ {icon} Battery │{$4}│{#keys}│{$2}"
|
||||
},
|
||||
{
|
||||
"type": "custom",
|
||||
"key": "│{#cyan}└──────────────┴{$1}┘{#keys}│",
|
||||
"format": ""
|
||||
},
|
||||
|
||||
// Desktop
|
||||
{
|
||||
"type": "custom",
|
||||
"key": "│{#green}┌──────────────┬{$1}┐{#keys}│\u001b[37D",
|
||||
"format": "{#bright_green} Desktop "
|
||||
},
|
||||
{
|
||||
"type": "de",
|
||||
"key": "│{#green}│ {icon} Desktop │{$4}│{#keys}│{$2}"
|
||||
},
|
||||
{
|
||||
"type": "wm",
|
||||
"key": "│{#green}│ {icon} Session │{$4}│{#keys}│{$2}"
|
||||
},
|
||||
{
|
||||
"type": "display",
|
||||
"key": "│{#green}│ {icon} Display │{$4}│{#keys}│{$2}",
|
||||
"compactType": "original-with-refresh-rate"
|
||||
},
|
||||
{
|
||||
"type": "gpu",
|
||||
"key": "│{#green}│ {icon} G-Driver │{$4}│{#keys}│{$2}",
|
||||
"format": "{driver}"
|
||||
},
|
||||
{
|
||||
"type": "custom",
|
||||
"key": "│{#green}└──────────────┴{$1}┘{#keys}│",
|
||||
"format": ""
|
||||
},
|
||||
|
||||
// Terminal
|
||||
{
|
||||
"type": "custom",
|
||||
"key": "│{#yellow}┌──────────────┬{$1}┐{#keys}│\u001b[37D",
|
||||
"format": "{#bright_yellow} Terminal "
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"key": "│{#yellow}│ {icon} Shell │{$4}│{#keys}│{$2}"
|
||||
},
|
||||
{
|
||||
"type": "terminal",
|
||||
"key": "│{#yellow}│ {icon} Terminal │{$4}│{#keys}│{$2}"
|
||||
},
|
||||
{
|
||||
"type": "terminalfont",
|
||||
"key": "│{#yellow}│ {icon} Term Font │{$4}│{#keys}│{$2}"
|
||||
},
|
||||
{
|
||||
"type": "terminaltheme",
|
||||
"key": "│{#yellow}│ {icon} Colors │{$4}│{#keys}│{$2}"
|
||||
},
|
||||
{
|
||||
"type": "packages",
|
||||
"key": "│{#yellow}│ {icon} Packages │{$4}│{#keys}│{$2}"
|
||||
},
|
||||
{
|
||||
"type": "custom",
|
||||
"key": "│{#yellow}└──────────────┴{$1}┘{#keys}│",
|
||||
"format": ""
|
||||
},
|
||||
|
||||
// Development
|
||||
{
|
||||
"type": "custom",
|
||||
"key": "│{#red}┌──────────────┬{$1}┐{#keys}│\u001b[39D",
|
||||
"format": "{#bright_red} Development "
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"keyIcon": "",
|
||||
"key": "│{#red}│ {icon} Rust │{$4}│{#keys}│{$2}",
|
||||
"text": "rustc --version | cut -d' ' -f2",
|
||||
"format": "rustc {}"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"keyIcon": "",
|
||||
"key": "│{#red}│ {icon} Clang │{$4}│{#keys}│{$2}",
|
||||
"text": "clang --version | head -1 | awk '{print $NF}'",
|
||||
"format": "clang {}"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"keyIcon": "",
|
||||
"key": "│{#red}│ {icon} NodeJS │{$4}│{#keys}│{$2}",
|
||||
"text": "node --version",
|
||||
"format": "node {~1}"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"keyIcon": "",
|
||||
"key": "│{#red}│ {icon} Go │{$4}│{#keys}│{$2}",
|
||||
"text": "go version | cut -d' ' -f3",
|
||||
"format": "go {~2}"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"keyIcon": "",
|
||||
"key": "│{#red}│ {icon} Zig │{$4}│{#keys}│{$2}",
|
||||
"text": "zig version",
|
||||
"format": "zig {}"
|
||||
},
|
||||
{
|
||||
"type": "editor",
|
||||
"key": "│{#red}│ {icon} Editor │{$4}│{#keys}│{$2}"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"keyIcon": "",
|
||||
"key": "│{#red}│ {icon} Git │{$4}│{#keys}│{$2}",
|
||||
"text": "git version",
|
||||
"format": "git {~12}"
|
||||
},
|
||||
{
|
||||
"type": "font",
|
||||
"key": "│{#red}│ {icon} Interface │{$4}│{#keys}│{$2}"
|
||||
},
|
||||
{
|
||||
"type": "custom",
|
||||
"key": "│{#red}└──────────────┴{$1}┘{#keys}│",
|
||||
"format": ""
|
||||
},
|
||||
|
||||
// Uptime
|
||||
{
|
||||
"type": "custom",
|
||||
"key": "│{#magenta}┌──────────────┬{$1}┐{#keys}│\u001b[36D",
|
||||
"format": "{#bright_magenta} Uptime "
|
||||
},
|
||||
{
|
||||
"type": "uptime",
|
||||
"key": "│{#magenta}│ {icon} Uptime │{$4}│{#keys}│{$2}"
|
||||
},
|
||||
{
|
||||
"type": "users",
|
||||
"myselfOnly": true,
|
||||
"keyIcon": "",
|
||||
"key": "│{#magenta}│ {icon} Login │{$4}│{#keys}│{$2}"
|
||||
},
|
||||
{
|
||||
"type": "disk",
|
||||
"keyIcon": "",
|
||||
"key": "│{#magenta}│ {icon} OS Age │{$4}│{#keys}│{$2}",
|
||||
"folders": "/", // On macOS, "/System/Volumes/VM" works for me
|
||||
"format": "{create-time:10} [{days} days]"
|
||||
},
|
||||
{
|
||||
"type": "custom",
|
||||
"key": "│{#magenta}└──────────────┴{$1}┘{#keys}│",
|
||||
"format": ""
|
||||
},
|
||||
{
|
||||
"type": "custom",
|
||||
"key": "└─────────────────{$1}┘",
|
||||
"format": ""
|
||||
},
|
||||
|
||||
// End
|
||||
"break",
|
||||
"colors"
|
||||
]
|
||||
}
|
||||
@@ -227,9 +227,6 @@ void ffListFeatures(void)
|
||||
#if FF_HAVE_GLX
|
||||
"glx\n"
|
||||
#endif
|
||||
#if FF_HAVE_OSMESA
|
||||
"osmesa\n"
|
||||
#endif
|
||||
#if FF_HAVE_OPENCL
|
||||
"opencl\n"
|
||||
#endif
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#ifndef _WIN32
|
||||
#include <net/if.h>
|
||||
#else
|
||||
#define IF_NAMESIZE 16
|
||||
#define IF_NAMESIZE 0
|
||||
#endif
|
||||
|
||||
bool ffNetifGetDefaultRouteImpl(char iface[IF_NAMESIZE + 1], uint32_t* ifIndex);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "netif.h"
|
||||
|
||||
#include "common/io/io.h"
|
||||
#include "util/mallocHelper.h"
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_dl.h>
|
||||
@@ -8,13 +9,17 @@
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#if defined(__OpenBSD__) || defined(__DragonFly__)
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
#define ROUNDUP2(a, n) ((a) > 0 ? (1 + (((a) - 1U) | ((n) - 1))) : (n))
|
||||
|
||||
#if defined(__APPLE__)
|
||||
# define ROUNDUP(a) ROUNDUP2((a), sizeof(int))
|
||||
#elif defined(__NetBSD__)
|
||||
# define ROUNDUP(a) ROUNDUP2((a), sizeof(uint64_t))
|
||||
#elif defined(__FreeBSD__)
|
||||
#elif defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
# define ROUNDUP(a) ROUNDUP2((a), sizeof(int))
|
||||
#elif defined(__OpenBSD__)
|
||||
# define ROUNDUP(a) ROUNDUP2((a), sizeof(int))
|
||||
@@ -47,6 +52,39 @@ get_rt_address(struct rt_msghdr *rtm, int desired)
|
||||
|
||||
bool ffNetifGetDefaultRouteImpl(char iface[IF_NAMESIZE + 1], uint32_t* ifIndex)
|
||||
{
|
||||
#if defined(__OpenBSD__) || defined(__DragonFly__)
|
||||
int mib[6] = {CTL_NET, PF_ROUTE, 0, AF_INET, NET_RT_FLAGS, RTF_GATEWAY};
|
||||
size_t needed;
|
||||
|
||||
if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0)
|
||||
return false;
|
||||
|
||||
FF_AUTO_FREE char* buf = malloc(needed);
|
||||
|
||||
if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0)
|
||||
return false;
|
||||
|
||||
char* lim = buf + needed;
|
||||
struct rt_msghdr* rtm;
|
||||
for (char* next = buf; next < lim; next += rtm->rtm_msglen)
|
||||
{
|
||||
rtm = (struct rt_msghdr *)next;
|
||||
struct sockaddr* sa = (struct sockaddr *)(rtm + 1);
|
||||
|
||||
if ((rtm->rtm_flags & RTF_GATEWAY) && (sa->sa_family == AF_INET))
|
||||
{
|
||||
struct sockaddr_dl* sdl = (struct sockaddr_dl *)get_rt_address(rtm, RTA_IFP);
|
||||
if (sdl->sdl_family == AF_LINK)
|
||||
{
|
||||
assert(sdl->sdl_nlen <= IF_NAMESIZE);
|
||||
memcpy(iface, sdl->sdl_data, sdl->sdl_nlen);
|
||||
iface[sdl->sdl_nlen] = '\0';
|
||||
*ifIndex = sdl->sdl_index;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
//https://github.com/hashPirate/copenheimer-masscan-fork/blob/36f1ed9f7b751a7dccd5ed27874e2e703db7d481/src/rawsock-getif.c#L104
|
||||
|
||||
FF_AUTO_CLOSE_FD int pfRoute = socket(PF_ROUTE, SOCK_RAW, AF_INET);
|
||||
@@ -106,5 +144,7 @@ bool ffNetifGetDefaultRouteImpl(char iface[IF_NAMESIZE + 1], uint32_t* ifIndex)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,27 +1,36 @@
|
||||
#include "netif.h"
|
||||
#include "util/mallocHelper.h"
|
||||
|
||||
#include <ws2tcpip.h> // AF_INET6, IN6_IS_ADDR_UNSPECIFIED
|
||||
#include <iphlpapi.h>
|
||||
|
||||
bool ffNetifGetDefaultRouteImpl(FF_MAYBE_UNUSED char* iface/* unsupported */, uint32_t* ifIndex)
|
||||
bool ffNetifGetDefaultRouteImpl(FF_MAYBE_UNUSED char iface[IF_NAMESIZE + 1], uint32_t* ifIndex)
|
||||
{
|
||||
ULONG size = 0;
|
||||
if (GetIpForwardTable(NULL, &size, TRUE) != ERROR_INSUFFICIENT_BUFFER)
|
||||
PMIB_IPFORWARD_TABLE2 pIpForwardTable = NULL;
|
||||
DWORD result = GetIpForwardTable2(AF_UNSPEC, &pIpForwardTable);
|
||||
|
||||
if (result != NO_ERROR)
|
||||
return false;
|
||||
|
||||
FF_AUTO_FREE MIB_IPFORWARDTABLE* pIpForwardTable = (MIB_IPFORWARDTABLE*) malloc(size);
|
||||
if (GetIpForwardTable(pIpForwardTable, &size, TRUE) != ERROR_SUCCESS)
|
||||
return false;
|
||||
bool foundDefault = false;
|
||||
|
||||
for (uint32_t i = 0; i < pIpForwardTable->dwNumEntries; ++i)
|
||||
for (ULONG i = 0; i < pIpForwardTable->NumEntries; ++i)
|
||||
{
|
||||
MIB_IPFORWARDROW* ipForwardRow = &pIpForwardTable->table[i];
|
||||
if (ipForwardRow->dwForwardDest == 0 && ipForwardRow->dwForwardMask == 0)
|
||||
MIB_IPFORWARD_ROW2* row = &pIpForwardTable->Table[i];
|
||||
|
||||
if ((row->DestinationPrefix.PrefixLength == 0) &&
|
||||
((row->DestinationPrefix.Prefix.Ipv4.sin_family == AF_INET &&
|
||||
row->DestinationPrefix.Prefix.Ipv4.sin_addr.S_un.S_addr == 0) ||
|
||||
(row->DestinationPrefix.Prefix.Ipv6.sin6_family == AF_INET6 &&
|
||||
IN6_IS_ADDR_UNSPECIFIED(&row->DestinationPrefix.Prefix.Ipv6.sin6_addr))))
|
||||
{
|
||||
*ifIndex = ipForwardRow->dwForwardIfIndex;
|
||||
*ifIndex = row->InterfaceIndex;
|
||||
foundDefault = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
FreeMibTable(pIpForwardTable);
|
||||
|
||||
return foundDefault;
|
||||
}
|
||||
|
||||
@@ -7,14 +7,16 @@
|
||||
#include <minwindef.h>
|
||||
#endif
|
||||
|
||||
struct addrinfo;
|
||||
|
||||
typedef struct FFNetworkingState {
|
||||
#ifdef _WIN32
|
||||
uintptr_t sockfd;
|
||||
OVERLAPPED overlapped;
|
||||
#else
|
||||
int sockfd;
|
||||
FFstrbuf host;
|
||||
FFstrbuf command;
|
||||
struct addrinfo* addr;
|
||||
|
||||
#ifdef FF_HAVE_THREADS
|
||||
FFThreadType thread;
|
||||
@@ -23,7 +25,14 @@ typedef struct FFNetworkingState {
|
||||
|
||||
uint32_t timeout;
|
||||
bool ipv6;
|
||||
bool compression; // if true, HTTP content compression will be enabled if supported
|
||||
bool tfo; // if true, TCP Fast Open will be attempted first, and fallback to traditional connection if it fails
|
||||
} FFNetworkingState;
|
||||
|
||||
const char* ffNetworkingSendHttpRequest(FFNetworkingState* state, const char* host, const char* path, const char* headers);
|
||||
const char* ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buffer);
|
||||
|
||||
#ifdef FF_HAVE_ZLIB
|
||||
const char* ffNetworkingLoadZlibLibrary(void);
|
||||
bool ffNetworkingDecompressGzip(FFstrbuf* buffer, char* headerEnd);
|
||||
#endif
|
||||
@@ -0,0 +1,194 @@
|
||||
#include "fastfetch.h"
|
||||
#include "common/library.h"
|
||||
#include "common/networking/networking.h"
|
||||
#include "util/stringUtils.h"
|
||||
#include "util/debug.h"
|
||||
|
||||
#ifdef FF_HAVE_ZLIB
|
||||
#include <zlib.h>
|
||||
|
||||
struct FFZlibLibrary
|
||||
{
|
||||
FF_LIBRARY_SYMBOL(inflateInit2_)
|
||||
FF_LIBRARY_SYMBOL(inflate)
|
||||
FF_LIBRARY_SYMBOL(inflateEnd)
|
||||
FF_LIBRARY_SYMBOL(inflateGetHeader)
|
||||
|
||||
bool inited;
|
||||
} zlibData;
|
||||
|
||||
const char* ffNetworkingLoadZlibLibrary(void)
|
||||
{
|
||||
if (!zlibData.inited)
|
||||
{
|
||||
zlibData.inited = true;
|
||||
FF_LIBRARY_LOAD(zlib, "dlopen libz failed",
|
||||
#ifdef _WIN32
|
||||
"zlib1"
|
||||
#else
|
||||
"libz"
|
||||
#endif
|
||||
FF_LIBRARY_EXTENSION, 2)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(zlib, zlibData, inflateInit2_)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(zlib, zlibData, inflate)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(zlib, zlibData, inflateEnd)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(zlib, zlibData, inflateGetHeader)
|
||||
zlib = NULL; // don't auto dlclose
|
||||
}
|
||||
return zlibData.ffinflateEnd == NULL ? "Failed to load libz" : NULL;
|
||||
}
|
||||
|
||||
// Try to pre-read gzip header to determine uncompressed size
|
||||
static uint32_t guessGzipOutputSize(const void* data, uint32_t dataSize)
|
||||
{
|
||||
// gzip file format: http://www.zlib.org/rfc-gzip.html
|
||||
if (dataSize < 10 || ((const uint8_t*)data)[0] != 0x1f || ((const uint8_t*)data)[1] != 0x8b)
|
||||
return 0;
|
||||
|
||||
// Uncompressed size in gzip format is stored in the last 4 bytes, but only valid if data is less than 4GB
|
||||
if (dataSize > 18) {
|
||||
// Get ISIZE value from the end of file (little endian)
|
||||
const uint8_t* tail = (const uint8_t*)data + dataSize - 4;
|
||||
uint32_t uncompressedSize = (uint32_t) tail[0] | ((uint32_t) tail[1] << 8u) | ((uint32_t) tail[2] << 16u) | ((uint32_t) tail[3] << 24u);
|
||||
|
||||
// For valid gzip files, this value is the length of the uncompressed data modulo 2^32
|
||||
if (uncompressedSize > 0) {
|
||||
FF_DEBUG("Read uncompressed size from GZIP trailer: %u bytes", uncompressedSize);
|
||||
// Add some margin to the estimated size for safety
|
||||
return uncompressedSize + 64;
|
||||
}
|
||||
}
|
||||
|
||||
// If unable to get size from trailer or size is 0, use estimated value
|
||||
// Typically, text data compression ratio is between 3-5x, we use the larger value
|
||||
uint32_t estimatedSize = dataSize * 5;
|
||||
FF_DEBUG("Unable to read exact uncompressed size, estimated as 5x of compressed data: %u bytes", estimatedSize);
|
||||
return estimatedSize;
|
||||
}
|
||||
|
||||
// Decompress gzip content
|
||||
bool ffNetworkingDecompressGzip(FFstrbuf* buffer, char* headerEnd)
|
||||
{
|
||||
// Calculate header size
|
||||
uint32_t headerSize = (uint32_t) (headerEnd - buffer->chars);
|
||||
|
||||
*headerEnd = '\0'; // Replace delimiter with null character for easier processing
|
||||
// Ensure Content-Encoding is in response headers, not in response body
|
||||
bool hasGzip = strcasestr(buffer->chars, "\nContent-Encoding: gzip") != NULL;
|
||||
*headerEnd = '\r'; // Restore delimiter
|
||||
|
||||
if (!hasGzip) {
|
||||
FF_DEBUG("No gzip compressed content detected, skipping decompression");
|
||||
return true;
|
||||
}
|
||||
|
||||
FF_DEBUG("Gzip compressed content detected, preparing for decompression");
|
||||
|
||||
const char* bodyStart = headerEnd + 4; // Skip delimiter
|
||||
|
||||
// Calculate compressed content size
|
||||
uint32_t compressedSize = buffer->length - headerSize - 4;
|
||||
|
||||
if (compressedSize <= 0) {
|
||||
// No content to decompress
|
||||
FF_DEBUG("Compressed content size is 0, skipping decompression");
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if content is actually in gzip format (gzip header magic is 0x1f 0x8b)
|
||||
if (compressedSize < 2 || (uint8_t)bodyStart[0] != 0x1f || (uint8_t)bodyStart[1] != 0x8b) {
|
||||
FF_DEBUG("Content is not valid gzip format, skipping decompression");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Predict uncompressed size
|
||||
uint32_t estimatedSize = guessGzipOutputSize(bodyStart, compressedSize);
|
||||
|
||||
// Create decompression buffer with estimated size
|
||||
FF_STRBUF_AUTO_DESTROY decompressedBuffer = ffStrbufCreateA(estimatedSize > 0 ? estimatedSize : compressedSize * 5);
|
||||
FF_DEBUG("Created decompression buffer: %u bytes", decompressedBuffer.allocated);
|
||||
|
||||
// Initialize decompression
|
||||
z_stream zs = {
|
||||
.zalloc = Z_NULL,
|
||||
.zfree = Z_NULL,
|
||||
.opaque = Z_NULL,
|
||||
.avail_in = (uInt)compressedSize,
|
||||
.next_in = (Bytef*)bodyStart,
|
||||
.avail_out = (uInt)ffStrbufGetFree(&decompressedBuffer),
|
||||
.next_out = (Bytef*)decompressedBuffer.chars,
|
||||
};
|
||||
|
||||
// Initialize decompression engine
|
||||
if (zlibData.ffinflateInit2_(&zs, 16 + MAX_WBITS, ZLIB_VERSION, (int)sizeof(z_stream)) != Z_OK) {
|
||||
FF_DEBUG("Failed to initialize decompression engine");
|
||||
return false;
|
||||
}
|
||||
uInt availableOut = zs.avail_out;
|
||||
|
||||
// Perform decompression
|
||||
int result = zlibData.ffinflate(&zs, Z_FINISH);
|
||||
|
||||
// If output buffer is insufficient, try to extend buffer
|
||||
while (result == Z_BUF_ERROR || (result != Z_STREAM_END && zs.avail_out == 0))
|
||||
{
|
||||
FF_DEBUG("Output buffer insufficient, trying to extend");
|
||||
|
||||
// Save already decompressed data amount
|
||||
uint32_t alreadyDecompressed = (uint32_t)(availableOut - zs.avail_out);
|
||||
decompressedBuffer.length += alreadyDecompressed;
|
||||
decompressedBuffer.chars[decompressedBuffer.length] = '\0'; // Ensure null-terminated string
|
||||
|
||||
ffStrbufEnsureFree(&decompressedBuffer, decompressedBuffer.length / 2);
|
||||
|
||||
// Set output parameters to point to new buffer
|
||||
zs.avail_out = (uInt)ffStrbufGetFree(&decompressedBuffer);
|
||||
zs.next_out = (Bytef*)(decompressedBuffer.chars + decompressedBuffer.length);
|
||||
availableOut = zs.avail_out;
|
||||
|
||||
// Decompress again
|
||||
result = zlibData.ffinflate(&zs, Z_FINISH);
|
||||
}
|
||||
|
||||
zlibData.ffinflateEnd(&zs);
|
||||
|
||||
// Calculate decompressed size
|
||||
uint32_t decompressedSize = (uint32_t)(availableOut - zs.avail_out);
|
||||
decompressedBuffer.length += decompressedSize;
|
||||
decompressedBuffer.chars[decompressedSize] = '\0'; // Ensure null-terminated string
|
||||
FF_DEBUG("Successfully decompressed %u bytes compressed data to %u bytes", compressedSize, decompressedBuffer.length);
|
||||
|
||||
// Modify Content-Length header and remove Content-Encoding header
|
||||
FF_STRBUF_AUTO_DESTROY newBuffer = ffStrbufCreateA(headerSize + decompressedSize + 64);
|
||||
|
||||
char* line = NULL;
|
||||
size_t len = 0;
|
||||
while (ffStrbufGetline(&line, &len, buffer))
|
||||
{
|
||||
if (ffStrStartsWithIgnCase(line, "Content-Encoding:"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (ffStrStartsWithIgnCase(line, "Content-Length:"))
|
||||
{
|
||||
ffStrbufAppendF(&newBuffer, "Content-Length: %u\r\n", decompressedSize);
|
||||
continue;
|
||||
}
|
||||
else if (line[0] == '\r')
|
||||
{
|
||||
ffStrbufAppendS(&newBuffer, "\r\n");
|
||||
ffStrbufGetlineRestore(&line, &len, buffer);
|
||||
break;
|
||||
}
|
||||
|
||||
ffStrbufAppendS(&newBuffer, line);
|
||||
ffStrbufAppendC(&newBuffer, '\n');
|
||||
}
|
||||
|
||||
ffStrbufAppend(&newBuffer, &decompressedBuffer);
|
||||
ffStrbufDestroy(buffer);
|
||||
ffStrbufInitMove(buffer, &newBuffer);
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif // FF_HAVE_ZLIB
|
||||
@@ -0,0 +1,500 @@
|
||||
#include "fastfetch.h"
|
||||
#include "common/networking/networking.h"
|
||||
#include "common/time.h"
|
||||
#include "common/library.h"
|
||||
#include "util/stringUtils.h"
|
||||
#include "util/mallocHelper.h"
|
||||
#include "util/debug.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/poll.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h> // For FreeBSD
|
||||
#include <netinet/tcp.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
static const char* tryNonThreadingFastPath(FFNetworkingState* state)
|
||||
{
|
||||
#if defined(TCP_FASTOPEN) || __APPLE__
|
||||
|
||||
if (!state->tfo)
|
||||
{
|
||||
#ifdef __linux__
|
||||
// Linux doesn't support sendto() on unconnected sockets
|
||||
FF_DEBUG("TCP Fast Open disabled, skipping");
|
||||
return "TCP Fast Open disabled";
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
FF_DEBUG("Attempting to use TCP Fast Open to connect");
|
||||
|
||||
#ifndef __APPLE__ // On macOS, TCP_FASTOPEN doesn't seem to be needed
|
||||
// Set TCP Fast Open
|
||||
#ifdef __linux__
|
||||
int flag = 5; // the queue length of pending packets
|
||||
#else
|
||||
int flag = 1; // enable TCP Fast Open
|
||||
#endif
|
||||
if (setsockopt(state->sockfd, IPPROTO_TCP,
|
||||
#ifdef __APPLE__
|
||||
// https://github.com/rust-lang/libc/pull/3135
|
||||
0x218 // TCP_FASTOPEN_FORCE_ENABLE
|
||||
#else
|
||||
TCP_FASTOPEN
|
||||
#endif
|
||||
, &flag, sizeof(flag)) != 0) {
|
||||
FF_DEBUG("Failed to set TCP_FASTOPEN option: %s", strerror(errno));
|
||||
return "setsockopt(TCP_FASTOPEN) failed";
|
||||
} else {
|
||||
#ifdef __linux__
|
||||
FF_DEBUG("Successfully set TCP_FASTOPEN option, queue length: %d", flag);
|
||||
#elif defined(__APPLE__)
|
||||
FF_DEBUG("Successfully set TCP_FASTOPEN_FORCE_ENABLE option");
|
||||
#else
|
||||
FF_DEBUG("Successfully set TCP_FASTOPEN option");
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef __APPLE__
|
||||
FF_DEBUG("Using sendto() + MSG_DONTWAIT to send %u bytes of data", state->command.length);
|
||||
ssize_t sent = sendto(state->sockfd,
|
||||
state->command.chars,
|
||||
state->command.length,
|
||||
#ifdef MSG_FASTOPEN
|
||||
MSG_FASTOPEN |
|
||||
#endif
|
||||
#ifdef MSG_NOSIGNAL
|
||||
MSG_NOSIGNAL |
|
||||
#endif
|
||||
MSG_DONTWAIT,
|
||||
state->addr->ai_addr,
|
||||
state->addr->ai_addrlen);
|
||||
#else
|
||||
if (fcntl(state->sockfd, F_SETFL, O_NONBLOCK) == -1) {
|
||||
FF_DEBUG("fcntl(F_SETFL) failed: %s", strerror(errno));
|
||||
return "fcntl(F_SETFL) failed";
|
||||
}
|
||||
FF_DEBUG("Using connectx() to send %u bytes of data", state->command.length);
|
||||
// Use connectx to establish connection and send data in one call
|
||||
size_t sent;
|
||||
if (connectx(state->sockfd,
|
||||
&(sa_endpoints_t) {
|
||||
.sae_dstaddr = state->addr->ai_addr,
|
||||
.sae_dstaddrlen = state->addr->ai_addrlen,
|
||||
},
|
||||
SAE_ASSOCID_ANY, state->tfo ? CONNECT_DATA_IDEMPOTENT : 0,
|
||||
&(struct iovec) {
|
||||
.iov_base = state->command.chars,
|
||||
.iov_len = state->command.length,
|
||||
}, 1, &sent, NULL) != 0) sent = 0;
|
||||
if (fcntl(state->sockfd, F_SETFL, 0) == -1) {
|
||||
FF_DEBUG("fcntl(F_SETFL) failed: %s", strerror(errno));
|
||||
return "fcntl(F_SETFL) failed";
|
||||
}
|
||||
#endif
|
||||
if (sent > 0 || (errno == EAGAIN || errno == EWOULDBLOCK
|
||||
#ifdef __APPLE__
|
||||
// On macOS EINPROGRESS means the connection cannot be completed immediately
|
||||
// On Linux, it means the TFO cookie is not available locally
|
||||
|| errno == EINPROGRESS
|
||||
#endif
|
||||
))
|
||||
{
|
||||
FF_DEBUG(
|
||||
#ifdef __APPLE__
|
||||
"connectx()"
|
||||
#else
|
||||
"sendto()"
|
||||
#endif
|
||||
" %s (sent=%zd, errno=%d: %s)", errno == 0 ? "succeeded" : "was in progress",
|
||||
sent, errno, strerror(errno));
|
||||
freeaddrinfo(state->addr);
|
||||
state->addr = NULL;
|
||||
ffStrbufDestroy(&state->command);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
FF_DEBUG(
|
||||
#ifdef __APPLE__
|
||||
"connectx()"
|
||||
#else
|
||||
"sendto()"
|
||||
#endif
|
||||
" failed: %s (errno=%d)", strerror(errno), errno);
|
||||
#ifdef __APPLE__
|
||||
return "connectx() failed";
|
||||
#else
|
||||
return "sendto() failed";
|
||||
#endif
|
||||
#else
|
||||
FF_UNUSED(state);
|
||||
return "TFO support is not available";
|
||||
#endif
|
||||
}
|
||||
|
||||
// Traditional connect and send function
|
||||
static const char* connectAndSend(FFNetworkingState* state)
|
||||
{
|
||||
const char* ret = NULL;
|
||||
FF_DEBUG("Using traditional connection method to connect");
|
||||
|
||||
FF_DEBUG("Attempting connect() to server...");
|
||||
if(connect(state->sockfd, state->addr->ai_addr, state->addr->ai_addrlen) == -1)
|
||||
{
|
||||
FF_DEBUG("connect() failed: %s (errno=%d)", strerror(errno), errno);
|
||||
ret = "connect() failed";
|
||||
goto error;
|
||||
}
|
||||
FF_DEBUG("connect() succeeded");
|
||||
|
||||
FF_DEBUG("Attempting to send %u bytes of data...", state->command.length);
|
||||
if(send(state->sockfd, state->command.chars, state->command.length, 0) < 0)
|
||||
{
|
||||
FF_DEBUG("send() failed: %s (errno=%d)", strerror(errno), errno);
|
||||
ret = "send() failed";
|
||||
goto error;
|
||||
}
|
||||
FF_DEBUG("Data sent successfully");
|
||||
|
||||
goto exit;
|
||||
|
||||
error:
|
||||
FF_DEBUG("Error occurred, closing socket");
|
||||
close(state->sockfd);
|
||||
state->sockfd = -1;
|
||||
|
||||
exit:
|
||||
FF_DEBUG("Releasing address info and other resources");
|
||||
freeaddrinfo(state->addr);
|
||||
state->addr = NULL;
|
||||
ffStrbufDestroy(&state->command);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
FF_THREAD_ENTRY_DECL_WRAPPER(connectAndSend, FFNetworkingState*);
|
||||
|
||||
// Parallel DNS resolution and socket creation
|
||||
static const char* initNetworkingState(FFNetworkingState* state, const char* host, const char* path, const char* headers)
|
||||
{
|
||||
FF_DEBUG("Initializing network connection state: host=%s, path=%s", host, path);
|
||||
|
||||
// Initialize command and host information
|
||||
ffStrbufInitA(&state->command, 64);
|
||||
ffStrbufAppendS(&state->command, "GET ");
|
||||
ffStrbufAppendS(&state->command, path);
|
||||
ffStrbufAppendS(&state->command, " HTTP/1.0\nHost: ");
|
||||
ffStrbufAppendS(&state->command, host);
|
||||
ffStrbufAppendS(&state->command, "\r\n");
|
||||
|
||||
// Add extra optimized HTTP headers
|
||||
ffStrbufAppendS(&state->command, "Connection: close\r\n"); // Explicitly tell the server we don't need to keep the connection
|
||||
|
||||
// If compression needs to be enabled
|
||||
if (state->compression) {
|
||||
FF_DEBUG("Enabling HTTP content compression");
|
||||
ffStrbufAppendS(&state->command, "Accept-Encoding: gzip\r\n");
|
||||
}
|
||||
|
||||
ffStrbufAppendS(&state->command, headers);
|
||||
ffStrbufAppendS(&state->command, "\r\n");
|
||||
|
||||
#ifdef FF_HAVE_THREADS
|
||||
state->thread = 0;
|
||||
FF_DEBUG("Thread ID initialized to 0");
|
||||
#endif
|
||||
|
||||
const char* ret = NULL;
|
||||
|
||||
struct addrinfo hints = {
|
||||
.ai_family = state->ipv6 ? AF_INET6 : AF_INET,
|
||||
.ai_socktype = SOCK_STREAM,
|
||||
.ai_flags = AI_NUMERICSERV
|
||||
};
|
||||
|
||||
FF_DEBUG("Resolving address: %s (%s)", host, state->ipv6 ? "IPv6" : "IPv4");
|
||||
// Use AI_NUMERICSERV flag to indicate the service is a numeric port, reducing parsing time
|
||||
|
||||
if(getaddrinfo(host, "80", &hints, &state->addr) != 0)
|
||||
{
|
||||
FF_DEBUG("getaddrinfo() failed: %s", gai_strerror(errno));
|
||||
ret = "getaddrinfo() failed";
|
||||
goto error;
|
||||
}
|
||||
FF_DEBUG("Address resolution successful");
|
||||
|
||||
FF_DEBUG("Creating socket");
|
||||
state->sockfd = socket(state->addr->ai_family, state->addr->ai_socktype, state->addr->ai_protocol);
|
||||
if(state->sockfd == -1)
|
||||
{
|
||||
FF_DEBUG("socket() failed: %s (errno=%d)", strerror(errno), errno);
|
||||
ret = "socket() failed";
|
||||
goto error;
|
||||
}
|
||||
FF_DEBUG("Socket creation successful: fd=%d", state->sockfd);
|
||||
|
||||
int flag = 1;
|
||||
#ifdef TCP_NODELAY
|
||||
// Disable Nagle's algorithm to reduce small packet transmission delay
|
||||
if (setsockopt(state->sockfd, IPPROTO_TCP, TCP_NODELAY, &flag, sizeof(flag)) != 0) {
|
||||
FF_DEBUG("Failed to set TCP_NODELAY: %s", strerror(errno));
|
||||
} else {
|
||||
FF_DEBUG("Successfully disabled Nagle's algorithm");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef TCP_QUICKACK
|
||||
// Set TCP_QUICKACK option to avoid delayed acknowledgments
|
||||
if (setsockopt(state->sockfd, IPPROTO_TCP, TCP_QUICKACK, &flag, sizeof(flag)) != 0) {
|
||||
FF_DEBUG("Failed to set TCP_QUICKACK: %s", strerror(errno));
|
||||
} else {
|
||||
FF_DEBUG("Successfully enabled TCP quick acknowledgment");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (state->timeout > 0)
|
||||
{
|
||||
FF_DEBUG("Setting connection timeout: %u ms", state->timeout);
|
||||
FF_MAYBE_UNUSED uint32_t sec = state->timeout / 1000;
|
||||
if (sec == 0) sec = 1;
|
||||
|
||||
#ifdef TCP_CONNECTIONTIMEOUT
|
||||
FF_DEBUG("Using TCP_CONNECTIONTIMEOUT: %u seconds", sec);
|
||||
setsockopt(state->sockfd, IPPROTO_TCP, TCP_CONNECTIONTIMEOUT, &sec, sizeof(sec));
|
||||
#elif defined(TCP_KEEPINIT)
|
||||
FF_DEBUG("Using TCP_KEEPINIT: %u seconds", sec);
|
||||
setsockopt(state->sockfd, IPPROTO_TCP, TCP_KEEPINIT, &sec, sizeof(sec));
|
||||
#elif defined(TCP_USER_TIMEOUT)
|
||||
FF_DEBUG("Using TCP_USER_TIMEOUT: %u milliseconds", state->timeout);
|
||||
setsockopt(state->sockfd, IPPROTO_TCP, TCP_USER_TIMEOUT, &state->timeout, sizeof(state->timeout));
|
||||
#else
|
||||
FF_DEBUG("Current platform does not support TCP connection timeout");
|
||||
#endif
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
error:
|
||||
FF_DEBUG("Error occurred during initialization");
|
||||
if (state->addr != NULL)
|
||||
{
|
||||
FF_DEBUG("Releasing address information");
|
||||
freeaddrinfo(state->addr);
|
||||
state->addr = NULL;
|
||||
}
|
||||
|
||||
if (state->sockfd > 0)
|
||||
{
|
||||
FF_DEBUG("Closing socket: fd=%d", state->sockfd);
|
||||
close(state->sockfd);
|
||||
state->sockfd = -1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
const char* ffNetworkingSendHttpRequest(FFNetworkingState* state, const char* host, const char* path, const char* headers)
|
||||
{
|
||||
FF_DEBUG("Preparing to send HTTP request: host=%s, path=%s", host, path);
|
||||
|
||||
if (state->compression)
|
||||
{
|
||||
FF_DEBUG("Compression enabled, checking if zlib is available");
|
||||
|
||||
#ifdef FF_HAVE_ZLIB
|
||||
const char* zlibError = ffNetworkingLoadZlibLibrary();
|
||||
// Only enable compression if zlib library is successfully loaded
|
||||
if (zlibError == NULL)
|
||||
{
|
||||
FF_DEBUG("Successfully loaded zlib library, compression enabled");
|
||||
} else {
|
||||
FF_DEBUG("Failed to load zlib library, compression disabled: %s", zlibError);
|
||||
state->compression = false;
|
||||
}
|
||||
#else
|
||||
FF_DEBUG("zlib not supported at build time, compression disabled");
|
||||
state->compression = false;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
FF_DEBUG("Compression disabled");
|
||||
}
|
||||
|
||||
const char* initResult = initNetworkingState(state, host, path, headers);
|
||||
if (initResult != NULL) {
|
||||
FF_DEBUG("Initialization failed: %s", initResult);
|
||||
return initResult;
|
||||
}
|
||||
FF_DEBUG("Network state initialization successful");
|
||||
|
||||
const char* tfoResult = tryNonThreadingFastPath(state);
|
||||
if (tfoResult == NULL) {
|
||||
FF_DEBUG("TryNonThreadingFastPath() succeeded or in progress");
|
||||
return NULL;
|
||||
}
|
||||
FF_DEBUG("TryNonThreadingFastPath() failed: %s, trying traditional connection", tfoResult);
|
||||
|
||||
#ifdef FF_HAVE_THREADS
|
||||
if (instance.config.general.multithreading)
|
||||
{
|
||||
FF_DEBUG("Multithreading mode enabled, creating connection thread");
|
||||
state->thread = ffThreadCreate(connectAndSendThreadMain, state);
|
||||
if (state->thread) {
|
||||
FF_DEBUG("Thread creation successful: thread=%p", (void*)state->thread);
|
||||
return NULL;
|
||||
}
|
||||
FF_DEBUG("Thread creation failed");
|
||||
} else {
|
||||
FF_DEBUG("Multithreading mode disabled, connecting in main thread");
|
||||
}
|
||||
#endif
|
||||
|
||||
return connectAndSend(state);
|
||||
}
|
||||
|
||||
const char* ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buffer)
|
||||
{
|
||||
FF_DEBUG("Preparing to receive HTTP response");
|
||||
uint32_t timeout = state->timeout;
|
||||
|
||||
#ifdef FF_HAVE_THREADS
|
||||
if (state->thread)
|
||||
{
|
||||
FF_DEBUG("Connection thread is running, waiting for it to complete (timeout=%u ms)", timeout);
|
||||
if (!ffThreadJoin(state->thread, timeout)) {
|
||||
FF_DEBUG("Thread join failed or timed out");
|
||||
return "ffThreadJoin() failed or timeout";
|
||||
}
|
||||
FF_DEBUG("Thread completed successfully");
|
||||
state->thread = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if(state->sockfd == -1)
|
||||
{
|
||||
FF_DEBUG("Invalid socket, HTTP request might have failed");
|
||||
return "ffNetworkingSendHttpRequest() failed";
|
||||
}
|
||||
|
||||
// Set larger initial receive buffer instead of small repeated receives
|
||||
int rcvbuf = 65536; // 64KB
|
||||
setsockopt(state->sockfd, SOL_SOCKET, SO_RCVBUF, &rcvbuf, sizeof(rcvbuf));
|
||||
|
||||
#ifdef __APPLE__
|
||||
// poll for the socket to be readable.
|
||||
// Because of the non-blocking connectx() call, the connection might not be established yet
|
||||
FF_DEBUG("Using poll() to check if socket is readable");
|
||||
if (poll(&(struct pollfd) {
|
||||
.fd = state->sockfd,
|
||||
.events = POLLIN
|
||||
}, 1, timeout > 0 ? (int) timeout : -1) == -1)
|
||||
{
|
||||
FF_DEBUG("poll() failed: %s (errno=%d)", strerror(errno), errno);
|
||||
close(state->sockfd);
|
||||
state->sockfd = -1;
|
||||
return "poll() failed";
|
||||
}
|
||||
FF_DEBUG("Socket is readable, proceeding to receive data");
|
||||
#else
|
||||
if(timeout > 0)
|
||||
{
|
||||
FF_DEBUG("Setting receive timeout: %u ms", timeout);
|
||||
struct timeval timev;
|
||||
timev.tv_sec = timeout / 1000;
|
||||
timev.tv_usec = (__typeof__(timev.tv_usec)) ((timeout % 1000) * 1000); //milliseconds to microseconds
|
||||
setsockopt(state->sockfd, SOL_SOCKET, SO_RCVTIMEO, &timev, sizeof(timev));
|
||||
}
|
||||
#endif
|
||||
|
||||
FF_DEBUG("Starting data reception");
|
||||
FF_MAYBE_UNUSED int recvCount = 0;
|
||||
uint32_t contentLength = 0;
|
||||
char* headerEnd = NULL;
|
||||
|
||||
do {
|
||||
FF_DEBUG("Data reception loop #%d, current buffer size: %u, available space: %u",
|
||||
++recvCount, buffer->length, ffStrbufGetFree(buffer));
|
||||
|
||||
ssize_t received = recv(state->sockfd, buffer->chars + buffer->length, ffStrbufGetFree(buffer), MSG_WAITALL);
|
||||
|
||||
if (received <= 0) {
|
||||
if (received == 0) {
|
||||
FF_DEBUG("Connection closed (received=0)");
|
||||
} else {
|
||||
FF_DEBUG("Reception failed: %s (errno=%d)", strerror(errno), errno);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
buffer->length += (uint32_t) received;
|
||||
buffer->chars[buffer->length] = '\0';
|
||||
|
||||
FF_DEBUG("Successfully received %zd bytes of data, total: %u bytes", received, buffer->length);
|
||||
|
||||
// Check if HTTP header end marker is found
|
||||
if (headerEnd == NULL) {
|
||||
headerEnd = memmem(buffer->chars, buffer->length, "\r\n\r\n", 4);
|
||||
if (headerEnd != NULL) {
|
||||
FF_DEBUG("Found HTTP header end marker, position: %ld", (long)(headerEnd - buffer->chars));
|
||||
|
||||
// Check for Content-Length header to pre-allocate enough memory
|
||||
const char* clHeader = strcasestr(buffer->chars, "Content-Length:");
|
||||
if (clHeader) {
|
||||
contentLength = (uint32_t) strtoul(clHeader + 16, NULL, 10);
|
||||
if (contentLength > 0) {
|
||||
FF_DEBUG("Detected Content-Length: %u, pre-allocating buffer", contentLength);
|
||||
// Ensure buffer is large enough, adding header size and some margin
|
||||
ffStrbufEnsureFree(buffer, contentLength + 16);
|
||||
FF_DEBUG("Extended receive buffer to %u bytes", buffer->length);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (ffStrbufGetFree(buffer) > 0);
|
||||
|
||||
FF_DEBUG("Closing socket: fd=%d", state->sockfd);
|
||||
close(state->sockfd);
|
||||
state->sockfd = -1;
|
||||
|
||||
if (buffer->length == 0) {
|
||||
FF_DEBUG("Server response is empty");
|
||||
return "Empty server response received";
|
||||
}
|
||||
|
||||
if (headerEnd == NULL) {
|
||||
FF_DEBUG("No HTTP header end marker found");
|
||||
return "No HTTP header end found";
|
||||
}
|
||||
if (contentLength > 0 && buffer->length != contentLength + (uint32_t)(headerEnd - buffer->chars) + 4) {
|
||||
FF_DEBUG("Received content length mismatches: %u != %u", buffer->length, contentLength + (uint32_t)(headerEnd - buffer->chars) + 4);
|
||||
return "Content length mismatch";
|
||||
}
|
||||
|
||||
if (ffStrbufStartsWithS(buffer, "HTTP/1.0 200 OK\r\n")) {
|
||||
FF_DEBUG("Received valid HTTP 200 response, content %u bytes, total %u bytes", contentLength, buffer->length);
|
||||
} else {
|
||||
FF_DEBUG("Invalid response: %.40s...", buffer->chars);
|
||||
return "Invalid response";
|
||||
}
|
||||
|
||||
// If compression was used, try to decompress
|
||||
#ifdef FF_HAVE_ZLIB
|
||||
if (state->compression) {
|
||||
FF_DEBUG("Content received, checking if compressed");
|
||||
if (!ffNetworkingDecompressGzip(buffer, headerEnd)) {
|
||||
FF_DEBUG("Decompression failed or invalid compression format");
|
||||
return "Failed to decompress or invalid format";
|
||||
} else {
|
||||
FF_DEBUG("Decompression successful or no decompression needed, total length after decompression: %u bytes", buffer->length);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -0,0 +1,339 @@
|
||||
#include <mswsock.h>
|
||||
#include <ws2tcpip.h>
|
||||
|
||||
//Must be included after <mswsock.h>
|
||||
#include "fastfetch.h"
|
||||
#include "common/networking/networking.h"
|
||||
#include "util/stringUtils.h"
|
||||
#include "util/debug.h"
|
||||
|
||||
static LPFN_CONNECTEX ConnectEx;
|
||||
|
||||
static const char* initWsaData(WSADATA* wsaData)
|
||||
{
|
||||
FF_DEBUG("Initializing WinSock");
|
||||
if(WSAStartup(MAKEWORD(2, 2), wsaData) != 0) {
|
||||
FF_DEBUG("WSAStartup() failed");
|
||||
return "WSAStartup() failed";
|
||||
}
|
||||
|
||||
if(LOBYTE(wsaData->wVersion) != 2 || HIBYTE(wsaData->wVersion) != 2) {
|
||||
FF_DEBUG("Invalid wsaData version found: %d.%d", LOBYTE(wsaData->wVersion), HIBYTE(wsaData->wVersion));
|
||||
return "Invalid wsaData version found";
|
||||
}
|
||||
|
||||
//Dummy socket needed for WSAIoctl
|
||||
SOCKET sockfd = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if(sockfd == INVALID_SOCKET) {
|
||||
FF_DEBUG("socket(AF_INET, SOCK_STREAM) failed");
|
||||
return "socket(AF_INET, SOCK_STREAM) failed";
|
||||
}
|
||||
|
||||
DWORD dwBytes;
|
||||
GUID guid = WSAID_CONNECTEX;
|
||||
if(WSAIoctl(sockfd, SIO_GET_EXTENSION_FUNCTION_POINTER,
|
||||
&guid, sizeof(guid),
|
||||
&ConnectEx, sizeof(ConnectEx),
|
||||
&dwBytes, NULL, NULL) != 0) {
|
||||
FF_DEBUG("WSAIoctl(sockfd, SIO_GET_EXTENSION_FUNCTION_POINTER) failed");
|
||||
return "WSAIoctl(sockfd, SIO_GET_EXTENSION_FUNCTION_POINTER) failed";
|
||||
}
|
||||
|
||||
closesocket(sockfd);
|
||||
FF_DEBUG("WinSock initialized successfully");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* ffNetworkingSendHttpRequest(FFNetworkingState* state, const char* host, const char* path, const char* headers)
|
||||
{
|
||||
FF_DEBUG("Preparing to send HTTP request: host=%s, path=%s", host, path);
|
||||
|
||||
if (state->compression)
|
||||
{
|
||||
#ifdef FF_HAVE_ZLIB
|
||||
const char* zlibError = ffNetworkingLoadZlibLibrary();
|
||||
// Only enable compression if zlib library is successfully loaded
|
||||
if (zlibError == NULL)
|
||||
{
|
||||
FF_DEBUG("Successfully loaded zlib library, compression enabled");
|
||||
} else {
|
||||
FF_DEBUG("Failed to load zlib library, compression disabled: %s", zlibError);
|
||||
state->compression = false;
|
||||
}
|
||||
#else
|
||||
FF_DEBUG("zlib not supported at build time, compression disabled");
|
||||
state->compression = false;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
FF_DEBUG("Compression disabled");
|
||||
}
|
||||
|
||||
static WSADATA wsaData;
|
||||
if (wsaData.wVersion == 0)
|
||||
{
|
||||
const char* error = initWsaData(&wsaData);
|
||||
if (error != NULL)
|
||||
{
|
||||
wsaData.wVersion = (WORD) -1;
|
||||
FF_DEBUG("WinSock initialization failed: %s", error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
else if (wsaData.wVersion == (WORD) -1)
|
||||
{
|
||||
FF_DEBUG("WinSock initialization previously failed");
|
||||
return "initWsaData() failed before";
|
||||
}
|
||||
|
||||
struct addrinfo* addr;
|
||||
struct addrinfo hints = {
|
||||
.ai_family = state->ipv6 ? AF_INET6 : AF_INET,
|
||||
.ai_socktype = SOCK_STREAM,
|
||||
.ai_flags = AI_NUMERICSERV,
|
||||
};
|
||||
|
||||
FF_DEBUG("Resolving address: %s (%s)", host, state->ipv6 ? "IPv6" : "IPv4");
|
||||
if(getaddrinfo(host, "80", &hints, &addr) != 0)
|
||||
{
|
||||
FF_DEBUG("getaddrinfo() failed");
|
||||
return "getaddrinfo() failed";
|
||||
}
|
||||
|
||||
state->sockfd = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol);
|
||||
if(state->sockfd == INVALID_SOCKET)
|
||||
{
|
||||
FF_DEBUG("socket() failed");
|
||||
freeaddrinfo(addr);
|
||||
return "socket() failed";
|
||||
}
|
||||
|
||||
DWORD flag = 1;
|
||||
#ifdef TCP_NODELAY
|
||||
// Enable TCP_NODELAY to disable Nagle's algorithm
|
||||
if (setsockopt(state->sockfd, IPPROTO_TCP, TCP_NODELAY, (char*)&flag, sizeof(flag)) != 0) {
|
||||
FF_DEBUG("Failed to set TCP_NODELAY: %s", ffDebugWin32Error((DWORD) WSAGetLastError()));
|
||||
} else {
|
||||
FF_DEBUG("Successfully disabled Nagle's algorithm");
|
||||
}
|
||||
#endif
|
||||
|
||||
// Set timeout if needed
|
||||
if (state->timeout > 0) {
|
||||
FF_DEBUG("Setting connection timeout: %u ms", state->timeout);
|
||||
setsockopt(state->sockfd, SOL_SOCKET, SO_SNDTIMEO, (const char*)&state->timeout, sizeof(state->timeout));
|
||||
}
|
||||
|
||||
//ConnectEx requires the socket to be initially bound
|
||||
if((state->ipv6
|
||||
? bind(state->sockfd, (SOCKADDR *) &(struct sockaddr_in6) {
|
||||
.sin6_family = AF_INET6,
|
||||
.sin6_addr = in6addr_any,
|
||||
}, sizeof(struct sockaddr_in6))
|
||||
: bind(state->sockfd, (SOCKADDR *) &(struct sockaddr_in) {
|
||||
.sin_family = AF_INET,
|
||||
.sin_addr.s_addr = INADDR_ANY,
|
||||
}, sizeof(struct sockaddr_in))) != 0)
|
||||
{
|
||||
FF_DEBUG("bind() failed: %s", ffDebugWin32Error((DWORD) WSAGetLastError()));
|
||||
closesocket(state->sockfd);
|
||||
freeaddrinfo(addr);
|
||||
state->sockfd = INVALID_SOCKET;
|
||||
return "bind() failed";
|
||||
}
|
||||
|
||||
// Initialize overlapped structure for asynchronous I/O
|
||||
memset(&state->overlapped, 0, sizeof(OVERLAPPED));
|
||||
|
||||
// Build HTTP command
|
||||
FF_STRBUF_AUTO_DESTROY command = ffStrbufCreateA(64);
|
||||
ffStrbufAppendS(&command, "GET ");
|
||||
ffStrbufAppendS(&command, path);
|
||||
ffStrbufAppendS(&command, " HTTP/1.0\nHost: ");
|
||||
ffStrbufAppendS(&command, host);
|
||||
ffStrbufAppendS(&command, "\r\n");
|
||||
ffStrbufAppendS(&command, "Connection: close\r\n"); // Explicitly request connection closure
|
||||
|
||||
// Add compression support if enabled
|
||||
if (state->compression) {
|
||||
FF_DEBUG("Enabling HTTP content compression");
|
||||
ffStrbufAppendS(&command, "Accept-Encoding: gzip\r\n");
|
||||
}
|
||||
|
||||
ffStrbufAppendS(&command, headers);
|
||||
ffStrbufAppendS(&command, "\r\n");
|
||||
|
||||
#ifdef TCP_FASTOPEN
|
||||
if (state->tfo)
|
||||
{
|
||||
// Set TCP Fast Open
|
||||
flag = 1;
|
||||
if (setsockopt(state->sockfd, IPPROTO_TCP, TCP_FASTOPEN, (char*)&flag, sizeof(flag)) != 0) {
|
||||
FF_DEBUG("Failed to set TCP_FASTOPEN option: %s", ffDebugWin32Error((DWORD) WSAGetLastError()));
|
||||
} else {
|
||||
FF_DEBUG("Successfully set TCP_FASTOPEN option");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FF_DEBUG("TCP Fast Open disabled");
|
||||
}
|
||||
#endif
|
||||
|
||||
FF_DEBUG("Using ConnectEx to send %u bytes of data", command.length);
|
||||
DWORD sent = 0;
|
||||
BOOL result = ConnectEx(state->sockfd, addr->ai_addr, (int)addr->ai_addrlen,
|
||||
command.chars, command.length, &sent, &state->overlapped);
|
||||
|
||||
freeaddrinfo(addr);
|
||||
addr = NULL;
|
||||
|
||||
if(!result)
|
||||
{
|
||||
if (WSAGetLastError() != WSA_IO_PENDING)
|
||||
{
|
||||
FF_DEBUG("ConnectEx() failed: %s", ffDebugWin32Error((DWORD) WSAGetLastError()));
|
||||
closesocket(state->sockfd);
|
||||
state->sockfd = INVALID_SOCKET;
|
||||
return "ConnectEx() failed";
|
||||
}
|
||||
else
|
||||
{
|
||||
FF_DEBUG("ConnectEx() pending");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FF_DEBUG("ConnectEx() succeeded, sent %u bytes of data", (unsigned) sent);
|
||||
}
|
||||
|
||||
// No need to cleanup state fields here since we need them in the receive function
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buffer)
|
||||
{
|
||||
FF_DEBUG("Preparing to receive HTTP response");
|
||||
|
||||
if (state->sockfd == INVALID_SOCKET)
|
||||
{
|
||||
FF_DEBUG("Invalid socket, HTTP request might have failed");
|
||||
return "ffNetworkingSendHttpRequest() failed";
|
||||
}
|
||||
|
||||
uint32_t timeout = state->timeout;
|
||||
if (timeout > 0)
|
||||
{
|
||||
FF_DEBUG("WaitForSingleObject with timeout: %u ms", timeout);
|
||||
if (WaitForSingleObject((HANDLE)state->sockfd, timeout) != WAIT_OBJECT_0)
|
||||
{
|
||||
FF_DEBUG("WaitForSingleObject failed or timed out");
|
||||
CancelIo((HANDLE) state->sockfd);
|
||||
closesocket(state->sockfd);
|
||||
return "WaitForSingleObject(state->sockfd) failed or timeout";
|
||||
}
|
||||
}
|
||||
|
||||
DWORD transfer, flags;
|
||||
if (!WSAGetOverlappedResult(state->sockfd, &state->overlapped, &transfer, TRUE, &flags))
|
||||
{
|
||||
FF_DEBUG("WSAGetOverlappedResult failed: %s", ffDebugWin32Error((DWORD) WSAGetLastError()));
|
||||
closesocket(state->sockfd);
|
||||
return "WSAGetOverlappedResult() failed";
|
||||
}
|
||||
|
||||
if(timeout > 0)
|
||||
{
|
||||
FF_DEBUG("Setting receive timeout: %u ms", timeout);
|
||||
setsockopt(state->sockfd, SOL_SOCKET, SO_RCVTIMEO, (const char*)&timeout, sizeof(timeout));
|
||||
}
|
||||
|
||||
// Set larger receive buffer for better performance
|
||||
int rcvbuf = 65536; // 64KB
|
||||
setsockopt(state->sockfd, SOL_SOCKET, SO_RCVBUF, (const char*)&rcvbuf, sizeof(rcvbuf));
|
||||
|
||||
FF_DEBUG("Starting data reception");
|
||||
FF_MAYBE_UNUSED int recvCount = 0;
|
||||
uint32_t contentLength = 0;
|
||||
char* headerEnd = NULL;
|
||||
|
||||
do {
|
||||
FF_DEBUG("Data reception loop #%d, current buffer size: %u, available space: %u",
|
||||
++recvCount, buffer->length, ffStrbufGetFree(buffer));
|
||||
|
||||
ssize_t received = recv(state->sockfd, buffer->chars + buffer->length, (int)ffStrbufGetFree(buffer), 0);
|
||||
|
||||
if (received <= 0) {
|
||||
if (received == 0) {
|
||||
FF_DEBUG("Connection closed (received=0)");
|
||||
} else {
|
||||
FF_DEBUG("Reception failed: %s", ffDebugWin32Error((DWORD) WSAGetLastError()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
buffer->length += (uint32_t) received;
|
||||
buffer->chars[buffer->length] = '\0';
|
||||
|
||||
FF_DEBUG("Successfully received %zd bytes of data, total: %u bytes", received, buffer->length);
|
||||
|
||||
// Check if HTTP header end marker is found
|
||||
if (headerEnd == NULL) {
|
||||
headerEnd = strstr(buffer->chars, "\r\n\r\n");
|
||||
if (headerEnd != NULL) {
|
||||
FF_DEBUG("Found HTTP header end marker, position: %ld", (long)(headerEnd - buffer->chars));
|
||||
|
||||
// Check for Content-Length header to pre-allocate enough memory
|
||||
const char* clHeader = strcasestr(buffer->chars, "Content-Length:");
|
||||
if (clHeader) {
|
||||
contentLength = (uint32_t) strtoul(clHeader + 16, NULL, 10);
|
||||
if (contentLength > 0) {
|
||||
FF_DEBUG("Detected Content-Length: %u, pre-allocating buffer", contentLength);
|
||||
// Ensure buffer is large enough, adding header size and some margin
|
||||
ffStrbufEnsureFree(buffer, contentLength + 16);
|
||||
FF_DEBUG("Extended receive buffer to %u bytes", buffer->allocated);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (ffStrbufGetFree(buffer) > 0);
|
||||
|
||||
FF_DEBUG("Closing socket: fd=%u", (unsigned)state->sockfd);
|
||||
closesocket(state->sockfd);
|
||||
state->sockfd = INVALID_SOCKET;
|
||||
|
||||
if (buffer->length == 0) {
|
||||
FF_DEBUG("Server response is empty");
|
||||
return "Empty server response received";
|
||||
}
|
||||
|
||||
if (headerEnd == NULL) {
|
||||
FF_DEBUG("No HTTP header end marker found");
|
||||
return "No HTTP header end found";
|
||||
}
|
||||
|
||||
if (ffStrbufStartsWithS(buffer, "HTTP/1.0 200 OK\r\n")) {
|
||||
FF_DEBUG("Received valid HTTP 200 response, content length: %u bytes, total length: %u bytes",
|
||||
contentLength, buffer->length);
|
||||
} else {
|
||||
FF_DEBUG("Invalid response: %.40s...", buffer->chars);
|
||||
return "Invalid response";
|
||||
}
|
||||
|
||||
// If compression was used, try to decompress
|
||||
#ifdef FF_HAVE_ZLIB
|
||||
if (state->compression) {
|
||||
FF_DEBUG("Content received, checking if compressed");
|
||||
if (!ffNetworkingDecompressGzip(buffer, headerEnd)) {
|
||||
FF_DEBUG("Decompression failed or invalid compression format");
|
||||
return "Failed to decompress or invalid format";
|
||||
} else {
|
||||
FF_DEBUG("Decompression successful or no decompression needed, total length after decompression: %u bytes", buffer->length);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
#include "fastfetch.h"
|
||||
#include "common/networking.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h> // For FreeBSD
|
||||
#include <netinet/tcp.h>
|
||||
|
||||
static const char* connectAndSend(FFNetworkingState* state)
|
||||
{
|
||||
const char* ret = NULL;
|
||||
struct addrinfo* addr;
|
||||
|
||||
if(getaddrinfo(state->host.chars, "80", &(struct addrinfo) {
|
||||
.ai_family = state->ipv6 ? AF_INET6 : AF_INET,
|
||||
.ai_socktype = SOCK_STREAM,
|
||||
}, &addr) != 0)
|
||||
{
|
||||
ret = "getaddrinfo() failed";
|
||||
goto error;
|
||||
}
|
||||
|
||||
state->sockfd = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol);
|
||||
if(state->sockfd == -1)
|
||||
{
|
||||
freeaddrinfo(addr);
|
||||
ret = "socket() failed";
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (state->timeout > 0)
|
||||
{
|
||||
FF_MAYBE_UNUSED uint32_t sec = state->timeout / 1000;
|
||||
if (sec == 0) sec = 1;
|
||||
|
||||
#ifdef TCP_CONNECTIONTIMEOUT
|
||||
setsockopt(state->sockfd, IPPROTO_TCP, TCP_CONNECTIONTIMEOUT, &sec, sizeof(sec));
|
||||
#elif defined(TCP_KEEPINIT)
|
||||
setsockopt(state->sockfd, IPPROTO_TCP, TCP_KEEPINIT, &sec, sizeof(sec));
|
||||
#elif defined(TCP_USER_TIMEOUT)
|
||||
setsockopt(state->sockfd, IPPROTO_TCP, TCP_USER_TIMEOUT, &state->timeout, sizeof(state->timeout));
|
||||
#endif
|
||||
}
|
||||
|
||||
if(connect(state->sockfd, addr->ai_addr, addr->ai_addrlen) == -1)
|
||||
{
|
||||
close(state->sockfd);
|
||||
freeaddrinfo(addr);
|
||||
ret = "connect() failed";
|
||||
goto error;
|
||||
}
|
||||
|
||||
freeaddrinfo(addr);
|
||||
|
||||
if(send(state->sockfd, state->command.chars, state->command.length, 0) < 0)
|
||||
{
|
||||
close(state->sockfd);
|
||||
ret = "send() failed";
|
||||
goto error;
|
||||
}
|
||||
|
||||
goto exit;
|
||||
|
||||
error:
|
||||
state->sockfd = -1;
|
||||
|
||||
exit:
|
||||
ffStrbufDestroy(&state->host);
|
||||
ffStrbufDestroy(&state->command);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
FF_THREAD_ENTRY_DECL_WRAPPER(connectAndSend, FFNetworkingState*);
|
||||
|
||||
const char* ffNetworkingSendHttpRequest(FFNetworkingState* state, const char* host, const char* path, const char* headers)
|
||||
{
|
||||
ffStrbufInitS(&state->host, host);
|
||||
|
||||
ffStrbufInitA(&state->command, 64);
|
||||
ffStrbufAppendS(&state->command, "GET ");
|
||||
ffStrbufAppendS(&state->command, path);
|
||||
ffStrbufAppendS(&state->command, " HTTP/1.1\nHost: ");
|
||||
ffStrbufAppendS(&state->command, host);
|
||||
ffStrbufAppendS(&state->command, "\r\n");
|
||||
ffStrbufAppendS(&state->command, headers);
|
||||
ffStrbufAppendS(&state->command, "\r\n");
|
||||
|
||||
#ifdef FF_HAVE_THREADS
|
||||
if (instance.config.general.multithreading)
|
||||
{
|
||||
state->thread = ffThreadCreate(connectAndSendThreadMain, state);
|
||||
return state->thread ? NULL : "ffThreadCreate(connectAndSend) failed";
|
||||
}
|
||||
#endif
|
||||
|
||||
return connectAndSend(state);
|
||||
}
|
||||
|
||||
const char* ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buffer)
|
||||
{
|
||||
uint32_t timeout = state->timeout;
|
||||
|
||||
#ifdef FF_HAVE_THREADS
|
||||
if (instance.config.general.multithreading)
|
||||
{
|
||||
if (!ffThreadJoin(state->thread, timeout))
|
||||
return "ffThreadJoin() failed or timeout";
|
||||
}
|
||||
#endif
|
||||
|
||||
if(state->sockfd == -1)
|
||||
return "ffNetworkingSendHttpRequest() failed";
|
||||
|
||||
if(timeout > 0)
|
||||
{
|
||||
struct timeval timev;
|
||||
timev.tv_sec = timeout / 1000;
|
||||
timev.tv_usec = (__typeof__(timev.tv_usec)) ((timeout % 1000) * 1000); //milliseconds to microseconds
|
||||
setsockopt(state->sockfd, SOL_SOCKET, SO_RCVTIMEO, &timev, sizeof(timev));
|
||||
}
|
||||
|
||||
uint32_t recvStart;
|
||||
do {
|
||||
recvStart = buffer->length;
|
||||
ssize_t received = recv(state->sockfd, buffer->chars + buffer->length, ffStrbufGetFree(buffer), 0);
|
||||
if (received <= 0) break;
|
||||
buffer->length += (uint32_t) received;
|
||||
buffer->chars[buffer->length] = '\0';
|
||||
} while (ffStrbufGetFree(buffer) > 0 && strstr(buffer->chars + recvStart, "\r\n\r\n") == NULL);
|
||||
|
||||
close(state->sockfd);
|
||||
if (buffer->length == 0) return "Empty server response received";
|
||||
return ffStrbufStartsWithS(buffer, "HTTP/1.1 200 OK\r\n") ? NULL : "Invalid response";
|
||||
}
|
||||
@@ -1,146 +0,0 @@
|
||||
#include <mswsock.h>
|
||||
#include <ws2tcpip.h>
|
||||
|
||||
//Must be included after <mswsock.h>
|
||||
#include "fastfetch.h"
|
||||
#include "common/networking.h"
|
||||
|
||||
static LPFN_CONNECTEX ConnectEx;
|
||||
|
||||
static const char* initWsaData(WSADATA* wsaData)
|
||||
{
|
||||
if(WSAStartup(MAKEWORD(2, 2), wsaData) != 0)
|
||||
return "WSAStartup() failed";
|
||||
|
||||
if(LOBYTE(wsaData->wVersion) != 2 || HIBYTE(wsaData->wVersion) != 2)
|
||||
return "Invalid wsaData version found";
|
||||
|
||||
//Dummy socket needed for WSAIoctl
|
||||
SOCKET sockfd = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if(sockfd == INVALID_SOCKET)
|
||||
return "socket(AF_INET, SOCK_STREAM) failed";
|
||||
|
||||
DWORD dwBytes;
|
||||
GUID guid = WSAID_CONNECTEX;
|
||||
if(WSAIoctl(sockfd, SIO_GET_EXTENSION_FUNCTION_POINTER,
|
||||
&guid, sizeof(guid),
|
||||
&ConnectEx, sizeof(ConnectEx),
|
||||
&dwBytes, NULL, NULL) != 0)
|
||||
return "WSAIoctl(sockfd, SIO_GET_EXTENSION_FUNCTION_POINTER) failed";
|
||||
|
||||
closesocket(sockfd);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* ffNetworkingSendHttpRequest(FFNetworkingState* state, const char* host, const char* path, const char* headers)
|
||||
{
|
||||
static WSADATA wsaData;
|
||||
if (wsaData.wVersion == 0)
|
||||
{
|
||||
const char* error = initWsaData(&wsaData);
|
||||
if (error != NULL)
|
||||
{
|
||||
wsaData.wVersion = (WORD) -1;
|
||||
return error;
|
||||
}
|
||||
}
|
||||
else if (wsaData.wVersion == (WORD) -1)
|
||||
return "initWsaData() failed before";
|
||||
|
||||
struct addrinfo* addr;
|
||||
|
||||
if(getaddrinfo(host, "80", &(struct addrinfo) {
|
||||
.ai_family = state->ipv6 ? AF_INET6 : AF_INET,
|
||||
.ai_socktype = SOCK_STREAM,
|
||||
}, &addr) != 0)
|
||||
return "getaddrinfo() failed";
|
||||
|
||||
state->sockfd = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol);
|
||||
if(state->sockfd == INVALID_SOCKET)
|
||||
{
|
||||
freeaddrinfo(addr);
|
||||
return "socket() failed";
|
||||
}
|
||||
|
||||
//ConnectEx requires the socket to be initially bound
|
||||
if((state->ipv6
|
||||
? bind(state->sockfd, (SOCKADDR *) &(struct sockaddr_in6) {
|
||||
.sin6_family = AF_INET6,
|
||||
.sin6_addr = in6addr_any,
|
||||
}, sizeof(struct sockaddr_in6))
|
||||
: bind(state->sockfd, (SOCKADDR *) &(struct sockaddr_in) {
|
||||
.sin_family = AF_INET,
|
||||
.sin_addr.s_addr = INADDR_ANY,
|
||||
}, sizeof(struct sockaddr_in))) != 0)
|
||||
{
|
||||
closesocket(state->sockfd);
|
||||
freeaddrinfo(addr);
|
||||
state->sockfd = INVALID_SOCKET;
|
||||
return "bind() failed";
|
||||
}
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY command = ffStrbufCreateA(64);
|
||||
ffStrbufAppendS(&command, "GET ");
|
||||
ffStrbufAppendS(&command, path);
|
||||
ffStrbufAppendS(&command, " HTTP/1.1\nHost: ");
|
||||
ffStrbufAppendS(&command, host);
|
||||
ffStrbufAppendS(&command, "\r\n");
|
||||
ffStrbufAppendS(&command, headers);
|
||||
ffStrbufAppendS(&command, "\r\n");
|
||||
|
||||
BOOL result = ConnectEx(state->sockfd, addr->ai_addr, (int)addr->ai_addrlen, command.chars, command.length, NULL, &state->overlapped);
|
||||
freeaddrinfo(addr);
|
||||
|
||||
if(!result && WSAGetLastError() != WSA_IO_PENDING)
|
||||
{
|
||||
closesocket(state->sockfd);
|
||||
state->sockfd = INVALID_SOCKET;
|
||||
return "ConnectEx() failed";
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buffer)
|
||||
{
|
||||
if (state->sockfd == INVALID_SOCKET)
|
||||
return "ffNetworkingSendHttpRequest() failed";
|
||||
|
||||
uint32_t timeout = state->timeout;
|
||||
if (timeout > 0)
|
||||
{
|
||||
if (WaitForSingleObject((HANDLE) state->sockfd, timeout) != WAIT_OBJECT_0)
|
||||
{
|
||||
CancelIo((HANDLE) state->sockfd);
|
||||
closesocket(state->sockfd);
|
||||
return "WaitForSingleObject(state->sockfd) failed or timeout";
|
||||
}
|
||||
}
|
||||
|
||||
DWORD transfer, flags;
|
||||
if (!WSAGetOverlappedResult(state->sockfd, &state->overlapped, &transfer, TRUE, &flags))
|
||||
{
|
||||
closesocket(state->sockfd);
|
||||
return "WSAGetOverlappedResult() failed";
|
||||
}
|
||||
|
||||
if(timeout > 0)
|
||||
{
|
||||
//https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt
|
||||
setsockopt(state->sockfd, SOL_SOCKET, SO_RCVTIMEO, (const char*) &timeout, sizeof(timeout));
|
||||
}
|
||||
|
||||
uint32_t recvStart;
|
||||
do {
|
||||
recvStart = buffer->length;
|
||||
ssize_t received = recv(state->sockfd, buffer->chars + buffer->length, (int) ffStrbufGetFree(buffer), 0);
|
||||
if (received <= 0) break;
|
||||
buffer->length = recvStart + (uint32_t) received;
|
||||
buffer->chars[buffer->length] = '\0';
|
||||
} while (ffStrbufGetFree(buffer) > 0 && strstr(buffer->chars + recvStart, "\r\n\r\n") == NULL);
|
||||
|
||||
closesocket(state->sockfd);
|
||||
if (buffer->length == 0) return "Empty server response received";
|
||||
return ffStrbufStartsWithS(buffer, "HTTP/1.1 200 OK\r\n") ? NULL : "Invalid response";
|
||||
}
|
||||
@@ -82,6 +82,18 @@ static inline const char* ffTimeToShortStr(uint64_t msec)
|
||||
return buf;
|
||||
}
|
||||
|
||||
// Not thread-safe
|
||||
static inline const char* ffTimeToTimeStr(uint64_t msec)
|
||||
{
|
||||
if (msec == 0) return "";
|
||||
time_t tsec = (time_t) (msec / 1000);
|
||||
|
||||
static char buf[32];
|
||||
strftime(buf, sizeof(buf), "%T", localtime(&tsec));
|
||||
sprintf(buf + __builtin_strlen("00:00:00"), ".%03u", (unsigned) (msec % 1000));
|
||||
return buf;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
+4
-5
@@ -683,8 +683,8 @@
|
||||
"type": "enum",
|
||||
"enum": {
|
||||
"IEC": "1024 Bytes = 1 KiB, 1024 KiB = 1 MiB, ...",
|
||||
"SI": "1000 Bytes = 1 KB, 1000 KB = 1 MB, ...",
|
||||
"JEDEC": "1024 Bytes = 1 kB, 1024 kB = 1 MB, ..."
|
||||
"SI": "1000 Bytes = 1 kB, 1000 kB = 1 MB, ...",
|
||||
"JEDEC": "1024 Bytes = 1 KB, 1024 KB = 1 MB, ..."
|
||||
},
|
||||
"default": "IEC"
|
||||
}
|
||||
@@ -1419,10 +1419,9 @@
|
||||
"arg": {
|
||||
"type": "enum",
|
||||
"enum": {
|
||||
"auto": "Auto detection",
|
||||
"auto": "Prefer EGL on *nix; prefer platform specific implementation on others",
|
||||
"egl": "EGL",
|
||||
"glx": "GLX",
|
||||
"osmesa": "OSMesa"
|
||||
"glx": "GLX (*nix only)"
|
||||
},
|
||||
"default": "auto"
|
||||
}
|
||||
|
||||
@@ -18,6 +18,9 @@ const char* parseBattery(int dfd, const char* battId, FFlist* results)
|
||||
if (ioctl(fd, GET_EXTENDED_BATTERY_INFO, &extended, sizeof(extended)) != 0)
|
||||
return "ioctl(GET_EXTENDED_BATTERY_INFO) failed";
|
||||
|
||||
if (extended.last_full_charge == (uint32)-1)
|
||||
return "Skipped";
|
||||
|
||||
FFBatteryResult* battery = (FFBatteryResult*)ffListAdd(results);
|
||||
ffStrbufInitS(&battery->modelName, extended.model_number);
|
||||
ffStrbufInitS(&battery->manufacturer, extended.oem_info);
|
||||
|
||||
@@ -20,7 +20,7 @@ const char* ffDetectBootmgr(FFBootmgrResult* result)
|
||||
|
||||
ffEfiFillLoadOption((FFEfiLoadOption *)&buffer[4], result);
|
||||
|
||||
if (ffReadFileData(FF_EFIVARS_PATH_PREFIX "SecureBoot-" FF_EFI_GLOBAL_GUID, sizeof(buffer), buffer) == 6)
|
||||
if (ffReadFileData(FF_EFIVARS_PATH_PREFIX "SecureBoot-" FF_EFI_GLOBAL_GUID, sizeof(buffer), buffer) >= 5)
|
||||
result->secureBoot = buffer[4] == 1;
|
||||
|
||||
return NULL;
|
||||
|
||||
@@ -7,6 +7,7 @@ typedef struct FFBrightnessResult
|
||||
{
|
||||
FFstrbuf name;
|
||||
double min, max, current;
|
||||
bool builtin;
|
||||
} FFBrightnessResult;
|
||||
|
||||
const char* ffDetectBrightness(FFBrightnessOptions* options, FFlist* result); // list of FFBrightnessResult
|
||||
|
||||
@@ -42,6 +42,7 @@ static const char* detectWithDisplayServices(const FFDisplayServerResult* displa
|
||||
brightness->max = 1;
|
||||
brightness->min = 0;
|
||||
ffStrbufInitCopy(&brightness->name, &display->name);
|
||||
brightness->builtin = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -111,6 +112,7 @@ static const char* detectWithDdcci(FF_MAYBE_UNUSED const FFDisplayServerResult*
|
||||
brightness->min = 0;
|
||||
brightness->current = current;
|
||||
ffStrbufInit(&brightness->name);
|
||||
brightness->builtin = false;
|
||||
|
||||
uint8_t edid[128] = {};
|
||||
if (IOAVServiceReadI2C(service, 0x50, 0x00, edid, ARRAY_SIZE(edid)) == KERN_SUCCESS)
|
||||
@@ -179,6 +181,7 @@ static const char* detectWithDdcci(const FFDisplayServerResult* displayServer, F
|
||||
brightness->min = 0;
|
||||
brightness->current = current;
|
||||
ffStrbufInitCopy(&brightness->name, &display->name);
|
||||
brightness->builtin = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ const char* ffDetectBrightness(FF_MAYBE_UNUSED FFBrightnessOptions* options, FFl
|
||||
brightness->max = BACKLIGHTMAXLEVELS;
|
||||
brightness->min = 0;
|
||||
brightness->current = status.brightness;
|
||||
brightness->builtin = true;
|
||||
|
||||
struct backlight_info info;
|
||||
if(ioctl(blfd, BACKLIGHTGETINFO, &info) == 0)
|
||||
|
||||
@@ -74,6 +74,7 @@ static const char* detectWithBacklight(FFlist* result)
|
||||
brightness->max = ffStrbufToDouble(&buffer);
|
||||
brightness->min = 0;
|
||||
brightness->current = actualBrightness;
|
||||
brightness->builtin = true;
|
||||
}
|
||||
}
|
||||
ffStrbufSubstrBefore(&backlightDir, backlightDirLength);
|
||||
|
||||
@@ -7,7 +7,7 @@ const char* ffDetectBrightness(FF_MAYBE_UNUSED FFBrightnessOptions* options, FFl
|
||||
// https://man.netbsd.org/NetBSD-10.1/acpiout.4#DESCRIPTION
|
||||
char key[] = "hw.acpi.acpiout0.brightness";
|
||||
char* pn = key + strlen("hw.acpi.acpiout");
|
||||
|
||||
|
||||
for (uint32_t i = 0; i <= 9; ++i)
|
||||
{
|
||||
*pn = (char) ('0' + i);
|
||||
@@ -20,6 +20,7 @@ const char* ffDetectBrightness(FF_MAYBE_UNUSED FFBrightnessOptions* options, FFl
|
||||
brightness->max = 100;
|
||||
brightness->min = 0;
|
||||
brightness->current = value;
|
||||
brightness->builtin = true;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ const char* ffDetectBrightness(FF_MAYBE_UNUSED FFBrightnessOptions* options, FFl
|
||||
brightness->max = param.max;
|
||||
brightness->min = param.min;
|
||||
brightness->current = param.curval;
|
||||
brightness->builtin = true;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ static const char* detectWithWmi(FFlist* result)
|
||||
brightness->max = 100;
|
||||
brightness->min = 0;
|
||||
brightness->current = vtValue.get<uint8_t>();
|
||||
brightness->builtin = true;
|
||||
|
||||
ffStrbufInit(&brightness->name);
|
||||
if (FFWmiVariant vtName = record.get(L"InstanceName"))
|
||||
@@ -61,6 +62,7 @@ static const char* detectWithDdcci(const FFDisplayServerResult* displayServer, F
|
||||
brightness->max = max;
|
||||
brightness->min = min;
|
||||
brightness->current = curr;
|
||||
brightness->builtin = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,18 +16,18 @@ const char* ffDetectCamera(FFlist* result)
|
||||
#ifdef MAC_OS_X_VERSION_10_15
|
||||
FF_SUPPRESS_IO(); // #822
|
||||
|
||||
AVCaptureDeviceType deviceType;
|
||||
AVCaptureDeviceType deviceType = NULL;
|
||||
|
||||
#ifdef MAC_OS_VERSION_14_0
|
||||
// Strangely `@available(macOS 14.0, *)` doesn't work here (#1594)
|
||||
if (@available(macOS 14.0, *))
|
||||
{
|
||||
deviceType = AVCaptureDeviceTypeExternal;
|
||||
if (&AVCaptureDeviceTypeExternal)
|
||||
deviceType = AVCaptureDeviceTypeExternal;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (deviceType == NULL)
|
||||
deviceType = AVCaptureDeviceTypeExternalUnknown;
|
||||
}
|
||||
|
||||
AVCaptureDeviceDiscoverySession* session = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:@[AVCaptureDeviceTypeBuiltInWideAngleCamera, deviceType]
|
||||
mediaType:AVMediaTypeVideo
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
#include "chassis.h"
|
||||
#include "detection/host/host.h"
|
||||
|
||||
const char* ffDetectChassis(FFChassisResult* result)
|
||||
{
|
||||
FFHostResult host = {
|
||||
.family = ffStrbufCreate(),
|
||||
.name = ffStrbufCreate(),
|
||||
.version = ffStrbufCreate(),
|
||||
.sku = ffStrbufCreate(),
|
||||
.serial = ffStrbufCreate(),
|
||||
.uuid = ffStrbufCreate(),
|
||||
.vendor = ffStrbufCreate(),
|
||||
};
|
||||
if (ffDetectHost(&host) != NULL)
|
||||
return "Failed to detect host";
|
||||
|
||||
if (ffStrbufStartsWithS(&host.name, "MacBook "))
|
||||
ffStrbufSetStatic(&result->type, "Laptop");
|
||||
else if (ffStrbufStartsWithS(&host.name, "Mac mini "))
|
||||
ffStrbufSetStatic(&result->type, "Mini PC");
|
||||
else if (ffStrbufStartsWithS(&host.name, "iMac "))
|
||||
ffStrbufSetStatic(&result->type, "All-in-One");
|
||||
else
|
||||
ffStrbufSetStatic(&result->type, "Desktop");
|
||||
|
||||
ffStrbufSet(&result->vendor, &host.vendor);
|
||||
|
||||
ffStrbufDestroy(&host.family);
|
||||
ffStrbufDestroy(&host.name);
|
||||
ffStrbufDestroy(&host.version);
|
||||
ffStrbufDestroy(&host.sku);
|
||||
ffStrbufDestroy(&host.serial);
|
||||
ffStrbufDestroy(&host.uuid);
|
||||
ffStrbufDestroy(&host.vendor);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -189,26 +189,47 @@ static void detectDisplays(FFDisplayServerResult* ds)
|
||||
|
||||
if (display)
|
||||
{
|
||||
DISPLAYCONFIG_GET_ADVANCED_COLOR_INFO advColorInfo = {
|
||||
DISPLAYCONFIG_GET_ADVANCED_COLOR_INFO_2 advColorInfo2 = {
|
||||
.header = {
|
||||
.type = DISPLAYCONFIG_DEVICE_INFO_GET_ADVANCED_COLOR_INFO,
|
||||
.size = sizeof(advColorInfo),
|
||||
.type = DISPLAYCONFIG_DEVICE_INFO_GET_ADVANCED_COLOR_INFO_2,
|
||||
.size = sizeof(advColorInfo2),
|
||||
.adapterId = path->targetInfo.adapterId,
|
||||
.id = path->targetInfo.id,
|
||||
}
|
||||
};
|
||||
if (DisplayConfigGetDeviceInfo(&advColorInfo.header) == ERROR_SUCCESS)
|
||||
if (DisplayConfigGetDeviceInfo(&advColorInfo2.header) == ERROR_SUCCESS)
|
||||
{
|
||||
if (advColorInfo.advancedColorEnabled)
|
||||
if (advColorInfo2.highDynamicRangeUserEnabled)
|
||||
display->hdrStatus = FF_DISPLAY_HDR_STATUS_ENABLED;
|
||||
else if (advColorInfo.advancedColorSupported)
|
||||
else if (advColorInfo2.highDynamicRangeSupported)
|
||||
display->hdrStatus = FF_DISPLAY_HDR_STATUS_SUPPORTED;
|
||||
else
|
||||
display->hdrStatus = FF_DISPLAY_HDR_STATUS_UNSUPPORTED;
|
||||
display->bitDepth = (uint8_t) advColorInfo.bitsPerColorChannel;
|
||||
display->bitDepth = (uint8_t) advColorInfo2.bitsPerColorChannel;
|
||||
}
|
||||
else
|
||||
display->hdrStatus = FF_DISPLAY_HDR_STATUS_UNKNOWN;
|
||||
{
|
||||
DISPLAYCONFIG_GET_ADVANCED_COLOR_INFO advColorInfo = {
|
||||
.header = {
|
||||
.type = DISPLAYCONFIG_DEVICE_INFO_GET_ADVANCED_COLOR_INFO,
|
||||
.size = sizeof(advColorInfo),
|
||||
.adapterId = path->targetInfo.adapterId,
|
||||
.id = path->targetInfo.id,
|
||||
}
|
||||
};
|
||||
if (DisplayConfigGetDeviceInfo(&advColorInfo.header) == ERROR_SUCCESS)
|
||||
{
|
||||
if (advColorInfo.advancedColorEnabled)
|
||||
display->hdrStatus = FF_DISPLAY_HDR_STATUS_ENABLED;
|
||||
else if (advColorInfo.advancedColorSupported)
|
||||
display->hdrStatus = FF_DISPLAY_HDR_STATUS_SUPPORTED;
|
||||
else
|
||||
display->hdrStatus = FF_DISPLAY_HDR_STATUS_UNSUPPORTED;
|
||||
display->bitDepth = (uint8_t) advColorInfo.bitsPerColorChannel;
|
||||
}
|
||||
else
|
||||
display->hdrStatus = FF_DISPLAY_HDR_STATUS_UNKNOWN;
|
||||
}
|
||||
if (edidLength > 0)
|
||||
ffEdidGetSerialAndManufactureDate(edidData, &display->serial, &display->manufactureYear, &display->manufactureWeek);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ static const char* drmParseSysfs(FFDisplayServerResult* result)
|
||||
|
||||
char buf;
|
||||
ffStrbufAppendS(&drmDir, "/enabled");
|
||||
if (!ffReadFileData(drmDir.chars, sizeof(buf), &buf) || buf != 'e') {
|
||||
if (ffReadFileData(drmDir.chars, sizeof(buf), &buf) <= 0 || buf != 'e') {
|
||||
/* read failed or enabled != "enabled" */
|
||||
ffStrbufSubstrBefore(&drmDir, drmDirWithDnameLength);
|
||||
ffStrbufAppendS(&drmDir, "/status");
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(FF_HAVE_EGL) || defined(FF_HAVE_GLX) || defined(FF_HAVE_OSMESA)
|
||||
#if defined(FF_HAVE_EGL) || defined(FF_HAVE_GLX)
|
||||
#define FF_HAVE_GL 1
|
||||
|
||||
#include "common/library.h"
|
||||
@@ -155,66 +155,6 @@ static const char* detectByGlx(FFOpenGLResult* result)
|
||||
|
||||
#endif //FF_HAVE_GLX
|
||||
|
||||
#ifdef FF_HAVE_OSMESA
|
||||
#if __has_include(<GL/osmesa.h>)
|
||||
#include <GL/osmesa.h>
|
||||
#else
|
||||
#include <mesa/osmesa.h> // for sunos
|
||||
#endif
|
||||
|
||||
typedef struct OSMesaData
|
||||
{
|
||||
FF_LIBRARY_SYMBOL(glGetString)
|
||||
FF_LIBRARY_SYMBOL(OSMesaGetProcAddress)
|
||||
FF_LIBRARY_SYMBOL(OSMesaCreateContext)
|
||||
FF_LIBRARY_SYMBOL(OSMesaMakeCurrent)
|
||||
FF_LIBRARY_SYMBOL(OSMesaDestroyContext)
|
||||
|
||||
OSMesaContext context;
|
||||
} OSMesaData;
|
||||
|
||||
static const char* osMesaHandleContext(FFOpenGLResult* result, OSMesaData* data)
|
||||
{
|
||||
unsigned char buffer[FF_OPENGL_BUFFER_WIDTH * FF_OPENGL_BUFFER_HEIGHT * sizeof(uint32_t)]; // 4 bytes per pixel (RGBA)
|
||||
|
||||
if(data->ffOSMesaMakeCurrent(data->context, buffer, GL_UNSIGNED_BYTE, FF_OPENGL_BUFFER_WIDTH, FF_OPENGL_BUFFER_HEIGHT) != GL_TRUE)
|
||||
return "OSMesaMakeCurrent returned GL_FALSE";
|
||||
|
||||
ffOpenGLHandleResult(result, data->ffglGetString);
|
||||
ffStrbufSetF(&result->library, "OSMesa %d.%d.%d", OSMESA_MAJOR_VERSION, OSMESA_MINOR_VERSION, OSMESA_PATCH_VERSION);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char* osMesaHandleData(FFOpenGLResult* result, OSMesaData* data)
|
||||
{
|
||||
data->ffglGetString = (void*) data->ffOSMesaGetProcAddress("glGetString");
|
||||
if(data->ffglGetString == NULL)
|
||||
return "OSMesaGetProcAddress(glGetString) returned NULL";
|
||||
|
||||
data->context = data->ffOSMesaCreateContext(OSMESA_RGBA, NULL);
|
||||
if(data->context == NULL)
|
||||
return "OSMesaCreateContext returned NULL";
|
||||
|
||||
const char* error = osMesaHandleContext(result, data);
|
||||
data->ffOSMesaDestroyContext(data->context);
|
||||
return error;
|
||||
}
|
||||
|
||||
static const char* detectByOsMesa(FFOpenGLResult* result)
|
||||
{
|
||||
OSMesaData data;
|
||||
|
||||
FF_LIBRARY_LOAD(osmesa, "dlopen osmesa failed", "libOSMesa" FF_LIBRARY_EXTENSION, 8);
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(osmesa, data, OSMesaGetProcAddress);
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(osmesa, data, OSMesaCreateContext);
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(osmesa, data, OSMesaMakeCurrent);
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(osmesa, data, OSMesaDestroyContext);
|
||||
|
||||
return osMesaHandleData(result, &data);
|
||||
}
|
||||
|
||||
#endif //FF_HAVE_OSMESA
|
||||
|
||||
const char* ffDetectOpenGL(FFOpenGLOptions* options, FFOpenGLResult* result)
|
||||
{
|
||||
#if FF_HAVE_GL
|
||||
@@ -238,15 +178,6 @@ const char* ffDetectOpenGL(FFOpenGLOptions* options, FFOpenGLResult* result)
|
||||
#endif
|
||||
}
|
||||
|
||||
if(options->library == FF_OPENGL_LIBRARY_OSMESA)
|
||||
{
|
||||
#ifdef FF_HAVE_OSMESA
|
||||
return detectByOsMesa(result);
|
||||
#else
|
||||
return "fastfetch was compiled without osmesa support";
|
||||
#endif
|
||||
}
|
||||
|
||||
const char* error = ""; // not NULL dummy value
|
||||
|
||||
#ifdef FF_HAVE_EGL
|
||||
@@ -259,9 +190,6 @@ const char* ffDetectOpenGL(FFOpenGLOptions* options, FFOpenGLResult* result)
|
||||
error = detectByGlx(result);
|
||||
#endif
|
||||
|
||||
//We don't use osmesa in auto mode here, because it is a software implementation,
|
||||
//that doesn't reflect the opengl supported by the hardware
|
||||
|
||||
return error;
|
||||
|
||||
#else
|
||||
|
||||
@@ -83,6 +83,11 @@ FF_MAYBE_UNUSED static void getUbuntuFlavour(FFOSResult* result)
|
||||
ffStrbufSetS(&result->versionID, result->prettyName.chars + strlen("Rhino Linux "));
|
||||
return;
|
||||
}
|
||||
else if(ffStrbufStartsWithS(&result->prettyName, "VanillaOS "))
|
||||
{
|
||||
ffStrbufSetS(&result->id, "vanilla");
|
||||
ffStrbufSetS(&result->idLike, "ubuntu");
|
||||
}
|
||||
|
||||
if(ffStrContains(xdgConfigDirs, "kde") || ffStrContains(xdgConfigDirs, "plasma") || ffStrContains(xdgConfigDirs, "kubuntu"))
|
||||
{
|
||||
|
||||
@@ -32,6 +32,7 @@ typedef struct FFPackagesResult
|
||||
uint32_t pacman;
|
||||
uint32_t pacstall;
|
||||
uint32_t paludis;
|
||||
uint32_t pisi;
|
||||
uint32_t pkg;
|
||||
uint32_t pkgsrc;
|
||||
uint32_t pkgtool;
|
||||
|
||||
@@ -573,6 +573,8 @@ static void getPackageCounts(FFstrbuf* baseDir, FFPackagesResult* packageCounts,
|
||||
if (!(options->disabled & FF_PACKAGES_FLAG_LINGLONG_BIT)) packageCounts->linglong += getNumElements(baseDir, "/var/lib/linglong/repo/refs/heads/main", true);
|
||||
if (!(options->disabled & FF_PACKAGES_FLAG_PACSTALL_BIT)) packageCounts->pacstall += getNumElements(baseDir, "/var/lib/pacstall/metadata", false);
|
||||
if (!(options->disabled & FF_PACKAGES_FLAG_QI_BIT)) packageCounts->qi += getNumStrings(baseDir, "/var/qi/installed_packages.list", "\n", "qi");
|
||||
if (!(options->disabled & FF_PACKAGES_FLAG_PISI_BIT)) packageCounts->pisi += getNumElements(baseDir, "/var/lib/pisi/package", true);
|
||||
if (!(options->disabled & FF_PACKAGES_FLAG_PKGSRC_BIT)) packageCounts->pkgsrc += getNumElements(baseDir, "/usr/pkg/pkgdb", DT_DIR);
|
||||
}
|
||||
|
||||
static void getPackageCountsRegular(FFstrbuf* baseDir, FFPackagesResult* packageCounts, FFPackagesOptions* options)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "publicip.h"
|
||||
#include "common/networking.h"
|
||||
#include "common/networking/networking.h"
|
||||
|
||||
#define FF_UNITIALIZED ((const char*)(uintptr_t) -1)
|
||||
static FFNetworkingState states[2];
|
||||
@@ -19,7 +19,11 @@ void ffPreparePublicIp(FFPublicIpOptions* options)
|
||||
state->ipv6 = options->ipv6;
|
||||
|
||||
if (options->url.length == 0)
|
||||
{
|
||||
state->compression = true;
|
||||
state->tfo = true;
|
||||
*status = ffNetworkingSendHttpRequest(state, options->ipv6 ? "v6.ipinfo.io" : "ipinfo.io", "/json", NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY host = ffStrbufCreateCopy(&options->url);
|
||||
|
||||
@@ -475,4 +475,6 @@ void ffDetectTerminalFontPlatform(const FFTerminalResult* terminal, FFTerminalFo
|
||||
else if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "Terminal"))
|
||||
detectHaikuTerminal(terminalFont);
|
||||
#endif
|
||||
else if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "termite"))
|
||||
detectFromConfigFile("termite/config", "font =", terminalFont);
|
||||
}
|
||||
|
||||
@@ -20,13 +20,14 @@
|
||||
#include "util/windows/version.h"
|
||||
#include <windows.h>
|
||||
|
||||
static bool getFileVersion(const FFstrbuf* exePath, FFstrbuf* version)
|
||||
static bool getFileVersion(const FFstrbuf* exePath, const wchar_t* stringName, FFstrbuf* version)
|
||||
{
|
||||
wchar_t exePathW[PATH_MAX];
|
||||
int len = MultiByteToWideChar(CP_UTF8, 0, exePath->chars, (int)exePath->length, exePathW, ARRAY_SIZE(exePathW));
|
||||
if (len <= 0) return false;
|
||||
return ffGetFileVersion(exePathW, version);
|
||||
return ffGetFileVersion(exePathW, stringName, version);
|
||||
}
|
||||
|
||||
#elif __HAIKU__
|
||||
#include "util/haiku/version.h"
|
||||
#endif
|
||||
@@ -98,7 +99,7 @@ static bool getShellVersionPwsh(FFstrbuf* exe, FFstrbuf* version)
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
if(getFileVersion(exe, version))
|
||||
if(getFileVersion(exe, NULL, version))
|
||||
{
|
||||
ffStrbufSubstrBeforeLastC(version, '.');
|
||||
return true;
|
||||
@@ -291,7 +292,7 @@ bool fftsGetShellVersion(FFstrbuf* exe, const char* exeName, FFstrbuf* exePath,
|
||||
if(ffStrEqualsIgnCase(exeName, "powershell") || ffStrEqualsIgnCase(exeName, "powershell_ise"))
|
||||
return getShellVersionWinPowerShell(exe, version);
|
||||
|
||||
return getFileVersion(exe, version);
|
||||
return getFileVersion(exe, NULL, version);
|
||||
#endif
|
||||
|
||||
return false;
|
||||
@@ -707,6 +708,20 @@ FF_MAYBE_UNUSED static bool getTerminalVersionSakura(FFstrbuf* exe, FFstrbuf* ve
|
||||
ffStrbufSubstrAfterLastC(version, ' ');
|
||||
return true;
|
||||
}
|
||||
|
||||
FF_MAYBE_UNUSED static bool getTerminalVersionTermite(FFstrbuf* exe, FFstrbuf* version)
|
||||
{
|
||||
if(ffProcessAppendStdOut(version, (char* const[]) {
|
||||
exe->chars,
|
||||
"--version",
|
||||
NULL
|
||||
}) != NULL) // termite v16.9\nvte 0.78.1 +BIDI +GNUTLS +ICU +SYSTEMD
|
||||
return false;
|
||||
|
||||
ffStrbufSubstrBeforeFirstC(version, '\n');
|
||||
ffStrbufSubstrAfterLastC(version, 'v');
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
@@ -723,7 +738,7 @@ static bool getTerminalVersionWindowsTerminal(FFstrbuf* exe, FFstrbuf* version)
|
||||
return true;
|
||||
}
|
||||
|
||||
return getFileVersion(exe, version);
|
||||
return getFileVersion(exe, NULL, version);
|
||||
}
|
||||
|
||||
static bool getTerminalVersionConEmu(FFstrbuf* exe, FFstrbuf* version)
|
||||
@@ -733,7 +748,7 @@ static bool getTerminalVersionConEmu(FFstrbuf* exe, FFstrbuf* version)
|
||||
if(version->length)
|
||||
return true;
|
||||
|
||||
return getFileVersion(exe, version);
|
||||
return getFileVersion(exe, NULL, version);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -812,6 +827,9 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe
|
||||
if(ffStrbufIgnCaseEqualS(processName, "sakura"))
|
||||
return getTerminalVersionSakura(exe, version);
|
||||
|
||||
if(ffStrbufIgnCaseEqualS(processName, "termite"))
|
||||
return getTerminalVersionTermite(exe, version);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
@@ -822,6 +840,9 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe
|
||||
if(ffStrbufStartsWithIgnCaseS(processName, "ConEmu"))
|
||||
return getTerminalVersionConEmu(exe, version);
|
||||
|
||||
if(ffStrbufIgnCaseEqualS(processName, "warp.exe"))
|
||||
return getFileVersion(exe, L"ProductVersion", version);
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
@@ -897,7 +918,7 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
return getFileVersion(exe, version);
|
||||
return getFileVersion(exe, NULL, version);
|
||||
|
||||
#else
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ static void setShellInfoDetails(FFShellResult* result)
|
||||
if(wcsncmp(module.szModule, L"clink_dll_", strlen("clink_dll_")) == 0)
|
||||
{
|
||||
ffStrbufAppendS(&result->prettyName, " (with Clink ");
|
||||
ffGetFileVersion(module.szExePath, &result->prettyName);
|
||||
ffGetFileVersion(module.szExePath, NULL, &result->prettyName);
|
||||
ffStrbufAppendC(&result->prettyName, ')');
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "weather.h"
|
||||
#include "common/networking/networking.h"
|
||||
|
||||
#define FF_UNITIALIZED ((const char*)(uintptr_t) -1)
|
||||
static FFNetworkingState state;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "common/networking.h"
|
||||
#include "fastfetch.h"
|
||||
|
||||
void ffPrepareWeather(FFWeatherOptions* options);
|
||||
const char* ffDetectWeather(FFWeatherOptions* options, FFstrbuf* result);
|
||||
|
||||
+38
-150
@@ -4,61 +4,41 @@
|
||||
|
||||
#import <CoreWLAN/CoreWLAN.h>
|
||||
|
||||
struct Apple80211; // https://code.google.com/archive/p/iphone-wireless/wikis/Apple80211.wiki
|
||||
|
||||
// 0 is successful; < 0 is failure
|
||||
int Apple80211GetInfoCopy(struct Apple80211 *handle, CFDictionaryRef *info) __attribute__((weak_import));
|
||||
|
||||
@interface CWInterface()
|
||||
@property (readonly) struct Apple80211* device;
|
||||
@end
|
||||
|
||||
inline static NSDictionary* getWifiInfoByApple80211(CWInterface* inf)
|
||||
static bool queryIpconfig(const char* ifName, FFstrbuf* result)
|
||||
{
|
||||
if (!inf.device || !Apple80211GetInfoCopy) return NULL;
|
||||
CFDictionaryRef result = NULL;
|
||||
if (Apple80211GetInfoCopy(inf.device, &result) < 0) return NULL;
|
||||
return CFBridgingRelease(result);
|
||||
return ffProcessAppendStdOut(result, (char* const[]) {
|
||||
"/usr/sbin/ipconfig",
|
||||
"getsummary",
|
||||
(char* const) ifName,
|
||||
NULL
|
||||
}) == NULL;
|
||||
}
|
||||
|
||||
static NSDictionary* getWifiInfoBySystemProfiler(NSString* ifName)
|
||||
static bool getWifiInfoByIpconfig(FFstrbuf* ipconfig, const char* prefix, FFstrbuf* result)
|
||||
{
|
||||
// Warning: costs about 2s on my machine
|
||||
static NSArray* spData;
|
||||
static bool inited;
|
||||
if (!inited)
|
||||
{
|
||||
inited = true;
|
||||
FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreate();
|
||||
if (ffProcessAppendStdOut(&buffer, (char* const[]) {
|
||||
"system_profiler",
|
||||
"SPAirPortDataType",
|
||||
"-xml",
|
||||
"-detailLevel",
|
||||
"basic",
|
||||
NULL
|
||||
}) != NULL)
|
||||
return nil;
|
||||
// `ipconfig getsummary <interface>` returns a string like this:
|
||||
// <dictionary> {
|
||||
// BSSID : <redacted>
|
||||
// IPv4 : <array> {
|
||||
// ...
|
||||
// }
|
||||
// IPv6 : <array> {
|
||||
// ...
|
||||
// }
|
||||
// InterfaceType : WiFi
|
||||
// LinkStatusActive : TRUE
|
||||
// NetworkID : XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
||||
// SSID : XXXXXX
|
||||
// Security : WPA2_PSK
|
||||
// }
|
||||
|
||||
spData = [NSPropertyListSerialization propertyListWithData:[NSData dataWithBytes:buffer.chars length:buffer.length]
|
||||
options:NSPropertyListImmutable
|
||||
format:nil
|
||||
error:nil];
|
||||
}
|
||||
|
||||
if (spData)
|
||||
{
|
||||
for (NSDictionary* data in spData[0][@"_items"])
|
||||
{
|
||||
for (NSDictionary* inf in data[@"spairport_airport_interfaces"])
|
||||
{
|
||||
if ([ifName isEqualToString:inf[@"_name"]])
|
||||
return inf[@"spairport_current_network_information"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
const char* start = memmem(ipconfig->chars, ipconfig->length, prefix, strlen(prefix));
|
||||
if (!start) return false;
|
||||
start += strlen(prefix);
|
||||
const char* end = strchr(start, '\n');
|
||||
if (!end) return false;
|
||||
ffStrbufSetNS(result, (uint32_t) (end - start), start);
|
||||
return false;
|
||||
}
|
||||
|
||||
const char* ffDetectWifi(FFlist* result)
|
||||
@@ -92,22 +72,19 @@ const char* ffDetectWifi(FFlist* result)
|
||||
if(inf.interfaceMode == kCWInterfaceModeNone)
|
||||
continue;
|
||||
|
||||
NSDictionary* apple = nil; // For getWifiInfoByApple80211
|
||||
NSDictionary* sp = nil; // For getWifiInfoBySystemProfiler
|
||||
FF_STRBUF_AUTO_DESTROY ipconfig = ffStrbufCreate();
|
||||
|
||||
if (inf.ssid) // https://developer.apple.com/forums/thread/732431
|
||||
ffStrbufAppendS(&item->conn.ssid, inf.ssid.UTF8String);
|
||||
else if (apple || (apple = getWifiInfoByApple80211(inf)))
|
||||
ffStrbufAppendS(&item->conn.ssid, [apple[@"SSID_STR"] UTF8String]);
|
||||
else if (sp || (sp = getWifiInfoBySystemProfiler(inf.interfaceName)))
|
||||
ffStrbufAppendS(&item->conn.ssid, [sp[@"_name"] UTF8String]);
|
||||
else if (ipconfig.length || (queryIpconfig(item->inf.description.chars, &ipconfig)))
|
||||
getWifiInfoByIpconfig(&ipconfig, "\n SSID : ", &item->conn.ssid);
|
||||
else
|
||||
ffStrbufSetStatic(&item->conn.ssid, "<unknown ssid>"); // https://developer.apple.com/forums/thread/732431
|
||||
|
||||
if (inf.bssid)
|
||||
ffStrbufAppendS(&item->conn.bssid, inf.bssid.UTF8String);
|
||||
else if (apple || (apple = getWifiInfoByApple80211(inf)))
|
||||
ffStrbufAppendS(&item->conn.bssid, [apple[@"BSSID"] UTF8String]);
|
||||
else if (ipconfig.length || (queryIpconfig(item->inf.description.chars, &ipconfig)))
|
||||
getWifiInfoByIpconfig(&ipconfig, "\n BSSID : ", &item->conn.bssid);
|
||||
|
||||
switch(inf.activePHYMode)
|
||||
{
|
||||
@@ -138,22 +115,6 @@ const char* ffDetectWifi(FFlist* result)
|
||||
default:
|
||||
if (inf.activePHYMode < 8)
|
||||
ffStrbufAppendF(&item->conn.protocol, "Unknown (%ld)", inf.activePHYMode);
|
||||
else if (sp || (sp = getWifiInfoBySystemProfiler(inf.interfaceName)))
|
||||
{
|
||||
ffStrbufSetS(&item->conn.protocol, [sp[@"spairport_network_phymode"] UTF8String]);
|
||||
if (ffStrbufStartsWithS(&item->conn.protocol, "802.11"))
|
||||
{
|
||||
const char* subProtocol = item->conn.protocol.chars + strlen("802.11");
|
||||
if (ffStrEquals(subProtocol, "be"))
|
||||
ffStrbufSetStatic(&item->conn.protocol, "802.11be (Wi-Fi 7)");
|
||||
else if (ffStrEquals(subProtocol, "ax"))
|
||||
ffStrbufSetStatic(&item->conn.protocol, "802.11ax (Wi-Fi 6)");
|
||||
else if (ffStrEquals(subProtocol, "ac"))
|
||||
ffStrbufSetStatic(&item->conn.protocol, "802.11ac (Wi-Fi 5)");
|
||||
else if (ffStrEquals(subProtocol, "n"))
|
||||
ffStrbufSetStatic(&item->conn.protocol, "802.11n (Wi-Fi 4)");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
item->conn.signalQuality = (double) (inf.rssiValue >= -50 ? 100 : inf.rssiValue <= -100 ? 0 : (inf.rssiValue + 100) * 2);
|
||||
@@ -210,82 +171,9 @@ const char* ffDetectWifi(FFlist* result)
|
||||
ffStrbufSetStatic(&item->conn.security, "OWE Transition");
|
||||
break;
|
||||
case kCWSecurityUnknown:
|
||||
// Sonoma...
|
||||
if (apple || (apple = getWifiInfoByApple80211(inf)))
|
||||
{
|
||||
NSDictionary* authType = apple[@"AUTH_TYPE"];
|
||||
if (authType)
|
||||
{
|
||||
// AUTH_LOWER seems useless. `airport` verifies if its value is between 1 and 3, and prints `unknown` if not
|
||||
|
||||
NSNumber* authUpper = authType[@"AUTH_UPPER"];
|
||||
if (!authUpper)
|
||||
ffStrbufSetStatic(&item->conn.security, "Insecure");
|
||||
else
|
||||
{
|
||||
int authUpperValue = authUpper.intValue;
|
||||
switch (authUpperValue)
|
||||
{
|
||||
case 1:
|
||||
ffStrbufSetStatic(&item->conn.security, "WPA");
|
||||
break;
|
||||
case 2:
|
||||
ffStrbufSetStatic(&item->conn.security, "WPA-PSK");
|
||||
break;
|
||||
case 4:
|
||||
ffStrbufSetStatic(&item->conn.security, "WPA2");
|
||||
break;
|
||||
case 8:
|
||||
ffStrbufSetStatic(&item->conn.security, "WPA2-PSK");
|
||||
break;
|
||||
case 16:
|
||||
ffStrbufSetStatic(&item->conn.security, "FT-WPA2-PSK");
|
||||
break;
|
||||
case 32:
|
||||
ffStrbufSetStatic(&item->conn.security, "LEAP");
|
||||
break;
|
||||
case 64:
|
||||
ffStrbufSetStatic(&item->conn.security, "802.1X");
|
||||
break;
|
||||
case 128:
|
||||
ffStrbufSetStatic(&item->conn.security, "FT-WPA2");
|
||||
break;
|
||||
case 256:
|
||||
ffStrbufSetStatic(&item->conn.security, "WPS");
|
||||
break;
|
||||
case 4096:
|
||||
ffStrbufSetStatic(&item->conn.security, "WPA3-SAE");
|
||||
break;
|
||||
case 8192:
|
||||
ffStrbufSetStatic(&item->conn.security, "WPA3-FT-SAE");
|
||||
break;
|
||||
default: // TODO: support more auth types
|
||||
ffStrbufAppendF(&item->conn.security, "To be supported (%d)", authUpperValue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (sp || (sp = getWifiInfoBySystemProfiler(inf.interfaceName)))
|
||||
{
|
||||
ffStrbufSetS(&item->conn.security, [sp[@"spairport_security_mode"] UTF8String]);
|
||||
ffStrbufSubstrAfterFirstS(&item->conn.security, "_mode_");
|
||||
if (ffStrbufEqualS(&item->conn.security, "none"))
|
||||
ffStrbufSetStatic(&item->conn.security, "Insecure");
|
||||
else
|
||||
{
|
||||
ffStrbufReplaceAllC(&item->conn.security, '_', ' ');
|
||||
if (ffStrbufStartsWithS(&item->conn.security, "wpa"))
|
||||
{
|
||||
item->conn.security.chars[0] = 'W';
|
||||
item->conn.security.chars[1] = 'P';
|
||||
item->conn.security.chars[2] = 'A';
|
||||
char* sub = strchr(item->conn.security.chars, ' ');
|
||||
if (sub && sub[1])
|
||||
sub[1] = (char) toupper(sub[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Sonoma?
|
||||
if (ipconfig.length || (queryIpconfig(item->inf.description.chars, &ipconfig)))
|
||||
getWifiInfoByIpconfig(&ipconfig, "\n Security : ", &item->conn.security);
|
||||
break;
|
||||
default:
|
||||
ffStrbufAppendF(&item->conn.security, "Unknown (%ld)", inf.security);
|
||||
|
||||
@@ -79,7 +79,7 @@ const char* ffDetectWMVersion(const FFstrbuf* wmName, FFstrbuf* result, FF_MAYBE
|
||||
wchar_t fullPath[MAX_PATH];
|
||||
wcscpy(fullPath, pPath);
|
||||
wcscat(fullPath, L"\\dwm.exe");
|
||||
ffGetFileVersion(fullPath, result);
|
||||
ffGetFileVersion(fullPath, NULL, result);
|
||||
}
|
||||
CoTaskMemFree(pPath);
|
||||
return NULL;
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
_________
|
||||
| __ |
|
||||
| \ \___ |
|
||||
| \ _ \ |
|
||||
| \___/ |
|
||||
|_________|
|
||||
@@ -0,0 +1,9 @@
|
||||
████████████████
|
||||
██████░░░░░░████░░░░██ ████
|
||||
████░░░░████░░░░░░██░░░░░░██░░░░██
|
||||
██░░░░░░░░░░██░░░░░░██░░░░░░░░██░░░░██
|
||||
██░░░░░░░░░░██░░░░░░░░░░░░░░░░██░░░░░░██
|
||||
██▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓██
|
||||
██▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓██
|
||||
██▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓▓▓▓██
|
||||
██████████████████████████
|
||||
@@ -0,0 +1,11 @@
|
||||
╭───────────────────────╮
|
||||
│ $2● $3● $4● $5FASTFETCH $1│
|
||||
├───────────────────────┤
|
||||
│ │
|
||||
│ $2 /\ $7►►►►►►► $1│
|
||||
│ $2 /--\ $7►►►►►► $1│
|
||||
│ $2/----\ $7►►►►► $1│
|
||||
│ $6|xx| $7►►►► $1│
|
||||
│ $6|xx| $7►►► $1│
|
||||
│ $3^^^^ $1│
|
||||
╰───────────────────────╯
|
||||
@@ -1,8 +0,0 @@
|
||||
________ ________ ___ ___ ________ ________
|
||||
|\ _____\\ __ \ |\ \ / /|\ __ \|\ ____\
|
||||
\ \ \__/\ \ \|\ \ \ \ \/ / | \ \|\ \ \ \___|_
|
||||
\ \ __\\ \ \\\ \ \ \ / / \ \ \\\ \ \_____ \
|
||||
\ \ \_| \ \ \\\ \ / \/ \ \ \\\ \|____|\ \
|
||||
\ \__\ \ \_______\/ /\ \ \ \_______\____\_\ \
|
||||
\|__| \|_______/__/ /\ __\ \|_______|\_________\
|
||||
|__|/ \|__| \|_________|
|
||||
@@ -0,0 +1,20 @@
|
||||
__,gnnnOCCCCCOObaau,_
|
||||
$2 _._ $1__,gnnCCCCCCCCOPF"''
|
||||
$2 (N\\$1XCbngg,._____.,gnnndCCCCCCCCCCCCF"___,,,,___
|
||||
$2 \N\\$1XCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCOOOOPYvv.
|
||||
$2 \N\\$1XCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPF"''
|
||||
$2 \N\\$1XCCCCCCCCCCCCCCCCCCCCCCCCCOF"'
|
||||
$2 \N\\$1XCCCCCCCCCCCCCCCCCCCCOF"'
|
||||
$2 \N\\$1XCCCCCCCCCCCCCCCPF"'
|
||||
$2 \N\\$1\"PCOCCCOCCFP""
|
||||
$2 \N\\
|
||||
\N\\
|
||||
\N\\
|
||||
\NN\
|
||||
\NN\
|
||||
\NNA.
|
||||
\NNA,
|
||||
\NNN,
|
||||
\NNN\
|
||||
\NNN\
|
||||
\NNNA
|
||||
@@ -0,0 +1,9 @@
|
||||
.oooo.
|
||||
o o o
|
||||
ooooo oo
|
||||
o oo
|
||||
'oooooooooooo.
|
||||
oo o
|
||||
oo ooooo
|
||||
o o o
|
||||
'oooo'
|
||||
@@ -0,0 +1,20 @@
|
||||
'
|
||||
'#'
|
||||
'#!#'
|
||||
'#!#!#'
|
||||
'#!#!#!#'
|
||||
'#!#!#!#!#'
|
||||
'#!#!#!#!#!#'
|
||||
'#!#!#!#!#!#!#'
|
||||
#!#!#!#!#!#!'
|
||||
'#! #!#!#!#!#'
|
||||
'#!#!#!#! #!#!#!'
|
||||
'#!#!#!#!#!#!#! #!#!'
|
||||
'#!#!#!#!#!#!#!#!#!#! #'
|
||||
'#!#!#!#!#!#!#!#!#!#!#!#!
|
||||
'#!#!#!#!#!#!#!#!#!#! #!'
|
||||
'#!#!#!#!#!#!#!#! #!#!#!'
|
||||
'#!#!#!#!#!#! #!#!#!#!#!'
|
||||
'#!#!#!#! #!#!#!#!#'
|
||||
'#!#! #!#!#'
|
||||
'# #!'
|
||||
@@ -0,0 +1,5 @@
|
||||
__ __ _ __ ___ ____
|
||||
\ \ / /__ | |/ _|/ _ \/ ___|
|
||||
\ \ /\ / / _ \| | |_| | | \___ \
|
||||
\ V V / (_) | | _| |_| |___) |
|
||||
\_/\_/ \___/|_|_| \___/|____/
|
||||
+152
-107
@@ -56,7 +56,7 @@ static const FFlogo A[] = {
|
||||
},
|
||||
// AlmaLinux
|
||||
{
|
||||
.names = {"almalinux"},
|
||||
.names = {"Almalinux"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_ALMALINUX,
|
||||
.colors = {
|
||||
FF_COLOR_FG_RED,
|
||||
@@ -70,7 +70,7 @@ static const FFlogo A[] = {
|
||||
},
|
||||
// Alpine
|
||||
{
|
||||
.names = {"alpine", "alpinelinux", "alpine-linux"},
|
||||
.names = {"Alpine"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_ALPINE,
|
||||
.colors = {
|
||||
FF_COLOR_FG_BLUE,
|
||||
@@ -80,7 +80,7 @@ static const FFlogo A[] = {
|
||||
},
|
||||
// AlpineSmall
|
||||
{
|
||||
.names = {"alpine_small", "alpine-linux-small"},
|
||||
.names = {"Alpine_small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_ALPINE_SMALL,
|
||||
.colors = {
|
||||
@@ -92,7 +92,7 @@ static const FFlogo A[] = {
|
||||
},
|
||||
// Alpine2Small
|
||||
{
|
||||
.names = {"alpine2_small", "alpine-linux2-small"},
|
||||
.names = {"alpine2_small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT | FF_LOGO_LINE_TYPE_ALTER_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_ALPINE2_SMALL,
|
||||
.colors = {
|
||||
@@ -114,7 +114,7 @@ static const FFlogo A[] = {
|
||||
},
|
||||
// ALTLinux
|
||||
{
|
||||
.names = {"ALTLinux", "Sisyphus"},
|
||||
.names = {"ALTLinux"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_ALTLINUX,
|
||||
.colors = {
|
||||
FF_COLOR_FG_YELLOW,
|
||||
@@ -177,7 +177,7 @@ static const FFlogo A[] = {
|
||||
},
|
||||
// AndroidSmall
|
||||
{
|
||||
.names = {"android-small", "android_small"},
|
||||
.names = {"android_small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_ANDROID_SMALL,
|
||||
.colors = {
|
||||
@@ -341,7 +341,7 @@ static const FFlogo A[] = {
|
||||
},
|
||||
// Arch
|
||||
{
|
||||
.names = {"arch", "archlinux", "arch-linux", "archmerge"},
|
||||
.names = {"arch", "archmerge"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_ARCH,
|
||||
.colors = {
|
||||
FF_COLOR_FG_CYAN,
|
||||
@@ -350,7 +350,7 @@ static const FFlogo A[] = {
|
||||
},
|
||||
// Arch2
|
||||
{
|
||||
.names = {"arch2", "archlinux2", "arch-linux2"},
|
||||
.names = {"arch2"},
|
||||
.type = FF_LOGO_LINE_TYPE_ALTER_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_ARCH2,
|
||||
.colors = {
|
||||
@@ -360,7 +360,7 @@ static const FFlogo A[] = {
|
||||
},
|
||||
// Arch3
|
||||
{
|
||||
.names = {"arch3", "archlinux3", "arch-linux3"},
|
||||
.names = {"arch3"},
|
||||
.type = FF_LOGO_LINE_TYPE_ALTER_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_ARCH3,
|
||||
.colors = {
|
||||
@@ -370,7 +370,7 @@ static const FFlogo A[] = {
|
||||
},
|
||||
// ArchSmall
|
||||
{
|
||||
.names = {"arch_small", "archlinux_small", "arch-linux-small"},
|
||||
.names = {"arch_small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_ARCH_SMALL,
|
||||
.colors = {
|
||||
@@ -454,7 +454,7 @@ static const FFlogo A[] = {
|
||||
},
|
||||
// ArtixSmall
|
||||
{
|
||||
.names = {"artix_small", "artixlinux_small", "artix-linux-small"},
|
||||
.names = {"artix_small", "artixlinux_small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_ARTIX_SMALL,
|
||||
.colors = {
|
||||
@@ -465,7 +465,7 @@ static const FFlogo A[] = {
|
||||
},
|
||||
// Artix2Small
|
||||
{
|
||||
.names = {"artix2_small", "artixlinux2_small", "artix-linux2-small"},
|
||||
.names = {"artix2_small", "artixlinux2_small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT | FF_LOGO_LINE_TYPE_ALTER_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_ARTIX2_SMALL,
|
||||
.colors = {
|
||||
@@ -634,7 +634,7 @@ static const FFlogo A[] = {
|
||||
static const FFlogo B[] = {
|
||||
// Bedrock
|
||||
{
|
||||
.names = {"bedrock", "bedrocklinux", "bedrock-linux"},
|
||||
.names = {"bedrock"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_BEDROCK,
|
||||
.colors = {
|
||||
FF_COLOR_FG_LIGHT_BLACK, //grey
|
||||
@@ -643,6 +643,17 @@ static const FFlogo B[] = {
|
||||
.colorKeys = FF_COLOR_FG_LIGHT_BLACK, //grey
|
||||
.colorTitle = FF_COLOR_FG_WHITE,
|
||||
},
|
||||
// BedrockSmall
|
||||
{
|
||||
.names = {"bedrock_small"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_BEDROCK_SMALL,
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.colors = {
|
||||
FF_COLOR_FG_WHITE,
|
||||
},
|
||||
.colorKeys = FF_COLOR_FG_WHITE,
|
||||
.colorTitle = FF_COLOR_FG_WHITE,
|
||||
},
|
||||
// BigLinux
|
||||
{
|
||||
.names = {"BigLinux"},
|
||||
@@ -755,6 +766,16 @@ static const FFlogo B[] = {
|
||||
.colorKeys = FF_COLOR_FG_CYAN,
|
||||
.colorTitle = FF_COLOR_FG_GREEN,
|
||||
},
|
||||
// BredOS
|
||||
{
|
||||
.names = {"Bredos"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_BREDOS,
|
||||
.colors = {
|
||||
FF_COLOR_FG_RGB "198;151;66", //grey
|
||||
},
|
||||
.colorKeys = FF_COLOR_FG_RGB "198;151;66",
|
||||
.colorTitle = FF_COLOR_FG_RGB "198;151;66",
|
||||
},
|
||||
// BSD
|
||||
{
|
||||
.names = {"BSD"},
|
||||
@@ -786,7 +807,7 @@ static const FFlogo B[] = {
|
||||
static const FFlogo C[] = {
|
||||
// CachyOS
|
||||
{
|
||||
.names = {"Cachy", "cachyos", "cachy-linux", "cachyos-linux"},
|
||||
.names = {"CachyOS"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_CACHYOS,
|
||||
.colors = {
|
||||
FF_COLOR_FG_CYAN,
|
||||
@@ -798,7 +819,7 @@ static const FFlogo C[] = {
|
||||
},
|
||||
// CachyOSSmall
|
||||
{
|
||||
.names = {"Cachy_small", "cachyos_small", "cachy-linux-small", "cachyos-linux-small"},
|
||||
.names = {"CachyOS_small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_CACHYOS_SMALL,
|
||||
.colors = {
|
||||
@@ -882,7 +903,7 @@ static const FFlogo C[] = {
|
||||
},
|
||||
// CentOS
|
||||
{
|
||||
.names = {"Cent", "centos", "cent-linux", "centos-linux"},
|
||||
.names = {"CentOS"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_CENTOS,
|
||||
.colors = {
|
||||
FF_COLOR_FG_YELLOW,
|
||||
@@ -896,7 +917,7 @@ static const FFlogo C[] = {
|
||||
},
|
||||
// CentOSSmall
|
||||
{
|
||||
.names = {"Cent_small", "centos_small", "cent-linux_small", "cent-linux-small", "centos-linux-small"},
|
||||
.names = {"CentOS_small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_CENTOS_SMALL,
|
||||
.colors = {
|
||||
@@ -910,7 +931,7 @@ static const FFlogo C[] = {
|
||||
},
|
||||
// Cereus
|
||||
{
|
||||
.names = {"cereus", "Cereus Linux"},
|
||||
.names = {"Cereus", "Cereus Linux"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_CEREUS,
|
||||
.colors = {
|
||||
FF_COLOR_FG_256 "173",
|
||||
@@ -1082,6 +1103,16 @@ static const FFlogo C[] = {
|
||||
.colorKeys = FF_COLOR_FG_BLUE,
|
||||
.colorTitle = FF_COLOR_FG_WHITE,
|
||||
},
|
||||
// Common Torizon
|
||||
{
|
||||
.names = {"common-torizon"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_TORIZONCORE,
|
||||
.colors = {
|
||||
FF_COLOR_FG_LIGHT_WHITE,
|
||||
FF_COLOR_FG_YELLOW,
|
||||
FF_COLOR_FG_BLUE
|
||||
},
|
||||
},
|
||||
// Cosmic DE
|
||||
{
|
||||
.names = {"Cosmic"},
|
||||
@@ -1239,7 +1270,7 @@ static const FFlogo D[] = {
|
||||
},
|
||||
// DebianSmall
|
||||
{
|
||||
.names = {"Debian_small", "debian-linux-small"},
|
||||
.names = {"Debian_small", "debian-linux_small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_DEBIAN_SMALL,
|
||||
.colors = {
|
||||
@@ -1271,7 +1302,7 @@ static const FFlogo D[] = {
|
||||
},
|
||||
// Devuan
|
||||
{
|
||||
.names = {"Devuan", "devuan-linux"},
|
||||
.names = {"Devuan"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_DEVUAN,
|
||||
.colors = {
|
||||
FF_COLOR_FG_MAGENTA,
|
||||
@@ -1281,7 +1312,7 @@ static const FFlogo D[] = {
|
||||
},
|
||||
// DevuanSmall
|
||||
{
|
||||
.names = {"Devuan_small", "devuan-linux-small"},
|
||||
.names = {"Devuan_small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_DEVUAN_SMALL,
|
||||
.colors = {
|
||||
@@ -1314,7 +1345,7 @@ static const FFlogo D[] = {
|
||||
},
|
||||
// DragonFly
|
||||
{
|
||||
.names = {"DragonFly", "DragonFly-BSD"},
|
||||
.names = {"DragonFly"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_DRAGONFLY,
|
||||
.colors = {
|
||||
FF_COLOR_FG_RED,
|
||||
@@ -1325,7 +1356,7 @@ static const FFlogo D[] = {
|
||||
},
|
||||
// DragonFlySmall
|
||||
{
|
||||
.names = {"DragonFly_small", "DragonFly-BSD_small"},
|
||||
.names = {"DragonFly_small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_DRAGONFLY_SMALL,
|
||||
.colors = {
|
||||
@@ -1337,7 +1368,7 @@ static const FFlogo D[] = {
|
||||
},
|
||||
// DragonFlyOld
|
||||
{
|
||||
.names = {"DragonFly_old", "DragonFly-BSD_old"},
|
||||
.names = {"DragonFly_old"},
|
||||
.type = FF_LOGO_LINE_TYPE_ALTER_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_DRAGONFLY_OLD,
|
||||
.colors = {
|
||||
@@ -1397,7 +1428,7 @@ static const FFlogo E[] = {
|
||||
},
|
||||
// ElementarySmall
|
||||
{
|
||||
.names = {"Elementary_small", "elementary-small"},
|
||||
.names = {"Elementary_small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_ELEMENTARY_SMALL,
|
||||
.colors = {
|
||||
@@ -1570,9 +1601,25 @@ static const FFlogo E[] = {
|
||||
};
|
||||
|
||||
static const FFlogo F[] = {
|
||||
// Fastfetch
|
||||
{
|
||||
.names = {"Fastfetch", "FF"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_FASTFETCH,
|
||||
.colors = {
|
||||
FF_COLOR_FG_BLUE,
|
||||
FF_COLOR_FG_RED,
|
||||
FF_COLOR_FG_YELLOW,
|
||||
FF_COLOR_FG_GREEN,
|
||||
FF_COLOR_FG_DEFAULT,
|
||||
FF_COLOR_FG_MAGENTA,
|
||||
FF_COLOR_FG_CYAN,
|
||||
},
|
||||
.colorKeys = FF_COLOR_FG_BLUE,
|
||||
.colorTitle = FF_COLOR_FG_YELLOW,
|
||||
},
|
||||
// Fedora
|
||||
{
|
||||
.names = {"Fedora", "fedora-linux"},
|
||||
.names = {"Fedora"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_FEDORA,
|
||||
.colors = {
|
||||
FF_COLOR_FG_BLUE,
|
||||
@@ -1599,7 +1646,7 @@ static const FFlogo F[] = {
|
||||
},
|
||||
// FedoraSmall
|
||||
{
|
||||
.names = {"Fedora_small", "fedora-linux-small"},
|
||||
.names = {"Fedora_small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_FEDORA_SMALL,
|
||||
.colors = {
|
||||
@@ -1610,7 +1657,7 @@ static const FFlogo F[] = {
|
||||
},
|
||||
// FedoraOld
|
||||
{
|
||||
.names = {"Fedora_old", "fedora-old", "fedora-linux-old", "fedora-linux_old"},
|
||||
.names = {"Fedora_old"},
|
||||
.type = FF_LOGO_LINE_TYPE_ALTER_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_FEDORA_OLD,
|
||||
.colors = {
|
||||
@@ -1622,7 +1669,7 @@ static const FFlogo F[] = {
|
||||
},
|
||||
// FedoraSilverblue
|
||||
{
|
||||
.names = {"Fedora_silverblue", "fedora-silverblue", "fedora-linux-silverblue", "fedora-linux_silverblue"},
|
||||
.names = {"Fedora_silverblue", "fedora-silverblue"},
|
||||
.type = FF_LOGO_LINE_TYPE_ALTER_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_FEDORA_SILVERBLUE,
|
||||
.colors = {
|
||||
@@ -1635,7 +1682,7 @@ static const FFlogo F[] = {
|
||||
},
|
||||
// FedoraKinoite
|
||||
{
|
||||
.names = {"Fedora_kinoite", "fedora-kinoite", "fedora-linux-kinoite", "fedora-linux_kinoite"},
|
||||
.names = {"Fedora_kinoite", "fedora-kinoite"},
|
||||
.type = FF_LOGO_LINE_TYPE_ALTER_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_FEDORA_KINOITE,
|
||||
.colors = {
|
||||
@@ -1647,7 +1694,7 @@ static const FFlogo F[] = {
|
||||
},
|
||||
// FedoraSericea
|
||||
{
|
||||
.names = {"Fedora_sericea", "fedora-sericea", "fedora-linux-sericea", "fedora-linux_sericea"},
|
||||
.names = {"Fedora_sericea", "fedora-sericea"},
|
||||
.type = FF_LOGO_LINE_TYPE_ALTER_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_FEDORA_SERICEA,
|
||||
.colors = {
|
||||
@@ -1659,7 +1706,7 @@ static const FFlogo F[] = {
|
||||
},
|
||||
// FedoraCoreOS
|
||||
{
|
||||
.names = {"Fedora_coreos", "fedora-coreos", "fedora-linux-coreos", "fedora-linux_coreos"},
|
||||
.names = {"Fedora_coreos", "fedora-coreos"},
|
||||
.type = FF_LOGO_LINE_TYPE_ALTER_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_FEDORA_COREOS,
|
||||
.colors = {
|
||||
@@ -1721,14 +1768,6 @@ static const FFlogo F[] = {
|
||||
.colorKeys = FF_COLOR_FG_RED,
|
||||
.colorTitle = FF_COLOR_FG_WHITE,
|
||||
},
|
||||
// FoxOS
|
||||
{
|
||||
.names = {"FoxOS"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_FOXOS,
|
||||
.colors = {
|
||||
FF_COLOR_FG_YELLOW,
|
||||
},
|
||||
},
|
||||
// FreeBSD
|
||||
{
|
||||
.names = {"Freebsd"},
|
||||
@@ -1822,7 +1861,7 @@ static const FFlogo G[] = {
|
||||
},
|
||||
// GarudaDragon
|
||||
{
|
||||
.names = {"GarudaDragon", "garuda-dragon", "garuda-linux-dragon"},
|
||||
.names = {"GarudaDragon", "garuda-dragon"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_GARUDA_DRAGON,
|
||||
.colors = {
|
||||
FF_COLOR_FG_RED,
|
||||
@@ -1832,7 +1871,7 @@ static const FFlogo G[] = {
|
||||
},
|
||||
// GarudaSmall
|
||||
{
|
||||
.names = {"Garuda_small", "garudalinux_small", "garuda-linux-small"},
|
||||
.names = {"Garuda_small", "garuda-linux_small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_GARUDA_SMALL,
|
||||
.colors = {
|
||||
@@ -1843,7 +1882,7 @@ static const FFlogo G[] = {
|
||||
},
|
||||
// Gentoo
|
||||
{
|
||||
.names = {"Gentoo", "gentoo-linux"},
|
||||
.names = {"Gentoo"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_GENTOO,
|
||||
.colors = {
|
||||
FF_COLOR_FG_MAGENTA,
|
||||
@@ -1854,7 +1893,7 @@ static const FFlogo G[] = {
|
||||
},
|
||||
// GentooSmall
|
||||
{
|
||||
.names = {"Gentoo_small", "gentoo-linux-small"},
|
||||
.names = {"Gentoo_small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_GENTOO_SMALL,
|
||||
.colors = {
|
||||
@@ -2025,7 +2064,7 @@ static const FFlogo H[] = {
|
||||
},
|
||||
// HaikuSmall
|
||||
{
|
||||
.names = {"Haiku-small"},
|
||||
.names = {"Haiku_small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_HAIKU_SMALL,
|
||||
.colors = {
|
||||
@@ -2475,7 +2514,7 @@ static const FFlogo L[] = {
|
||||
},
|
||||
// Lingmo OS
|
||||
{
|
||||
.names = {"Lingmo", "lingmo", "LingmoOS", "lingmoos"},
|
||||
.names = {"Lingmo", "LingmoOS"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_LINGMO,
|
||||
.colors = {
|
||||
FF_COLOR_FG_BLUE,
|
||||
@@ -2558,7 +2597,7 @@ static const FFlogo L[] = {
|
||||
// LinuxMint
|
||||
{
|
||||
.names = {"linuxmint", "linux-mint"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_MINT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_LINUXMINT,
|
||||
.colors = {
|
||||
FF_COLOR_FG_GREEN,
|
||||
FF_COLOR_FG_WHITE,
|
||||
@@ -2570,7 +2609,7 @@ static const FFlogo L[] = {
|
||||
{
|
||||
.names = {"linuxmint_small", "linux-mint_small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_MINT_SMALL,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_LINUXMINT_SMALL,
|
||||
.colors = {
|
||||
FF_COLOR_FG_GREEN,
|
||||
FF_COLOR_FG_WHITE,
|
||||
@@ -2582,7 +2621,7 @@ static const FFlogo L[] = {
|
||||
{
|
||||
.names = {"linuxmint_old", "linux-mint_old"},
|
||||
.type = FF_LOGO_LINE_TYPE_ALTER_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_MINT_OLD,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_LINUXMINT_OLD,
|
||||
.colors = {
|
||||
FF_COLOR_FG_GREEN,
|
||||
FF_COLOR_FG_WHITE,
|
||||
@@ -2810,7 +2849,7 @@ static const FFlogo M[] = {
|
||||
},
|
||||
// Manjaro
|
||||
{
|
||||
.names = {"manjaro", "manjaro-linux", "manjarolinux", "manjaro-arm"},
|
||||
.names = {"manjaro", "manjaro-arm"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_MANJARO,
|
||||
.colors = {
|
||||
FF_COLOR_FG_GREEN,
|
||||
@@ -2820,7 +2859,7 @@ static const FFlogo M[] = {
|
||||
},
|
||||
// ManjaroSmall
|
||||
{
|
||||
.names = {"manjaro_small", "manjaro-linux-small"},
|
||||
.names = {"manjaro_small", "manjaro-arm_small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_MANJARO_SMALL,
|
||||
.colors = {
|
||||
@@ -2924,41 +2963,6 @@ static const FFlogo M[] = {
|
||||
.colorKeys = FF_COLOR_FG_LIGHT_BLACK,
|
||||
.colorTitle = FF_COLOR_FG_WHITE,
|
||||
},
|
||||
// Mint
|
||||
{
|
||||
.names = {"mint", "mint-linux"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_MINT,
|
||||
.colors = {
|
||||
FF_COLOR_FG_GREEN,
|
||||
FF_COLOR_FG_WHITE,
|
||||
},
|
||||
.colorKeys = FF_COLOR_FG_GREEN,
|
||||
.colorTitle = FF_COLOR_FG_GREEN,
|
||||
},
|
||||
// MintSmall
|
||||
{
|
||||
.names = {"mint_small", "mint-linux-small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_MINT_SMALL,
|
||||
.colors = {
|
||||
FF_COLOR_FG_GREEN,
|
||||
FF_COLOR_FG_WHITE,
|
||||
},
|
||||
.colorKeys = FF_COLOR_FG_GREEN,
|
||||
.colorTitle = FF_COLOR_FG_GREEN,
|
||||
},
|
||||
// MintOld
|
||||
{
|
||||
.names = {"mint_old", "mint-old", "mint-linux_old", "mint-linux-old"},
|
||||
.type = FF_LOGO_LINE_TYPE_ALTER_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_MINT_OLD,
|
||||
.colors = {
|
||||
FF_COLOR_FG_GREEN,
|
||||
FF_COLOR_FG_WHITE,
|
||||
},
|
||||
.colorKeys = FF_COLOR_FG_GREEN,
|
||||
.colorTitle = FF_COLOR_FG_GREEN,
|
||||
},
|
||||
// Minix
|
||||
{
|
||||
.names = {"Minix"},
|
||||
@@ -3096,7 +3100,7 @@ static const FFlogo N[] = {
|
||||
},
|
||||
// NixOS
|
||||
{
|
||||
.names = {"NixOS", "nix", "nixos-linux", "nix-linux"},
|
||||
.names = {"NixOS"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_NIXOS,
|
||||
.colors = {
|
||||
FF_COLOR_FG_BLUE,
|
||||
@@ -3105,7 +3109,7 @@ static const FFlogo N[] = {
|
||||
},
|
||||
// NixOSSmall
|
||||
{
|
||||
.names = {"NixOS_small", "nix_small", "nixos-linux-small", "nix-linux-small"},
|
||||
.names = {"NixOS_small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_NIXOS_SMALL,
|
||||
.colors = {
|
||||
@@ -3115,7 +3119,7 @@ static const FFlogo N[] = {
|
||||
},
|
||||
// NixOSOld
|
||||
{
|
||||
.names = {"nixos_old", "nix-old", "nixos-old", "nix_old"},
|
||||
.names = {"nixos_old"},
|
||||
.type = FF_LOGO_LINE_TYPE_ALTER_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_NIXOS_OLD,
|
||||
.colors = {
|
||||
@@ -3125,7 +3129,7 @@ static const FFlogo N[] = {
|
||||
},
|
||||
// NixOsOldSmall
|
||||
{
|
||||
.names = {"nixos_old_small", "nix-old-small", "nixos-old-small", "nix_old_small"},
|
||||
.names = {"nixos_old_small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT | FF_LOGO_LINE_TYPE_ALTER_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_NIXOS_OLD_SMALL,
|
||||
.colors = {
|
||||
@@ -3144,6 +3148,18 @@ static const FFlogo N[] = {
|
||||
.colorKeys = FF_COLOR_FG_RED,
|
||||
.colorTitle = FF_COLOR_FG_WHITE,
|
||||
},
|
||||
// NetBSD2
|
||||
{
|
||||
.names = {"NetBSD2"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_NETBSD2,
|
||||
.type = FF_LOGO_LINE_TYPE_ALTER_BIT,
|
||||
.colors = {
|
||||
FF_COLOR_FG_RED,
|
||||
FF_COLOR_FG_WHITE,
|
||||
},
|
||||
.colorKeys = FF_COLOR_FG_RED,
|
||||
.colorTitle = FF_COLOR_FG_WHITE,
|
||||
},
|
||||
// NetBSD Small
|
||||
{
|
||||
.names = {"NetBSD_small"},
|
||||
@@ -3269,7 +3285,7 @@ static const FFlogo O[] = {
|
||||
},
|
||||
// OpenBSDSmall
|
||||
{
|
||||
.names = {"openbsd_small", "openbsd-small"},
|
||||
.names = {"openbsd_small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_OPENBSD_SMALL,
|
||||
.colors = {
|
||||
@@ -3339,7 +3355,7 @@ static const FFlogo O[] = {
|
||||
},
|
||||
// openSuseMicroOS
|
||||
{
|
||||
.names = {"opensuse-microos", "opensuse_microos"},
|
||||
.names = {"opensuse-microos"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_OPENSUSE_MICROOS,
|
||||
.colors = {
|
||||
FF_COLOR_FG_GREEN,
|
||||
@@ -3347,7 +3363,7 @@ static const FFlogo O[] = {
|
||||
},
|
||||
// OpenSuseLeap
|
||||
{
|
||||
.names = {"opensuse-leap", "opensuse leap"},
|
||||
.names = {"opensuse-leap"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_OPENSUSE_LEAP,
|
||||
.colors = {
|
||||
FF_COLOR_FG_WHITE,
|
||||
@@ -3357,7 +3373,7 @@ static const FFlogo O[] = {
|
||||
},
|
||||
// OpenSuseLeapOld
|
||||
{
|
||||
.names = {"opensuse-leap_old", "opensuse leap_old"},
|
||||
.names = {"opensuse-leap_old"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_OPENSUSE_LEAP_OLD,
|
||||
.type = FF_LOGO_LINE_TYPE_ALTER_BIT,
|
||||
.colors = {
|
||||
@@ -3376,9 +3392,20 @@ static const FFlogo O[] = {
|
||||
.colorKeys = FF_COLOR_FG_GREEN,
|
||||
.colorTitle = FF_COLOR_FG_GREEN,
|
||||
},
|
||||
// OpenSuseTumbleweedSmall
|
||||
{
|
||||
.names = {"opensuse-tumbleweed_small"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_OPENSUSE_TUMBLEWEED,
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.colors = {
|
||||
FF_COLOR_FG_WHITE,
|
||||
},
|
||||
.colorKeys = FF_COLOR_FG_GREEN,
|
||||
.colorTitle = FF_COLOR_FG_GREEN,
|
||||
},
|
||||
// OpenSuseTumbleweedOld
|
||||
{
|
||||
.names = {"opensuse-tumbleweed-old"},
|
||||
.names = {"opensuse-tumbleweed_old"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_OPENSUSE_TUMBLEWEED_OLD,
|
||||
.type = FF_LOGO_LINE_TYPE_ALTER_BIT,
|
||||
.colors = {
|
||||
@@ -3684,9 +3711,9 @@ static const FFlogo P[] = {
|
||||
FF_COLOR_FG_YELLOW,
|
||||
},
|
||||
},
|
||||
// Pisi
|
||||
// PisiLinux
|
||||
{
|
||||
.names = {"Pisi"},
|
||||
.names = {"PisiLinux"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_PISI,
|
||||
.colors = {
|
||||
FF_COLOR_FG_BLUE,
|
||||
@@ -4229,6 +4256,15 @@ static const FFlogo S[] = {
|
||||
FF_COLOR_FG_WHITE,
|
||||
},
|
||||
},
|
||||
// Shebang
|
||||
{
|
||||
.names = {"Shebang"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_SHEBANG,
|
||||
.colors = {
|
||||
FF_COLOR_FG_WHITE,
|
||||
FF_COLOR_FG_WHITE,
|
||||
},
|
||||
},
|
||||
// Siduction
|
||||
{
|
||||
.names = {"Siduction"},
|
||||
@@ -4609,7 +4645,7 @@ static const FFlogo U[] = {
|
||||
},
|
||||
// UbuntuSmall
|
||||
{
|
||||
.names = {"ubuntu_small", "ubuntu-linux-small"},
|
||||
.names = {"ubuntu_small", "ubuntu-linux_small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_UBUNTU_SMALL,
|
||||
.colors = {
|
||||
@@ -4644,7 +4680,7 @@ static const FFlogo U[] = {
|
||||
},
|
||||
// UbuntuOld2Small
|
||||
{
|
||||
.names = {"ubuntu_old2_small", "ubuntu_old2-small"},
|
||||
.names = {"ubuntu_old2_small", "ubuntu_old2_small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT | FF_LOGO_LINE_TYPE_ALTER_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_UBUNTU_OLD2_SMALL,
|
||||
.colors = {
|
||||
@@ -4851,7 +4887,7 @@ static const FFlogo V[] = {
|
||||
},
|
||||
// Vanilla
|
||||
{
|
||||
.names = {"vanilla", "vanilla-os", "vanilla-linux"},
|
||||
.names = {"vanilla"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_VANILLA,
|
||||
.colors = {
|
||||
FF_COLOR_FG_YELLOW,
|
||||
@@ -4861,7 +4897,7 @@ static const FFlogo V[] = {
|
||||
},
|
||||
// Vanilla2
|
||||
{
|
||||
.names = {"vanilla2", "vanilla-os2", "vanilla-linux2"},
|
||||
.names = {"vanilla2"},
|
||||
.type = FF_LOGO_LINE_TYPE_ALTER_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_VANILLA2,
|
||||
.colors = {
|
||||
@@ -4872,7 +4908,7 @@ static const FFlogo V[] = {
|
||||
},
|
||||
// VanillaSmall
|
||||
{
|
||||
.names = {"vanilla-small", "vanilla-os-small", "vanilla-linux-small"},
|
||||
.names = {"vanilla_small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_VANILLA_SMALL,
|
||||
.colors = {
|
||||
@@ -4923,7 +4959,7 @@ static const FFlogo V[] = {
|
||||
},
|
||||
// Void
|
||||
{
|
||||
.names = {"void", "void-linux"},
|
||||
.names = {"void"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_VOID,
|
||||
.colors = {
|
||||
FF_COLOR_FG_GREEN,
|
||||
@@ -4934,7 +4970,7 @@ static const FFlogo V[] = {
|
||||
},
|
||||
// VoidSmall
|
||||
{
|
||||
.names = {"void_small", "void-linux-small"},
|
||||
.names = {"void_small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_VOID_SMALL,
|
||||
.colors = {
|
||||
@@ -4945,7 +4981,7 @@ static const FFlogo V[] = {
|
||||
},
|
||||
// Void2Small
|
||||
{
|
||||
.names = {"void2_small", "void-linux2-small"},
|
||||
.names = {"void2_small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT | FF_LOGO_LINE_TYPE_ALTER_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_VOID2_SMALL,
|
||||
.colors = {
|
||||
@@ -4996,7 +5032,7 @@ static const FFlogo W[] = {
|
||||
},
|
||||
// Windows11Small
|
||||
{
|
||||
.names = {"Windows 11_small", "Windows 11-small"},
|
||||
.names = {"Windows 11_small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_WINDOWS_11_SMALL,
|
||||
.colors = {
|
||||
@@ -5049,6 +5085,15 @@ static const FFlogo W[] = {
|
||||
.colorKeys = FF_COLOR_FG_CYAN,
|
||||
.colorTitle = FF_COLOR_FG_BLUE,
|
||||
},
|
||||
// WolfOS
|
||||
{
|
||||
.names = {"WolfOS"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_WOLFOS,
|
||||
.colors = {
|
||||
FF_COLOR_FG_BLUE,
|
||||
FF_COLOR_FG_GREEN,
|
||||
},
|
||||
},
|
||||
// LAST
|
||||
{},
|
||||
};
|
||||
@@ -5131,7 +5176,7 @@ static const FFlogo Y[] = {
|
||||
static const FFlogo Z[] = {
|
||||
// Zorin
|
||||
{
|
||||
.names = {"zorin", "zorin-linux", "zorinos", "zorinos-linux"},
|
||||
.names = {"Zorin"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_ZORIN,
|
||||
.colors = {
|
||||
FF_COLOR_FG_BLUE,
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<!-- Fastfetch Logo -->
|
||||
<svg width="400" height="400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 400">
|
||||
<!-- Terminal border -->
|
||||
<rect x="0" y="0" width="400" height="400" rx="15" ry="15" fill="#282c34" stroke="#3498db"
|
||||
stroke-width="3" />
|
||||
|
||||
<!-- Title bar of terminal -->
|
||||
<g>
|
||||
<!-- Background -->
|
||||
<path d="M15,0 h370 a15,15 0 0 1 15,15 v25 h-400 v-25 a15,15 0 0 1 15,-15 z" fill="#3498db" opacity="0.2" />
|
||||
<text x="190" y="28" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#ecf0f1">FASTFETCH</text>
|
||||
<!-- Close btn -->
|
||||
<circle cx="25" cy="20" r="7" fill="#e74c3c" />
|
||||
<!-- Minimize btn -->
|
||||
<circle cx="45" cy="20" r="7" fill="#f1c40f" />
|
||||
<!-- Maximize btn -->
|
||||
<circle cx="65" cy="20" r="7" fill="#2ecc71" />
|
||||
<!-- Bottom border of title bar -->
|
||||
<line x1="0" y1="40" x2="400" y2="40" stroke="#3498db" stroke-width="2" />
|
||||
</g>
|
||||
<!-- Rocket icon -->
|
||||
<g>
|
||||
<path d="M94.25,73.59 L139.99,142.20 L48.52,142.20 Z" fill="#e74c3c" />
|
||||
<rect x="48.52" y="142.20" width="91.48" height="141.75" fill="#ecf0f1" />
|
||||
<rect x="57.66" y="172.50" width="73.19" height="45.74" fill="#95a5a6" />
|
||||
<path d="M57.66,328.89 L71.39,374.63 L89.68,328.89 Z" fill="#e67e22" />
|
||||
<path d="M98.83,328.89 L117.12,374.63 L130.85,328.89 Z" fill="#e67e22" />
|
||||
<rect x="48.52" y="283.15" width="91.48" height="45.74" fill="#7f8c8d" />
|
||||
</g>
|
||||
<!-- System info -->
|
||||
<g font-family="monospace" font-size="42" fill="#2980b9" transform="translate(190, 102)">
|
||||
<text y="0">►►►►►►►</text>
|
||||
<text y="45">►►►►►►</text>
|
||||
<text y="90">►►►►►</text>
|
||||
<text y="135">►►►►</text>
|
||||
<text y="180">►►►</text>
|
||||
<text y="225">►►</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
@@ -23,6 +23,7 @@ static void printBattery(FFBatteryOptions* options, FFBatteryResult* result, uin
|
||||
FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, ((FFformatarg[]) {
|
||||
FF_FORMAT_ARG(index, "index"),
|
||||
FF_FORMAT_ARG(result->modelName, "name"),
|
||||
FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"),
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
@@ -82,6 +82,8 @@ void ffPrintBrightness(FFBrightnessOptions* options)
|
||||
ffPercentAppendNum(&str, percent, options->percent, str.length > 0, &options->moduleArgs);
|
||||
}
|
||||
|
||||
ffStrbufAppendS(&str, item->builtin ? " [Built-in]" : " [External]");
|
||||
|
||||
ffStrbufPutTo(&str, stdout);
|
||||
}
|
||||
else
|
||||
@@ -100,6 +102,7 @@ void ffPrintBrightness(FFBrightnessOptions* options)
|
||||
FF_FORMAT_ARG(item->min, "min"),
|
||||
FF_FORMAT_ARG(item->current, "current"),
|
||||
FF_FORMAT_ARG(valueBar, "percentage-bar"),
|
||||
FF_FORMAT_ARG(item->builtin, "is-builtin"),
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -204,6 +207,7 @@ void ffGenerateBrightnessJsonResult(FF_MAYBE_UNUSED FFBrightnessOptions* options
|
||||
yyjson_mut_obj_add_real(doc, obj, "max", item->max);
|
||||
yyjson_mut_obj_add_real(doc, obj, "min", item->min);
|
||||
yyjson_mut_obj_add_real(doc, obj, "current", item->current);
|
||||
yyjson_mut_obj_add_bool(doc, obj, "builtin", item->builtin);
|
||||
}
|
||||
|
||||
FF_LIST_FOR_EACH(FFBrightnessResult, item, result)
|
||||
@@ -227,6 +231,7 @@ static FFModuleBaseInfo ffModuleInfo = {
|
||||
{"Minimum brightness value", "min"},
|
||||
{"Current brightness value", "current"},
|
||||
{"Screen brightness (percentage bar)", "percentage-bar"},
|
||||
{"Is built-in screen", "is-builtin"},
|
||||
}))
|
||||
};
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ void ffPrintDateTimeFormat(struct tm* tm, const FFModuleArgs* moduleArgs)
|
||||
result.dayInYear = (uint8_t) (tm->tm_yday + 1);
|
||||
result.dayInMonth = (uint8_t) tm->tm_mday;
|
||||
result.dayInWeek = tm->tm_wday == 0 ? 7 : (uint8_t) tm->tm_wday;
|
||||
strftime(result.dayPretty, sizeof(result.dayPretty), "%0d", tm);
|
||||
strftime(result.dayPretty, sizeof(result.dayPretty), "%d", tm);
|
||||
result.hour = (uint8_t) tm->tm_hour;
|
||||
strftime(result.hourPretty, sizeof(result.hourPretty), "%H", tm);
|
||||
result.hour12 = (uint8_t) (result.hour % 12);
|
||||
|
||||
@@ -156,6 +156,8 @@ static void printDisk(FFDiskOptions* options, const FFDisk* disk, uint32_t index
|
||||
FF_FORMAT_ARG(minutes, "minutes"),
|
||||
FF_FORMAT_ARG(seconds, "seconds"),
|
||||
FF_FORMAT_ARG(milliseconds, "milliseconds"),
|
||||
FF_FORMAT_ARG(disk->mountpoint, "mountpoint"),
|
||||
FF_FORMAT_ARG(disk->mountFrom, "mount-from"),
|
||||
}));
|
||||
}
|
||||
}
|
||||
@@ -483,6 +485,8 @@ static FFModuleBaseInfo ffModuleInfo = {
|
||||
{"Minutes after creation", "minutes"},
|
||||
{"Seconds after creation", "seconds"},
|
||||
{"Milliseconds after creation", "milliseconds"},
|
||||
{"Mount point / drive letter", "mountpoint"},
|
||||
{"Mount from (device path)", "mount-from"},
|
||||
}))
|
||||
};
|
||||
|
||||
|
||||
+65
-8
@@ -20,6 +20,8 @@ static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResu
|
||||
default: type = "Unknown"; break;
|
||||
}
|
||||
|
||||
FFPercentageTypeFlags percentType = options->percent.type == 0 ? instance.config.display.percentType : options->percent.type;
|
||||
|
||||
if(options->moduleArgs.outputFormat.length == 0)
|
||||
{
|
||||
ffPrintLogoAndKey(FF_GPU_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT);
|
||||
@@ -53,16 +55,28 @@ static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResu
|
||||
{
|
||||
ffStrbufAppendS(&output, " (");
|
||||
|
||||
if(gpu->dedicated.used != FF_GPU_VMEM_SIZE_UNSET)
|
||||
if (!(percentType & FF_PERCENTAGE_TYPE_HIDE_OTHERS_BIT))
|
||||
{
|
||||
ffParseSize(gpu->dedicated.used, &output);
|
||||
ffStrbufAppendS(&output, " / ");
|
||||
if(gpu->dedicated.used != FF_GPU_VMEM_SIZE_UNSET)
|
||||
{
|
||||
ffParseSize(gpu->dedicated.used, &output);
|
||||
ffStrbufAppendS(&output, " / ");
|
||||
}
|
||||
ffParseSize(gpu->dedicated.total, &output);
|
||||
}
|
||||
ffParseSize(gpu->dedicated.total, &output);
|
||||
if(gpu->dedicated.used != FF_GPU_VMEM_SIZE_UNSET)
|
||||
{
|
||||
ffStrbufAppendS(&output, ", ");
|
||||
ffPercentAppendNum(&output, (double) gpu->dedicated.used / (double) gpu->dedicated.total * 100.0, options->percent, false, &options->moduleArgs);
|
||||
double percent = (double) gpu->dedicated.used / (double) gpu->dedicated.total * 100.0;
|
||||
if (percentType & FF_PERCENTAGE_TYPE_NUM_BIT)
|
||||
{
|
||||
ffStrbufAppendS(&output, ", ");
|
||||
ffPercentAppendNum(&output, percent, options->percent, false, &options->moduleArgs);
|
||||
}
|
||||
if (percentType & FF_PERCENTAGE_TYPE_BAR_BIT)
|
||||
{
|
||||
ffStrbufAppendS(&output, " ");
|
||||
ffPercentAppendBar(&output, percent, options->percent, &options->moduleArgs);
|
||||
}
|
||||
}
|
||||
ffStrbufAppendC(&output, ')');
|
||||
}
|
||||
@@ -78,16 +92,47 @@ static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResu
|
||||
ffTempsAppendNum(gpu->temperature, &tempStr, options->tempConfig, &options->moduleArgs);
|
||||
FF_STRBUF_AUTO_DESTROY dTotal = ffStrbufCreate();
|
||||
FF_STRBUF_AUTO_DESTROY dUsed = ffStrbufCreate();
|
||||
FF_STRBUF_AUTO_DESTROY sTotal = ffStrbufCreate();
|
||||
FF_STRBUF_AUTO_DESTROY sUsed = ffStrbufCreate();
|
||||
FF_STRBUF_AUTO_DESTROY dPercentNum = ffStrbufCreate();
|
||||
FF_STRBUF_AUTO_DESTROY dPercentBar = ffStrbufCreate();
|
||||
if (gpu->dedicated.total != FF_GPU_VMEM_SIZE_UNSET) ffParseSize(gpu->dedicated.total, &dTotal);
|
||||
if (gpu->dedicated.used != FF_GPU_VMEM_SIZE_UNSET) ffParseSize(gpu->dedicated.used, &dUsed);
|
||||
if (gpu->dedicated.total != FF_GPU_VMEM_SIZE_UNSET && gpu->dedicated.used != FF_GPU_VMEM_SIZE_UNSET)
|
||||
{
|
||||
double percent = (double) gpu->dedicated.used / (double) gpu->dedicated.total * 100.0;
|
||||
if (percentType & FF_PERCENTAGE_TYPE_NUM_BIT)
|
||||
ffPercentAppendNum(&dPercentNum, percent, options->percent, false, &options->moduleArgs);
|
||||
if (percentType & FF_PERCENTAGE_TYPE_BAR_BIT)
|
||||
ffPercentAppendBar(&dPercentBar, percent, options->percent, &options->moduleArgs);
|
||||
}
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY sTotal = ffStrbufCreate();
|
||||
FF_STRBUF_AUTO_DESTROY sUsed = ffStrbufCreate();
|
||||
FF_STRBUF_AUTO_DESTROY sPercentNum = ffStrbufCreate();
|
||||
FF_STRBUF_AUTO_DESTROY sPercentBar = ffStrbufCreate();
|
||||
if (gpu->shared.total != FF_GPU_VMEM_SIZE_UNSET) ffParseSize(gpu->shared.total, &sTotal);
|
||||
if (gpu->shared.used != FF_GPU_VMEM_SIZE_UNSET) ffParseSize(gpu->shared.used, &sUsed);
|
||||
if (gpu->shared.total != FF_GPU_VMEM_SIZE_UNSET && gpu->shared.used != FF_GPU_VMEM_SIZE_UNSET)
|
||||
{
|
||||
double percent = (double) gpu->shared.used / (double) gpu->shared.total * 100.0;
|
||||
if (percentType & FF_PERCENTAGE_TYPE_NUM_BIT)
|
||||
ffPercentAppendNum(&sPercentNum, percent, options->percent, false, &options->moduleArgs);
|
||||
if (percentType & FF_PERCENTAGE_TYPE_BAR_BIT)
|
||||
ffPercentAppendBar(&sPercentBar, percent, options->percent, &options->moduleArgs);
|
||||
}
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY frequency = ffStrbufCreate();
|
||||
ffParseFrequency(gpu->frequency, &frequency);
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY coreUsageNum = ffStrbufCreate();
|
||||
FF_STRBUF_AUTO_DESTROY coreUsageBar = ffStrbufCreate();
|
||||
if (gpu->coreUsage == gpu->coreUsage) //FF_GPU_CORE_USAGE_UNSET
|
||||
{
|
||||
if (percentType & FF_PERCENTAGE_TYPE_NUM_BIT)
|
||||
ffPercentAppendNum(&coreUsageNum, gpu->coreUsage, options->percent, false, &options->moduleArgs);
|
||||
if (percentType & FF_PERCENTAGE_TYPE_BAR_BIT)
|
||||
ffPercentAppendBar(&coreUsageBar, gpu->coreUsage, options->percent, &options->moduleArgs);
|
||||
}
|
||||
|
||||
FF_PRINT_FORMAT_CHECKED(FF_GPU_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]) {
|
||||
FF_FORMAT_ARG(gpu->vendor, "vendor"),
|
||||
FF_FORMAT_ARG(gpu->name, "name"),
|
||||
@@ -102,6 +147,12 @@ static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResu
|
||||
FF_FORMAT_ARG(gpu->platformApi, "platform-api"),
|
||||
FF_FORMAT_ARG(frequency, "frequency"),
|
||||
FF_FORMAT_ARG(index, "index"),
|
||||
FF_FORMAT_ARG(dPercentNum, "dedicated-percentage-num"),
|
||||
FF_FORMAT_ARG(dPercentBar, "dedicated-percentage-bar"),
|
||||
FF_FORMAT_ARG(sPercentNum, "shared-percentage-num"),
|
||||
FF_FORMAT_ARG(sPercentBar, "shared-percentage-bar"),
|
||||
FF_FORMAT_ARG(coreUsageNum, "core-usage-num"),
|
||||
FF_FORMAT_ARG(coreUsageBar, "core-usage-bar"),
|
||||
}));
|
||||
}
|
||||
}
|
||||
@@ -414,6 +465,12 @@ static FFModuleBaseInfo ffModuleInfo = {
|
||||
{"The platform API used when detecting the GPU", "platform-api"},
|
||||
{"Current frequency in GHz", "frequency"},
|
||||
{"GPU vendor specific index", "index"},
|
||||
{"Dedicated memory usage percentage num", "dedicated-percentage-num"},
|
||||
{"Dedicated memory usage percentage bar", "dedicated-percentage-bar"},
|
||||
{"Shared memory usage percentage num", "shared-percentage-num"},
|
||||
{"Shared memory usage percentage bar", "shared-percentage-bar"},
|
||||
{"Core usage percentage num (supports Nvidia & Apple GPU only)", "core-usage-num"},
|
||||
{"Core usage percentage bar (supports Nvidia & Apple GPU only)", "core-usage-bar"},
|
||||
})),
|
||||
};
|
||||
|
||||
|
||||
@@ -525,7 +525,7 @@ void ffInitLocalIpOptions(FFLocalIpOptions* options)
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
|
||||
options->showType = FF_LOCALIP_TYPE_IPV4_BIT | FF_LOCALIP_TYPE_PREFIX_LEN_BIT
|
||||
#if !__ANDROID__ /*Permission denied*/ && !__OpenBSD__ /*Report invalid argument for some reason*/ && !__DragonFly__ /*Doesn't work*/
|
||||
#if !__ANDROID__ /*Permission denied*/
|
||||
| FF_LOCALIP_TYPE_DEFAULT_ROUTE_ONLY_BIT
|
||||
#endif
|
||||
;
|
||||
|
||||
@@ -56,7 +56,6 @@ bool ffParseOpenGLCommandOptions(FFOpenGLOptions* options, const char* key, cons
|
||||
{ "auto", FF_OPENGL_LIBRARY_AUTO },
|
||||
{ "egl", FF_OPENGL_LIBRARY_EGL },
|
||||
{ "glx", FF_OPENGL_LIBRARY_GLX },
|
||||
{ "osmesa", FF_OPENGL_LIBRARY_OSMESA },
|
||||
{}
|
||||
});
|
||||
return true;
|
||||
@@ -85,7 +84,6 @@ void ffParseOpenGLJsonObject(FFOpenGLOptions* options, yyjson_val* module)
|
||||
{ "auto", FF_OPENGL_LIBRARY_AUTO },
|
||||
{ "egl", FF_OPENGL_LIBRARY_EGL },
|
||||
{ "glx", FF_OPENGL_LIBRARY_GLX },
|
||||
{ "osmesa", FF_OPENGL_LIBRARY_OSMESA },
|
||||
{},
|
||||
});
|
||||
if (error)
|
||||
@@ -119,9 +117,6 @@ void ffGenerateOpenGLJsonConfig(FFOpenGLOptions* options, yyjson_mut_doc* doc, y
|
||||
case FF_OPENGL_LIBRARY_GLX:
|
||||
yyjson_mut_obj_add_str(doc, module, "library", "glx");
|
||||
break;
|
||||
case FF_OPENGL_LIBRARY_OSMESA:
|
||||
yyjson_mut_obj_add_str(doc, module, "library", "osmesa");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ typedef enum __attribute__((__packed__)) FFOpenGLLibrary
|
||||
FF_OPENGL_LIBRARY_AUTO,
|
||||
FF_OPENGL_LIBRARY_EGL,
|
||||
FF_OPENGL_LIBRARY_GLX,
|
||||
FF_OPENGL_LIBRARY_OSMESA
|
||||
} FFOpenGLLibrary;
|
||||
|
||||
typedef struct FFOpenGLOptions
|
||||
|
||||
+17
-3
@@ -63,6 +63,19 @@ void ffPrintOS(FFOSOptions* options)
|
||||
return;
|
||||
}
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY key = ffStrbufCreate();
|
||||
|
||||
if(options->moduleArgs.key.length == 0)
|
||||
ffStrbufSetStatic(&key, FF_OS_MODULE_NAME);
|
||||
else
|
||||
{
|
||||
FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, ((FFformatarg[]) {
|
||||
FF_FORMAT_ARG(instance.state.platform.sysinfo.name, "sysname"),
|
||||
FF_FORMAT_ARG(os->name, "name"),
|
||||
FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"),
|
||||
}));
|
||||
}
|
||||
|
||||
if(options->moduleArgs.outputFormat.length == 0)
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY result = ffStrbufCreate();
|
||||
@@ -79,12 +92,12 @@ void ffPrintOS(FFOSOptions* options)
|
||||
ffStrbufAppend(&result, &instance.state.platform.sysinfo.architecture);
|
||||
}
|
||||
|
||||
ffPrintLogoAndKey(FF_OS_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT);
|
||||
ffPrintLogoAndKey(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY);
|
||||
ffStrbufPutTo(&result, stdout);
|
||||
}
|
||||
else
|
||||
{
|
||||
FF_PRINT_FORMAT_CHECKED(FF_OS_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]){
|
||||
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, ((FFformatarg[]){
|
||||
FF_FORMAT_ARG(instance.state.platform.sysinfo.name, "sysname"),
|
||||
FF_FORMAT_ARG(os->name, "name"),
|
||||
FF_FORMAT_ARG(os->prettyName, "pretty-name"),
|
||||
@@ -96,7 +109,8 @@ void ffPrintOS(FFOSOptions* options)
|
||||
FF_FORMAT_ARG(os->versionID, "version-id"),
|
||||
FF_FORMAT_ARG(os->codename, "codename"),
|
||||
FF_FORMAT_ARG(os->buildID, "build-id"),
|
||||
FF_FORMAT_ARG(instance.state.platform.sysinfo.architecture, "arch")
|
||||
FF_FORMAT_ARG(instance.state.platform.sysinfo.architecture, "arch"),
|
||||
FF_FORMAT_ARG(instance.state.platform.sysinfo.release, "kernel-release"),
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ typedef enum __attribute__((__packed__)) FFPackagesFlags
|
||||
FF_PACKAGES_FLAG_QI_BIT = 1 << 27,
|
||||
FF_PACKAGES_FLAG_PKGSRC_BIT = 1 << 28,
|
||||
FF_PACKAGES_FLAG_HPKG_BIT = 1 << 29,
|
||||
FF_PACKAGES_FLAG_PISI_BIT = 1 << 30,
|
||||
FF_PACKAGES_FLAG_FORCE_UNSIGNED = UINT32_MAX,
|
||||
} FFPackagesFlags;
|
||||
static_assert(sizeof(FFPackagesFlags) == sizeof(uint32_t), "");
|
||||
|
||||
@@ -77,6 +77,7 @@ void ffPrintPackages(FFPackagesOptions* options)
|
||||
FF_PRINT_PACKAGE(pacstall)
|
||||
FF_PRINT_PACKAGE(mport)
|
||||
FF_PRINT_PACKAGE(qi)
|
||||
FF_PRINT_PACKAGE(pisi)
|
||||
|
||||
putchar('\n');
|
||||
}
|
||||
@@ -128,6 +129,7 @@ void ffPrintPackages(FFPackagesOptions* options)
|
||||
FF_FORMAT_ARG(counts.pkgsrc, "pkgsrc"),
|
||||
FF_FORMAT_ARG(counts.hpkgSystem, "hpkg-system"),
|
||||
FF_FORMAT_ARG(counts.hpkgUser, "hpkg-user"),
|
||||
FF_FORMAT_ARG(counts.pisi, "pisi"),
|
||||
FF_FORMAT_ARG(nixAll, "nix-all"),
|
||||
FF_FORMAT_ARG(flatpakAll, "flatpak-all"),
|
||||
FF_FORMAT_ARG(brewAll, "brew-all"),
|
||||
@@ -206,6 +208,7 @@ bool ffParsePackagesCommandOptions(FFPackagesOptions* options, const char* key,
|
||||
FF_TEST_PACKAGE_NAME(PACMAN)
|
||||
FF_TEST_PACKAGE_NAME(PACSTALL)
|
||||
FF_TEST_PACKAGE_NAME(PALUDIS)
|
||||
FF_TEST_PACKAGE_NAME(PISI)
|
||||
FF_TEST_PACKAGE_NAME(PKG)
|
||||
FF_TEST_PACKAGE_NAME(PKGTOOL)
|
||||
FF_TEST_PACKAGE_NAME(PKGSRC)
|
||||
@@ -324,6 +327,7 @@ void ffParsePackagesJsonObject(FFPackagesOptions* options, yyjson_val* module)
|
||||
FF_TEST_PACKAGE_NAME(PACMAN)
|
||||
FF_TEST_PACKAGE_NAME(PACSTALL)
|
||||
FF_TEST_PACKAGE_NAME(PALUDIS)
|
||||
FF_TEST_PACKAGE_NAME(PISI)
|
||||
FF_TEST_PACKAGE_NAME(PKG)
|
||||
FF_TEST_PACKAGE_NAME(PKGTOOL)
|
||||
FF_TEST_PACKAGE_NAME(PKGSRC)
|
||||
@@ -388,6 +392,7 @@ void ffGeneratePackagesJsonConfig(FFPackagesOptions* options, yyjson_mut_doc* do
|
||||
FF_TEST_PACKAGE_NAME(PACMAN)
|
||||
FF_TEST_PACKAGE_NAME(PACSTALL)
|
||||
FF_TEST_PACKAGE_NAME(PALUDIS)
|
||||
FF_TEST_PACKAGE_NAME(PISI)
|
||||
FF_TEST_PACKAGE_NAME(PKG)
|
||||
FF_TEST_PACKAGE_NAME(PKGTOOL)
|
||||
FF_TEST_PACKAGE_NAME(PKGSRC)
|
||||
@@ -445,6 +450,7 @@ void ffGeneratePackagesJsonResult(FF_MAYBE_UNUSED FFPackagesOptions* options, yy
|
||||
FF_APPEND_PACKAGE_COUNT(pacman)
|
||||
FF_APPEND_PACKAGE_COUNT(pacstall)
|
||||
FF_APPEND_PACKAGE_COUNT(paludis)
|
||||
FF_APPEND_PACKAGE_COUNT(pisi)
|
||||
FF_APPEND_PACKAGE_COUNT(pkg)
|
||||
FF_APPEND_PACKAGE_COUNT(pkgtool)
|
||||
FF_APPEND_PACKAGE_COUNT(pkgsrc)
|
||||
@@ -508,6 +514,7 @@ static FFModuleBaseInfo ffModuleInfo = {
|
||||
{"Number of pkgsrc packages", "pkgsrc"},
|
||||
{"Number of hpkg-system packages", "hpkg-system"},
|
||||
{"Number of hpkg-user packages", "hpkg-user"},
|
||||
{"Number of pisi packages", "pisi"},
|
||||
{"Total number of all nix packages", "nix-all"},
|
||||
{"Total number of all flatpak app packages", "flatpak-all"},
|
||||
{"Total number of all brew packages", "brew-all"},
|
||||
|
||||
@@ -317,6 +317,10 @@ bool ffOptionsParseDisplayCommandLine(FFOptionsDisplay* options, const char* key
|
||||
options->pipe = ffOptionParseBoolean(value);
|
||||
else if(ffStrEqualsIgnCase(key, "--show-errors"))
|
||||
options->showErrors = ffOptionParseBoolean(value);
|
||||
#ifndef NDEBUG
|
||||
else if(ffStrEqualsIgnCase(key, "--debug"))
|
||||
options->debugMode = ffOptionParseBoolean(value);
|
||||
#endif
|
||||
else if(ffStrEqualsIgnCase(key, "--disable-linewrap"))
|
||||
options->disableLinewrap = ffOptionParseBoolean(value);
|
||||
else if(ffStrEqualsIgnCase(key, "--hide-cursor"))
|
||||
@@ -505,6 +509,7 @@ void ffOptionsInitDisplay(FFOptionsDisplay* options)
|
||||
options->disableLinewrap = !options->pipe;
|
||||
#else
|
||||
options->disableLinewrap = false;
|
||||
options->debugMode = false;
|
||||
#endif
|
||||
|
||||
options->hideCursor = false;
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
typedef enum __attribute__((__packed__)) FFSizeBinaryPrefixType
|
||||
{
|
||||
FF_SIZE_BINARY_PREFIX_TYPE_IEC, // 1024 Bytes = 1 KiB, 1024 KiB = 1 MiB, ... (standard)
|
||||
FF_SIZE_BINARY_PREFIX_TYPE_SI, // 1000 Bytes = 1 KB, 1000 KB = 1 MB, ...
|
||||
FF_SIZE_BINARY_PREFIX_TYPE_JEDEC, // 1024 Bytes = 1 kB, 1024 kB = 1 MB, ...
|
||||
FF_SIZE_BINARY_PREFIX_TYPE_SI, // 1000 Bytes = 1 kB, 1000 kB = 1 MB, ...
|
||||
FF_SIZE_BINARY_PREFIX_TYPE_JEDEC, // 1024 Bytes = 1 KB, 1024 KB = 1 MB, ...
|
||||
} FFSizeBinaryPrefixType;
|
||||
|
||||
typedef enum __attribute__((__packed__)) FFTemperatureUnit
|
||||
@@ -32,6 +32,9 @@ typedef struct FFOptionsDisplay
|
||||
int32_t stat; // <0: disable stat; 0: no threshold; >0: threshold in ms
|
||||
bool pipe; //disables all escape sequences
|
||||
bool showErrors;
|
||||
#ifndef NDEBUG
|
||||
bool debugMode;
|
||||
#endif
|
||||
bool disableLinewrap;
|
||||
bool hideCursor;
|
||||
FFSizeBinaryPrefixType sizeBinaryPrefix;
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
#include "common/time.h"
|
||||
|
||||
static inline const char* ffFindFileName(const char* file)
|
||||
{
|
||||
const char* lastSlash = __builtin_strrchr(file, '/');
|
||||
#ifdef _WIN32
|
||||
if (lastSlash == NULL)
|
||||
lastSlash = __builtin_strrchr(file, '\\');
|
||||
#endif
|
||||
if (lastSlash != NULL)
|
||||
return lastSlash + 1;
|
||||
return file;
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define FF_DEBUG_PRINT(file_, line_, format_, ...) \
|
||||
do { \
|
||||
if (instance.config.display.debugMode) \
|
||||
fprintf(stderr, "[%s%4d, %s] " format_ "\n", ffFindFileName(file_), line_, ffTimeToTimeStr(ffTimeGetNow()), ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
#else
|
||||
#define FF_DEBUG_PRINT(file_, line_, format_, ...) \
|
||||
do { } while (0)
|
||||
#endif
|
||||
|
||||
#define FF_DEBUG(format, ...) FF_DEBUG_PRINT(__FILE__, __LINE__, format, ##__VA_ARGS__)
|
||||
|
||||
const char* ffDebugWin32Error(unsigned long errorCode);
|
||||
@@ -0,0 +1,28 @@
|
||||
#include "debug.h"
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
const char* ffDebugWin32Error(DWORD errorCode)
|
||||
{
|
||||
static char buffer[256];
|
||||
|
||||
DWORD len = FormatMessageA(
|
||||
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL,
|
||||
(DWORD) errorCode,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
buffer,
|
||||
sizeof(buffer),
|
||||
NULL);
|
||||
|
||||
if (len == 0) {
|
||||
snprintf(buffer, sizeof(buffer), "Unknown error code (%lu)", errorCode);
|
||||
} else {
|
||||
// Remove trailing newline
|
||||
if (buffer[len - 1] == '\n') buffer[len - 1] = '\0';
|
||||
if (buffer[len - 2] == '\r') buffer[len - 2] = '\0';
|
||||
snprintf(buffer + len - 2, sizeof(buffer) - len + 2, " (%lu)", errorCode);
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
@@ -31,6 +31,50 @@ bool ffKmodLoaded(const char* modName)
|
||||
{
|
||||
return modfind(modName) >= 0;
|
||||
}
|
||||
#elif __NetBSD__
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#include <sys/module.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
typedef struct __attribute__((__packed__)) FFNbsdModList
|
||||
{
|
||||
int len;
|
||||
modstat_t mods[];
|
||||
} FFNbsdModList;
|
||||
|
||||
bool ffKmodLoaded(const char* modName)
|
||||
{
|
||||
static FFNbsdModList* list = NULL;
|
||||
|
||||
if (list == NULL)
|
||||
{
|
||||
struct iovec iov = {};
|
||||
|
||||
// 初始尝试分配的内存大小
|
||||
for (size_t len = 8192;; len = iov.iov_len)
|
||||
{
|
||||
iov.iov_len = len;
|
||||
iov.iov_base = realloc(iov.iov_base, len);
|
||||
if (modctl(MODCTL_STAT, &iov) < 0)
|
||||
{
|
||||
free(iov.iov_base);
|
||||
return true; // ignore errors
|
||||
}
|
||||
|
||||
if (len >= iov.iov_len) break;
|
||||
}
|
||||
list = (FFNbsdModList*) iov.iov_base;
|
||||
}
|
||||
|
||||
for (int i = 0; i < list->len; i++)
|
||||
{
|
||||
if (ffStrEquals(list->mods[i].ms_name, modName))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
#elif __APPLE__
|
||||
#include "util/apple/cf_helpers.h"
|
||||
#include <IOKit/kext/KextManager.h>
|
||||
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# Convert logo.svg to logo.ico
|
||||
rsvg-convert -w 16 -h 16 logo.svg > logo16.png
|
||||
rsvg-convert -w 32 -h 32 logo.svg > logo32.png
|
||||
rsvg-convert -w 48 -h 48 logo.svg > logo48.png
|
||||
rsvg-convert -w 64 -h 64 logo.svg > logo64.png
|
||||
rsvg-convert -w 128 -h 128 logo.svg > logo128.png
|
||||
rsvg-convert -w 256 -h 256 logo.svg > logo256.png
|
||||
convert logo16.png logo32.png logo48.png logo64.png logo128.png logo256.png logo.ico
|
||||
rm logo16.png logo32.png logo48.png logo64.png logo128.png logo256.png
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 105 KiB |
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../logo/logo.svg
|
||||
+45
-14
@@ -1,28 +1,59 @@
|
||||
#include "util/windows/version.h"
|
||||
#include "util/mallocHelper.h"
|
||||
#include "util/windows/unicode.h"
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
bool ffGetFileVersion(const wchar_t* filePath, FFstrbuf* version)
|
||||
bool ffGetFileVersion(const wchar_t* filePath, const wchar_t* stringName, FFstrbuf* version)
|
||||
{
|
||||
DWORD handle;
|
||||
DWORD size = GetFileVersionInfoSizeW(filePath, &handle);
|
||||
if(size > 0)
|
||||
if (size > 0)
|
||||
{
|
||||
FF_AUTO_FREE void* versionData = malloc(size);
|
||||
if(GetFileVersionInfoW(filePath, handle, size, versionData))
|
||||
FF_AUTO_FREE void *versionData = malloc(size);
|
||||
if (GetFileVersionInfoW(filePath, handle, size, versionData))
|
||||
{
|
||||
VS_FIXEDFILEINFO* verInfo;
|
||||
UINT len;
|
||||
if(VerQueryValueW(versionData, L"\\", (void**)&verInfo, &len) && len && verInfo->dwSignature == 0xFEEF04BD)
|
||||
if (!stringName)
|
||||
{
|
||||
ffStrbufAppendF(version, "%u.%u.%u.%u",
|
||||
(unsigned)(( verInfo->dwProductVersionMS >> 16 ) & 0xffff),
|
||||
(unsigned)(( verInfo->dwProductVersionMS >> 0 ) & 0xffff),
|
||||
(unsigned)(( verInfo->dwProductVersionLS >> 16 ) & 0xffff),
|
||||
(unsigned)(( verInfo->dwProductVersionLS >> 0 ) & 0xffff)
|
||||
);
|
||||
return true;
|
||||
VS_FIXEDFILEINFO* verInfo;
|
||||
UINT len;
|
||||
if (VerQueryValueW(versionData, L"\\", (void **)&verInfo, &len) && len && verInfo->dwSignature == 0xFEEF04BD)
|
||||
{
|
||||
ffStrbufAppendF(version, "%u.%u.%u.%u",
|
||||
(unsigned)((verInfo->dwProductVersionMS >> 16) & 0xffff),
|
||||
(unsigned)((verInfo->dwProductVersionMS >> 0) & 0xffff),
|
||||
(unsigned)((verInfo->dwProductVersionLS >> 16) & 0xffff),
|
||||
(unsigned)((verInfo->dwProductVersionLS >> 0) & 0xffff));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
struct
|
||||
{
|
||||
WORD language;
|
||||
WORD codePage;
|
||||
}* translations;
|
||||
|
||||
UINT translationsLen;
|
||||
|
||||
if (VerQueryValueW(versionData, L"\\VarFileInfo\\Translation",
|
||||
(void **) &translations, &translationsLen) &&
|
||||
translationsLen >= sizeof(*translations))
|
||||
{
|
||||
wchar_t subBlock[128];
|
||||
snwprintf(subBlock, ARRAY_SIZE(subBlock), L"\\StringFileInfo\\%04x%04x\\%ls",
|
||||
translations[0].language, translations[0].codePage, stringName);
|
||||
|
||||
wchar_t* value;
|
||||
UINT valueLen;
|
||||
|
||||
if (VerQueryValueW(versionData, subBlock, (void **)&value, &valueLen) && valueLen > 0)
|
||||
{
|
||||
ffStrbufSetWS(version, value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
#include "fastfetch.h"
|
||||
|
||||
bool ffGetFileVersion(const wchar_t* filePath, FFstrbuf* version);
|
||||
|
||||
/**
|
||||
* @brief Retrieves a specific version string for a Windows file.
|
||||
*
|
||||
* This function gets a version string from a Windows file's version information.
|
||||
*
|
||||
* @param filePath The path to the file for which version information is requested.
|
||||
* @param stringName The name of the specific version string to retrieve (e.g., "FileVersion", "ProductVersion").
|
||||
* @param version Pointer to an FFstrbuf where the version string will be stored.
|
||||
*
|
||||
* @return true if the version string was successfully retrieved, false otherwise.
|
||||
*/
|
||||
bool ffGetFileVersion(const wchar_t* filePath, const wchar_t* stringName, FFstrbuf* version);
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#define FF_TO_STR(str) FF_TO_STR1(str)
|
||||
|
||||
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "manifest.xml"
|
||||
id ICON "logo.ico"
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION FASTFETCH_PROJECT_VERSION_MAJOR,FASTFETCH_PROJECT_VERSION_MINOR,FASTFETCH_PROJECT_VERSION_PATCH,FASTFETCH_PROJECT_VERSION_TWEAK_NUM
|
||||
|
||||
Reference in New Issue
Block a user