Compare commits

...

145 Commits

Author SHA1 Message Date
Carter Li ff0236639a Merge pull request #1574 from fastfetch-cli/dev
Release: v2.37.0
2025-02-19 15:39:29 +08:00
李通洲 959bf769fb Doc: fix typo in changelog [ci skip] 2025-02-19 15:35:52 +08:00
李通洲 3ae7c4f788 Release: v2.37.0 2025-02-19 15:21:01 +08:00
李通洲 143b3df771 OS (Haiku): calcuate OS version 2025-02-19 10:47:21 +08:00
李通洲 c0c59a890a Version: report more CPU arches 2025-02-19 10:01:29 +08:00
Carter Li 3c5f69b874 OS (Haiku): report pre version as - 2025-02-19 09:10:40 +08:00
Carter Li 36a452c852 CPU (NetBSD): support non-intel CPUs
Fix #1573
2025-02-19 08:59:10 +08:00
Carter Li c66b32fc6f CMake (Haiku): enable more optional dependencies 2025-02-18 20:48:17 +08:00
Carter Li bc129a65d9 OS (Haiku): detect OS beta version 2025-02-18 20:38:58 +08:00
Carter Li 1137e8d1c9 Processing (Haiku): fix exe detection 2025-02-18 19:49:40 +08:00
Carter Li 95a44d3a33 GPU (Haiku): silence warnings 2025-02-18 19:49:19 +08:00
李通洲 b8b2fab499 Haiku: fix building 2025-02-18 15:49:39 +08:00
李通洲 7aceb1072a Doc: update changelog [ci skip] 2025-02-18 14:13:13 +08:00
李通洲 13723893ba Packages (Haiku): rename package manager name to hpkg 2025-02-18 10:38:14 +08:00
李通洲 6fd4720faf PhysicalDisk (Haiku): fix drive size calcuation 2025-02-18 10:13:25 +08:00
李通洲 966b8452b7 Disk (Haiku): report all partitions 2025-02-18 09:35:56 +08:00
李通洲 8dc4f77f42 Shell (Haiku): fix arg0 detection 2025-02-18 09:17:55 +08:00
Carter Li ab0240e9b7 IO (Haiku): access /path/to/file/ doesn't work. Work around it 2025-02-18 06:58:09 +08:00
李通洲 399f262692 LocalIP: fix --localip-default-route-only false not working with --gen-config
Fix #1570
2025-02-17 21:29:27 +08:00
Carter Li d1385804bb Bios (Haiku): report BIOS type 2025-02-17 21:24:35 +08:00
Carter Li 948a965c7a Terminal (Haiku): detect terminal version 2025-02-17 21:22:12 +08:00
李通洲 a13935e232 PhysicalDisk (Haiku): fix SCSI drive detection 2025-02-17 21:21:28 +08:00
李通洲 46f920ae2a OpenGL (Haiku): report platform API 2025-02-16 23:29:05 +08:00
李通洲 e79b561f2a Smbios: add comments about UEFI systems [ci skip] 2025-02-16 23:25:16 +08:00
Carter Li 9018fda92e OpenGL (Haiku): add support 2025-02-16 22:53:20 +08:00
Carter Li 76b8b9a44b Chore: remove unused #includes 2025-02-16 22:53:20 +08:00
李通洲 36a129f668 GPU: add missing variable inits 2025-02-16 22:05:06 +08:00
Carter Li 24e94acbb9 Bluetooth (Haiku): suppress debug output of system API 2025-02-16 21:43:35 +08:00
Carter Li 716f0a3bbb PhysicalDisk (Haiku): report drive type 2025-02-16 21:43:35 +08:00
李通洲 f839fcfa29 Presets: print keyboard & mouse in all.jsonc 2025-02-16 21:27:53 +08:00
Carter Li 41d930b1e1 Bluetooth (Haiku): WIP 2025-02-16 20:37:21 +08:00
Carter Li 5e615d12d5 Gamepad (Haiku): enable 2025-02-16 20:18:04 +08:00
Carter Li 17711ee5c8 PhysicalDisk (Haiku): add support 2025-02-16 20:12:46 +08:00
李通洲 9ff3142b61 CPUUsage (Haiku): add support 2025-02-16 19:13:47 +08:00
Carter Li 8e5c2adda3 Gamepad (Haiku): add support 2025-02-16 11:05:58 +08:00
Carter Li 01d37653b0 Disk (Haiku): code cleanup; honor option->folders 2025-02-16 11:05:53 +08:00
Carter Li f5dbbb70ef Mouse / Keyboard (Haiku): code cleanup; ignore disabled devices 2025-02-16 10:22:26 +08:00
Carter Li fc3f47742a NetIO (Haiku): code cleanup 2025-02-16 10:14:14 +08:00
François Revol 1d2b6c0b1a NetIO (Haiku): add support 2025-02-16 10:04:36 +08:00
François Revol 5ebf984e9a Keyboard (Haiku): add support 2025-02-16 10:04:36 +08:00
François Revol bfa59d2c04 Mouse (Haiku): add support 2025-02-16 10:04:36 +08:00
François Revol c1c59cff6d Sound (Haiku): fix runtime error getting mute status
sizeof(bool) is only 1.
2025-02-15 22:38:05 +08:00
李通洲 519dae9462 Smbios: don't try to scan memory multiple times 2025-02-15 19:50:34 +08:00
李通洲 34419d9bcf Revert "Host (Haiku): add debug log"
This reverts commit f3e54f33c2.
2025-02-15 19:47:16 +08:00
Carter Li 532b3cd457 Smbios (NetBSD): add support 2025-02-15 14:45:09 +08:00
Carter Li 437006f5f1 Sound (Haiku): Init variables unconditionally; fix mute handling 2025-02-15 12:42:26 +08:00
François Revol 1c858ae835 InitSystem (Haiku): add support 2025-02-15 12:08:27 +08:00
François Revol 349fdd47e4 Sound (Haiku): add support 2025-02-15 12:08:27 +08:00
François Revol c64854804d Haiku: 32bit fixes
For historical reasons int32 and int32_t are not compatible types.
2025-02-15 12:08:27 +08:00
Carter Li f3e54f33c2 Host (Haiku): add debug log 2025-02-15 11:13:03 +08:00
Carter Li 5f3ff07b4b Terminal (Haiku): fix konsole version detection 2025-02-14 23:54:16 +08:00
李通洲 e8db71fe19 Chore (Haiku): silence compiler warnings 2025-02-14 22:42:15 +08:00
Carter Li 8984aa740e Smbios (Haiku): add support; enable related modules 2025-02-14 21:49:50 +00:00
李通洲 c081268b7c StringUtils: fix a possible segfault 2025-02-14 19:34:33 +08:00
李通洲 fae8d1dd10 PhysicalMemory: fix --format json printing 2025-02-14 19:34:33 +08:00
Carter Li 217ea61568 Sound: properly round percent values
Fix #1558
2025-02-14 14:06:08 +08:00
李通洲 ba7885913d Weather: honor display.temp.unit
Fix #1560
2025-02-14 10:31:13 +08:00
李通洲 a8afd05d19 Battery (Haiku): fix capacity calculation 2025-02-14 10:30:34 +08:00
李通洲 f4f1592bfa CI: enable -DENABLE_EMBEDDED_AMDGPUIDS=On 2025-02-14 01:09:28 +08:00
Carter Li cdc8124883 Battery (Haiku): add support (untested) 2025-02-14 00:23:20 +00:00
Carter Li c53191a441 Battery (Haiku): add stub file 2025-02-13 23:27:14 +00:00
Carter Li 14aadd5b61 Logo (Builtin): simplify haiku; add haiku2 from neofetch 2025-02-13 23:04:20 +00:00
Carter Li e38f094c16 Uptime (Haiku): silence compiler warnings 2025-02-13 22:56:25 +00:00
Carter Li 452d52c217 InitSystem (Haiku): enable support 2025-02-13 22:46:27 +00:00
Carter Li c585e09ef0 Processing (Haiku): support exe path detection 2025-02-13 22:39:45 +00:00
Carter Li 464e00d616 GPU (Haiku): use system API to fetch PCI devices 2025-02-13 22:22:29 +00:00
李通洲 b8e25bdc4e GPU: support embedding amdgpu.ids into fastfetch 2025-02-13 05:57:41 +00:00
Carter Li 379c39d8b5 GPU (Haiku): change the path of pci.ids to hwdata 2025-02-12 23:06:40 +00:00
Carter Li f2a41b82bc TerminalFont (Haiku): support Haiku Terminal 2025-02-12 22:48:24 +00:00
Carter Li d1a98fe69f Terminal (Haiku): add pretty name for Haiku Terminal 2025-02-12 22:47:37 +00:00
Carter Li ef3412f81b GPU (Haiku): add pci.ids file path 2025-02-12 22:22:35 +00:00
DrSheppard 1812c30fbf Doc: update README.md (#1557) [ci skip]
* [chore] Update README.md

move repology badge to install section
customize with `columns` and `minversion` tags

* tweaks

---------

Co-authored-by: Carter Li <CarterLi@users.noreply.github.com>
2025-02-12 16:42:21 +08:00
李通洲 3c45f2e590 Scripts: download pci.ids by cmake; remove python-requests dependency 2025-02-12 16:18:02 +08:00
Pro-pra 735a464f68 Logo (Builtin): update Rosa linux logo (#1559)
* Update rosa logo

* Update rosa colors

* replace invisible unicode charactors

---------

Co-authored-by: Carter Li <CarterLi@users.noreply.github.com>
2025-02-12 15:13:17 +08:00
Carter Li 3e3dfb4a02 OS: remove option --escape-bedrock 2025-02-12 08:53:27 +08:00
李通洲 f77a9c185d Media (Haiku): enable support 2025-02-12 00:45:14 +08:00
李通洲 d3a5f986a8 Terminal (Haiku): add basic support 2025-02-12 00:44:41 +08:00
李通洲 ef60910e51 Display (Haiku): code cleanup; detect manufacture date 2025-02-12 00:44:07 +08:00
李通洲 565934ba2e OS (Haiku): silence warnings 2025-02-12 00:43:33 +08:00
Carter Li 5c5e12f0a7 Media (Haiku): enable support 2025-02-12 00:42:55 +08:00
李通洲 b3e7451a08 Sound (Haiku): add stub file 2025-02-12 00:42:55 +08:00
李通洲 da76dcb2fe Disk (Haiku): add support 2025-02-12 00:42:55 +08:00
李通洲 cbc8b1f11d CPU (Haiku): add support 2025-02-12 00:42:55 +08:00
李通洲 5ca4268be2 CMake (Haiku): add more optional dependencies 2025-02-12 00:42:54 +08:00
李通洲 ff8bfadd25 Display (Haiku): trim monitor name 2025-02-11 16:24:42 +08:00
李通洲 1fc0f75776 GPU (Haiku): add support 2025-02-11 16:23:05 +08:00
Shu Niu bf707c2e94 GPU (macOS): fix build error in MacOS 10.13 (#1556)
* Fix build error in MacOS 10.13

* Update gpu_apple.m

---------

Co-authored-by: Carter Li <CarterLi@users.noreply.github.com>
2025-02-11 14:15:32 +08:00
Carter Li 08cd4ac1ee Packaging: update debian stuff [ci skip] 2025-02-11 13:41:50 +08:00
Carter Li 48fc598ccb Merge pull request #1555 from fastfetch-cli/dev
Release: v2.36.1
2025-02-11 10:40:51 +08:00
李通洲 3a8138e3da Release: v2.36.1 2025-02-11 10:20:16 +08:00
李通洲 4251456619 CI: fix typo 2025-02-11 10:19:38 +08:00
李通洲 5bc6d16138 CMake (Haiku): set _GNU_SOURCE 2025-02-11 09:15:30 +08:00
Jami Kettunen 11374e73ae Logo (Builtin): fix Chimera Linux distro name to match ID (#1554)
* Logo (Builtin): fix Chimera Linux distro name to match ID

* Update builtin.c

---------

Co-authored-by: Carter Li <CarterLi@users.noreply.github.com>
2025-02-11 08:45:28 +08:00
Sultaniiazov David 373cb4106a Logo (Builtin): correct shape of ALT Linux (#1553) 2025-02-10 22:32:53 +08:00
李通洲 a0949c5675 CI: build with chafa & ddcutil (aarch64) 2025-02-10 15:40:13 +08:00
李通洲 97b1eb155f CI: update artifact names of armv6l and armv7l 2025-02-10 15:15:10 +08:00
李通洲 093cc6fba2 Doc: update readme 2025-02-10 14:35:38 +08:00
李通洲 c8a3ae9186 CI (Linux): use native aarch64 runner
It now uses Ubuntu 22.04
2025-02-10 13:29:13 +08:00
李通洲 778013aec9 CI (NetBSD): update OS version to 10.1 2025-02-10 10:49:17 +08:00
Carter Li e6af1bfb91 Packaging: update debian stuff [ci skip] 2025-02-10 10:15:11 +08:00
Carter Li 9d8a83349c Merge pull request #1551 from fastfetch-cli/dev
Release: v2.36.0
2025-02-10 10:07:31 +08:00
Carter Li 3bc6be9139 CI: add linux-s390x 2025-02-10 09:32:31 +08:00
Carter Li 1eef6f837b CPU: remove useless w/ Radeon 780M Graphics 2025-02-10 09:26:08 +08:00
Carter Li 85ed4b136f Terminal (Linux): improve performance of Tilix version detection
Fix #1550
2025-02-10 09:15:55 +08:00
李通洲 339e08fef1 Release: v2.36.0 2025-02-09 19:17:44 +08:00
李通洲 5957831f3f OpenGL (Haiku): enable support 2025-02-09 19:17:02 +08:00
Carter Li 016b1e6961 Format: support syntax of {$ENV_VAR} in custom format
Fix #1541
2025-02-08 22:54:25 +08:00
李通洲 486ade0e71 Logo (Builtin): KDE -> KDE Neon 2025-02-08 16:43:56 +08:00
Carter Li e021cfe77a Doc: update changelog [ci skip] 2025-02-08 15:12:38 +08:00
JohnTheCoolingFan a016397961 OS (Linux): combine all armbian variants (#1547) 2025-02-08 14:54:04 +08:00
Carter Li 99e8d1f2bb CPU (Linux): loosely detect cpu name of unknown platform 2025-02-08 10:38:13 +08:00
Carter Li 263d2902dd CPU (Linux): add cpu name detection for s390x 2025-02-08 10:31:06 +08:00
Ng Zhun Onn 292fa0686f Display: capitalize {type}'s output (#1543)
* Display: capitalize {type}'s output

* Update display.c

* Update json_schema.json

---------

Co-authored-by: Carter Li <CarterLi@users.noreply.github.com>
2025-02-07 21:48:31 +08:00
Carter Li f2755a844b Logo (Builtin): split ID_LIKE before using
Fix #1540
2025-02-07 10:57:30 +08:00
Carter Li 1d21d02878 CPU (Linux): support physical core count and package count detection on loongarch 2025-02-07 10:07:00 +08:00
李通洲 b3062499f4 Logo (Builtin): update some distro names 2025-02-06 10:50:30 +08:00
李通洲 49bb957c86 Logo (Builtin): simplify RebornOS 2025-02-06 09:02:07 +08:00
李通洲 8f27e43929 Logo (Builtin): fix color of Haiku in light mode 2025-02-06 08:43:38 +08:00
李通洲 8774fb3fb7 Shell (OpenBSD): trim - for login shells 2025-02-05 16:10:42 +08:00
李通洲 356501270a CPU (Linux): detect for model name on unknown platform 2025-02-05 16:10:01 +08:00
李通洲 5a04a2ecc3 Doc: update license 2025-02-05 15:45:34 +08:00
李通洲 edcd7995e5 CMake (Haiku): fix build
Ref: https://github.com/fastfetch-cli/fastfetch/pull/1538#issuecomment-2635866129
2025-02-05 15:44:03 +08:00
李通洲 7f212025de Processing (Unix): better pipe2(2) existance check 2025-02-05 15:36:09 +08:00
李通洲 63cc8e5523 Camera (macOS): make fastfetch compiled on newer macOS versions runs on older ones 2025-02-05 14:42:41 +08:00
李通洲 c3023259e2 GPU (macOS): use recommendedMaxWorkingSetSize as total GPU mem size
Worth noting that the value is static. It won't change even if the free global memory is smaller than the value.
2025-02-05 14:06:06 +08:00
李通洲 994a8b4dd0 GPU (Nvidia): fall back to nvmlDeviceGetMemoryInfo if nvmlDeviceGetMemoryInfo_v2 isn't supported 2025-02-05 13:50:36 +08:00
李通洲 76710c8159 Temps (macOS): support M4x 2025-02-05 11:01:09 +08:00
Carter Li 70820e424b Packaging: update debian stuff [ci skip] 2025-02-05 10:27:26 +08:00
李通洲 9221e2b41d Logo (Builtin): remove left padding of filotimo 2025-02-05 10:23:59 +08:00
Thomas Duckworth 71a2e55869 Logo (Builtin): add filotimo logo (#1535) 2025-02-05 10:23:00 +08:00
komaru dc5ff01e74 Logo (Builtin): add Nexa Linux logo (#1539)
* Logo (Builtin): add Nexa Linux logo

* Update nexalinux.txt

Remove padding

---------

Co-authored-by: Carter Li <CarterLi@users.noreply.github.com>
2025-02-05 10:19:25 +08:00
李通洲 fc8ddce182 Chore: use ffStrEquals instead of strcmp 2025-02-05 10:17:32 +08:00
李通洲 dd67010e5c CMake (Haiku): fix an invalid file name 2025-02-05 10:15:09 +08:00
李通洲 d1ba690973 Chore: fix typo 2025-02-05 10:14:37 +08:00
François Revol 01f400c15f Haiku: minimal implementation (#1538) 2025-02-05 09:08:28 +08:00
sirenuf 33c905aa99 Logo (Builtin): change arch_old logo colours to be more accurate to the actual original logo. 2025-01-31 23:03:07 +08:00
Carter Li fe7c4f724e Disk (BSD): silence compiler warnings 2025-01-27 23:52:59 +08:00
Carter Li abadcb95bd CMake (OpenBSD): remove pulseaudio detection 2025-01-27 23:52:25 +08:00
Carter Li 3d8050fd5c Sound (NetBSD): use kernel APIs instead of the OSS wrapper 2025-01-27 23:49:42 +08:00
李通洲 4d842ac6b6 CPU (Linux): fix build on PPC 2025-01-27 21:53:39 +08:00
carterli b76e62685e Sound (OpenBSD): Use sndio instead of pulseaudio 2025-01-27 21:16:42 +08:00
李通洲 1279bbcf28 CPU (Linux): rework cpuinfo parsing 2025-01-27 13:20:51 +08:00
Carter Li 4e9fecc767 Sound (NetBSD): don't assume readlink reports file name only 2025-01-26 23:18:11 +08:00
李通洲 1c4953a467 Sound (NetBSD): use OSS instead of pulseaudio
Fix #1527
2025-01-26 21:09:45 +08:00
Carter Li 3ad5d5c8b0 Sound (FreeBSD): report OSS ABI version 2025-01-26 14:10:24 +08:00
109 changed files with 2401 additions and 360 deletions
+117 -54
View File
@@ -56,7 +56,7 @@ jobs:
run: ldd fastfetch
- name: run tests
run: ctest
run: ctest --output-on-failure
linux-amd64:
name: Linux-amd64
@@ -73,8 +73,14 @@ jobs:
- name: uname -a
run: uname -a
- name: cat /etc/os-release
run: cat /etc/os-release
- name: cat /proc/cpuinfo
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 python3-requests
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
- name: install linuxbrew packages
run: |
@@ -87,7 +93,7 @@ jobs:
languages: c
- name: configure project
run: PKG_CONFIG_PATH=/home/linuxbrew/.linuxbrew/lib/pkgconfig:$PKG_CONFIG_PATH cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On -DCMAKE_INSTALL_PREFIX=/usr .
run: PKG_CONFIG_PATH=/home/linuxbrew/.linuxbrew/lib/pkgconfig:$PKG_CONFIG_PATH cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On -DENABLE_EMBEDDED_AMDGPUIDS=On -DCMAKE_INSTALL_PREFIX=/usr .
- name: build project
run: cmake --build . --target package --verbose -j4
@@ -111,7 +117,7 @@ jobs:
run: ldd fastfetch
- name: run tests
run: ctest
run: ctest --output-on-failure
- name: get fastfetch version
id: ffversion
@@ -125,7 +131,7 @@ jobs:
linux-aarch64:
name: Linux-aarch64
runs-on: ubuntu-22.04
runs-on: ubuntu-22.04-arm
permissions:
security-events: write
contents: read
@@ -133,24 +139,45 @@ jobs:
- name: checkout repository
uses: actions/checkout@v4
- name: run VM
uses: uraimo/run-on-arch-action@v2
id: runcmd
with:
arch: aarch64
distro: ubuntu20.04
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 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
time ./fastfetch -c presets/ci.jsonc --stat false
time ./fastfetch -c presets/ci.jsonc --format json
time ./flashfetch
ldd fastfetch
ctest
- name: uname -a
run: uname -a
- name: cat /etc/os-release
run: cat /etc/os-release
- name: cat /proc/cpuinfo
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
- name: configure project
run: cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On -DENABLE_EMBEDDED_AMDGPUIDS=On -DCMAKE_INSTALL_PREFIX=/usr .
- name: build project
run: cmake --build . --target package --verbose -j4
- name: list features
run: ./fastfetch --list-features
- name: run fastfetch
run: time ./fastfetch -c presets/ci.jsonc --stat false
- name: run fastfetch --format json
run: time ./fastfetch -c presets/ci.jsonc --format json
- name: run flashfetch
run: time ./flashfetch
- name: print dependencies
run: ldd fastfetch
- name: run tests
run: ctest --output-on-failure
- name: get fastfetch version
id: ffversion
run: echo "ffversion=$(./fastfetch --version-raw)" >> $GITHUB_OUTPUT
- name: upload artifacts
uses: actions/upload-artifact@v4
@@ -158,8 +185,8 @@ jobs:
name: fastfetch-linux-aarch64
path: ./fastfetch-*.*
linux-armv7:
name: Linux-armv7
linux-armv7l:
name: Linux-armv7l
runs-on: ubuntu-22.04
permissions:
security-events: write
@@ -189,16 +216,16 @@ jobs:
time ./fastfetch -c presets/ci.jsonc --format json
time ./flashfetch
ldd fastfetch
ctest
ctest --output-on-failure
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: fastfetch-linux-armv7
name: fastfetch-linux-armv7l
path: ./fastfetch-*.*
linux-armv6:
name: Linux-armv6
linux-armv6l:
name: Linux-armv6l
runs-on: ubuntu-22.04
permissions:
security-events: write
@@ -225,12 +252,12 @@ jobs:
time ./fastfetch -c presets/ci.jsonc --format json
time ./flashfetch
ldd fastfetch
ctest
ctest --output-on-failure
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: fastfetch-linux-armv6
name: fastfetch-linux-armv6l
path: ./fastfetch-*.*
linux-riscv64:
@@ -260,7 +287,7 @@ jobs:
time ./fastfetch -c presets/ci.jsonc --format json
time ./flashfetch
ldd fastfetch
ctest
ctest --output-on-failure
- name: upload artifacts
uses: actions/upload-artifact@v4
@@ -295,7 +322,7 @@ jobs:
time ./fastfetch -c presets/ci.jsonc --format json
time ./flashfetch
ldd fastfetch
ctest
ctest --output-on-failure
- name: upload artifacts
uses: actions/upload-artifact@v4
@@ -303,6 +330,41 @@ jobs:
name: fastfetch-linux-ppc64le
path: ./fastfetch-*.*
linux-s390x:
name: Linux-s390x
runs-on: ubuntu-22.04
permissions:
security-events: write
contents: read
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: run VM
uses: uraimo/run-on-arch-action@v2
id: runcmd
with:
arch: s390x
distro: ubuntu20.04
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
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_INSTALL_PREFIX=/usr .
cmake --build . --target package --verbose -j4
./fastfetch --list-features
time ./fastfetch -c presets/ci.jsonc --stat false
time ./fastfetch -c presets/ci.jsonc --format json
time ./flashfetch
ldd fastfetch
ctest --output-on-failure
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: fastfetch-linux-s390x
path: ./fastfetch-*.*
musl-amd64:
name: Musl-amd64
runs-on: ubuntu-latest
@@ -318,12 +380,12 @@ jobs:
run: |
cat /etc/alpine-release
uname -a
apk add cmake samurai vulkan-loader-dev libxcb-dev wayland-dev libdrm-dev dconf-dev imagemagick-dev chafa-dev zlib-dev dbus-dev mesa-dev opencl-dev xfconf-dev sqlite-dev networkmanager-dev pulseaudio-dev ddcutil-dev elfutils-dev py3-requests gcc g++
apk add cmake samurai vulkan-loader-dev libxcb-dev wayland-dev libdrm-dev dconf-dev imagemagick-dev chafa-dev zlib-dev dbus-dev mesa-dev opencl-dev xfconf-dev sqlite-dev networkmanager-dev pulseaudio-dev ddcutil-dev elfutils-dev gcc g++
shell: alpine.sh --root {0}
- name: build
run: |
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_INSTALL_PREFIX=/usr -DIS_MUSL=ON -DENABLE_EMBEDDED_PCIIDS=On -GNinja .
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_INSTALL_PREFIX=/usr -DIS_MUSL=ON -DENABLE_EMBEDDED_PCIIDS=On -DENABLE_EMBEDDED_AMDGPUIDS=On -GNinja .
cmake --build . --target package --verbose -j4
shell: alpine.sh {0}
@@ -334,7 +396,7 @@ jobs:
time ./fastfetch -c presets/ci.jsonc --format json
time ./flashfetch
ldd fastfetch
ctest
ctest --output-on-failure
shell: alpine.sh {0}
- name: upload artifacts
@@ -390,7 +452,7 @@ jobs:
run: otool -L fastfetch
- name: run tests
run: ctest
run: ctest --output-on-failure
- name: upload artifacts
uses: actions/upload-artifact@v4
@@ -422,7 +484,7 @@ jobs:
time ./fastfetch -c presets/ci.jsonc --format json
time ./flashfetch
ldd fastfetch
ctest
ctest --output-on-failure
cpack
- name: upload artifacts
@@ -452,15 +514,15 @@ 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 py311-requests chafa
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On .
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
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On -DENABLE_EMBEDDED_AMDGPUIDS=On .
cmake --build . --target package --verbose -j4
./fastfetch --list-features
time ./fastfetch -c presets/ci.jsonc --stat false
time ./fastfetch -c presets/ci.jsonc --format json
time ./flashfetch
ldd fastfetch
ctest
ctest --output-on-failure
- name: upload artifacts
uses: actions/upload-artifact@v4
@@ -485,17 +547,17 @@ 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 py39-requests 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 libosmesa opencl ocl-icd v4l_compat chafa libelf
run: |
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On .
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On -DENABLE_EMBEDDED_AMDGPUIDS=On .
cmake --build . --target package --verbose -j4
./fastfetch --list-features
time ./fastfetch -c presets/ci.jsonc --stat false
time ./fastfetch -c presets/ci.jsonc --format json
time ./flashfetch
ldd fastfetch
ctest
ctest --output-on-failure
- name: upload artifacts
uses: actions/upload-artifact@v4
@@ -523,15 +585,15 @@ 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 py3-requests
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=ON .
sudo pkg_add -r cmake git pkgconf wayland vulkan-headers vulkan-loader glib2 dconf dbus sqlite3 xfconf imagemagick chafa pulseaudio hwdata
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On -DENABLE_EMBEDDED_AMDGPUIDS=On .
cmake --build . --target package --verbose -j4
./fastfetch --list-features
time ./fastfetch -c presets/ci.jsonc --stat false
time ./fastfetch -c presets/ci.jsonc --format json
time ./flashfetch
ldd fastfetch
ctest
ctest --output-on-failure
- name: upload artifacts
uses: actions/upload-artifact@v4
@@ -556,18 +618,18 @@ jobs:
architecture: x86-64
cpu_count: 4
shell: bash
version: '10.0'
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 py312-requests
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=ON .
sudo pkgin -y install cmake git pkgconf wayland vulkan-headers dconf dbus sqlite3 ImageMagick pulseaudio 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
time ./fastfetch -c presets/ci.jsonc --stat false
time ./fastfetch -c presets/ci.jsonc --format json
time ./flashfetch
ldd fastfetch
ctest
ctest --output-on-failure
- name: upload artifacts
uses: actions/upload-artifact@v4
@@ -626,7 +688,7 @@ jobs:
run: ldd fastfetch
- name: run tests
run: ctest
run: ctest --output-on-failure
- name: create zip archive
run: 7z a -tzip -mx9 -bd -y fastfetch-windows-amd64.zip LICENSE *.dll fastfetch.exe flashfetch.exe presets
@@ -647,10 +709,11 @@ jobs:
needs:
- linux-amd64
- linux-aarch64
- linux-armv7
- linux-armv6
- linux-armv7l
- linux-armv6l
- linux-riscv64
- linux-ppc64le
- linux-s390x
- musl-amd64
- macos-universal
- freebsd-amd64
+71
View File
@@ -1,3 +1,74 @@
# 2.37.0
Changes:
* Option `--escape-bedrock` is removed. The function is always enabled now.
Features:
* Support for Haiku is greatly improved (Haiku)
* CPU, GPU, Disk, Sound, Terminal, Terminal Font, Init System, Battery, Mouse, Keyboard, NetIO, CPU Usage, Physical Disk and OpenGL should work on Haiku now
* SMBIOS related modules (Host, Bios, Board, Chassis, Physical Memory) should work in platforms with legacy BIOS system.
* Support for Gamepad and Bluetooth are WIP.
* Some bugs are found and fixed.
* Remove `python-requests` dependency in `scripts/gen-*.py`.
* Add cmake option `-DENABLE_EMBEDDED_AMDGPUIDS=BOOL` (disabled by default)
* If enabled, fastfetch will embed the newest [`amdgpu.ids`](https://gitlab.freedesktop.org/mesa/drm/-/blob/main/data/amdgpu.ids?ref_type=heads) file into fastfetch binary.
* Weather module now honors `display.temp.unit` option (#1560, Weather)
* Support Physical Memory module in NetBSD (PhysicalMemory, NetBSD)
* Requires root permission
* Improve non-intel CPU detection in NetBSD (#1573, CPU, NetBSD)
Bugfixes:
* Fix building in macOS 10.13 (GPU, macOS)
* Properly round percent values when detecting volume (#1558, Sound)
* Fix Physical Memory module doesn't work in `--format json` mode
* Add some missing variable inits (GPU, Linux)
* Fix `--localip-default-route-only false` not working with `--gen-config` (#1570, LocalIP)
Logo:
* Update Rosa linux
* Add Haiku2
# 2.36.1
Changes:
* To use [the native arm64 runner of Github Action](https://github.blog/changelog/2025-01-16-linux-arm64-hosted-runners-now-available-for-free-in-public-repositories-public-preview/), Linux aarch64 binary is built with Ubuntu 22.04 (Glibc 2.35, Debian 12).
Bugfixes:
* Chimera Linux logo is now displayed correctly (#1554, Logo)
* Regression of 2.36.0
* Fix building on Haiku
Logo:
* Fix ALT Linux
# 2.36.0
Bugfixes:
* Trim leading slash for login shells (Shell, OpenBSD)
* Prefer SOC name if available over CPU name (CPU, Linux)
Features:
* Use kernel API to detect sound devices (Sound, NetBSD)
* Use sndio for sound server detection on OpenBSD (Sound, OpenBSD)
* Add minimal implementation for Haiku (#1538, Haiku)
* Support CPU & GPU temperature detection for M4x (CPU / GPU, macOS)
* Support VMEM size detection for old Nvidia cards (GPU, Linux)
* Use [recommendedMaxWorkingSetSize](https://developer.apple.com/documentation/metal/mtldevice/recommendedmaxworkingsetsize) as total GPU mem size (GPU, macOS)
* Support Physical core count and CPU package count detection for loongarch (CPU, Linux)
* Split ID_LIKE when used for distro matching (#1540, Logo)
* Capitalize `{type}`'s first letter in custom format (#1543, Display)
* Support model name detection for s390x (CPU, Linux)
* Support more Armbian variants detection (#1547, OS, Linux)
* Support the syntax of `{$ENV_VAR}` in custom format, which will be replaced by the value of the environment variable `ENV_VAR` (#1541)
* This is another way to pass 3rd-party data to fastfetch besides `Custom` module.
* Improve performance of Tilix version detection (Terminal, Linux)
Logo:
* Update arch_old
* Add Nexa Linux
* Add filotimo
* Update some distro names
# 2.35.0
Bugfixes:
+137 -15
View File
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url
project(fastfetch
VERSION 2.35.0
VERSION 2.37.0
LANGUAGES C
DESCRIPTION "Fast neofetch-like system information tool"
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
@@ -30,6 +30,8 @@ elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "DragonFly")
set(DragonFly TRUE CACHE BOOL "..." FORCE)
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS")
set(SunOS TRUE CACHE BOOL "..." FORCE)
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Haiku")
set(Haiku TRUE CACHE BOOL "..." FORCE)
elseif(NOT APPLE AND NOT WIN32)
message(FATAL_ERROR "Unsupported platform: ${CMAKE_SYSTEM_NAME}")
endif()
@@ -54,7 +56,7 @@ include(CheckIncludeFile)
include(CMakeDependentOption)
cmake_dependent_option(ENABLE_VULKAN "Enable vulkan" ON "LINUX OR APPLE OR FreeBSD OR OpenBSD OR NetBSD OR WIN32 OR ANDROID OR SunOS" OFF)
cmake_dependent_option(ENABLE_VULKAN "Enable vulkan" ON "LINUX OR APPLE OR FreeBSD OR OpenBSD OR NetBSD OR WIN32 OR ANDROID OR SunOS OR Haiku" OFF)
cmake_dependent_option(ENABLE_WAYLAND "Enable wayland-client" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD" OFF)
cmake_dependent_option(ENABLE_XCB_RANDR "Enable xcb-randr" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS" OFF)
cmake_dependent_option(ENABLE_XRANDR "Enable xrandr" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS" OFF)
@@ -62,23 +64,23 @@ cmake_dependent_option(ENABLE_DRM "Enable libdrm" ON "LINUX OR FreeBSD OR OpenBS
cmake_dependent_option(ENABLE_DRM_AMDGPU "Enable libdrm_amdgpu" ON "LINUX" OFF)
cmake_dependent_option(ENABLE_GIO "Enable gio-2.0" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS" OFF)
cmake_dependent_option(ENABLE_DCONF "Enable dconf" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS" OFF)
cmake_dependent_option(ENABLE_DBUS "Enable dbus-1" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS" OFF)
cmake_dependent_option(ENABLE_DBUS "Enable dbus-1" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS OR Haiku" OFF)
cmake_dependent_option(ENABLE_XFCONF "Enable libxfconf-0" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS" OFF)
cmake_dependent_option(ENABLE_SQLITE3 "Enable sqlite3" ON "LINUX OR FreeBSD OR APPLE OR OpenBSD OR NetBSD OR SunOS" OFF)
cmake_dependent_option(ENABLE_RPM "Enable rpm" ON "LINUX" OFF)
cmake_dependent_option(ENABLE_IMAGEMAGICK7 "Enable imagemagick 7" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR APPLE OR WIN32 OR SunOS" OFF)
cmake_dependent_option(ENABLE_IMAGEMAGICK7 "Enable imagemagick 7" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR APPLE OR WIN32 OR SunOS OR Haiku" OFF)
cmake_dependent_option(ENABLE_IMAGEMAGICK6 "Enable imagemagick 6" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR APPLE OR SunOS" OFF)
cmake_dependent_option(ENABLE_CHAFA "Enable chafa" ON "ENABLE_IMAGEMAGICK6 OR ENABLE_IMAGEMAGICK7" OFF)
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" 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" OFF)
cmake_dependent_option(ENABLE_OPENCL "Enable opencl" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR WIN32 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 OpenBSD OR NetBSD OR SunOS" OFF)
cmake_dependent_option(ENABLE_PULSE "Enable pulse" ON "LINUX OR SunOS" OFF)
cmake_dependent_option(ENABLE_DDCUTIL "Enable ddcutil" ON "LINUX" OFF)
cmake_dependent_option(ENABLE_DIRECTX_HEADERS "Enable DirectX headers for WSL" ON "LINUX" OFF)
cmake_dependent_option(ENABLE_ELF "Enable libelf" ON "LINUX OR ANDROID OR DragonFly" OFF)
cmake_dependent_option(ENABLE_ELF "Enable libelf" ON "LINUX OR ANDROID OR DragonFly OR Haiku" OFF)
cmake_dependent_option(ENABLE_THREADS "Enable multithreading" ON "Threads_FOUND" OFF)
cmake_dependent_option(ENABLE_LIBZFS "Enable libzfs" ON "LINUX OR FreeBSD OR SunOS" OFF)
cmake_dependent_option(ENABLE_PCIACCESS "Enable libpciaccess" ON "NetBSD OR OpenBSD OR SunOS" OFF)
@@ -92,6 +94,7 @@ option(SET_TWEAK "Add tweak to project version" ON) # This is set to off by gith
option(IS_MUSL "Build with musl libc" OFF) # Used by Github Actions
option(INSTALL_LICENSE "Install license into /usr/share/licenses" ON)
option(ENABLE_EMBEDDED_PCIIDS "Embed pci.ids into fastfetch, requires `python`" OFF)
option(ENABLE_EMBEDDED_AMDGPUIDS "Embed amdgpu.ids into fastfetch, requires `python`" OFF)
set(BINARY_LINK_TYPE_OPTIONS dlopen dynamic static)
set(BINARY_LINK_TYPE dlopen CACHE STRING "How to link fastfetch")
@@ -139,7 +142,7 @@ set(WARNING_FLAGS "-Wall -Wextra -Wconversion -Werror=uninitialized -Werror=retu
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS} -Werror=incompatible-pointer-types -Werror=implicit-function-declaration -Werror=int-conversion")
if(WIN32 OR ENABLE_DIRECTX_HEADERS)
if(WIN32 OR Haiku OR ENABLE_DIRECTX_HEADERS)
enable_language(CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS}")
@@ -269,11 +272,16 @@ endif()
if(ENABLE_EMBEDDED_PCIIDS AND NOT EXISTS "${PROJECT_BINARY_DIR}/fastfetch_pciids.c.inc")
if(Python_FOUND)
if(NOT EXISTS "${PROJECT_BINARY_DIR}/pci.ids")
message(STATUS "'${PROJECT_BINARY_DIR}/pci.ids' is missing, downloading...")
file(DOWNLOAD "https://pci-ids.ucw.cz/v2.2/pci.ids" "${PROJECT_BINARY_DIR}/pci.ids")
endif()
message(STATUS "Generating 'fastfetch_pciids.c.inc'")
execute_process(COMMAND ${Python_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/scripts/gen-pciids.py"
execute_process(COMMAND ${Python_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/scripts/gen-pciids.py" "${PROJECT_BINARY_DIR}/pci.ids"
OUTPUT_FILE "${PROJECT_BINARY_DIR}/fastfetch_pciids.c.inc"
RESULT_VARIABLE PYTHON_PCIIDS_RETCODE)
if(NOT PYTHON_PCIIDS_RETCODE EQUAL 0)
file(REMOVE "${PROJECT_BINARY_DIR}/fastfetch_pciids.c.inc")
message(FATAL_ERROR "Failed to generate 'fastfetch_pciids.c.inc'")
endif()
else()
@@ -282,6 +290,26 @@ if(ENABLE_EMBEDDED_PCIIDS AND NOT EXISTS "${PROJECT_BINARY_DIR}/fastfetch_pciids
endif()
endif()
if(ENABLE_EMBEDDED_AMDGPUIDS AND NOT EXISTS "${PROJECT_BINARY_DIR}/fastfetch_amdgpuids.c.inc")
if(Python_FOUND)
if(NOT EXISTS "${PROJECT_BINARY_DIR}/amdgpu.ids")
message(STATUS "'${PROJECT_BINARY_DIR}/amdgpu.ids' is missing, downloading...")
file(DOWNLOAD "https://gitlab.freedesktop.org/mesa/drm/-/raw/main/data/amdgpu.ids" "${PROJECT_BINARY_DIR}/amdgpu.ids")
endif()
message(STATUS "Generating 'fastfetch_amdgpuids.c.inc'")
execute_process(COMMAND ${Python_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/scripts/gen-amdgpuids.py" "${PROJECT_BINARY_DIR}/amdgpu.ids"
OUTPUT_FILE "${PROJECT_BINARY_DIR}/fastfetch_amdgpuids.c.inc"
RESULT_VARIABLE PYTHON_AMDGPUIDS_RETCODE)
if(NOT PYTHON_AMDGPUIDS_RETCODE EQUAL 0)
file(REMOVE "${PROJECT_BINARY_DIR}/fastfetch_amdgpuids.c.inc")
message(FATAL_ERROR "Failed to generate 'fastfetch_amdgpuids.c.inc'")
endif()
else()
message(WARNING "Python3 is not found, 'fastfetch_amdgpuids.c.inc' will not be generated")
set(ENABLE_EMBEDDED_AMDGPUIDS OFF)
endif()
endif()
if(Python_FOUND)
message(STATUS "Generating 'fastfetch.1'")
execute_process(COMMAND ${Python_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/scripts/gen-man.py"
@@ -716,13 +744,13 @@ elseif(NetBSD)
src/detection/btrfs/btrfs_nosupport.c
src/detection/chassis/chassis_nbsd.c
src/detection/cpu/cpu_nbsd.c
src/detection/cpucache/cpucache_nosupport.c
src/detection/cpucache/cpucache_shared.c
src/detection/cpuusage/cpuusage_bsd.c
src/detection/cursor/cursor_linux.c
src/detection/disk/disk_bsd.c
src/detection/dns/dns_linux.c
src/detection/physicaldisk/physicaldisk_nosupport.c
src/detection/physicalmemory/physicalmemory_nosupport.c
src/detection/physicalmemory/physicalmemory_linux.c
src/detection/diskio/diskio_nbsd.c
src/detection/displayserver/linux/displayserver_linux.c
src/detection/displayserver/linux/drm.c
@@ -761,7 +789,7 @@ elseif(NetBSD)
src/detection/poweradapter/poweradapter_nosupport.c
src/detection/processes/processes_nbsd.c
src/detection/gtk_qt/qt.c
src/detection/sound/sound_linux.c
src/detection/sound/sound_nbsd.c
src/detection/swap/swap_obsd.c
src/detection/terminalfont/terminalfont_linux.c
src/detection/terminalshell/terminalshell_linux.c
@@ -843,7 +871,7 @@ elseif(OpenBSD)
src/detection/poweradapter/poweradapter_nosupport.c
src/detection/processes/processes_obsd.c
src/detection/gtk_qt/qt.c
src/detection/sound/sound_linux.c
src/detection/sound/sound_obsd.c
src/detection/swap/swap_obsd.c
src/detection/terminalfont/terminalfont_linux.c
src/detection/terminalshell/terminalshell_linux.c
@@ -1088,6 +1116,76 @@ elseif(SunOS)
src/util/platform/FFPlatform_unix.c
src/util/binary_linux.c
)
elseif(Haiku)
list(APPEND LIBFASTFETCH_SRC
src/common/dbus.c
src/common/io/io_unix.c
src/common/netif/netif_haiku.c
src/common/networking_linux.c
src/common/processing_linux.c
src/detection/battery/battery_haiku.c
src/detection/bios/bios_windows.c
src/detection/board/board_windows.c
src/detection/bootmgr/bootmgr_nosupport.c
src/detection/brightness/brightness_nosupport.c
src/detection/btrfs/btrfs_nosupport.c
src/detection/chassis/chassis_windows.c
src/detection/cpu/cpu_haiku.c
src/detection/cpucache/cpucache_shared.c
src/detection/cpuusage/cpuusage_haiku.c
src/detection/cursor/cursor_nosupport.c
src/detection/bluetooth/bluetooth_haiku.cpp
src/detection/bluetoothradio/bluetoothradio_nosupport.c
src/detection/disk/disk_haiku.cpp
src/detection/dns/dns_linux.c
src/detection/physicaldisk/physicaldisk_haiku.c
src/detection/physicalmemory/physicalmemory_linux.c
src/detection/diskio/diskio_nosupport.c
src/detection/displayserver/displayserver_haiku.cpp
src/detection/font/font_haiku.cpp
src/detection/gpu/gpu_haiku.c
src/detection/gpu/gpu_pci.c
src/detection/gtk_qt/gtk.c
src/detection/host/host_windows.c
src/detection/icons/icons_nosupport.c
src/detection/initsystem/initsystem_haiku.c
src/detection/keyboard/keyboard_haiku.cpp
src/detection/libc/libc_nosupport.c
src/detection/lm/lm_nosupport.c
src/detection/loadavg/loadavg_nosupport.c
src/detection/locale/locale_linux.c
src/detection/localip/localip_linux.c
src/detection/gamepad/gamepad_haiku.cpp
src/detection/media/media_linux.c
src/detection/memory/memory_haiku.c
src/detection/mouse/mouse_haiku.cpp
src/detection/netio/netio_haiku.cpp
src/detection/opengl/opengl_haiku.cpp
src/detection/os/os_haiku.c
src/detection/packages/packages_haiku.c
src/detection/poweradapter/poweradapter_nosupport.c
src/detection/processes/processes_haiku.c
src/detection/gtk_qt/qt.c
src/detection/sound/sound_haiku.cpp
src/detection/swap/swap_haiku.c
src/detection/terminalfont/terminalfont_linux.c
src/detection/terminalshell/terminalshell_linux.c
src/detection/terminalsize/terminalsize_linux.c
src/detection/theme/theme_nosupport.c
src/detection/tpm/tpm_nosupport.c
src/detection/uptime/uptime_haiku.c
src/detection/users/users_linux.c
src/detection/wallpaper/wallpaper_nosupport.c
src/detection/wifi/wifi_nosupport.c
src/detection/wm/wm_nosupport.c
src/detection/de/de_nosupport.c
src/detection/wmtheme/wmtheme_nosupport.c
src/detection/camera/camera_nosupport.c
src/detection/zpool/zpool_nosupport.c
src/util/platform/FFPlatform_unix.c
src/util/binary_linux.c
src/util/haiku/version.cpp
)
endif()
if(ENABLE_DIRECTX_HEADERS)
@@ -1112,6 +1210,9 @@ endif()
if(LINUX)
check_function_exists(statx HAVE_STATX)
endif()
if(NOT WIN32)
check_function_exists(pipe2 HAVE_PIPE2)
endif()
if(ENABLE_SYSTEM_YYJSON)
find_package(yyjson)
@@ -1206,6 +1307,8 @@ elseif(NetBSD)
target_compile_definitions(libfastfetch PUBLIC _GNU_SOURCE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-char-subscripts")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,/usr/X11R7/lib -Wl,-rpath,/usr/pkg/lib") # ditto
elseif(Haiku)
target_compile_definitions(libfastfetch PUBLIC _GNU_SOURCE)
endif()
if(FreeBSD OR OpenBSD OR NetBSD)
@@ -1226,6 +1329,10 @@ if(HAVE_WCWIDTH)
target_compile_definitions(libfastfetch PUBLIC FF_HAVE_WCWIDTH)
endif()
if(HAVE_PIPE2)
target_compile_definitions(libfastfetch PUBLIC FF_HAVE_PIPE2)
endif()
if(NOT "${CUSTOM_PCI_IDS_PATH}" STREQUAL "")
message(STATUS "Custom file path of pci.ids: ${CUSTOM_PCI_IDS_PATH}")
target_compile_definitions(libfastfetch PRIVATE FF_CUSTOM_PCI_IDS_PATH=${CUSTOM_PCI_IDS_PATH})
@@ -1432,6 +1539,9 @@ endif()
if(ENABLE_EMBEDDED_PCIIDS)
target_compile_definitions(libfastfetch PRIVATE FF_HAVE_EMBEDDED_PCIIDS=1)
endif()
if(ENABLE_EMBEDDED_AMDGPUIDS)
target_compile_definitions(libfastfetch PRIVATE FF_HAVE_EMBEDDED_AMDGPUIDS=1)
endif()
if(LINUX)
target_link_libraries(libfastfetch
@@ -1504,6 +1614,7 @@ elseif(OpenBSD)
target_link_libraries(libfastfetch
PRIVATE "m"
PRIVATE "kvm"
PRIVATE "sndio"
)
elseif(NetBSD)
target_link_libraries(libfastfetch
@@ -1533,6 +1644,17 @@ elseif(ANDROID)
)
endif()
endif()
elseif(Haiku)
target_link_libraries(libfastfetch
PRIVATE "network"
PRIVATE "bnetapi"
PRIVATE "media"
PRIVATE "device"
PRIVATE "bluetooth"
PRIVATE "GL"
PRIVATE "be"
PRIVATE "gnu"
)
endif()
target_include_directories(libfastfetch
+1 -1
View File
@@ -1,7 +1,7 @@
MIT License
Copyright (c) 2021-2023 Linus Dierheimer
Copyright (c) 2022-2024 Carter Li
Copyright (c) 2022-2025 Carter Li
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+8 -14
View File
@@ -29,6 +29,10 @@ There are [screenshots on different platforms](https://github.com/fastfetch-cli/
Some distros package an outdated fastfetch version. Older versions receive no support, so please try always to use the latest version.
<a href="https://repology.org/project/fastfetch/versions">
<img src="https://repology.org/badge/vertical-allrepos/fastfetch.svg?columns=2" alt="Packaging status" align="right">
</a>
* Ubuntu: [`ppa:zhangsongcui3371/fastfetch`](https://launchpad.net/~zhangsongcui3371/+archive/ubuntu/fastfetch) (for Ubuntu 22.04 or newer)
* Debian: `apt install fastfetch` (for Debian 13 or newer)
* Debian / Ubuntu: Download `fastfetch-linux-<proper architecture>.deb` from [Github release page](https://github.com/fastfetch-cli/fastfetch/releases/latest) and double-click it (for Ubuntu 20.04 or newer and Debian 11 or newer).
@@ -47,8 +51,6 @@ Some distros package an outdated fastfetch version. Older versions receive no su
You may need `sudo`, `doas` or `sup` to run these commands.
[See also if fastfetch has been packaged for your favorite Linux distro](#Packaging).
If fastfetch is not packaged for your distro or an outdated version is packaged, [linuxbrew](https://brew.sh/) is a good alternative: `brew install fastfetch`
### macOS
@@ -73,6 +75,10 @@ You may also download the program directly from [the GitHub releases page](https
* `pkg install fastfetch`
### Nightly
<https://nightly.link/fastfetch-cli/fastfetch/workflows/ci/dev?preview>
## Build from source
See Wiki: https://github.com/fastfetch-cli/fastfetch/wiki/Building
@@ -91,18 +97,6 @@ Fastfetch uses the JSONC (or JSON with comments) for configuration. [See Wiki fo
Logos can also be heavily customized; see the [logo documentation](https://github.com/fastfetch-cli/fastfetch/wiki/Logo-options) for more information.
## Packaging
### Repositories
[![Packaging status](https://repology.org/badge/vertical-allrepos/fastfetch.svg?header=)](https://repology.org/project/fastfetch/versions)
### Manual
* DEB / RPM package: `cmake --build . --target package`
* Install directly: `cmake --install . --prefix /usr/local`
## FAQ
### Q: Neofetch is good enough. Why do I need fastfetch?
+18
View File
@@ -1,3 +1,21 @@
fastfetch (2.36.1) jammy; urgency=medium
* Update to 2.36.1
-- Carter Li <zhangsongcui@live.cn> Tue, 11 Feb 2025 13:39:55 +0800
fastfetch (2.36.0) jammy; urgency=medium
* Update to 2.36.0
-- Carter Li <zhangsongcui@live.cn> Mon, 10 Feb 2025 10:13:53 +0800
fastfetch (2.35.0) jammy; urgency=medium
* Update to 2.35.0
-- Carter Li <zhangsongcui@live.cn> Sun, 26 Jan 2025 10:15:22 +0800
fastfetch (2.34.1) jammy; urgency=medium
* Update to 2.34.1
+1 -1
View File
@@ -1 +1 @@
fastfetch_2.34.1_source.buildinfo universe/utils optional
fastfetch_2.36.1_source.buildinfo universe/utils optional
+4 -3
View File
@@ -179,7 +179,7 @@
"type": "string"
},
"displayFormat": {
"description": "Output format of the module `Display`. See `-h format` for formatting syntax\n 1. {width}: Screen configured width (in pixels)\n 2. {height}: Screen configured height (in pixels)\n 3. {refresh-rate}: Screen configured refresh rate (in Hz)\n 4. {scaled-width}: Screen scaled width (in pixels)\n 5. {scaled-height}: Screen scaled height (in pixels)\n 6. {name}: Screen name\n 7. {type}: Screen type (builtin, external or unknown)\n 8. {rotation}: Screen rotation (in degrees)\n 9. {is-primary}: True if being the primary screen\n 10. {physical-width}: Screen physical width (in millimeters)\n 11. {physical-height}: Screen physical height (in millimeters)\n 12. {inch}: Physical diagonal length in inches\n 13. {ppi}: Pixels per inch (PPI)\n 14. {bit-depth}: Bits per color channel\n 15. {hdr-enabled}: True if high dynamic range (HDR) mode is enabled\n 16. {manufacture-year}: Year of manufacturing\n 17. {manufacture-week}: Nth week of manufacturing in the year\n 18. {serial}: Serial number\n 19. {platform-api}: The platform API used when detecting the display\n 20. {hdr-compatible}: True if the display is HDR compatible\n 21. {scale-factor}: HiDPI scale factor\n 22. {preferred-width}: Screen preferred width (in pixels)\n 23. {preferred-height}: Screen preferred height (in pixels)\n 24. {preferred-refresh-rate}: Screen preferred refresh rate (in Hz)",
"description": "Output format of the module `Display`. See `-h format` for formatting syntax\n 1. {width}: Screen configured width (in pixels)\n 2. {height}: Screen configured height (in pixels)\n 3. {refresh-rate}: Screen configured refresh rate (in Hz)\n 4. {scaled-width}: Screen scaled width (in pixels)\n 5. {scaled-height}: Screen scaled height (in pixels)\n 6. {name}: Screen name\n 7. {type}: Screen type (Built-in or External)\n 8. {rotation}: Screen rotation (in degrees)\n 9. {is-primary}: True if being the primary screen\n 10. {physical-width}: Screen physical width (in millimeters)\n 11. {physical-height}: Screen physical height (in millimeters)\n 12. {inch}: Physical diagonal length in inches\n 13. {ppi}: Pixels per inch (PPI)\n 14. {bit-depth}: Bits per color channel\n 15. {hdr-enabled}: True if high dynamic range (HDR) mode is enabled\n 16. {manufacture-year}: Year of manufacturing\n 17. {manufacture-week}: Nth week of manufacturing in the year\n 18. {serial}: Serial number\n 19. {platform-api}: The platform API used when detecting the display\n 20. {hdr-compatible}: True if the display is HDR compatible\n 21. {scale-factor}: HiDPI scale factor\n 22. {preferred-width}: Screen preferred width (in pixels)\n 23. {preferred-height}: Screen preferred height (in pixels)\n 24. {preferred-refresh-rate}: Screen preferred refresh rate (in Hz)",
"type": "string"
},
"diskFormat": {
@@ -817,8 +817,8 @@
"unit": {
"type": "string",
"description": "Set the unit of the temperature",
"enum": ["CELSIUS", "C", "FAHRENHEIT", "F", "KELVIN", "K"],
"default": "C"
"enum": ["D", "Default", "Celsius", "C", "Fahrenheit", "F", "Kelvin", "K"],
"default": "D"
},
"ndigits": {
"type": "integer",
@@ -2641,6 +2641,7 @@
"eopkg",
"flatpak",
"guix",
"hpkg",
"linglong",
"lpkg",
"lpkgbuild",
+2
View File
@@ -90,6 +90,8 @@
"sound",
"camera",
"gamepad",
"mouse",
"keyboard",
{
"type": "weather",
"timeout": 1000
+2
View File
@@ -92,6 +92,8 @@
"sound",
"camera",
"gamepad",
"mouse",
"keyboard",
{
"type": "weather",
"timeout": 1000
+43
View File
@@ -0,0 +1,43 @@
#!/usr/bin/env python3
import sys
def main(amdgpu_ids_path: str):
with open(amdgpu_ids_path, 'r') as f:
full_text = f.read()
products = []
for line in full_text.split('\n'):
if not line or line[0] == '#' or not ',\t' in line:
continue
device, revision, name = line.split(',\t', maxsplit=2)
products.append((device, revision, name))
code = """\
// SPDX-License-Identifier: MIT
// https://opensource.org/license/mit
// Generated from https://gitlab.freedesktop.org/mesa/drm/-/raw/main/data/amdgpu.ids
#include <stdint.h>
#include <stddef.h>
typedef struct FFArmGpuProduct
{
const uint32_t id; // device << 8 | revision
const char* name;
} FFArmGpuProduct;
const FFArmGpuProduct ffAmdGpuProducts[] = {
"""
for device, revision, name in products:
code += f" {{ 0x{device} << 8 | 0x{revision}, \"{name}\" }},\n"
code += "};\n"
print(code)
if __name__ == '__main__':
len(sys.argv) == 2 or sys.exit('Usage: gen-amdgpuids.py </path/to/amdgpu.ids>')
main(sys.argv[1])
+7 -9
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
from requests import get as http_get
import sys
class PciDeviceModel:
def __init__(self, id: int, name: str):
@@ -13,14 +13,10 @@ class PciVendorModel:
self.name = name
self.devices = []
def main(keep_vendor_list: set):
def main(keep_vendor_list: set, pci_ids_path: str):
vendors = []
try:
with open('pci.ids', 'r') as f:
full_text = f.read()
except FileNotFoundError:
response = http_get('https://pci-ids.ucw.cz/v2.2/pci.ids')
full_text = response.text
with open(pci_ids_path, 'r') as f:
full_text = f.read()
dev_list_text = full_text[:full_text.rfind('\n\n\n')] # remove known classes
for line in dev_list_text.split('\n'):
@@ -80,6 +76,8 @@ const FFPciVendor ffPciVendors[] = {{
print(code)
if __name__ == '__main__':
len(sys.argv) == 2 or sys.exit('Usage: gen-pciids.py </path/to/pci.ids>')
# From <src/detection/gpu/gpu.c>
main({
0x106b, # Apple
@@ -94,4 +92,4 @@ if __name__ == '__main__':
0x1ab8, # Parallel
0x1414, # Microsoft
0x108e, # Oracle
})
}, sys.argv[1])
+20 -11
View File
@@ -259,24 +259,33 @@ void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t n
continue;
}
//test for constant, if so evaluate it
//test for constant or env var, if so evaluate it
if (firstChar == '$')
{
char* pend = NULL;
int32_t indexSigned = (int32_t) strtol(placeholderValue.chars + 1, &pend, 10);
uint32_t index = (uint32_t) indexSigned;
bool backward = indexSigned < 0;
if (indexSigned == 0 || *pend != '\0' || instance.config.display.constants.length < index)
if (pend == placeholderValue.chars + 1)
{
appendInvalidPlaceholder(buffer, "{", &placeholderValue, i, formatstr->length);
continue;
// treat placeholder as an environment variable
char* envValue = getenv(placeholderValue.chars + 1);
if (envValue)
ffStrbufAppendS(buffer, envValue);
else
appendInvalidPlaceholder(buffer, "{", &placeholderValue, i, formatstr->length);
}
else
{
// treat placeholder as a constant
uint32_t index = (uint32_t) (indexSigned < 0 ? (int32_t) instance.config.display.constants.length + indexSigned : indexSigned - 1);
FFstrbuf* item = FF_LIST_GET(FFstrbuf, instance.config.display.constants, backward
? instance.config.display.constants.length - index
: index - 1);
ffStrbufAppend(buffer, item);
if (*pend != '\0' || instance.config.display.constants.length <= index)
appendInvalidPlaceholder(buffer, "{", &placeholderValue, i, formatstr->length);
else
{
FFstrbuf* item = FF_LIST_GET(FFstrbuf, instance.config.display.constants, index);
ffStrbufAppend(buffer, item);
}
}
continue;
}
+3
View File
@@ -236,6 +236,9 @@ void ffListFeatures(void)
#if FF_HAVE_FREETYPE
"freetype\n"
#endif
#if FF_HAVE_PCIACCESS
"libpciaccess\n"
#endif
#if FF_HAVE_PULSE
"libpulse\n"
#endif
+1 -1
View File
@@ -119,7 +119,7 @@ static inline bool ffPathExists(const char* path, FFPathType pathType)
}
else
{
#if __APPLE__ // #1395
#if (__APPLE__ || __HAIKU__) // #1395
struct stat fileStat;
if(stat(path, &fileStat) != 0)
return false;
+1 -1
View File
@@ -310,7 +310,7 @@ void listFilesRecursively(uint32_t baseLength, FFstrbuf* folder, uint8_t indenta
continue;
bool isDir = false;
#ifndef __sun
#if !defined(__sun) && !defined(__HAIKU__)
if(entry->d_type != DT_UNKNOWN && entry->d_type != DT_LNK)
isDir = entry->d_type == DT_DIR;
else
+63
View File
@@ -0,0 +1,63 @@
#include "netif.h"
#include "common/io/io.h"
#include "util/mallocHelper.h"
#include <arpa/inet.h>
#include <net/if.h>
#include <net/route.h>
#include <sys/socket.h>
#include <sys/sockio.h>
#include <stdio.h>
// loosely based on Haiku's src/bin/network/route/route.cpp
bool ffNetifGetDefaultRouteImpl(char iface[IF_NAMESIZE + 1], uint32_t* ifIndex)
{
// TODO: AF_INET6
FF_AUTO_CLOSE_FD int pfRoute = socket(AF_INET, SOCK_RAW, AF_INET);
if (pfRoute < 0)
return false;
struct ifconf config;
config.ifc_len = sizeof(config.ifc_value);
if (ioctl(pfRoute, SIOCGRTSIZE, &config, sizeof(struct ifconf)) < 0)
return false;
int size = config.ifc_value;
if (size <= 0)
return false;
FF_AUTO_FREE void *buffer = malloc((size_t) size);
if (buffer == NULL) {
return false;
}
config.ifc_len = size;
config.ifc_buf = buffer;
if (ioctl(pfRoute, SIOCGRTTABLE, &config, sizeof(struct ifconf)) < 0)
return false;
struct ifreq *interface = (struct ifreq*)buffer;
struct ifreq *end = (struct ifreq*)((uint8_t*)buffer + size);
while (interface < end) {
if (interface->ifr_route.flags & RTF_DEFAULT) {
strlcpy(iface, interface->ifr_name, IF_NAMESIZE);
*ifIndex = if_nametoindex(interface->ifr_name);
return true;
}
size_t addressSize = 0;
if (interface->ifr_route.destination != NULL)
addressSize += interface->ifr_route.destination->sa_len;
if (interface->ifr_route.mask != NULL)
addressSize += interface->ifr_route.mask->sa_len;
if (interface->ifr_route.gateway != NULL)
addressSize += interface->ifr_route.gateway->sa_len;
interface = (struct ifreq*)((addr_t)interface + IF_NAMESIZE
+ sizeof(struct route_entry) + addressSize);
}
return false;
}
+38 -3
View File
@@ -28,13 +28,16 @@
#elif defined(__NetBSD__)
#include <sys/types.h>
#include <sys/sysctl.h>
#elif defined(__HAIKU__)
#include <OS.h>
#include <image.h>
#endif
enum { FF_PIPE_BUFSIZ = 8192 };
static inline int ffPipe2(int *fds, int flags)
static inline int ffPipe2(int* fds, int flags)
{
#ifdef __APPLE__
#ifndef FF_HAVE_PIPE2
if(pipe(fds) == -1)
return -1;
fcntl(fds[0], F_SETFL, fcntl(fds[0], F_GETFL) | flags);
@@ -301,10 +304,30 @@ void ffProcessGetInfoLinux(pid_t pid, FFstrbuf* processName, FFstrbuf* exe, cons
if (proc)
{
char** argv = kvm_getargv(kd, proc, 0);
if (argv) ffStrbufSetS(exe, argv[0]);
if (argv)
{
const char* arg0 = argv[0];
if (arg0[0] == '-') arg0++;
ffStrbufSetS(exe, arg0);
}
}
kvm_close(kd);
#elif defined(__HAIKU__)
image_info info;
int32 cookie = 0;
while (get_next_image_info(pid, &cookie, &info) == B_OK)
{
if (info.type != B_APP_IMAGE) continue;
ffStrbufSetS(exe, info.name);
if (exePath)
ffStrbufSet(exePath, exe);
break;
}
#endif
if(exe->length == 0)
@@ -471,6 +494,18 @@ const char* ffProcessGetBasicInfoLinux(pid_t pid, FFstrbuf* name, pid_t* ppid, i
if (!proc)
return "kvm_getprocs() failed";
#elif defined(__HAIKU__)
team_info info;
if (get_team_info(pid, &info) == B_OK)
{
ffStrbufSetS(name, info.name);
if (ppid)
*ppid = info.parent;
}
FF_UNUSED(tty);
#else
return "Unsupported platform";
+1
View File
@@ -39,6 +39,7 @@ void ffTempsAppendNum(double celsius, FFstrbuf* buffer, FFColorRangeConfig confi
switch (options->tempUnit)
{
case FF_TEMPERATURE_UNIT_DEFAULT:
case FF_TEMPERATURE_UNIT_CELSIUS:
ffStrbufAppendF(buffer, "%.*f°C", options->tempNdigits, celsius);
break;
+6
View File
@@ -7,6 +7,8 @@
#include <synchapi.h>
#include <profileapi.h>
#include <sysinfoapi.h>
#elif defined(__HAIKU__)
#include <OS.h>
#endif
static inline double ffTimeGetTick(void) //In msec
@@ -17,6 +19,8 @@ static inline double ffTimeGetTick(void) //In msec
LARGE_INTEGER start;
QueryPerformanceCounter(&start);
return (double) start.QuadPart * 1000 / (double) frequency.QuadPart;
#elif defined(__HAIKU__)
return (double) system_time() / 1000.;
#else
struct timespec timeNow;
clock_gettime(CLOCK_MONOTONIC, &timeNow);
@@ -30,6 +34,8 @@ static inline uint64_t ffTimeGetNow(void)
uint64_t timeNow;
GetSystemTimeAsFileTime((FILETIME*) &timeNow);
return (timeNow - 116444736000000000ull) / 10000ull;
#elif defined(__HAIKU__)
return (uint64_t) real_time_clock_usecs() / 1000u;
#else
struct timespec timeNow;
clock_gettime(CLOCK_REALTIME, &timeNow);
+2 -11
View File
@@ -104,16 +104,6 @@
"default": true
}
},
{
"long": "escape-bedrock",
"desc": "On Bedrock Linux, whether to escape the bedrock jail",
"remark": "Linux only",
"arg": {
"type": "bool",
"optional": true,
"default": true
}
},
{
"long": "wmi-timeout",
"desc": "Set the timeout (ms) for WMI queries",
@@ -732,11 +722,12 @@
"arg": {
"type": "enum",
"enum": {
"D": "Default",
"C": "Celsius",
"F": "Fahrenheit",
"K": "Kelvin"
},
"default": "C"
"default": "D"
}
},
{
+2
View File
@@ -21,6 +21,8 @@ In 2.24.0 or newer, `{~startIndex,endIndex}` can be specified to slice a string.
If an index is omitted, 0 is used. For example, both `{~,0}` `{~0,}` and `{~,}` are same as `{~0,0}` and will always generate a empty string.
If `,endIndex` is omitted or greater than the length of the string, the length of string is used.
In 2.36.0 or newer, `{$NUM}` can be specified to reference a constant defined in `display.constants`. `{$ENV_VAR}` can be specified to reference an environment variable.
If the value index is missing, meaning the placeholder is "{}", an internal counter sets the value index.
This means that the format string "Values: {1} ({2})" is equivalent to "Values: {} ({})".
Note that this counter only counts empty placeholders, so the format string "{2} {} {}" will contain the second value, then the first, and then the second again.
+60
View File
@@ -0,0 +1,60 @@
#include "fastfetch.h"
#include "battery.h"
#include "common/io/io.h"
#include <private/device/power_managment.h>
#include <sys/ioctl.h>
#include <fcntl.h>
const char* parseBattery(int dfd, const char* battId, FFlist* results)
{
FF_AUTO_CLOSE_FD int fd = openat(dfd, battId, O_RDWR);
if (fd < 0) return "openat() failed";
acpi_battery_info basic = {};
if (ioctl(fd, GET_BATTERY_INFO, &basic, sizeof(basic)) != 0)
return "ioctl(GET_BATTERY_INFO) failed";
acpi_extended_battery_info extended = {};
if (ioctl(fd, GET_EXTENDED_BATTERY_INFO, &extended, sizeof(extended)) != 0)
return "ioctl(GET_EXTENDED_BATTERY_INFO) failed";
FFBatteryResult* battery = (FFBatteryResult*)ffListAdd(results);
ffStrbufInitS(&battery->modelName, extended.model_number);
ffStrbufInitS(&battery->manufacturer, extended.oem_info);
ffStrbufInit(&battery->manufactureDate);
ffStrbufInitS(&battery->technology, extended.type); // extended.technology?
ffStrbufInit(&battery->status);
ffStrbufInitS(&battery->serial, extended.serial_number);
battery->temperature = FF_BATTERY_TEMP_UNSET;
battery->cycleCount = extended.cycles;
battery->timeRemaining = -1;
battery->capacity = (double) basic.capacity * 100. / (double) extended.last_full_charge;
if (basic.state & BATTERY_DISCHARGING)
ffStrbufAppendS(&battery->status, "Discharging, ");
if (basic.state & BATTERY_CHARGING)
ffStrbufAppendS(&battery->status, "Charging, ");
if (basic.state & BATTERY_CRITICAL_STATE)
ffStrbufAppendS(&battery->status, "Critical, ");
if (basic.state & BATTERY_NOT_CHARGING)
ffStrbufAppendS(&battery->status, "AC Connected, ");
ffStrbufTrimRight(&battery->status, ' ');
ffStrbufTrimRight(&battery->status, ',');
return NULL;
}
const char* ffDetectBattery(FF_MAYBE_UNUSED FFBatteryOptions* options, FFlist* results)
{
FF_AUTO_CLOSE_DIR DIR* dir = opendir("/dev/power/acpi_battery/");
if (!dir) return "opendir(/dev/power/acpi_battery) failed";
struct dirent* entry;
while ((entry = readdir(dir)))
{
if (entry->d_name[0] == '.') continue;
parseBattery(dirfd(dir), entry->d_name, results);
}
return NULL;
}
+3
View File
@@ -89,6 +89,9 @@ const char* ffDetectBios(FFBiosResult* bios)
default: break;
}
}
#elif __HAIKU__
// Currently SMBIOS detection is supported in legency BIOS only
ffStrbufSetStatic(&bios->type, "BIOS");
#endif
return NULL;
@@ -0,0 +1,29 @@
extern "C" {
#include "bluetooth.h"
#include "common/io/io.h"
}
#include <bluetooth/LocalDevice.h>
const char* ffDetectBluetooth(FF_MAYBE_UNUSED FFBluetoothOptions* options, FFlist* devices /* FFBluetoothResult */)
{
using namespace Bluetooth;
FF_SUPPRESS_IO();
LocalDevice* dev = LocalDevice::GetLocalDevice();
if (!dev) return NULL;
BString devClass;
dev->GetDeviceClass().DumpDeviceClass(devClass);
FFBluetoothResult* device = (FFBluetoothResult*) ffListAdd(devices);
ffStrbufInitS(&device->name, dev->GetFriendlyName());
ffStrbufInitS(&device->address, bdaddrUtils::ToString(dev->GetBluetoothAddress()).String());
ffStrbufInitS(&device->type, devClass.String());
device->battery = 0;
device->connected = true;
// TODO: more devices?
return NULL;
}
+5
View File
@@ -6,6 +6,11 @@
// warning: 'AVCaptureDeviceTypeExternalUnknown' is deprecated
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#ifdef MAC_OS_VERSION_14_0
// To make fastfetch compiled on newer macOS versions runs on older ones
AVF_EXPORT __attribute__((weak_import)) AVCaptureDeviceType const AVCaptureDeviceTypeExternal;
#endif
const char* ffDetectCamera(FFlist* result)
{
#ifdef MAC_OS_X_VERSION_10_15
+6 -2
View File
@@ -10,10 +10,14 @@ const char* ffDetectCPU(const FFCPUOptions* options, FFCPUResult* cpu)
const char* removeStrings[] = {
" CPU", " FPU", " APU", " Processor",
" Dual-Core", " Quad-Core", " Six-Core", " Eight-Core", " Ten-Core",
" 2-Core", " 4-Core", " 6-Core", " 8-Core", " 10-Core", " 12-Core", " 14-Core", " 16-Core",
" with Radeon Graphics"
" 2-Core", " 4-Core", " 6-Core", " 8-Core", " 10-Core", " 12-Core", " 14-Core", " 16-Core"
};
ffStrbufRemoveStrings(&cpu->name, ARRAY_SIZE(removeStrings), removeStrings);
uint32_t radeonGraphics = ffStrbufFirstIndexS(&cpu->name, " w/ Radeon "); // w/ Radeon 780M Graphics
if (radeonGraphics >= cpu->name.length)
radeonGraphics = ffStrbufFirstIndexS(&cpu->name, " with Radeon ");
if (radeonGraphics < cpu->name.length)
ffStrbufSubstrBefore(&cpu->name, radeonGraphics);
ffStrbufSubstrBeforeFirstC(&cpu->name, '@'); //Cut the speed output in the name as we append our own
ffStrbufTrimRight(&cpu->name, ' '); //If we removed the @ in previous step there was most likely a space before it
ffStrbufRemoveDupWhitespaces(&cpu->name);
+1
View File
@@ -15,6 +15,7 @@ static double detectCpuTemp(const FFstrbuf* cpuName)
case 1: error = ffDetectSmcTemps(FF_TEMP_CPU_M1X, &result); break;
case 2: error = ffDetectSmcTemps(FF_TEMP_CPU_M2X, &result); break;
case 3: error = ffDetectSmcTemps(FF_TEMP_CPU_M3X, &result); break;
case 4: error = ffDetectSmcTemps(FF_TEMP_CPU_M4X, &result); break;
default: error = "Unsupported Apple Silicon CPU";
}
}
+64
View File
@@ -0,0 +1,64 @@
#include "cpu.h"
#include "util/mallocHelper.h"
#include <OS.h>
#include <private/shared/cpu_type.h>
const char* ffDetectCPUImpl(FF_MAYBE_UNUSED const FFCPUOptions* options, FFCPUResult* cpu)
{
system_info sysInfo;
if (get_system_info(&sysInfo) != B_OK)
return "get_system_info() failed";
uint32 topoNodeCount = 0;
get_cpu_topology_info(NULL, &topoNodeCount);
if (topoNodeCount == 0)
return "get_cpu_topology_info(NULL) failed";
FF_AUTO_FREE cpu_topology_node_info* topology = malloc(sizeof(*topology) * topoNodeCount);
if (get_cpu_topology_info(topology, &topoNodeCount) != B_OK)
return "get_cpu_topology_info(topology) failed";
enum cpu_platform platform = B_CPU_UNKNOWN;
enum cpu_vendor cpuVendor = B_CPU_VENDOR_UNKNOWN;
uint32 cpuModel = 0, frequency = 0;
uint16_t packages = 0, cores = 0;
for (uint32 i = 0; i < topoNodeCount; i++)
{
switch (topology[i].type) {
case B_TOPOLOGY_ROOT:
platform = topology[i].data.root.platform;
break;
case B_TOPOLOGY_PACKAGE:
cpuVendor = topology[i].data.package.vendor;
++packages;
break;
case B_TOPOLOGY_CORE:
cpuModel = topology[i].data.core.model;
uint32_t freq = (uint32_t) (topology[i].data.core.default_frequency / 1000000);
frequency = freq > frequency ? freq : frequency;
++cores;
break;
default:
break;
}
}
const char *model = get_cpu_model_string(platform, cpuVendor, cpuModel);
if (model)
ffStrbufSetS(&cpu->name, model);
else
ffStrbufSetF(&cpu->name, "(Unknown %" B_PRIx32 ")", cpuModel);
ffStrbufSetS(&cpu->vendor, get_cpu_vendor_string(cpuVendor));
ffCPUDetectSpeedByCpuid(cpu);
if (cpu->frequencyBase < frequency) cpu->frequencyBase = frequency;
cpu->packages = packages;
cpu->coresPhysical = cores;
cpu->coresOnline = cpu->coresLogical = (uint16_t) sysInfo.cpu_count;
return NULL;
}
+147 -71
View File
@@ -10,6 +10,8 @@
#include <unistd.h>
#include <dirent.h>
#define FF_CPUINFO_PATH "/proc/cpuinfo"
static double parseHwmonDir(FFstrbuf* dir, FFstrbuf* buffer)
{
//https://www.kernel.org/doc/Documentation/hwmon/sysfs-interface
@@ -283,11 +285,7 @@ static const char* parseCpuInfo(
while(ffStrbufGetline(&line, &len, cpuinfo))
{
//Stop after reasonable information is acquired
if((*line == '\0' || *line == '\n')
#if __arm__ || __aarch64__ || __loongarch__
&& cpu->name.length > 0 // #1202 #1204
#endif
)
if((*line == '\0' || *line == '\n') && cpu->name.length > 0)
{
ffStrbufGetlineRestore(&line, &len, cpuinfo);
break;
@@ -296,28 +294,37 @@ static const char* parseCpuInfo(
(void)(
// arm64 doesn't have "model name"; arm32 does have "model name" but its value is not useful.
// "Hardware" should always be used in this case
#if !(__arm__ || __aarch64__)
#if __x86_64__ || __i386__
(cpu->name.length == 0 && ffParsePropLine(line, "model name :", &cpu->name)) ||
(cpu->vendor.length == 0 && ffParsePropLine(line, "vendor_id :", &cpu->vendor)) ||
(physicalCoresBuffer->length == 0 && ffParsePropLine(line, "cpu cores :", physicalCoresBuffer)) ||
(cpuMHz->length == 0 && ffParsePropLine(line, "cpu MHz :", cpuMHz)) ||
#endif
#if !(__x86_64__ || __i386__ || __arm__ || __aarch64__)
(cpuIsa->length == 0 && ffParsePropLine(line, "isa :", cpuIsa)) ||
(cpuUarch->length == 0 && ffParsePropLine(line, "uarch :", cpuUarch)) ||
#endif
#if __arm__ || __aarch64__
#elif __arm__ || __aarch64__
(cpuImplementer->length == 0 && ffParsePropLine(line, "CPU implementer :", cpuImplementer)) ||
(cpu->name.length == 0 && ffParsePropLine(line, "Hardware :", &cpu->name)) || //For Android devices
#elif __powerpc__ || __powerpc
(cpuMHz->length == 0 && ffParsePropLine(line, "clock :", cpuMHz)) ||
(cpu->name.length == 0 && ffParsePropLine(line, "cpu :", &cpu->name)) ||
#elif __mips__ || __mips
(cpu->name.length == 0 && ffParsePropLine(line, "cpu model :", &cpu->name)) ||
#elif __loongarch__
(cpu->name.length == 0 && ffParsePropLine(line, "Model Name :", &cpu->name)) ||
(cpuMHz->length == 0 && ffParsePropLine(line, "CPU MHz :", cpuMHz)) ||
#elif __riscv__ || __riscv
(cpuIsa->length == 0 && ffParsePropLine(line, "isa :", cpuIsa)) ||
(cpuUarch->length == 0 && ffParsePropLine(line, "uarch :", cpuUarch)) ||
#elif __s390x__
(cpu->name.length == 0 && ffParsePropLine(line, "processor 0:", &cpu->name)) ||
(cpu->vendor.length == 0 && ffParsePropLine(line, "vendor_id :", &cpu->vendor)) ||
(cpuMHz->length == 0 && ffParsePropLine(line, "cpu MHz static :", cpuMHz)) || // This one cannot be detected because of early return
#else
(cpu->name.length == 0 && ffParsePropLine(line, "model name :", &cpu->name)) ||
(cpu->name.length == 0 && ffParsePropLine(line, "model :", &cpu->name)) ||
(cpu->name.length == 0 && ffParsePropLine(line, "cpu model :", &cpu->name)) ||
(cpu->name.length == 0 && ffParsePropLine(line, "hardware :", &cpu->name)) ||
(cpu->name.length == 0 && ffParsePropLine(line, "processor :", &cpu->name)) ||
#endif
#if __powerpc__ || __powerpc
(cpu->name.length == 0 && ffParsePropLine(line, "cpu :", &cpu->name)) || //For POWER
#endif
#if __mips__
(cpu->name.length == 0 && ffParsePropLine(line, "cpu model :", &cpu->name)) || //For MIPS
#endif
false
);
}
@@ -414,6 +421,59 @@ static bool detectFrequency(FFCPUResult* cpu, const FFCPUOptions* options)
return true;
}
#if __i386__ || __x86_64__
FF_MAYBE_UNUSED static uint16_t getPackageCount(FFstrbuf* cpuinfo)
{
const char* p = cpuinfo->chars;
uint64_t low = 0, high = 0;
while ((p = memmem(p, cpuinfo->length - (uint32_t) (p - cpuinfo->chars), "\nphysical id\t:", strlen("\nphysical id\t:"))))
{
if (!p) break;
p += strlen("\nphysical id\t:");
char* pend;
unsigned long id = strtoul(p, &pend, 10);
if (__builtin_expect(id > 64, false)) // Do 129-socket boards exist?
high |= 1 << (id - 64);
else
low |= 1 << id;
p = pend;
}
return (uint16_t) (__builtin_popcountll(low) + __builtin_popcountll(high));
}
FF_MAYBE_UNUSED static const char* detectCPUX86(const FFCPUOptions* options, FFCPUResult* cpu)
{
FF_STRBUF_AUTO_DESTROY cpuinfo = ffStrbufCreateA(PROC_FILE_BUFFSIZ);
if (!ffReadFileBuffer(FF_CPUINFO_PATH, &cpuinfo) || cpuinfo.length == 0)
return "ffReadFileBuffer(\"" FF_CPUINFO_PATH "\") failed";
FF_STRBUF_AUTO_DESTROY physicalCoresBuffer = ffStrbufCreate();
FF_STRBUF_AUTO_DESTROY cpuMHz = ffStrbufCreate();
const char* error = parseCpuInfo(&cpuinfo, cpu, &physicalCoresBuffer, &cpuMHz, NULL,NULL, NULL);
if (error) return error;
cpu->coresLogical = (uint16_t) get_nprocs_conf();
cpu->coresOnline = (uint16_t) get_nprocs();
cpu->packages = getPackageCount(&cpuinfo);
cpu->coresPhysical = (uint16_t) ffStrbufToUInt(&physicalCoresBuffer, 0); // physical cores in single package
if (cpu->coresPhysical == 0)
cpu->coresPhysical = cpu->coresLogical;
else if (cpu->packages > 1)
cpu->coresPhysical *= cpu->packages;
// Ref https://github.com/fastfetch-cli/fastfetch/issues/1194#issuecomment-2295058252
ffCPUDetectSpeedByCpuid(cpu);
if (!detectFrequency(cpu, options) || cpu->frequencyBase == 0)
cpu->frequencyBase = (uint32_t) ffStrbufToUInt(&cpuMHz, 0);
return NULL;
}
#else
FF_MAYBE_UNUSED static void parseIsa(FFstrbuf* cpuIsa)
{
// Always use the last part of the ISA string. Ref: #590 #1204
@@ -517,18 +577,20 @@ FF_MAYBE_UNUSED static void detectSocName(FFCPUResult* cpu)
}
}
FF_MAYBE_UNUSED static uint16_t getPackageCount(FFstrbuf* cpuinfo)
#ifdef __loongarch__
FF_MAYBE_UNUSED static uint16_t getLoongarchPropCount(FFstrbuf* cpuinfo, const char* key)
{
const char* p = cpuinfo->chars;
uint64_t low = 0, high = 0;
uint32_t keylen = (uint32_t) strlen(key);
while ((p = memmem(p, cpuinfo->length - (uint32_t) (p - cpuinfo->chars), "\nphysical id\t:", strlen("\nphysical id\t:"))))
while ((p = memmem(p, cpuinfo->length - (uint32_t) (p - cpuinfo->chars), key, keylen)))
{
if (!p) break;
p += strlen("\nphysical id\t:");
p += keylen;
char* pend;
unsigned long id = strtoul(p, &pend, 10);
if (__builtin_expect(id > 64, false)) // Do 129-socket boards exist?
if (__builtin_expect(id > 64, false))
high |= 1 << (id - 64);
else
low |= 1 << id;
@@ -537,69 +599,83 @@ FF_MAYBE_UNUSED static uint16_t getPackageCount(FFstrbuf* cpuinfo)
return (uint16_t) (__builtin_popcountll(low) + __builtin_popcountll(high));
}
#endif
const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
FF_MAYBE_UNUSED static const char* detectCPUOthers(const FFCPUOptions* options, FFCPUResult* cpu)
{
FF_STRBUF_AUTO_DESTROY cpuinfo = ffStrbufCreateA(PROC_FILE_BUFFSIZ);
if (!ffReadFileBuffer("/proc/cpuinfo", &cpuinfo) || cpuinfo.length == 0)
return "ffReadFileBuffer(\"/proc/cpuinfo\") failed";
cpu->temperature = options->temp ? detectCPUTemp() : FF_CPU_TEMP_UNSET;
FF_STRBUF_AUTO_DESTROY physicalCoresBuffer = ffStrbufCreate();
FF_STRBUF_AUTO_DESTROY cpuMHz = ffStrbufCreate();
FF_STRBUF_AUTO_DESTROY cpuIsa = ffStrbufCreate();
FF_STRBUF_AUTO_DESTROY cpuUarch = ffStrbufCreate();
FF_STRBUF_AUTO_DESTROY cpuImplementerStr = ffStrbufCreate();
const char* error = parseCpuInfo(&cpuinfo, cpu, &physicalCoresBuffer, &cpuMHz, &cpuIsa, &cpuUarch, &cpuImplementerStr);
if (error) return error;
cpu->coresLogical = (uint16_t) get_nprocs_conf();
cpu->coresPhysical = cpu->coresLogical = (uint16_t) get_nprocs_conf();
cpu->coresOnline = (uint16_t) get_nprocs();
cpu->coresPhysical = (uint16_t) ffStrbufToUInt(&physicalCoresBuffer, cpu->coresLogical);
#if __x86_64__ || __i386__
cpu->packages = getPackageCount(&cpuinfo);
if (cpu->packages > 1)
cpu->coresPhysical *= cpu->packages; // https://github.com/hykilpikonna/hyfetch/issues/374#issuecomment-2571578914
#endif
// Ref https://github.com/fastfetch-cli/fastfetch/issues/1194#issuecomment-2295058252
ffCPUDetectSpeedByCpuid(cpu);
if (!detectFrequency(cpu, options) || cpu->frequencyBase == 0)
cpu->frequencyBase = (uint32_t) ffStrbufToUInt(&cpuMHz, 0);
#if __ANDROID__
detectAndroid(cpu);
#elif !(__x86_64__ || __i386__)
#else
detectSocName(cpu);
#endif
#if __arm__ || __aarch64__
uint32_t cpuImplementer = (uint32_t) strtoul(cpuImplementerStr.chars, NULL, 16);
ffStrbufSetStatic(&cpu->vendor, hwImplId2Vendor(cpuImplementer));
detectFrequency(cpu, options);
if (cpu->name.length == 0)
detectArmName(&cpuinfo, cpu, cpuImplementer);
#elif !(__x86_64__ || __i386__)
if (cpu->name.length == 0)
{
if(cpuUarch.length > 0)
{
if(cpu->name.length > 0)
ffStrbufAppendC(&cpu->name, ' ');
ffStrbufAppend(&cpu->name, &cpuUarch);
}
FF_STRBUF_AUTO_DESTROY cpuinfo = ffStrbufCreateA(PROC_FILE_BUFFSIZ);
if (!ffReadFileBuffer(FF_CPUINFO_PATH, &cpuinfo) || cpuinfo.length == 0)
return "ffReadFileBuffer(\"" FF_CPUINFO_PATH "\") failed";
if(cpuIsa.length > 0)
FF_STRBUF_AUTO_DESTROY cpuMHz = ffStrbufCreate();
FF_STRBUF_AUTO_DESTROY cpuIsa = ffStrbufCreate();
FF_STRBUF_AUTO_DESTROY cpuUarch = ffStrbufCreate();
FF_STRBUF_AUTO_DESTROY cpuImplementerStr = ffStrbufCreate();
const char* error = parseCpuInfo(&cpuinfo, cpu, NULL, &cpuMHz, &cpuIsa, &cpuUarch, &cpuImplementerStr);
if (error) return error;
if (cpu->frequencyBase == 0)
cpu->frequencyBase = (uint32_t) ffStrbufToUInt(&cpuMHz, 0);
#if __arm__ || __aarch64__
uint32_t cpuImplementer = (uint32_t) strtoul(cpuImplementerStr.chars, NULL, 16);
ffStrbufSetStatic(&cpu->vendor, hwImplId2Vendor(cpuImplementer));
if (cpu->name.length == 0)
detectArmName(&cpuinfo, cpu, cpuImplementer);
#elif __riscv__ || __riscv
if (cpu->name.length == 0)
{
parseIsa(&cpuIsa);
if(cpu->name.length > 0)
ffStrbufAppendC(&cpu->name, ' ');
ffStrbufAppend(&cpu->name, &cpuIsa);
if(cpuUarch.length > 0)
{
if(cpu->name.length > 0)
ffStrbufAppendC(&cpu->name, ' ');
ffStrbufAppend(&cpu->name, &cpuUarch);
}
if(cpuIsa.length > 0)
{
parseIsa(&cpuIsa);
if(cpu->name.length > 0)
ffStrbufAppendC(&cpu->name, ' ');
ffStrbufAppend(&cpu->name, &cpuIsa);
}
}
#elif __loongarch__
cpu->packages = getLoongarchPropCount(&cpuinfo, "\npackage\t\t\t:");
cpu->coresPhysical = getLoongarchPropCount(&cpuinfo, "\ncore\t\t\t:");
if (cpu->packages > 1) cpu->coresPhysical *= cpu->packages;
#elif __s390x__
if (ffStrbufSubstrAfterFirstS(&cpu->name, "machine = "))
ffStrbufPrependS(&cpu->name, "Machine ");
#endif
}
#endif
return NULL;
}
#endif
const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
{
cpu->temperature = options->temp ? detectCPUTemp() : FF_CPU_TEMP_UNSET;
#if __x86_64__ || __i386__
return detectCPUX86(options, cpu);
#else
return detectCPUOthers(options, cpu);
#endif
}
+5 -3
View File
@@ -42,10 +42,11 @@ static const char* detectCpuTemp(double* current)
const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
{
if (ffSysctlGetString("machdep.cpu_brand", &cpu->name) != NULL)
if (ffSysctlGetString("machdep.cpu_brand", &cpu->name) != NULL &&
ffSysctlGetString("machdep.dmi.processor-version", &cpu->name) != NULL &&
ffSysctlGetString("hw.cpu0.name", &cpu->name) != NULL)
{
if (ffSysctlGetString("machdep.dmi.processor-version", &cpu->name) != NULL)
return "sysctlbyname(machdep.cpu_brand) failed";
ffStrbufSetS(&cpu->name, "Unknown CPU");
}
if (ffSysctlGetString("machdep.dmi.processor-vendor", &cpu->vendor) == NULL)
@@ -58,6 +59,7 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
ffCPUDetectSpeedByCpuid(cpu);
uint32_t freq = (uint32_t) ffSysctlGetInt("machdep.cpu.frequency.target", 0);
if (freq == 0) freq = (uint32_t) (ffSysctlGetInt64("hw.cpu0.clock_frequency", 0) / 1000000);
if (freq > cpu->frequencyBase) cpu->frequencyBase = freq;
cpu->temperature = FF_CPU_TEMP_UNSET;
+27
View File
@@ -0,0 +1,27 @@
#include "fastfetch.h"
#include "detection/cpuusage/cpuusage.h"
#include "util/mallocHelper.h"
#include <OS.h>
const char* ffGetCpuUsageInfo(FFlist* cpuTimes)
{
system_info sysInfo;
if (get_system_info(&sysInfo) != B_OK)
return "get_system_info() failed";
FF_AUTO_FREE cpu_info* cpuInfo = malloc(sizeof(*cpuInfo) * sysInfo.cpu_count);
if (get_cpu_info(0, sysInfo.cpu_count, cpuInfo) != B_OK)
return "get_cpu_info() failed";
uint64_t uptime = (uint64_t) system_time();
for (uint32_t i = 0; i < sysInfo.cpu_count; ++i)
{
FFCpuUsageInfo* info = (FFCpuUsageInfo*) ffListAdd(cpuTimes);
info->inUseAll = (uint64_t) cpuInfo[i].active_time;
info->totalAll = uptime;
}
return NULL;
}
+1 -1
View File
@@ -143,7 +143,7 @@ const char* ffDetectDisksImpl(FFDiskOptions* options, FFlist* disks)
for(struct statfs* fs = buf; fs < buf + size; ++fs)
{
if(__builtin_expect(options->folders.length, 0))
if(__builtin_expect(options->folders.length > 0, 0))
{
if(!ffDiskMatchMountpoint(options, fs->f_mntonname))
continue;
+59
View File
@@ -0,0 +1,59 @@
extern "C"
{
#include "disk.h"
#include "util/stringUtils.h"
}
#include <fs_info.h>
#include <Directory.h>
#include <Path.h>
const char* ffDetectDisksImpl(FFDiskOptions* options, FFlist* disks)
{
int32 pos = 0;
for (dev_t dev; (dev = next_dev(&pos)) >= B_OK;)
{
fs_info fs;
if (fs_stat_dev(dev, &fs) < -1) continue;
node_ref node(fs.dev, fs.root);
BDirectory dir(&node);
BPath path(&dir);
if (path.InitCheck() != B_OK) continue;
if (__builtin_expect(options->folders.length, 0))
{
if (!ffDiskMatchMountpoint(options, path.Path()))
continue;
}
FFDisk* disk = (FFDisk*) ffListAdd(disks);
disk->bytesTotal = (uint64_t)fs.total_blocks * (uint64_t) fs.block_size;
disk->bytesFree = (uint64_t)fs.free_blocks * (uint64_t) fs.block_size;
disk->bytesAvailable = disk->bytesFree;
disk->bytesUsed = 0; // To be filled in ./disk. c
disk->filesTotal = (uint32_t) fs.total_nodes;
disk->filesUsed = (uint32_t) (disk->filesTotal - (uint64_t)fs.free_nodes);
ffStrbufInitS(&disk->mountFrom, fs.device_name);
ffStrbufInitS(&disk->mountpoint, path.Path());
ffStrbufInitS(&disk->filesystem, fs.fsh_name);
ffStrbufInitS(&disk->name, fs.volume_name);
disk->type = FF_DISK_VOLUME_TYPE_NONE;
if (!(fs.flags & B_FS_IS_PERSISTENT))
disk->type = (FFDiskVolumeType) (disk->type | FF_DISK_VOLUME_TYPE_HIDDEN_BIT);
if (fs.flags & B_FS_IS_READONLY)
disk->type = (FFDiskVolumeType) (disk->type | FF_DISK_VOLUME_TYPE_READONLY_BIT);
if (fs.flags & B_FS_IS_REMOVABLE)
disk->type = (FFDiskVolumeType) (disk->type | FF_DISK_VOLUME_TYPE_EXTERNAL_BIT);
if (disk->type == FF_DISK_VOLUME_TYPE_NONE) disk->type = FF_DISK_VOLUME_TYPE_REGULAR_BIT;
disk->createTime = 0;
time_t crTime;
if (dir.GetCreationTime(&crTime) == B_OK)
disk->createTime = (uint64_t) crTime * 1000;
}
return NULL;
}
@@ -0,0 +1,77 @@
extern "C" {
#include "displayserver.h"
}
#include <math.h>
#include <Application.h>
#include <Screen.h>
extern "C" void ffConnectDisplayServerImpl(FFDisplayServerResult* ds);
static void detectDisplays(FFDisplayServerResult* ds)
{
// We need a valid be_app to query the app_server here.
BApplication app("application/x-vnd.fastfetch-cli-fastfetch");
BScreen s{}; // default screen is the main one
bool main = true;
do
{
if (!s.IsValid())
continue;
display_mode mode;
if (s.GetMode(&mode) != B_OK)
continue;
FF_STRBUF_AUTO_DESTROY name = ffStrbufCreateA(128);
monitor_info monitor;
// WARNING: This is experimental new Haiku API
status_t err = s.GetMonitorInfo(&monitor);
if (err == B_OK)
{
ffStrbufSetF(&name, "%s %s", monitor.vendor, monitor.name);
ffStrbufTrimRightSpace(&name);
}
uint32_t width = (uint32_t) s.Frame().Width() + 1;
uint32_t height = (uint32_t) (uint32_t)s.Frame().Height() + 1;
double scaleFactor = (double) 1.0;
FFDisplayResult* res = ffdsAppendDisplay(ds,
width,
height,
(double)mode.timing.pixel_clock * 1000 / (mode.timing.v_total * mode.timing.h_total),
(uint32_t) (width / scaleFactor + .5),
(uint32_t) (height / scaleFactor + .5),
0,
0,
0,
0,
&name,
FF_DISPLAY_TYPE_UNKNOWN,
main,
(uint64_t) s.ID().id,
0,
0,
"BScreen"
);
if (err == B_OK)
{
res->manufactureWeek = monitor.produced.week;
res->manufactureYear = monitor.produced.year;
}
main = false;
} while (s.SetToNext() == B_OK);
return;
}
void ffConnectDisplayServerImpl(FFDisplayServerResult* ds)
{
ffStrbufSetStatic(&ds->wmProcessName, "app_server");
ffStrbufSetStatic(&ds->wmPrettyName, "Application Server");
ffStrbufSetStatic(&ds->dePrettyName, "Application Kit");
detectDisplays(ds);
}
+7 -1
View File
@@ -4,9 +4,15 @@
#include "util/mallocHelper.h"
#include "util/stringUtils.h"
#ifdef __HAIKU__
#define RESOLV_CONF "/system/settings/network/resolv.conf"
#else
#define RESOLV_CONF "/etc/resolv.conf"
#endif
const char* ffDetectDNS(FFDNSOptions* options, FFlist* results)
{
FF_AUTO_CLOSE_FILE FILE* file = fopen(FASTFETCH_TARGET_DIR_ROOT "/etc/resolv.conf", "r");
FF_AUTO_CLOSE_FILE FILE* file = fopen(FASTFETCH_TARGET_DIR_ROOT RESOLV_CONF, "r");
if (!file)
return "fopen (" FASTFETCH_TARGET_DIR_ROOT "/etc/resolv.conf) failed";
+1
View File
@@ -10,6 +10,7 @@ typedef struct FFFontResult
* Linux / BSD: Qt, GTK2, GTK3, GTK4
* MacOS: System, User, System Mono, User Mono
* Windows: Caption, Menu, Message, Status
* Haiku: Plain, Menu, Bold, Mono
* Other: Unset, Unset, Unset, Unset
*/
FFstrbuf fonts[FF_DETECT_FONT_NUM_FONTS];
+63
View File
@@ -0,0 +1,63 @@
extern "C" {
#include "font.h"
}
#include <Application.h>
#include <Font.h>
#include <Menu.h>
extern "C" {
const char* ffDetectFontImpl(FFFontResult* result);
}
static void generateString(FFFontResult* font)
{
const char* types[] = { "Plain", "Menu", "Bold", "Mono" };
for(uint32_t i = 0; i < ARRAY_SIZE(types); ++i)
{
if(i == 0 || !ffStrbufEqual(&font->fonts[i - 1], &font->fonts[i]))
{
if(i > 0)
ffStrbufAppendS(&font->display, "], ");
ffStrbufAppendF(&font->display, "%s [%s", font->fonts[i].chars, types[i]);
}
else
{
ffStrbufAppendS(&font->display, " / ");
ffStrbufAppendS(&font->display, types[i]);
}
}
ffStrbufAppendC(&font->display, ']');
}
const char* ffDetectFontImpl(FFFontResult* result)
{
struct menu_info menuInfo;
const BFont *f;
// We need a valid be_app to query the app_server here.
BApplication app("application/x-vnd.fastfetch-cli-fastfetch");
if ((f = be_plain_font) != NULL)
{
f->GetFamilyAndStyle(&menuInfo.f_family, &menuInfo.f_style);
ffStrbufAppendF(&result->fonts[0], "%s %s (%dpt)", menuInfo.f_family, menuInfo.f_style, (int)f->Size());
}
if (get_menu_info(&menuInfo) == B_OK)
{
ffStrbufAppendF(&result->fonts[1], "%s %s (%dpt)", menuInfo.f_family, menuInfo.f_style, (int)menuInfo.font_size);
}
if ((f = be_bold_font) != NULL)
{
f->GetFamilyAndStyle(&menuInfo.f_family, &menuInfo.f_style);
ffStrbufAppendF(&result->fonts[2], "%s %s (%dpt)", menuInfo.f_family, menuInfo.f_style, (int)f->Size());
}
if ((f = be_fixed_font) != NULL)
{
f->GetFamilyAndStyle(&menuInfo.f_family, &menuInfo.f_style);
ffStrbufAppendF(&result->fonts[3], "%s %s (%dpt)", menuInfo.f_family, menuInfo.f_style, (int)f->Size());
}
generateString(result);
return NULL;
}
+21
View File
@@ -0,0 +1,21 @@
extern "C" {
#include "gamepad.h"
}
#include <Joystick.h>
const char* ffDetectGamepad(FFlist* devices /* List of FFGamepadDevice */)
{
BJoystick js;
for (int32 i = 0, n = js.CountDevices(); i < n; ++i)
{
char name[B_OS_NAME_LENGTH];
if (js.GetDeviceName(i, name) == B_OK)
{
FFGamepadDevice* device = (FFGamepadDevice*) ffListAdd(devices);
ffStrbufInit(&device->serial);
ffStrbufInitS(&device->name, name);
device->battery = 0;
}
}
return NULL;
}
+2 -1
View File
@@ -48,6 +48,7 @@ const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus);
const char* ffGPUGetVendorString(unsigned vendorId);
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__NetBSD__) || defined(__OpenBSD__)
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__HAIKU__)
void ffGPUFillVendorAndName(uint8_t subclass, uint16_t vendor, uint16_t device, FFGPUResult* gpu);
void ffGPUQueryAmdGpuName(uint16_t deviceId, uint8_t revisionId, FFGPUResult* gpu);
#endif
+2 -1
View File
@@ -21,6 +21,7 @@ static double detectGpuTemp(const FFstrbuf* gpuName)
case 1: error = ffDetectSmcTemps(FF_TEMP_GPU_M1X, &result); break;
case 2: error = ffDetectSmcTemps(FF_TEMP_GPU_M2X, &result); break;
case 3: error = ffDetectSmcTemps(FF_TEMP_GPU_M3X, &result); break;
case 4: error = ffDetectSmcTemps(FF_TEMP_GPU_M4X, &result); break;
default: error = "Unsupported Apple Silicon GPU";
}
}
@@ -114,7 +115,7 @@ const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus)
if(ffCfDictGetInt(properties, CFSTR("gpu-core-count"), &gpu->coreCount)) // For Apple
gpu->coreCount = FF_GPU_CORE_COUNT_UNSET;
gpu->coreUsage = 0.0/0.0;
gpu->coreUsage = FF_GPU_CORE_USAGE_UNSET;
CFDictionaryRef perfStatistics = NULL;
uint64_t vramUsed = 0, vramTotal = 0;
if (ffCfDictGetDict(properties, CFSTR("PerformanceStatistics"), &perfStatistics) == NULL)
+3
View File
@@ -67,6 +67,9 @@ const char* ffGpuDetectMetal(FFlist* gpus)
gpu->type = device.location == MTLDeviceLocationBuiltIn ? FF_GPU_TYPE_INTEGRATED : FF_GPU_TYPE_DISCRETE;
gpu->index = (uint32_t) device.locationNumber;
if (device.hasUnifiedMemory && device.recommendedMaxWorkingSetSize > 0)
gpu->shared.total = device.recommendedMaxWorkingSetSize;
#endif
}
return NULL;
+1 -6
View File
@@ -1,7 +1,6 @@
#include "gpu_driver_specific.h"
#include "common/io/io.h"
#include "common/properties.h"
#include <sys/pciio.h>
#include <fcntl.h>
@@ -76,11 +75,7 @@ const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus)
if (gpu->name.length == 0)
{
if (gpu->vendor.chars == FF_GPU_VENDOR_NAME_AMD)
{
char query[32];
snprintf(query, ARRAY_SIZE(query), "%X,\t%X,", (unsigned) pc->pc_device, (unsigned) pc->pc_revid);
ffParsePropFileData("libdrm/amdgpu.ids", query, &gpu->name);
}
ffGPUQueryAmdGpuName(pc->pc_device, pc->pc_revid, gpu);
if (gpu->name.length == 0)
ffGPUFillVendorAndName(pc->pc_subclass, pc->pc_vendor, pc->pc_device, gpu);
}
+2 -6
View File
@@ -2,7 +2,6 @@
#ifdef FF_HAVE_PCIACCESS
#include "common/properties.h"
#include "common/io/io.h"
#include "common/library.h"
@@ -37,17 +36,14 @@ const char* ffDetectGPUImpl(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist*
ffStrbufInit(&gpu->platformApi);
gpu->temperature = FF_GPU_TEMP_UNSET;
gpu->coreCount = FF_GPU_CORE_COUNT_UNSET;
gpu->coreUsage = FF_GPU_CORE_USAGE_UNSET;
gpu->type = FF_GPU_TYPE_UNKNOWN;
gpu->dedicated.total = gpu->dedicated.used = gpu->shared.total = gpu->shared.used = FF_GPU_VMEM_SIZE_UNSET;
gpu->deviceId = ((uint64_t) dev->domain << 6) | ((uint64_t) dev->bus << 4) | ((uint64_t) dev->dev << 2) | (uint64_t) dev->func;
gpu->frequency = FF_GPU_FREQUENCY_UNSET;
if (gpu->vendor.chars == FF_GPU_VENDOR_NAME_AMD)
{
char query[32];
snprintf(query, sizeof(query), "%X,\t%X,", (unsigned) dev->device_id, (unsigned) dev->revision);
ffParsePropFileData("libdrm/amdgpu.ids", query, &gpu->name);
}
ffGPUQueryAmdGpuName(dev->device_id, dev->revision, gpu);
if (gpu->name.length == 0)
{
+43
View File
@@ -0,0 +1,43 @@
#include "gpu.h"
#include "common/io/io.h"
#include <private/drivers/poke.h>
const char* ffDetectGPUImpl(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist* gpus)
{
FF_AUTO_CLOSE_FD int pokefd = open(POKE_DEVICE_FULLNAME, O_RDWR);
if (pokefd < 0) return "open(POKE_DEVICE_FULLNAME) failed";
pci_info dev;
pci_info_args cmd = {
.signature = POKE_SIGNATURE,
.info = &dev,
};
for (cmd.index = 0; ioctl(pokefd, POKE_GET_NTH_PCI_INFO, &cmd, sizeof(cmd)) == B_OK && cmd.status == B_OK; ++cmd.index)
{
if (dev.class_base != 0x03 /*PCI_BASE_CLASS_DISPLAY*/)
continue;
FFGPUResult* gpu = (FFGPUResult*)ffListAdd(gpus);
ffStrbufInitStatic(&gpu->vendor, ffGPUGetVendorString(dev.vendor_id));
ffStrbufInit(&gpu->name);
ffStrbufInit(&gpu->driver);
ffStrbufInit(&gpu->platformApi);
gpu->temperature = FF_GPU_TEMP_UNSET;
gpu->coreCount = FF_GPU_CORE_COUNT_UNSET;
gpu->coreUsage = FF_GPU_CORE_USAGE_UNSET;
gpu->type = FF_GPU_TYPE_UNKNOWN;
gpu->dedicated.total = gpu->dedicated.used = gpu->shared.total = gpu->shared.used = FF_GPU_VMEM_SIZE_UNSET;
gpu->deviceId = ((uint64_t) dev.bus << 4) | ((uint64_t) dev.device << 2) | (uint64_t) dev.function;
gpu->frequency = FF_GPU_FREQUENCY_UNSET;
if (gpu->vendor.chars == FF_GPU_VENDOR_NAME_AMD)
ffGPUQueryAmdGpuName(dev.device_id, dev.revision, gpu);
if (gpu->name.length == 0)
ffGPUFillVendorAndName(dev.class_sub, dev.vendor_id, dev.device_id, gpu);
}
return NULL;
}
+1 -10
View File
@@ -4,7 +4,6 @@
#include "detection/gpu/gpu_driver_specific.h"
#include "common/io/io.h"
#include "common/library.h"
#include "common/properties.h"
#include "util/stringUtils.h"
#include "util/mallocHelper.h"
@@ -491,15 +490,7 @@ static const char* detectPci(const FFGPUOptions* options, FFlist* gpus, FFstrbuf
char* pend;
uint64_t revision = strtoul(buffer->chars, &pend, 16);
if (pend != buffer->chars)
{
char query[32];
snprintf(query, ARRAY_SIZE(query), "%X,\t%X,", (unsigned) deviceId, (unsigned) revision);
#ifdef FF_CUSTOM_AMDGPU_IDS_PATH
ffParsePropFile(FF_STR(FF_CUSTOM_AMDGPU_IDS_PATH), query, &gpu->name);
#else
ffParsePropFileData("libdrm/amdgpu.ids", query, &gpu->name);
#endif
}
ffGPUQueryAmdGpuName((uint16_t) deviceId, (uint8_t) revision, gpu);
}
ffStrbufSubstrBefore(deviceDir, drmDirPathLength);
}
+11
View File
@@ -10,6 +10,7 @@ struct FFNvmlData {
FF_LIBRARY_SYMBOL(nvmlDeviceGetPciInfo_v3)
FF_LIBRARY_SYMBOL(nvmlDeviceGetTemperature)
FF_LIBRARY_SYMBOL(nvmlDeviceGetMemoryInfo_v2)
FF_LIBRARY_SYMBOL(nvmlDeviceGetMemoryInfo)
FF_LIBRARY_SYMBOL(nvmlDeviceGetNumGpuCores)
FF_LIBRARY_SYMBOL(nvmlDeviceGetMaxClockInfo)
FF_LIBRARY_SYMBOL(nvmlDeviceGetUtilizationRates)
@@ -36,6 +37,7 @@ const char* ffDetectNvidiaGpuInfo(const FFGpuDriverCondition* cond, FFGpuDriverR
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libnvml, nvmlData, nvmlDeviceGetPciInfo_v3)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libnvml, nvmlData, nvmlDeviceGetTemperature)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libnvml, nvmlData, nvmlDeviceGetMemoryInfo_v2)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libnvml, nvmlData, nvmlDeviceGetMemoryInfo)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libnvml, nvmlData, nvmlDeviceGetNumGpuCores)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libnvml, nvmlData, nvmlDeviceGetMaxClockInfo)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libnvml, nvmlData, nvmlDeviceGetUtilizationRates)
@@ -130,6 +132,15 @@ const char* ffDetectNvidiaGpuInfo(const FFGpuDriverCondition* cond, FFGpuDriverR
result.memory->total = memory.used + memory.free;
result.memory->used = memory.used;
}
else
{
nvmlMemory_t memory_v1;
if (nvmlData.ffnvmlDeviceGetMemoryInfo(device, &memory_v1) == NVML_SUCCESS)
{
result.memory->total = memory_v1.total;
result.memory->used = memory_v1.used;
}
}
}
if (result.coreCount)
+46
View File
@@ -1,5 +1,6 @@
#include "gpu.h"
#include "common/io/io.h"
#include "common/properties.h"
#include <stdlib.h>
#ifdef __FreeBSD__
@@ -16,6 +17,9 @@
#if FF_HAVE_EMBEDDED_PCIIDS
#include "fastfetch_pciids.c.inc"
#endif
#if FF_HAVE_EMBEDDED_AMDGPUIDS
#include "fastfetch_amdgpuids.c.inc"
#endif
#define FF_STR_INDIR(x) #x
#define FF_STR(x) FF_STR_INDIR(x)
@@ -45,6 +49,8 @@ static const FFstrbuf* loadPciIds()
ffReadFileBuffer(_PATH_LOCALBASE "/share/pciids/pci.ids", &pciids);
#elif __sun
ffReadFileBuffer(FASTFETCH_TARGET_DIR_ROOT "/usr/share/hwdata/pci.ids", &pciids);
#elif __HAIKU__
ffReadFileBuffer(FASTFETCH_TARGET_DIR_ROOT "/system/data/hwdata/pci.ids", &pciids);
#endif
#endif // FF_CUSTOM_PCI_IDS_PATH
@@ -189,3 +195,43 @@ void ffGPUFillVendorAndName(uint8_t subclass, uint16_t vendor, uint16_t device,
#endif
return parsePciIdsFile(loadPciIds(), subclass, vendor, device, gpu);
}
#if FF_HAVE_EMBEDDED_AMDGPUIDS
static inline int amdGpuCmp(const uint32_t* key, const FFArmGpuProduct* element)
{
// Maximum value of *key is 0x00FFFFFF. `(int) *key` should never overflow
return (int) *key - (int) element->id;
}
static bool loadAmdGpuIdsInc(uint16_t deviceId, uint8_t revision, FFGPUResult* gpu)
{
uint32_t key = (deviceId << 8u) | revision;
FFArmGpuProduct* product = bsearch(&key, ffAmdGpuProducts, ARRAY_SIZE(ffAmdGpuProducts), sizeof(*ffAmdGpuProducts), (void*) amdGpuCmp);
if (product)
{
ffStrbufSetS(&gpu->name, product->name);
return true;
}
return false;
}
#endif
static void parseAmdGpuIdsFile(uint16_t deviceId, uint8_t revision, FFGPUResult* gpu)
{
char query[32];
snprintf(query, ARRAY_SIZE(query), "%X,\t%X,", (unsigned) deviceId, (unsigned) revision);
#ifdef FF_CUSTOM_AMDGPU_IDS_PATH
ffParsePropFile(FF_STR(FF_CUSTOM_AMDGPU_IDS_PATH), query, &gpu->name);
#else
ffParsePropFileData("libdrm/amdgpu.ids", query, &gpu->name);
#endif
}
void ffGPUQueryAmdGpuName(uint16_t deviceId, uint8_t revisionId, FFGPUResult* gpu)
{
#if FF_HAVE_EMBEDDED_AMDGPUIDS
bool ok = loadAmdGpuIdsInc(deviceId, revisionId, gpu);
if (ok) return;
#endif
return parseAmdGpuIdsFile(deviceId, revisionId, gpu);
}
+1 -6
View File
@@ -1,5 +1,4 @@
#include "gpu.h"
#include "common/properties.h"
#include "common/io/io.h"
#include "common/processing.h"
@@ -65,11 +64,7 @@ const char* ffDetectGPUImpl(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist*
gpu->frequency = FF_GPU_FREQUENCY_UNSET;
if (gpu->vendor.chars == FF_GPU_VENDOR_NAME_AMD)
{
char query[32];
snprintf(query, ARRAY_SIZE(query), "%X,\t%X,", (unsigned) deviceId, (unsigned) revision);
ffParsePropFileData("libdrm/amdgpu.ids", query, &gpu->name);
}
ffGPUQueryAmdGpuName((uint16_t) deviceId, (uint8_t) revision, gpu);
if (gpu->name.length == 0)
{
+14
View File
@@ -56,6 +56,18 @@ typedef struct {
// https://github.com/NVIDIA/nvidia-settings/issues/78#issuecomment-1012837988
enum { nvmlMemory_v2 = (unsigned int)(sizeof(nvmlMemory_v2_t) | (2 << 24U)) };
// https://docs.nvidia.com/deploy/nvml-api/structnvmlMemory__t.html#structnvmlMemory__t
// Memory allocation information for a device (v1)
typedef struct
{
// Total physical device memory (in bytes)
unsigned long long total;
// Unallocated device memory (in bytes)
unsigned long long free;
// Sum of Reserved and Allocated device memory (in bytes)
unsigned long long used;
} nvmlMemory_t;
// https://docs.nvidia.com/deploy/nvml-api/group__nvmlDeviceEnumvs.html#group__nvmlDeviceEnumvs_1g805c0647be9996589fc5e3f6ff680c64
// Clock types
typedef enum {
@@ -124,6 +136,8 @@ extern nvmlReturn_t nvmlDeviceGetPciInfo_v3(nvmlDevice_t device, nvmlPciInfo_t*
extern nvmlReturn_t nvmlDeviceGetTemperature(nvmlDevice_t device, nvmlTemperatureSensors_t sensorType, unsigned int* temp);
// Retrieves the amount of used, free, reserved and total memory available on the device, in bytes. The reserved amount is supported on version 2 only
extern nvmlReturn_t nvmlDeviceGetMemoryInfo_v2(nvmlDevice_t device, nvmlMemory_v2_t* memory);
// Retrieves the amount of used, free, total memory available on the device, in bytes.
extern nvmlReturn_t nvmlDeviceGetMemoryInfo(nvmlDevice_t device, nvmlMemory_t *memory);
// Gets the device's core count
extern nvmlReturn_t nvmlDeviceGetNumGpuCores(nvmlDevice_t device, unsigned int* numCores);
// Retrieves the maximum clock speeds for the device
@@ -0,0 +1,34 @@
#include "initsystem.h"
#include "util/stringUtils.h"
#include "util/haiku/version.h"
#include "common/io/io.h"
#include <OS.h>
#include <unistd.h>
const char* ffDetectInitSystem(FFInitSystemResult* result)
{
// Since it runs first, registrar does not know about it,
// so we can't query be_roster for it.
const char* path = "/boot/system/servers/launch_daemon";
if (!ffPathExists(path, FF_PATHTYPE_FILE))
return "launch_daemon is not found";
ffStrbufSetStatic(&result->exe, path);
ffStrbufSetStatic(&result->name, "launch_daemon");
team_info teamInfo;
int32 cookie = 0;
while (get_next_team_info(&cookie, &teamInfo) == B_OK)
{
if (ffStrEquals(teamInfo.args, path))
{
result->pid = (uint32_t) teamInfo.team;
break;
}
}
ffGetFileVersion(path, &result->version);
return NULL;
}
+27
View File
@@ -0,0 +1,27 @@
extern "C" {
#include "keyboard.h"
}
#include <interface/Input.h>
#include <support/List.h>
const char* ffDetectKeyboard(FFlist* devices /* List of FFKeyboardDevice */)
{
BList list;
if (get_input_devices(&list) != B_OK)
return "get_input_devices() failed";
for (int32 i = 0, n = list.CountItems(); i < n; i++)
{
BInputDevice *device = (BInputDevice *) list.ItemAt(i);
if (device->Type() != B_KEYBOARD_DEVICE || !device->IsRunning())
continue;
FFKeyboardDevice* item = (FFKeyboardDevice*) ffListAdd(devices);
ffStrbufInit(&item->serial);
ffStrbufInitS(&item->name, device->Name());
}
return NULL;
}
+19 -4
View File
@@ -18,23 +18,27 @@
#include <linux/if.h>
#endif
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__APPLE__) || defined(__NetBSD__)
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__APPLE__) || defined(__NetBSD__) || defined(__HAIKU__)
#include <net/if_media.h>
#include <net/if_dl.h>
#else
#include <netpacket/packet.h>
#endif
#ifdef __sun
#if defined(__sun) || defined(__HAIKU__)
#include <sys/sockio.h>
#endif
static const FFLocalIpNIFlag niFlagOptions[] = {
{ IFF_UP, "UP" },
{ IFF_BROADCAST, "BROADCAST" },
#ifdef IFF_DEBUG
{ IFF_DEBUG, "DEBUG" },
#endif
{ IFF_LOOPBACK, "LOOPBACK" },
{ IFF_POINTOPOINT, "POINTOPOINT" },
#ifdef IFF_RUNNING
{ IFF_RUNNING, "RUNNING" },
#endif
{ IFF_NOARP, "NOARP" },
{ IFF_PROMISC, "PROMISC" },
{ IFF_ALLMULTI, "ALLMULTI" },
@@ -64,6 +68,13 @@ static const FFLocalIpNIFlag niFlagOptions[] = {
#endif
#ifdef IFF_CANTCONFIG
{ IFF_CANTCONFIG, "CANTCONFIG" },
#endif
#ifdef __HAIKU__
{ IFF_AUTOUP, "IAUTOUP" },
{ IFF_SIMPLEX, "SIMPLEX" },
{ IFF_LINK, "LINK" },
{ IFF_AUTO_CONFIGURED, "AUTO_CONFIGURED" },
{ IFF_CONFIGURING, "CONFIGURING" },
#endif
// sentinel
{},
@@ -128,8 +139,12 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
for (struct ifaddrs* ifa = ifAddrStruct; ifa; ifa = ifa->ifa_next)
{
if (!ifa->ifa_addr || !(ifa->ifa_flags & IFF_RUNNING))
if (!ifa->ifa_addr)
continue;
#ifdef IFF_RUNNING
if (!(ifa->ifa_flags & IFF_RUNNING))
continue;
#endif
bool isDefaultRoute = ffStrEquals(defaultRouteIfName, ifa->ifa_name);
if ((options->showType & FF_LOCALIP_TYPE_DEFAULT_ROUTE_ONLY_BIT) && !isDefaultRoute)
@@ -190,7 +205,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
addNewIp(results, ifa->ifa_name, addressBuffer, AF_INET6, isDefaultRoute, flags, !(options->showType & FF_LOCALIP_TYPE_ALL_IPS_BIT));
}
#if __FreeBSD__ || __OpenBSD__ || __APPLE__ || __NetBSD__
#if __FreeBSD__ || __OpenBSD__ || __APPLE__ || __NetBSD__ || __HAIKU__
else if (ifa->ifa_addr->sa_family == AF_LINK)
{
if (!(options->showType & FF_LOCALIP_TYPE_MAC_BIT))
+15
View File
@@ -0,0 +1,15 @@
#include "memory.h"
#include <OS.h>
const char* ffDetectMemory(FFMemoryResult* ram)
{
system_info info;
if (get_system_info(&info) != B_OK)
return "Error getting system info";
ram->bytesTotal = B_PAGE_SIZE * info.max_pages;
ram->bytesUsed = B_PAGE_SIZE * info.used_pages;
return NULL;
}
+27
View File
@@ -0,0 +1,27 @@
extern "C" {
#include "mouse.h"
}
#include <interface/Input.h>
#include <support/List.h>
const char* ffDetectMouse(FFlist* devices /* List of FFMouseDevice */)
{
BList list;
if (get_input_devices(&list) != B_OK)
return "get_input_devices() failed";
for (int32 i = 0, n = list.CountItems(); i < n; i++)
{
BInputDevice *device = (BInputDevice *) list.ItemAt(i);
if (device->Type() != B_POINTING_DEVICE || !device->IsRunning())
continue;
FFMouseDevice* item = (FFMouseDevice*) ffListAdd(devices);
ffStrbufInit(&item->serial);
ffStrbufInitS(&item->name, device->Name());
}
return NULL;
}
-2
View File
@@ -2,8 +2,6 @@
#include "common/time.h"
const char* ffNetIOGetIoCounters(FFlist* result, FFNetIOOptions* options);
static FFlist ioCounters1;
static uint64_t time1;
+1
View File
@@ -17,3 +17,4 @@ typedef struct FFNetIOResult
} FFNetIOResult;
const char* ffDetectNetIO(FFlist* result, FFNetIOOptions* options);
const char* ffNetIOGetIoCounters(FFlist* result, FFNetIOOptions* options);
+49
View File
@@ -0,0 +1,49 @@
extern "C" {
#include "netio.h"
#include "common/netif/netif.h"
}
#include <NetworkInterface.h>
#include <NetworkRoster.h>
const char* ffNetIOGetIoCounters(FFlist* result, FFNetIOOptions* options)
{
BNetworkRoster& roster = BNetworkRoster::Default();
BNetworkInterface interface;
uint32 cookie = 0;
uint32_t defaultRouteIfIndex = ffNetifGetDefaultRouteIfIndex();
while (roster.GetNextInterface(&cookie, interface) == B_OK)
{
if (!interface.Exists())
continue;
bool defaultRoute = interface.Index() == defaultRouteIfIndex;
if (options->defaultRouteOnly && !defaultRoute)
continue;
if (options->namePrefix.length && strncmp(interface.Name(), options->namePrefix.chars, options->namePrefix.length) != 0)
continue;
ifreq_stats stats = {};
if (interface.GetStats(stats) != B_OK) continue;
FFNetIOResult* counters = (FFNetIOResult*) ffListAdd(result);
*counters = (FFNetIOResult) {
.name = ffStrbufCreateS(interface.Name()),
.defaultRoute = defaultRoute,
.txBytes = stats.send.bytes,
.rxBytes = stats.receive.bytes,
.txPackets = stats.send.packets,
.rxPackets = stats.receive.packets,
.rxErrors = stats.receive.errors,
.txErrors = stats.send.errors,
.rxDrops = stats.receive.dropped,
.txDrops = stats.send.dropped
};
}
return NULL;
}
+39
View File
@@ -0,0 +1,39 @@
#include <OpenGLKit.h>
extern "C" {
#include "opengl.h"
#include "common/io/io.h"
#if FF_HAVE_EGL
const char* ffOpenGLDetectByEGL(FFOpenGLResult* result);
#endif
void ffOpenGLHandleResult(FFOpenGLResult* result, __typeof__(&glGetString) ffglGetString);
}
static const char* oglDetectOpenGL(FFOpenGLResult* result)
{
BApplication app("application/x-vnd.fastfetch-cli-fastfetch");
FF_SUPPRESS_IO();
BGLView glView(BRect(), "ff_ogl_view", B_FOLLOW_NONE, B_WILL_DRAW, BGL_RGB);
auto ffglGetString = (decltype(&glGetString)) glView.GetGLProcAddress("glGetString");
if (!ffglGetString) return "glView.GetGLProcAddress() failed";
ffOpenGLHandleResult(result, ffglGetString);
ffStrbufSetStatic(&result->library, "OpenGLKit");
return NULL;
}
const char* ffDetectOpenGL(FFOpenGLOptions* options, FFOpenGLResult* result)
{
if (options->library == FF_OPENGL_LIBRARY_AUTO)
return oglDetectOpenGL(result);
else if (options->library == FF_OPENGL_LIBRARY_EGL)
{
#if FF_HAVE_EGL
return ffOpenGLDetectByEGL(result);
#else
return "fastfetch was compiled without egl support";
#endif
}
else
return "Unsupported OpenGL library";
}
+73
View File
@@ -0,0 +1,73 @@
#include "os.h"
#include <OS.h>
#include <image.h>
void ffDetectOSImpl(FFOSResult* os)
{
ffStrbufSetStatic(&os->name, "Haiku");
ffStrbufSetStatic(&os->id, "haiku");
image_info image;
int32 cookie = 0;
while (get_next_image_info(B_SYSTEM_TEAM, &cookie, &image) == B_OK)
{
int32 ver = image.api_version;
if (ver == 0) continue;
// https://github.com/haiku/haiku/blob/e63683b2fb337d2034059a7e053c170eaf978142/headers/os/BeBuild.h#L36
if (ver < B_HAIKU_VERSION_1_ALPHA_1)
{
switch (ver)
{
case B_HAIKU_VERSION_BEOS:
ffStrbufSetStatic(&os->version, "BEOS");
break;
case B_HAIKU_VERSION_BONE:
ffStrbufSetStatic(&os->version, "BONE");
break;
case B_HAIKU_VERSION_DANO:
ffStrbufSetStatic(&os->version, "DANO");
break;
}
}
else
{
int32 relVer = ver / 0x10000;
ver %= 0x10000;
if (ver == 0)
{
ffStrbufSetF(&os->version, "R%d", relVer);
}
else
{
relVer++;
bool isPre = !!(ver & 1);
if (ver < B_HAIKU_VERSION_1_PRE_BETA_1)
{
int32 alphaVer = ver / 0x100;
if (isPre)
ffStrbufSetF(&os->version, "R%dA%d-", relVer, alphaVer + 1);
else
ffStrbufSetF(&os->version, "R%dA%d", relVer, alphaVer);
}
else if (ver < 0x00010000 /* B_HAIKU_VERSION_1 */)
{
int32 betaVer = (ver - B_HAIKU_VERSION_1_ALPHA_4) / 0x100;
if (isPre)
ffStrbufSetF(&os->version, "R%dB%d-", relVer, betaVer + 1);
else
ffStrbufSetF(&os->version, "R%dB%d", relVer, betaVer);
}
}
}
}
if (!os->version.length)
{
system_info sys;
if (get_system_info(&sys) == B_OK)
ffStrbufAppendF(&os->version, "R%ldx", sys.kernel_version);
}
}
+7 -4
View File
@@ -41,10 +41,13 @@ static bool parseOsRelease(const char* fileName, FFOSResult* result)
// Common logic for detecting Armbian image version
FF_MAYBE_UNUSED static bool detectArmbianVersion(FFOSResult* result)
{
if (ffStrbufStartsWithS(&result->prettyName, "Armbian ")) // Official Armbian release images
// Possible values `PRETTY_NAME` starts with on Armbian:
// - `Armbian` for official releases
// - `Armbian_community` for community releases
// - `Armbian_Security` for images with kali repo added
// - `Armbian-unofficial` for an unofficial image built from source, e.g. during development and testing
if (ffStrbufStartsWithS(&result->prettyName, "Armbian"))
ffStrbufSetS(&result->name, "Armbian");
else if (ffStrbufStartsWithS(&result->prettyName, "Armbian-unofficial ")) // Unofficial Armbian image built from source
ffStrbufSetS(&result->name, "Armbian (custom build)");
else
return false;
ffStrbufSet(&result->idLike, &result->id);
@@ -258,7 +261,7 @@ static void detectOS(FFOSResult* os)
return;
#endif
if(instance.config.general.escapeBedrock && parseOsRelease(FASTFETCH_TARGET_DIR_ROOT "/bedrock" FASTFETCH_TARGET_DIR_ETC "/bedrock-release", os))
if(parseOsRelease(FASTFETCH_TARGET_DIR_ROOT "/bedrock" FASTFETCH_TARGET_DIR_ETC "/bedrock-release", os))
{
if(os->id.length == 0)
ffStrbufAppendS(&os->id, "bedrock");
+1 -1
View File
@@ -100,7 +100,7 @@ uint32_t ffPackagesGetNumElements(const char* dirname, bool isdir)
{
bool ok = false;
#ifndef __sun
#if !defined(__sun) && !defined(__HAIKU__)
if(entry->d_type != DT_UNKNOWN && entry->d_type != DT_LNK)
ok = entry->d_type == (isdir ? DT_DIR : DT_REG);
else
+2
View File
@@ -18,6 +18,8 @@ typedef struct FFPackagesResult
uint32_t guixHome;
uint32_t guixSystem;
uint32_t guixUser;
uint32_t hpkgSystem;
uint32_t hpkgUser;
uint32_t linglong;
uint32_t lpkg;
uint32_t lpkgbuild;
+14
View File
@@ -0,0 +1,14 @@
#include "packages.h"
#include "common/io/io.h"
void ffDetectPackagesImpl(FFPackagesResult* result, FFPackagesOptions* options)
{
// TODO: Use the Package Kit C++ API instead (would account for disabled packages)
if (!(options->disabled & FF_PACKAGES_FLAG_HPKG_BIT))
{
result->hpkgSystem = ffPackagesGetNumElements(FASTFETCH_TARGET_DIR_ROOT "/system/packages", false);
result->hpkgUser = ffPackagesGetNumElements(FASTFETCH_TARGET_DIR_ROOT "/boot/home/config/packages", false);
}
}
@@ -0,0 +1,91 @@
#include "physicaldisk.h"
#include "common/io/io.h"
#include "util/stringUtils.h"
#include <OS.h>
#include <StorageDefs.h>
#include <Drivers.h>
#include <sys/ioctl.h>
static const char* detectDisk(FFstrbuf* path, const char* diskType, FFlist* result)
{
FF_AUTO_CLOSE_FD int rawfd = open(path->chars, O_RDONLY);
if (rawfd < 0) return "detectDisk: open(rawfd) failed";
device_geometry geometry;
if (ioctl(rawfd, B_GET_GEOMETRY, &geometry, sizeof(geometry)) < 0)
return "ioctl(B_GET_GEOMETRY) failed";
char name[B_OS_NAME_LENGTH];
if (ioctl(rawfd, B_GET_DEVICE_NAME, name, sizeof(name)) != 0)
{
// ioctl reports `not a tty` for NVME drives for some reason
snprintf(name, sizeof(name), "Unknown %s drive", diskType);
}
FFPhysicalDiskResult* device = (FFPhysicalDiskResult*) ffListAdd(result);
ffStrbufInitS(&device->name, name);
ffStrbufInitCopy(&device->devPath, path);
ffStrbufInit(&device->serial);
ffStrbufInit(&device->revision);
ffStrbufInitS(&device->interconnect, diskType);
device->temperature = FF_PHYSICALDISK_TEMP_UNSET;
device->type = FF_PHYSICALDISK_TYPE_NONE;
device->type |= (geometry.read_only ? FF_PHYSICALDISK_TYPE_READONLY : FF_PHYSICALDISK_TYPE_READWRITE) |
(geometry.removable ? FF_PHYSICALDISK_TYPE_REMOVABLE : FF_PHYSICALDISK_TYPE_FIXED);
device->size = (uint64_t) geometry.cylinder_count * geometry.head_count * geometry.sectors_per_track * geometry.bytes_per_sector;
return NULL;
}
static const char* searchRawDeviceFile(FFstrbuf* path, const char* diskType, FFlist* result)
{
FF_AUTO_CLOSE_DIR DIR* dir = opendir(path->chars);
if (!dir) return "detectDiskType: opendir() failed";
uint32_t baseLen = path->length;
struct dirent* entry;
while((entry = readdir(dir)))
{
if (entry->d_name[0] == '.') continue;
ffStrbufAppendC(path, '/');
ffStrbufAppendS(path, entry->d_name);
struct stat st;
if (stat(path->chars, &st) != 0)
{
ffStrbufSubstrBefore(path, baseLen);
continue;
}
if (S_ISDIR(st.st_mode))
searchRawDeviceFile(path, diskType, result);
else if (ffStrEquals(entry->d_name, "raw"))
detectDisk(path, diskType, result);
ffStrbufSubstrBefore(path, baseLen);
}
return NULL;
}
const char* ffDetectPhysicalDisk(FFlist* result, FF_MAYBE_UNUSED FFPhysicalDiskOptions* options)
{
FF_AUTO_CLOSE_DIR DIR* dir = opendir("/dev/disk");
if (!dir) return "opendir(/dev/disk) failed";
FF_STRBUF_AUTO_DESTROY path = ffStrbufCreateA(64);
ffStrbufAppendS(&path, "/dev/disk/");
uint32_t baseLen = path.length;
struct dirent* entry;
while((entry = readdir(dir)))
{
if (entry->d_name[0] == '.' || ffStrEquals(entry->d_name, "virtual")) continue;
ffStrbufAppendS(&path, entry->d_name);
searchRawDeviceFile(&path, entry->d_name, result);
ffStrbufSubstrBefore(&path, baseLen);
}
return NULL;
}
+14
View File
@@ -0,0 +1,14 @@
#include "processes.h"
#include <OS.h>
const char* ffDetectProcesses(uint32_t* result)
{
system_info info;
if (get_system_info(&info) != B_OK)
return "Error getting system info";
*result = info.used_teams;
return NULL;
}
+35 -8
View File
@@ -4,29 +4,54 @@
#include <fcntl.h>
#include <sys/soundcard.h>
#include <unistd.h>
const char* ffDetectSound(FFlist* devices)
{
char path[] = "/dev/mixer0";
#ifndef __NetBSD__
int defaultDev = ffSysctlGetInt("hw.snd.default_unit", -1);
if (defaultDev == -1)
return "sysctl(hw.snd.default_unit) failed";
#else
int defaultDev;
{
char mixerp[12];
ssize_t plen = readlink("/dev/mixer", mixerp, ARRAY_SIZE(mixerp));
if (plen < 6)
return "readlink(/dev/mixer) failed";
defaultDev = mixerp[plen - 1] - '0';
if (defaultDev < 0 || defaultDev > 9)
return "Invalid mixer device";
}
#endif
for (int idev = 0; idev <= 9; ++idev)
char path[] = "/dev/mixer0";
struct oss_sysinfo info = { .nummixers = 9 };
for (int idev = 0; idev <= info.nummixers; ++idev)
{
path[strlen("/dev/mixer")] = (char) ('0' + idev);
FF_AUTO_CLOSE_FD int fd = open(path, O_RDWR);
if (fd < 0) break;
if (idev == 0)
{
if (ioctl(fd, SNDCTL_SYSINFO, &info) != 0)
return "ioctl(SNDCTL_SYSINFO) failed";
}
uint32_t devmask = 0;
if (ioctl(fd, SOUND_MIXER_READ_DEVMASK, &devmask) < 0)
continue;
if (!(devmask & SOUND_MASK_VOLUME))
continue;
#if defined(SOUND_MIXER_MUTE) && (SOUND_MIXER_MUTE != SOUND_MIXER_NONE)
#define FF_SOUND_HAVE_MIXER_MUTE 1
uint32_t mutemask = 0;
ioctl(fd, SOUND_MIXER_READ_MUTE, &mutemask); // doesn't seem to be available on DragonFly
ioctl(fd, SOUND_MIXER_READ_MUTE, &mutemask);
#endif
struct oss_card_info ci = { .card = idev };
if (ioctl(fd, SNDCTL_CARDINFO, &ci) < 0)
@@ -40,10 +65,12 @@ const char* ffDetectSound(FFlist* devices)
ffStrbufInitS(&device->identifier, path);
ffStrbufInitF(&device->name, "%s %s", ci.longname, ci.hw_info);
ffStrbufTrimRightSpace(&device->name);
ffStrbufInitStatic(&device->platformApi, "OSS");
device->volume = mutemask & SOUND_MASK_VOLUME
? 0
: ((uint8_t) volume /*left*/ + (uint8_t) (volume >> 8) /*right*/) / 2;
ffStrbufInitF(&device->platformApi, "%s %s", info.product, info.version);
device->volume =
#ifdef FF_SOUND_HAVE_MIXER_MUTE
mutemask & SOUND_MASK_VOLUME ? 0 :
#endif
((uint8_t) volume /*left*/ + (uint8_t) (volume >> 8) /*right*/) / 2;
device->active = true;
device->main = defaultDev == idev;
}
+87
View File
@@ -0,0 +1,87 @@
extern "C"
{
#include "sound.h"
#include "util/stringUtils.h"
}
#include <MediaAddOn.h>
#include <MediaNode.h>
#include <MediaRoster.h>
#include <ParameterWeb.h>
const char* ffDetectSound(FFlist* devices /* List of FFSoundDevice */)
{
BMediaRoster* roster = BMediaRoster::Roster();
media_node mediaNode;
live_node_info liveInfo;
dormant_node_info dormantInfo;
if (roster->GetAudioOutput(&mediaNode) != B_OK)
return NULL;
FFSoundDevice* device = (FFSoundDevice*)ffListAdd(devices);
ffStrbufInit(&device->identifier);
if (roster->GetDormantNodeFor(mediaNode, &dormantInfo) == B_OK)
ffStrbufAppendS(&device->identifier, dormantInfo.name);
ffStrbufInit(&device->name);
if (roster->GetLiveNodeInfo(mediaNode, &liveInfo) == B_OK)
{
ffStrbufAppendS(&device->name, liveInfo.name);
ffStrbufTrimRightSpace(&device->name);
}
ffStrbufInitStatic(&device->platformApi, "MediaKit");
// We'll check the Mixer actually
device->volume = 0;
device->active = true;
device->main = true;
roster->ReleaseNode(mediaNode);
media_node mixer;
if (roster->GetAudioMixer(&mixer) != B_OK)
return NULL;
BParameterWeb *web;
status_t status = roster->GetParameterWebFor(mixer, &web);
roster->ReleaseNode(mixer); // the web is all we need :-)
if (status != B_OK)
return NULL;
BContinuousParameter *gain = NULL;
BParameter *mute = NULL;
BParameter *parameter;
for (int32 index = 0; (parameter = web->ParameterAt(index)) != NULL; index++)
{
// assume the mute preceding master gain control
if (ffStrEquals(parameter->Kind(), B_MUTE))
mute = parameter;
if (ffStrEquals(parameter->Kind(), B_MASTER_GAIN))
{
// Can not use dynamic_cast due to fno-rtti
//gain = dynamic_cast<BContinuousParameter *>(parameter);
gain = (BContinuousParameter *)(parameter);
break;
}
}
if (gain == NULL)
return NULL;
bigtime_t when;
size_t size;
if (mute)
{
int32 isMute = false;
size = sizeof(isMute);
if (mute->GetValue(&isMute, &size, &when) == B_OK && isMute)
return NULL;
}
float volume = 0.0;
size = sizeof(volume);
if (gain->GetValue(&volume, &size, &when) == B_OK)
device->volume = (uint8_t) (100 * (volume - gain->MinValue()) / (gain->MaxValue() - gain->MinValue()));
return NULL;
}
+1 -1
View File
@@ -18,7 +18,7 @@ static void paSinkInfoCallback(pa_context *c, const pa_sink_info *i, int eol, vo
ffStrbufInitS(&device->name, i->description);
ffStrbufTrimRightSpace(&device->name);
ffStrbufTrimLeft(&device->name, ' ');
device->volume = i->mute ? 0 : (uint8_t) (i->volume.values[0] * 100 / PA_VOLUME_NORM);
device->volume = i->mute ? 0 : (uint8_t) ((i->volume.values[0] * 100 + PA_VOLUME_NORM / 2 /*round*/) / PA_VOLUME_NORM);
device->active = i->active_port && i->active_port->available != PA_PORT_AVAILABLE_NO;
device->main = false;
}
+50
View File
@@ -0,0 +1,50 @@
#include "sound.h"
#include "common/io/io.h"
#include <fcntl.h>
#include <stdint.h>
#include <unistd.h>
#include <sys/audioio.h>
#include <sys/ioctl.h>
const char* ffDetectSound(FFlist* devices)
{
int defaultDev;
{
char audiop[12];
ssize_t plen = readlink("/dev/audio", audiop, ARRAY_SIZE(audiop));
if (plen < (ssize_t) strlen("audioN"))
return "readlink(/dev/audio) failed";
defaultDev = audiop[plen - 1] - '0';
if (defaultDev < 0 || defaultDev > 9)
return "Invalid audio device";
}
char path[] = "/dev/audio0";
for (int idev = 0; idev < 9; ++idev)
{
path[strlen("/dev/audio")] = (char) ('0' + idev);
FF_AUTO_CLOSE_FD int fd = open(path, O_RDWR);
if (fd < 0) break;
audio_device_t ad;
if (ioctl(fd, AUDIO_GETDEV, &ad) < 0)
continue;
audio_info_t ai;
if (ioctl(fd, AUDIO_GETINFO, &ai) < 0)
continue;
FFSoundDevice* device = ffListAdd(devices);
ffStrbufInitS(&device->identifier, path);
ffStrbufInitS(&device->name, ad.name);
ffStrbufTrimRightSpace(&device->name);
ffStrbufInitF(&device->platformApi, "%s", "SunAudio");
device->volume = (uint8_t) ((ai.play.gain * 100 + AUDIO_MAX_GAIN / 2) / AUDIO_MAX_GAIN);
device->active = true;
device->main = defaultDev == idev;
}
return NULL;
}
+86
View File
@@ -0,0 +1,86 @@
#include "sound.h"
#include "util/stringUtils.h"
#include <fcntl.h>
#include <sndio.h>
static void close_hdl(struct sioctl_hdl** phdl)
{
assert(phdl);
if (*phdl) sioctl_close(*phdl);
}
enum { MAX_CHANNEL_NUM = 8 };
typedef struct FFSoundDeviceBundle
{
char name[SIOCTL_DISPLAYMAX];
double level[MAX_CHANNEL_NUM];
uint8_t iLevel;
bool mute[MAX_CHANNEL_NUM];
uint8_t iMute;
} FFSoundDeviceBundle;
static void enumerate_props(FFSoundDeviceBundle* bundle, struct sioctl_desc* desc, int val)
{
if (!desc) return;
if (desc->type == SIOCTL_SEL)
{
if (desc->display[0] != '\0' && ffStrEquals(desc->node0.name, "server"))
ffStrCopy(bundle->name, desc->display, SIOCTL_DISPLAYMAX);
return;
}
if (desc->type != SIOCTL_NUM && desc->type != SIOCTL_SW)
return;
if (!ffStrEquals(desc->node0.name, "output"))
return;
if (ffStrEquals(desc->func, "level"))
{
if (__builtin_expect(bundle->iLevel == MAX_CHANNEL_NUM, false))
return;
bundle->level[bundle->iLevel] = (double) val / (double) desc->maxval;
++bundle->iLevel;
}
else if (ffStrEquals(desc->func, "mute"))
{
if (__builtin_expect(bundle->iMute == MAX_CHANNEL_NUM, false))
return;
bundle->mute[bundle->iMute] = !!val;
++bundle->iMute;
}
}
const char* ffDetectSound(FFlist* devices)
{
__attribute__((__cleanup__(close_hdl))) struct sioctl_hdl* hdl = sioctl_open(SIO_DEVANY, SIOCTL_READ, 0);
if (!hdl) return "sio_open() failed";
FFSoundDeviceBundle bundle = {};
if (sioctl_ondesc(hdl, (void*) enumerate_props, &bundle) == 0)
return "sioctl_ondesc() failed";
if (bundle.iLevel != bundle.iMute || bundle.iLevel == 0)
return "Unexpecd sioctl_ondesc() result";
FFSoundDevice* device = ffListAdd(devices);
ffStrbufInitS(&device->name, bundle.name);
ffStrbufInitS(&device->identifier, SIO_DEVANY);
ffStrbufInitStatic(&device->platformApi, "sndio");
device->active = true;
device->main = true;
device->volume = 0;
double totalLevel = 0;
for (uint8_t i = 0; i < bundle.iLevel; ++i)
{
if (!bundle.mute[i])
totalLevel += bundle.level[i];
}
device->volume = (uint8_t) ((totalLevel * 100 + bundle.iLevel / 2) / bundle.iLevel);
return NULL;
}
+17
View File
@@ -0,0 +1,17 @@
#include "swap.h"
#include <OS.h>
enum { FFMaxNSwap = 8 };
const char* ffDetectSwap(FFSwapResult* swap)
{
system_info info;
if (get_system_info(&info) != B_OK)
return "Error getting system info";
swap->bytesTotal = B_PAGE_SIZE * info.max_swap_pages;
swap->bytesUsed = B_PAGE_SIZE * (info.max_swap_pages - info.free_swap_pages);
return NULL;
}
@@ -418,6 +418,21 @@ static void detectWestonTerminal(FFTerminalFontResult* terminalFont)
ffFontInitValues(&terminalFont->font, font.chars, size.chars);
}
#ifdef __HAIKU__
static void detectHaikuTerminal(FFTerminalFontResult* terminalFont)
{
FF_STRBUF_AUTO_DESTROY font = ffStrbufCreate();
FF_STRBUF_AUTO_DESTROY size = ffStrbufCreate();
ffParsePropFileConfigValues("Terminal/Default", 2, (FFpropquery[]) {
{"\"Half Font Family\" , ", &font},
{"\"Half Font Size\" , ", &size},
});
if (!font.length) ffStrbufSetStatic(&font, "Noto Sans Mono");
if (!size.length) ffStrbufSetStatic(&size, "12");
ffFontInitValues(&terminalFont->font, font.chars, size.chars);
}
#endif
void ffDetectTerminalFontPlatform(const FFTerminalResult* terminal, FFTerminalFontResult* terminalFont)
{
if(ffStrbufIgnCaseEqualS(&terminal->processName, "konsole"))
@@ -455,5 +470,9 @@ void ffDetectTerminalFontPlatform(const FFTerminalResult* terminal, FFTerminalFo
else if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "terminator"))
detectTerminator(terminalFont);
else if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "sakura"))
detectFromConfigFile("sakura/sakura.conf", "font=", terminalFont);;
detectFromConfigFile("sakura/sakura.conf", "font=", terminalFont);
#ifdef __HAIKU__
else if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "Terminal"))
detectHaikuTerminal(terminalFont);
#endif
}
+14 -1
View File
@@ -27,6 +27,8 @@ static bool getFileVersion(const FFstrbuf* exePath, FFstrbuf* version)
if (len <= 0) return false;
return ffGetFileVersion(exePathW, version);
}
#elif __HAIKU__
#include "util/haiku/version.h"
#endif
static bool getExeVersionRaw(FFstrbuf* exe, FFstrbuf* version)
@@ -669,6 +671,12 @@ FF_MAYBE_UNUSED static bool getTerminalVersionPtyxis(FF_MAYBE_UNUSED FFstrbuf* e
FF_MAYBE_UNUSED static bool getTerminalVersionTilix(FFstrbuf* exe, FFstrbuf* version)
{
if (exe->chars[0] == '/')
{
ffBinaryExtractStrings(exe->chars, extractGeneralVersion, version, (uint32_t) strlen("0.0.0"));
if (version->length) return true;
}
if(ffProcessAppendStdOut(version, (char* const[]) {
exe->chars,
"--version",
@@ -741,7 +749,7 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe
#endif
#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__sun) || defined(__NetBSD__)
#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__sun) || defined(__NetBSD__) || defined(__HAIKU__)
if(ffStrbufStartsWithIgnCaseS(processName, "gnome-terminal"))
return getTerminalVersionGnome(exe, version);
@@ -841,6 +849,11 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe
if(ffStrbufStartsWithIgnCaseS(processName, "zed"))
return getTerminalVersionZed(exe, version);
#if __HAIKU__
if(ffStrbufEqualS(processName, "Terminal"))
return ffGetFileVersion(exe->chars, version);
#endif
const char* termProgramVersion = getenv("TERM_PROGRAM_VERSION");
if(termProgramVersion)
{
@@ -359,6 +359,11 @@ static void setTerminalInfoDetails(FFTerminalResult* result)
else if(ffStrbufEqualS(&result->processName, "WarpTerminal"))
ffStrbufInitStatic(&result->prettyName, "Warp");
#elif defined(__HAIKU__)
else if(ffStrbufEqualS(&result->processName, "Terminal"))
ffStrbufInitStatic(&result->prettyName, "Haiku Terminal");
#endif
else if(strncmp(result->exeName, result->processName.chars, result->processName.length) == 0) // if exeName starts with processName, print it. Otherwise print processName
+9
View File
@@ -0,0 +1,9 @@
#include "uptime.h"
#include "common/time.h"
const char* ffDetectUptime(FFUptimeResult* result)
{
result->uptime = (uint64_t) system_time() / 1000;
result->bootTime = ffTimeGetNow() - result->uptime;
return NULL;
}
+14 -2
View File
@@ -4,6 +4,8 @@
#define FF_ARCHITECTURE "x86_64"
#elif defined(__i386__)
#define FF_ARCHITECTURE "i386"
#elif defined(__ia64__)
#define FF_ARCHITECTURE "ia64"
#elif defined(__aarch64__)
#define FF_ARCHITECTURE "aarch64"
#elif defined(__arm__)
@@ -18,8 +20,16 @@
#define FF_ARCHITECTURE "s390x"
#elif defined(__loongarch__)
#define FF_ARCHITECTURE "loongarch"
#elif defined(__sparc__)
#define FF_ARCHITECTURE "sparc"
#elif defined(__alpha__)
#define FF_ARCHITECTURE "alpha"
#elif defined(__hppa__)
#define FF_ARCHITECTURE "hppa"
#elif defined(__m68k__)
#define FF_ARCHITECTURE "m68k"
#else
#define FF_ARCHITECTURE "unknown"
#define FF_ARCHITECTURE "Unknown"
#endif
#if defined(__ANDROID__)
@@ -42,8 +52,10 @@
#define FF_SYSNAME "OpenBSD"
#elif defined(__NetBSD__)
#define FF_SYSNAME "NetBSD"
#elif defined(__HAIKU__)
#define FF_SYSNAME "Haiku"
#else
#define FF_SYSNAME "unknown"
#define FF_SYSNAME "Unknown"
#endif
#define FF_STR_INDIR(x) #x
+11
View File
@@ -19,6 +19,17 @@ void ffPrepareWeather(FFWeatherOptions* options)
ffStrbufAppend(&path, &options->location);
ffStrbufAppendS(&path, "?format=");
ffStrbufAppend(&path, &options->outputFormat);
switch (instance.config.display.tempUnit)
{
case FF_TEMPERATURE_UNIT_CELSIUS:
ffStrbufAppendS(&path, "&m");
break;
case FF_TEMPERATURE_UNIT_FAHRENHEIT:
ffStrbufAppendS(&path, "&u");
break;
default:
break;
}
status = ffNetworkingSendHttpRequest(&state, "wttr.in", path.chars, "User-Agent: curl/0.0.0\r\n");
}
+2 -2
View File
@@ -1,7 +1,7 @@
##############
##############
######################
##########################
##+$2###$1#######################
##+$2####$1#######################
#####$2#$1*$2###%+$1######################
########$2%$1*#$2%#####$1###################
##########$2##$1*#*$2#######%+$1##############
+20
View File
@@ -0,0 +1,20 @@
O '
lk: ;xX. .0K '
lodk ;lldK' .lld0O :okX;
lloo0 ;lllld0: .lllllxKx :clllkKk
llllo, ;llllloox .clllllloxK :cclllllx0N
lllll, ;llllllll .cclllllllo' :cccclllllld
cllll, ;cclllllc .ccccllllll' :cccccclllll
cllll, ;cccllllc ccccccllll' ::cccccclllc
ccccl, ;cccccllc :cccccccll' :::ccccccclc
ccccc, ;cccccccc ::cccccccl' :::::ccccccc
:cccc, ;:ccccccc ::::cccccc' :::::::ccccc
:cccc, ;:::ccccc ::::::cccc' :;::::::ccc:
:::cc, ;:::::ccc ;:::::::cc' :;;:::::::c:
:::::, ;:::::::c ;;:::::::c' :;;;;:::::::
:::::, ;;::::::c ;;;;::::::' :;;;;;::::::
;::::, ,;;;::::c ,;;;;;::::' ';;;;;;::::
';;::, ;;;;::: .;;;;;::' .;;;;;::
;;;, ;;;;: .;;;:' ;;;:
,;, ,;: ';'
.,
+6 -6
View File
@@ -1,12 +1,12 @@
$3 MMMM MMMM
MMMM MMMM
MMMM MMMM
MMMM MMMM
MMMM$4 .ciO| /YMMMMM*"
$3 MMMM$4 .cOMMMMM|/MMMMM/`
MMMM MMMM
MMMM$2 .ciO| /YMMMMM*"
$1 MMMM$2 .cOMMMMM|/MMMMM/`
, ,iMM|/MMMMMMMMMMMMMMM*
`*.__,-cMMMMMMMMMMMMMMMMM/`$3.MMM
MM$4MMMMMMM/`:MMM/ $3MMMM
`*.__,-cMMMMMMMMMMMMMMMMM/`$1.MMM
MM$2MMMMMMM/`:MMM/ $1MMMM
MMMM MMMM
MMMM MMMM
"""" """"
"""" """"
+17
View File
@@ -0,0 +1,17 @@
${c2} :dc'
'l:;'${c1},${c2}'ck. .;dc:.
co ${c1}..${c2}k. .;; ':o.
co ${c1}..${c2}k. ol ${c1}.${c2}0.
co ${c1}..${c2}k. oc ${c1}..${c2}0.
co ${c1}..${c2}k. oc ${c1}..${c2}0.
.Ol,. co ${c1}...''${c2}Oc;kkodxOdddOoc,.
';lxxlxOdxkxk0kd${c1}oooll${c2}dl${c1}ccc:${c2}clxd;
..${c1}oOolllllccccccc:::::${c2}od;
cx:ooc${c1}:::::::;${c2}cooolcX.
cd${c1}.${c2}''cloxdoollc' ${c1}...${c2}0.
cd${c1}......${c2}k;${c1}.${c2}xl${c1}.... .${c2}0.
.::c${c1};..${c2}cx;${c1}.${c2}xo${c1}..... .${c2}0.
'::c'${c1}...${c2}do${c1}..... .${c2}K,
cd,.${c1}....:${c2}O,${c1}
':clod:'${c1}
${c1}
+19
View File
@@ -0,0 +1,19 @@
********
*****************
**********************
**************************
********** **********
******* *********
****** ********
******* *******
********* ****** *******
***************** ******
*************** *******
*********** *******
********
********
*********
**********
*********
*******
***
+18 -20
View File
@@ -1,20 +1,18 @@
ROSAROSAROSAROSAR
ROSA AROS
ROS SAROSAROSAROSAR AROS
RO ROSAROSAROSAROSAROSAR RO
ARO AROSAROSAROSARO AROS ROS
ARO ROSAROS OSAR ROSA ROS
RO AROSA ROSAROSAROSA ROSAR RO
RO ROSAR ROSAROSAROSAR R ROSARO RO
RO ROSA AROSAROSAROSA AR ROSARO AR
RO AROS ROSAROSAROSA ROS AROSARO AR
RO AROS ROSAROSARO ROSARO ROSARO AR
RO ROS AROSAROS ROSAROSA AROSAR AR
RO ROSA ROS ROSAROSAR ROSARO RO
RO ROS AROSAROSAROSA ROSARO AR
ARO ROSA ROSAROSAROS AROSAR ARO
ARO OROSA R ROSAROS ROS
RO AROSAROS AROSAROSAR RO
AROS AROSAROSAROSARO AROS
ROSA SARO
ROSAROSAROSAROSAR
${c2} ⢀⣀⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣄
${c2} ⠈⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇
${c1} ⢀⣤⣄ ${c2}⣿⣿⣿⡇
${c1} ⢀⣴⣿⣿⣿⠗ ${c2}⣿⣿⣿⡇
${c1} ⢠⣾⣿⣿⡿⠁ ${c2}⣿⣿⣿⡇
${c1} ⢠⣿⣿⣿⡟ ${c2}⣿⣿⣿⡇
${c1}⢀⣿⣿⣿⡿ ${c2}⣿⣿⣿⡇
${c1}⢸⣿⣿⣿⠃ ${c2}⣿⣿⣿⡇
${c1}⢸⣿⣿⣿ ${c2}⣿⣿⣿⡇
${c1}⢸⣿⣿⣿ ${c2}⣿⣿⣿⡇
${c1}⢸⣿⣿⣿⡄ ${c2}⠙⢿⡿
${c1}⠘⣿⣿⣿⣷
⠘⣿⣿⣿⣦
⠙⣿⣿⣿⣷⡀ ⢀⡀
⠘⢿⣿⣿⣿⣦⣄ ⣠⣴⣿⣿⡦
⠙⢿⣿⣿⣿⣷⣦⣀⣀⡀ ⢀⣀⣠⣴⣾⣿⣿⣿⠟⠁
⠈⠙⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠋⠁
⠈⠙⠛⠿⠿⠿⠿⠿⠿⠟⠛⠋⠁
+69 -39
View File
@@ -384,11 +384,11 @@ static const FFlogo A[] = {
.type = FF_LOGO_LINE_TYPE_ALTER_BIT,
.lines = FASTFETCH_DATATEXT_LOGO_ARCH_OLD,
.colors = {
FF_COLOR_FG_CYAN,
FF_COLOR_FG_BLUE,
FF_COLOR_FG_WHITE,
},
.colorTitle = FF_COLOR_FG_DEFAULT,
.colorKeys = FF_COLOR_FG_CYAN,
.colorKeys = FF_COLOR_FG_BLUE,
},
// Archlabs
{
@@ -954,9 +954,9 @@ static const FFlogo C[] = {
.colorKeys = FF_COLOR_FG_GREEN,
.colorTitle = FF_COLOR_FG_WHITE,
},
// Chimera Linux
// Chimera
{
.names = {"Chimera Linux"},
.names = {"Chimera"},
.lines = FASTFETCH_DATATEXT_LOGO_CHIMERA_LINUX,
.colors = {
FF_COLOR_FG_RED,
@@ -1428,10 +1428,10 @@ static const FFlogo E[] = {
.colorKeys = FF_COLOR_FG_MAGENTA,
.colorTitle = FF_COLOR_FG_GREEN,
},
// Endeavour
// EndeavourOS
{
.names = {"Endeavour", "endeavour-linux", "endeavouros", "endeavouros-linux"},
.lines = FASTFETCH_DATATEXT_LOGO_ENDEAVOUR,
.names = {"EndeavourOS"},
.lines = FASTFETCH_DATATEXT_LOGO_ENDEAVOUROS,
.colors = {
FF_COLOR_FG_MAGENTA,
FF_COLOR_FG_RED,
@@ -1440,11 +1440,11 @@ static const FFlogo E[] = {
.colorKeys = FF_COLOR_FG_MAGENTA,
.colorTitle = FF_COLOR_FG_RED,
},
// EndeavourSmall
// EndeavourOSSmall
{
.names = {"Endeavour_small", "endeavour-linux_small", "endeavouros_small", "endeavouros-linux_small"},
.names = {"EndeavourOS_small"},
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
.lines = FASTFETCH_DATATEXT_LOGO_ENDEAVOUR_SMALL,
.lines = FASTFETCH_DATATEXT_LOGO_ENDEAVOUROS_SMALL,
.colors = {
FF_COLOR_FG_RED,
FF_COLOR_FG_MAGENTA,
@@ -1690,6 +1690,16 @@ static const FFlogo F[] = {
.colorKeys = FF_COLOR_FG_BLUE,
.colorTitle = FF_COLOR_FG_WHITE,
},
// Filotimo
{
.names = {"filotimo"},
.lines = FASTFETCH_DATATEXT_LOGO_FILOTIMO,
.colors = {
FF_COLOR_FG_BLUE,
},
.colorKeys = FF_COLOR_FG_BLUE,
.colorTitle = FF_COLOR_FG_WHITE,
},
// Finnix
{
.names = {"Finnix"},
@@ -1996,14 +2006,23 @@ static const FFlogo H[] = {
.names = {"Haiku"},
.lines = FASTFETCH_DATATEXT_LOGO_HAIKU,
.colors = {
FF_COLOR_FG_RED,
FF_COLOR_FG_YELLOW,
FF_COLOR_FG_WHITE,
FF_COLOR_FG_DEFAULT,
FF_COLOR_FG_GREEN,
},
.colorKeys = FF_COLOR_FG_RED,
.colorTitle = FF_COLOR_FG_YELLOW,
},
// Haiku2
{
.names = {"Haiku2"},
.lines = FASTFETCH_DATATEXT_LOGO_HAIKU2,
.colors = {
FF_COLOR_FG_GREEN,
FF_COLOR_FG_DEFAULT,
},
.colorKeys = FF_COLOR_FG_RED,
.colorTitle = FF_COLOR_FG_YELLOW,
},
// HaikuSmall
{
.names = {"Haiku-small"},
@@ -2294,12 +2313,13 @@ static const FFlogo K[] = {
FF_COLOR_FG_WHITE
}
},
// KDENeon
// KDE Neon
{
.names = {"KDE", "kde-neon", "kde neon"},
.lines = FASTFETCH_DATATEXT_LOGO_KDE,
.names = {"KDE Neon"}, // Distro ID is `neon`; Distro name is `KDE Neon`
.lines = FASTFETCH_DATATEXT_LOGO_KDENEON,
.colors = {
FF_COLOR_FG_GREEN,
FF_COLOR_FG_DEFAULT,
},
},
// Kibojoe
@@ -2560,7 +2580,7 @@ static const FFlogo L[] = {
},
// LinuxMintOld
{
.names = {"linux-mint_old", "linux-mint-old"},
.names = {"linuxmint_old", "linux-mint_old"},
.type = FF_LOGO_LINE_TYPE_ALTER_BIT,
.lines = FASTFETCH_DATATEXT_LOGO_MINT_OLD,
.colors = {
@@ -3056,6 +3076,15 @@ static const FFlogo N[] = {
FF_COLOR_FG_WHITE,
},
},
// NexaLinux
{
.names = {"nexalinux"},
.lines = FASTFETCH_DATATEXT_LOGO_NEXALINUX,
.colors = {
FF_COLOR_FG_LIGHT_BLUE,
FF_COLOR_FG_LIGHT_BLUE,
},
},
// Nitrux
{
.names = {"Nitrux"},
@@ -3288,7 +3317,7 @@ static const FFlogo O[] = {
},
// OpenSuse
{
.names = {"opensuse", "open_suse", "open-suse"},
.names = {"opensuse"},
.lines = FASTFETCH_DATATEXT_LOGO_OPENSUSE,
.colors = {
FF_COLOR_FG_GREEN,
@@ -3299,7 +3328,7 @@ static const FFlogo O[] = {
},
// OpenSuseSmall
{
.names = {"opensuse_small", "open_suse_small", "open-suse_small"},
.names = {"opensuse_small"},
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
.lines = FASTFETCH_DATATEXT_LOGO_OPENSUSE_SMALL,
.colors = {
@@ -3318,7 +3347,7 @@ static const FFlogo O[] = {
},
// OpenSuseLeap
{
.names = {"opensuse_leap", "opensuse leap"},
.names = {"opensuse-leap", "opensuse leap"},
.lines = FASTFETCH_DATATEXT_LOGO_OPENSUSE_LEAP,
.colors = {
FF_COLOR_FG_WHITE,
@@ -3328,7 +3357,7 @@ static const FFlogo O[] = {
},
// OpenSuseLeapOld
{
.names = {"opensuse_leap_old", "opensuse leap_old"},
.names = {"opensuse-leap_old", "opensuse leap_old"},
.lines = FASTFETCH_DATATEXT_LOGO_OPENSUSE_LEAP_OLD,
.type = FF_LOGO_LINE_TYPE_ALTER_BIT,
.colors = {
@@ -3339,7 +3368,7 @@ static const FFlogo O[] = {
},
// OpenSuseTumbleweed
{
.names = {"opensuse-tumbleweed", "opensuse_tumbleweed"},
.names = {"opensuse-tumbleweed"},
.lines = FASTFETCH_DATATEXT_LOGO_OPENSUSE_TUMBLEWEED,
.colors = {
FF_COLOR_FG_WHITE,
@@ -3349,7 +3378,7 @@ static const FFlogo O[] = {
},
// OpenSuseTumbleweedOld
{
.names = {"opensuse-tumbleweed-old", "opensuse_tumbleweed-old"},
.names = {"opensuse-tumbleweed-old"},
.lines = FASTFETCH_DATATEXT_LOGO_OPENSUSE_TUMBLEWEED_OLD,
.type = FF_LOGO_LINE_TYPE_ALTER_BIT,
.colors = {
@@ -3360,7 +3389,7 @@ static const FFlogo O[] = {
},
// openSUSESlowroll
{
.names = {"opensuse_slowroll", "opensuse-slowroll", "opensuse-tumbleweed-slowroll"},
.names = {"opensuse-slowroll", "opensuse-tumbleweed-slowroll"},
.lines = FASTFETCH_DATATEXT_LOGO_OPENSUSE_SLOWROLL,
.colors = {
FF_COLOR_FG_WHITE,
@@ -3677,7 +3706,7 @@ static const FFlogo P[] = {
},
// Pop
{
.names = {"pop", "popos", "pop_os", "pop-linux"},
.names = {"pop", "popos"},
.lines = FASTFETCH_DATATEXT_LOGO_POP,
.colors = {
FF_COLOR_FG_CYAN,
@@ -3688,7 +3717,7 @@ static const FFlogo P[] = {
},
// PopSmall
{
.names = {"pop_small", "popos_small", "pop_os_small", "pop-linux-small"},
.names = {"pop_small", "popos_small"},
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
.lines = FASTFETCH_DATATEXT_LOGO_POP_SMALL,
.colors = {
@@ -3881,10 +3910,10 @@ static const FFlogo R[] = {
FF_COLOR_FG_WHITE,
},
},
// Reborn
// RebornOS
{
.names = {"Reborn", "Reborn OS", "reborn-os", "rebornos", "rebornos-linux", "reborn-os-linux"},
.lines = FASTFETCH_DATATEXT_LOGO_REBORN,
.names = {"RebornOS"},
.lines = FASTFETCH_DATATEXT_LOGO_REBORNOS,
.colors = {
FF_COLOR_FG_BLACK,
FF_COLOR_FG_BLUE,
@@ -3895,9 +3924,9 @@ static const FFlogo R[] = {
},
// RebornSmall
{
.names = {"Reborn_small", "Reborn OS_small", "reborn-os-small", "rebornos_small", "rebornos-linux-small", "reborn-os-linux-small"},
.names = {"RebornOS_small"},
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
.lines = FASTFETCH_DATATEXT_LOGO_REBORN_SMALL,
.lines = FASTFETCH_DATATEXT_LOGO_REBORNOS_SMALL,
.colors = {
FF_COLOR_FG_BLUE,
},
@@ -3960,7 +3989,7 @@ static const FFlogo R[] = {
},
// RedstarOS
{
.names = {"redstar", "redstar-os", "redstaros", "redstaros-linux", "redstar-os-linux"},
.names = {"redstar", "redstar-os", "redstaros"},
.lines = FASTFETCH_DATATEXT_LOGO_REDSTAR,
.colors = {
FF_COLOR_FG_RED,
@@ -4036,10 +4065,11 @@ static const FFlogo R[] = {
.names = {"rosa", "rosa-linux", "rosalinux"},
.lines = FASTFETCH_DATATEXT_LOGO_ROSA,
.colors = {
FF_COLOR_FG_BLUE,
FF_COLOR_FG_RGB "250;250;250",
FF_COLOR_FG_RGB "100;165;225",
},
.colorKeys = FF_COLOR_FG_BLUE,
.colorTitle = FF_COLOR_FG_BLUE,
.colorKeys = FF_COLOR_FG_RGB "100;165;225",
.colorTitle = FF_COLOR_FG_RGB "100;165;225",
},
// RhinoLinux
{
@@ -4264,7 +4294,7 @@ static const FFlogo S[] = {
},
// Slackware
{
.names = {"slackware", "slackware-linux", "slackwarelinux"},
.names = {"Slackware"},
.lines = FASTFETCH_DATATEXT_LOGO_SLACKWARE,
.colors = {
FF_COLOR_FG_BLUE,
@@ -4275,7 +4305,7 @@ static const FFlogo S[] = {
},
// SlackwareSmall
{
.names = {"slackware-small", "slackware-linux-small", "slackware_small", "slackwarelinux_small"},
.names = {"Slackware_small"},
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
.lines = FASTFETCH_DATATEXT_LOGO_SLACKWARE_SMALL,
.colors = {
@@ -4334,7 +4364,7 @@ static const FFlogo S[] = {
},
// SolarisSmall
{
.names = {"solaris-small", "solaris_small", "sunos-small", "sunos_small"},
.names = {"solaris_small", "sunos_small"},
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
.lines = FASTFETCH_DATATEXT_LOGO_SOLARIS_SMALL,
.colors = {
@@ -4345,7 +4375,7 @@ static const FFlogo S[] = {
},
// Solus
{
.names = {"solus", "solus-linux"},
.names = {"Solus", "solus-linux"},
.lines = FASTFETCH_DATATEXT_LOGO_SOLUS,
.colors = {
FF_COLOR_FG_BLUE,
+23 -6
View File
@@ -387,13 +387,30 @@ static const FFlogo* logoGetBuiltinDetected(FFLogoSize size)
if(logo != NULL)
return logo;
logo = logoGetBuiltin(&os->prettyName, size);
if(logo != NULL)
return logo;
if (ffStrbufContainC(&os->idLike, ' '))
{
FF_STRBUF_AUTO_DESTROY buf = ffStrbufCreate();
for (
uint32_t start = 0, end = ffStrbufFirstIndexC(&os->idLike, ' ');
true;
start = end + 1, end = ffStrbufNextIndexC(&os->idLike, start, ' ')
)
{
ffStrbufSetNS(&buf, end - start, os->idLike.chars + start);
logo = logoGetBuiltin(&buf, size);
if(logo != NULL)
return logo;
logo = logoGetBuiltin(&os->idLike, size);
if(logo != NULL)
return logo;
if (end >= os->idLike.length)
break;
}
}
else
{
logo = logoGetBuiltin(&os->idLike, size);
if(logo != NULL)
return logo;
}
logo = logoGetBuiltin(&instance.state.platform.sysinfo.name, size);
if(logo != NULL)
+2 -2
View File
@@ -75,7 +75,7 @@ void ffPrintDisplay(FFDisplayOptions* options)
{
FFDisplayResult* result = FF_LIST_GET(FFDisplayResult, dsResult->displays, i);
uint32_t moduleIndex = dsResult->displays.length == 1 ? 0 : i + 1;
const char* displayType = result->type == FF_DISPLAY_TYPE_UNKNOWN ? NULL : result->type == FF_DISPLAY_TYPE_BUILTIN ? "built-in" : "external";
const char* displayType = result->type == FF_DISPLAY_TYPE_UNKNOWN ? NULL : result->type == FF_DISPLAY_TYPE_BUILTIN ? "Built-in" : "External";
ffStrbufClear(&key);
if(options->moduleArgs.key.length == 0)
@@ -448,7 +448,7 @@ static FFModuleBaseInfo ffModuleInfo = {
{"Screen scaled width (in pixels)", "scaled-width"},
{"Screen scaled height (in pixels)", "scaled-height"},
{"Screen name", "name"},
{"Screen type (builtin, external or unknown)", "type"},
{"Screen type (Built-in or External)", "type"},
{"Screen rotation (in degrees)", "rotation"},
{"True if being the primary screen", "is-primary"},
{"Screen physical width (in millimeters)", "physical-width"},
+4 -4
View File
@@ -419,8 +419,8 @@ void ffGenerateLocalIpJsonConfig(FFLocalIpOptions* options, yyjson_mut_doc* doc,
if (defaultOptions.showType != options->showType)
{
if (options->showType & FF_LOCALIP_TYPE_IPV4_BIT)
yyjson_mut_obj_add_bool(doc, module, "showIpv4", true);
if (!(options->showType & FF_LOCALIP_TYPE_IPV4_BIT))
yyjson_mut_obj_add_bool(doc, module, "showIpv4", false);
if (options->showType & FF_LOCALIP_TYPE_IPV6_BIT)
yyjson_mut_obj_add_bool(doc, module, "showIpv6", true);
@@ -446,8 +446,8 @@ void ffGenerateLocalIpJsonConfig(FFLocalIpOptions* options, yyjson_mut_doc* doc,
if (options->showType & FF_LOCALIP_TYPE_COMPACT_BIT)
yyjson_mut_obj_add_bool(doc, module, "compact", true);
if (options->showType & FF_LOCALIP_TYPE_DEFAULT_ROUTE_ONLY_BIT)
yyjson_mut_obj_add_bool(doc, module, "defaultRouteOnly", true);
if (!(options->showType & FF_LOCALIP_TYPE_DEFAULT_ROUTE_ONLY_BIT))
yyjson_mut_obj_add_bool(doc, module, "defaultRouteOnly", false);
if (options->showType & FF_LOCALIP_TYPE_ALL_IPS_BIT)
yyjson_mut_obj_add_bool(doc, module, "showAllIps", true);
+1
View File
@@ -36,6 +36,7 @@ typedef enum __attribute__((__packed__)) FFPackagesFlags
FF_PACKAGES_FLAG_MPORT_BIT = 1 << 26,
FF_PACKAGES_FLAG_QI_BIT = 1 << 27,
FF_PACKAGES_FLAG_PKGSRC_BIT = 1 << 28,
FF_PACKAGES_FLAG_HPKG_BIT = 1 << 29,
FF_PACKAGES_FLAG_FORCE_UNSIGNED = UINT32_MAX,
} FFPackagesFlags;
static_assert(sizeof(FFPackagesFlags) == sizeof(uint32_t), "");
+18
View File
@@ -51,6 +51,8 @@ void ffPrintPackages(FFPackagesOptions* options)
FF_PRINT_PACKAGE(apk)
FF_PRINT_PACKAGE(pkg)
FF_PRINT_PACKAGE(pkgsrc)
FF_PRINT_PACKAGE_NAME(hpkgSystem, counts.hpkgUser ? "hpkg-system" : "hpkg")
FF_PRINT_PACKAGE_NAME(hpkgUser, "hpkg-user")
FF_PRINT_PACKAGE_NAME(flatpakSystem, counts.flatpakUser ? "flatpak-system" : "flatpak")
FF_PRINT_PACKAGE_NAME(flatpakUser, "flatpak-user")
FF_PRINT_PACKAGE(snap)
@@ -84,6 +86,7 @@ void ffPrintPackages(FFPackagesOptions* options)
uint32_t flatpakAll = counts.flatpakSystem + counts.flatpakUser;
uint32_t brewAll = counts.brew + counts.brewCask;
uint32_t guixAll = counts.guixSystem + counts.guixUser + counts.guixHome;
uint32_t hpkgAll = counts.hpkgSystem + counts.hpkgUser;
FF_PRINT_FORMAT_CHECKED(FF_PACKAGES_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]){
FF_FORMAT_ARG(counts.all, "all"),
FF_FORMAT_ARG(counts.pacman, "pacman"),
@@ -123,10 +126,13 @@ void ffPrintPackages(FFPackagesOptions* options)
FF_FORMAT_ARG(counts.qi, "qi"),
FF_FORMAT_ARG(counts.amUser, "am-user"),
FF_FORMAT_ARG(counts.pkgsrc, "pkgsrc"),
FF_FORMAT_ARG(counts.hpkgSystem, "hpkg-system"),
FF_FORMAT_ARG(counts.hpkgUser, "hpkg-user"),
FF_FORMAT_ARG(nixAll, "nix-all"),
FF_FORMAT_ARG(flatpakAll, "flatpak-all"),
FF_FORMAT_ARG(brewAll, "brew-all"),
FF_FORMAT_ARG(guixAll, "guix-all"),
FF_FORMAT_ARG(hpkgAll, "hpkg-all"),
}));
}
@@ -178,6 +184,9 @@ bool ffParsePackagesCommandOptions(FFPackagesOptions* options, const char* key,
case 'G': if (false);
FF_TEST_PACKAGE_NAME(GUIX)
break;
case 'H': if (false);
FF_TEST_PACKAGE_NAME(HPKG)
break;
case 'L': if (false);
FF_TEST_PACKAGE_NAME(LPKG)
FF_TEST_PACKAGE_NAME(LPKGBUILD)
@@ -293,6 +302,9 @@ void ffParsePackagesJsonObject(FFPackagesOptions* options, yyjson_val* module)
case 'G': if (false);
FF_TEST_PACKAGE_NAME(GUIX)
break;
case 'H': if (false);
FF_TEST_PACKAGE_NAME(HPKG)
break;
case 'L': if (false);
FF_TEST_PACKAGE_NAME(LPKG)
FF_TEST_PACKAGE_NAME(LPKGBUILD)
@@ -365,6 +377,7 @@ void ffGeneratePackagesJsonConfig(FFPackagesOptions* options, yyjson_mut_doc* do
FF_TEST_PACKAGE_NAME(EOPKG)
FF_TEST_PACKAGE_NAME(FLATPAK)
FF_TEST_PACKAGE_NAME(GUIX)
FF_TEST_PACKAGE_NAME(HPKG)
FF_TEST_PACKAGE_NAME(LINGLONG)
FF_TEST_PACKAGE_NAME(LPKG)
FF_TEST_PACKAGE_NAME(LPKGBUILD)
@@ -421,6 +434,8 @@ void ffGeneratePackagesJsonResult(FF_MAYBE_UNUSED FFPackagesOptions* options, yy
FF_APPEND_PACKAGE_COUNT(guixSystem)
FF_APPEND_PACKAGE_COUNT(guixUser)
FF_APPEND_PACKAGE_COUNT(guixHome)
FF_APPEND_PACKAGE_COUNT(hpkgSystem)
FF_APPEND_PACKAGE_COUNT(hpkgUser)
FF_APPEND_PACKAGE_COUNT(linglong)
FF_APPEND_PACKAGE_COUNT(mport)
FF_APPEND_PACKAGE_COUNT(nixDefault)
@@ -491,10 +506,13 @@ static FFModuleBaseInfo ffModuleInfo = {
{"Number of qi packages", "qi"},
{"Number of am-user (aka appman) packages", "am-user"},
{"Number of pkgsrc packages", "pkgsrc"},
{"Number of hpkg-system packages", "hpkg-system"},
{"Number of hpkg-user packages", "hpkg-user"},
{"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"},
{"Total number of all guix packages", "guix-all"},
{"Total number of all hpkg packages", "hpkg-all"},
}))
};
@@ -160,6 +160,7 @@ static FFModuleBaseInfo ffModuleInfo = {
.parseJsonObject = (void*) ffParsePhysicalMemoryJsonObject,
.printModule = (void*) ffPrintPhysicalMemory,
.generateJsonConfig = (void*) ffGeneratePhysicalMemoryJsonConfig,
.generateJsonResult = (void*) ffGeneratePhysicalMemoryJsonResult,
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
{"Size (in bytes)", "bytes"},
{"Size formatted", "size"},
+8 -1
View File
@@ -130,6 +130,8 @@ const char* ffOptionsParseDisplayJsonConfig(FFOptionsDisplay* options, yyjson_va
{
int value;
const char* error = ffJsonConfigParseEnum(unit, &value, (FFKeyValuePair[]) {
{ "DEFAULT", FF_TEMPERATURE_UNIT_DEFAULT },
{ "D", FF_TEMPERATURE_UNIT_DEFAULT },
{ "CELSIUS", FF_TEMPERATURE_UNIT_CELSIUS },
{ "C", FF_TEMPERATURE_UNIT_CELSIUS },
{ "FAHRENHEIT", FF_TEMPERATURE_UNIT_FAHRENHEIT },
@@ -418,6 +420,8 @@ bool ffOptionsParseDisplayCommandLine(FFOptionsDisplay* options, const char* key
if(ffStrEqualsIgnCase(subkey, "unit"))
{
options->tempUnit = (FFTemperatureUnit) ffOptionParseEnum(key, value, (FFKeyValuePair[]) {
{ "DEFAULT", FF_TEMPERATURE_UNIT_DEFAULT },
{ "D", FF_TEMPERATURE_UNIT_DEFAULT },
{ "CELSIUS", FF_TEMPERATURE_UNIT_CELSIUS },
{ "C", FF_TEMPERATURE_UNIT_CELSIUS },
{ "FAHRENHEIT", FF_TEMPERATURE_UNIT_FAHRENHEIT },
@@ -513,7 +517,7 @@ void ffOptionsInitDisplay(FFOptionsDisplay* options)
options->keyPaddingLeft = 0;
options->keyType = FF_MODULE_KEY_TYPE_STRING;
options->tempUnit = FF_TEMPERATURE_UNIT_CELSIUS;
options->tempUnit = FF_TEMPERATURE_UNIT_DEFAULT;
options->tempNdigits = 1;
ffStrbufInitStatic(&options->tempColorGreen, FF_COLOR_FG_GREEN);
ffStrbufInitStatic(&options->tempColorYellow, instance.state.terminalLightTheme ? FF_COLOR_FG_YELLOW : FF_COLOR_FG_LIGHT_YELLOW);
@@ -643,6 +647,9 @@ void ffOptionsGenerateDisplayJsonConfig(FFOptionsDisplay* options, yyjson_mut_do
{
switch (options->tempUnit)
{
case FF_TEMPERATURE_UNIT_DEFAULT:
yyjson_mut_obj_add_str(doc, temperature, "unit", "DEFAULT");
break;
case FF_TEMPERATURE_UNIT_CELSIUS:
yyjson_mut_obj_add_str(doc, obj, "unit", "C");
break;
+1
View File
@@ -11,6 +11,7 @@ typedef enum __attribute__((__packed__)) FFSizeBinaryPrefixType
typedef enum __attribute__((__packed__)) FFTemperatureUnit
{
FF_TEMPERATURE_UNIT_DEFAULT,
FF_TEMPERATURE_UNIT_CELSIUS,
FF_TEMPERATURE_UNIT_FAHRENHEIT,
FF_TEMPERATURE_UNIT_KELVIN,
+5 -13
View File
@@ -30,9 +30,7 @@ const char* ffOptionsParseGeneralJsonConfig(FFOptionsGeneral* options, yyjson_va
else if (ffStrEqualsIgnCase(key, "detectVersion"))
options->detectVersion = yyjson_get_bool(val);
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__)
else if (ffStrEqualsIgnCase(key, "escapeBedrock"))
options->escapeBedrock = yyjson_get_bool(val);
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__)
else if (ffStrEqualsIgnCase(key, "playerName"))
ffStrbufSetS(&options->playerName, yyjson_get_str(val));
else if (ffStrEqualsIgnCase(key, "dsForceDrm"))
@@ -75,9 +73,7 @@ bool ffOptionsParseGeneralCommandLine(FFOptionsGeneral* options, const char* key
else if(ffStrEqualsIgnCase(key, "--detect-version"))
options->detectVersion = ffOptionParseBoolean(value);
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__)
else if(ffStrEqualsIgnCase(key, "--escape-bedrock"))
options->escapeBedrock = ffOptionParseBoolean(value);
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__)
else if(ffStrEqualsIgnCase(key, "--player-name"))
ffOptionParseString(key, value, &options->playerName);
else if(ffStrEqualsIgnCase(key, "--ds-force-drm"))
@@ -106,8 +102,7 @@ void ffOptionsInitGeneral(FFOptionsGeneral* options)
options->multithreading = true;
options->detectVersion = true;
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__)
options->escapeBedrock = true;
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__)
ffStrbufInit(&options->playerName);
options->dsForceDrm = FF_DS_FORCE_DRM_TYPE_FALSE;
#elif defined(_WIN32)
@@ -117,7 +112,7 @@ void ffOptionsInitGeneral(FFOptionsGeneral* options)
void ffOptionsDestroyGeneral(FF_MAYBE_UNUSED FFOptionsGeneral* options)
{
#if defined(__linux__) || defined(__FreeBSD__)
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__)
ffStrbufDestroy(&options->playerName);
#endif
}
@@ -135,10 +130,7 @@ void ffOptionsGenerateGeneralJsonConfig(FFOptionsGeneral* options, yyjson_mut_do
if (options->processingTimeout != defaultOptions.processingTimeout)
yyjson_mut_obj_add_int(doc, obj, "processingTimeout", options->processingTimeout);
#if defined(__linux__) || defined(__FreeBSD__)
if (options->escapeBedrock != defaultOptions.escapeBedrock)
yyjson_mut_obj_add_bool(doc, obj, "escapeBedrock", options->escapeBedrock);
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__)
if (!ffStrbufEqual(&options->playerName, &defaultOptions.playerName))
yyjson_mut_obj_add_strbuf(doc, obj, "playerName", &options->playerName);
+1 -2
View File
@@ -16,9 +16,8 @@ typedef struct FFOptionsGeneral
bool detectVersion;
// Module options that cannot be put in module option structure
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__)
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__)
FFstrbuf playerName;
bool escapeBedrock;
FFDsForceDrmType dsForceDrm;
#elif defined(_WIN32)
int32_t wmiTimeout;

Some files were not shown because too many files have changed in this diff Show More