Compare commits

...

972 Commits

Author SHA1 Message Date
Carter Li 02aafbd7f4 Merge pull request #1852 from fastfetch-cli/dev
Release: v2.48.1
2025-07-18 19:28:54 +08:00
Carter Li 72da8150bd Release: v2.48.1 2025-07-18 18:50:30 +08:00
Carter Li aca2b5336d WM (Linux): fix a copy-paste error 2025-07-18 18:04:00 +08:00
李通洲 c79b67efc1 Modules: don't report errors when condition key is set 2025-07-18 16:16:38 +08:00
李通洲 30af91ce8e Packages: add new option --packages-combined 2025-07-18 15:55:33 +08:00
李通洲 6c56348e54 JsonConfig: add modules[n].condition to run modules conditionally on different platforms 2025-07-18 15:45:25 +08:00
李通洲 531b25dc2f Version: replace WIN32 with Windows and Darwin with macOS 2025-07-18 15:08:40 +08:00
李通洲 8c6dc34654 Processing (*nix): fix compiling on Android 7 2025-07-18 13:27:17 +08:00
李通洲 cf2034b93e Processing (Windows): redirect unused std handles to NUL to avoid potential errors 2025-07-18 10:39:11 +08:00
李通洲 f7db03b8c4 Processing (*nix): use traditional fork-exec on Android and OpenBSD
Fix https://github.com/termux/termux-packages/issues/25369
2025-07-18 10:37:52 +08:00
Carter Li 8647e366f9 Packaging: update debian stuff [ci skip] 2025-07-17 16:27:07 +08:00
李通洲 1bf41d68f9 WM (Linux): add Openbox version detection 2025-07-17 14:15:35 +08:00
Carter Li 1ac1f1f889 Chore: silense compiler warnings 2025-07-16 15:19:48 +08:00
Carter Li 14f1278485 Release: v2.48.0 (#1848)
Co-authored-by: Dariqq <77271900+Dariqq@users.noreply.github.com>
Co-authored-by: Robert Nilson <109800336+ZBookCMD@users.noreply.github.com>
Co-authored-by: Juan Llamas <38849891+xoltia@users.noreply.github.com>
Co-authored-by: Angel Gustavo Lopez <143856402+Xray-OS@users.noreply.github.com>
2025-07-16 15:09:29 +08:00
李通洲 c2c6856159 Doc: optimize README; fix typo 2025-07-16 14:45:56 +08:00
李通洲 c89f3d2896 Release: v2.48.0 2025-07-16 14:33:22 +08:00
李通洲 8e773470df Logo: partially revert c5c0e54 2025-07-16 14:29:41 +08:00
李通洲 ea4fc7bdda Separator: remove formatArgs
It makes no sense.
2025-07-16 10:46:47 +08:00
李通洲 468d1e0903 Display: add option --fraction-ndigits
to control number of digits to print when formatting ordinary fraction numbers
2025-07-16 10:33:20 +08:00
李通洲 6851e7b082 Uptime / Users: add years, days-of-year and year-fraction
Like what `Disk` has
2025-07-16 09:53:09 +08:00
Carter Li a734f18fd5 Chore (Linux): silience compiler warnings 2025-07-15 23:33:26 +08:00
李通洲 30b1e29785 JsonSchema: update xxxFormat [ci skip] 2025-07-15 22:44:56 +08:00
李通洲 dde0c22195 Disk: add keys years, days-of-year and years-fraction
Fix #1847
2025-07-15 22:38:31 +08:00
Angel Gustavo Lopez 1311a809db Logo (Builtin): rename ada to xray_os (#1845)
* going back to xray_os

* going back to xray_os

---------

Co-authored-by: xray_os <xray_os>
2025-07-15 17:52:09 +08:00
李通洲 60a54f4880 CMake: reconfigure after adding / removing logos 2025-07-15 11:02:31 +08:00
李通洲 b4e65e7e48 README: document how to run multiple modules on command line [ci skip] 2025-07-15 10:48:37 +08:00
李通洲 6f3ed4a7b4 Processing (Linux): cache the index of $LANG 2025-07-15 10:22:56 +08:00
李通洲 cc8f8ff0f7 README: add DeepWiki badge [ci skip]
An interesting website
2025-07-15 08:51:15 +08:00
李通洲 8a00f2d901 GPU (Windows): fix compiling on x86-32 2025-07-15 00:04:43 +08:00
李通洲 c5c0e543e4 Logo: don't print builtin logo if the provided logo source cannot be found 2025-07-13 20:32:31 +08:00
李通洲 97255f37da Logo: load .raw files as raw image file 2025-07-13 20:32:31 +08:00
李通洲 fb8a04f97a Logo: don't load text files as image file
Fix #1843
2025-07-13 20:32:13 +08:00
李通洲 c3ce5ac947 Logo: don't parse file paths as builtin logo name 2025-07-13 20:15:10 +08:00
李通洲 eae69049b2 GPU (Windows): more method to detect device name 2025-07-13 01:39:38 +08:00
李通洲 102e8fcc72 GPU (Windows): detect GPU frequency by default
Supported on Windows 11 only
2025-07-13 01:16:46 +08:00
李通洲 8372708f98 GPU (Intel): prefer matching GPU with bus id 2025-07-13 01:16:46 +08:00
Juan Llamas 5011edc9d9 Packages (Linux): clean up nix user package detection 2025-07-12 23:57:51 +08:00
Juan Llamas 94a5228ffc Packages (Linux): add /etc/profiles/per-user detection for nix user packages 2025-07-12 23:57:51 +08:00
李通洲 382c0cd7c3 GPU (Windows): ignore invalid temps 2025-07-12 15:16:36 +08:00
李通洲 ab496b23b7 GPU (Windows): greatly improve performance of GPU temp detection
... when `--gpu-driver-specific` is not set. Supported on Windows 10 and later
2025-07-12 01:26:33 +08:00
李通洲 939f428da7 Logo (Builtin): add AxOS
Fix #1841
2025-07-11 14:01:30 +08:00
Robert Nilson 2d496c91e1 Logo (Builtin): add the Minimal System logo (#1837)
* Added logo of Minimal System

* Changed to spaces instead of tabs

* Removed paddings for minimal.txt

* Changed

Co-authored-by: Carter Li <CarterLi@users.noreply.github.com>

---------

Co-authored-by: Carter Li <CarterLi@users.noreply.github.com>
2025-07-10 03:31:49 -05:00
李通洲 442d58b646 Revert "GPU (macOS): update how integrated GPUs are detected"
This reverts commit 5381395c54.
2025-07-10 16:16:45 +08:00
李通洲 4d377b94b7 CI (Haiku): Apply work-around for work directory
From <cross-platform-actions/action#104 (comment)>
2025-07-10 14:40:25 +08:00
李通洲 7248868e33 Sound (macOS): improve device id detection 2025-07-10 10:42:23 +08:00
Carter Li 2eda6464ad Processing (Linux): use posix_spawnp for better performance 2025-07-09 23:56:02 +08:00
Carter Li 2622fc12a6 Chore (Linux): silence compiler warnings 2025-07-09 20:23:28 +08:00
李通洲 b178e43428 GPU (Windows): use nvapi to detect GPU type 2025-07-09 00:28:16 +08:00
李通洲 d00fca26c5 GPU (Windows): clean up 2025-07-09 00:08:13 +08:00
李通洲 23e4d1c4aa Chore (Windows): tidy 2025-07-07 22:34:23 +08:00
李通洲 6871c8bb73 GPU (Windows): fix Win7 compatibility 2025-07-07 22:34:04 +08:00
李通洲 61adc7cf64 GPU (Windows): new method to detect device type 2025-07-07 22:03:30 +08:00
李通洲 9ba30adcba GPU (Windows): add driver version fall back 2025-07-06 18:23:14 +08:00
李通洲 010b2c6262 CMake (Windows): remove setupapi dependency 2025-07-06 17:48:39 +08:00
李通洲 c65fb1a868 Battery (Windows): use CMAPI instead of SetupAPI 2025-07-06 17:04:51 +08:00
李通洲 2029679ea5 GPU (Windows): use CMAPI instead of SetupAPI
Improve performance
2025-07-06 17:04:31 +08:00
Carter Li 817f70c2cd Presets: add a new example
Fix #1832
2025-07-05 08:33:55 +08:00
Carter Li 3a1f0485f4 PhysicalDisk: unifying white space trimming 2025-07-05 08:31:21 +08:00
李通洲 64910d0781 OS (Linux): detect fedora variants
Fix #1830
2025-07-04 10:31:59 +08:00
Dariqq 821462e152 Chore: Add a missing semicolon (#1828)
Followup to a9f021ccb9
2025-07-03 20:16:14 -05:00
Carter Li b015fd579c Packaging: update debian stuff [ci skip] 2025-07-03 14:53:14 +08:00
Carter Li 8b40a81e22 Merge pull request #1826 from fastfetch-cli/dev
Release: v2.47.0
2025-07-03 14:05:23 +08:00
李通洲 8be64714ba OS (Linux): remove duplicated code 2025-07-03 11:03:14 +08:00
李通洲 fe5d739cba Doc: update README [ci skip] 2025-07-03 10:51:42 +08:00
李通洲 dba0672a11 CMake: remove the unused option ENABLE_CPUUSAGE_PERFLIB 2025-07-03 10:47:44 +08:00
李通洲 3ed6acf3ca Release: v2.47.0 2025-07-03 10:45:41 +08:00
李通洲 8c74c54bb0 README 2025-07-03 10:27:44 +08:00
Carter Li 818473102c Logo (Builtin): always use FG_DEFAULT on title and keys 2025-07-03 09:39:32 +08:00
Carter Li f1cc4a7805 Logo (Builtin): fix colors of raw Linux logo 2025-07-03 09:36:39 +08:00
Carter Li c574af97a4 Logo (Builtin): fix colors of DragonFly 2025-07-03 09:33:04 +08:00
Carter Li 74ae84e719 Revert "Logo (Builtin): :%s/FG_WHITE/FG_DEFAULT/g"
This reverts commit bdbc885811.
2025-07-03 09:03:23 +08:00
李通洲 98738b6920 CPUUsage (Windows): detect perflib support dynamically based on OS version 2025-07-02 19:40:22 +08:00
李通洲 2e5769def2 OS (Linux): add support of Xubuntu
Fix #1825
2025-07-02 09:41:07 +08:00
李通洲 18a6929662 CPUUsage (Windows): disable ENABLE_CPUUSAGE_PERFLIB by default
Because Windows 7 doesn't support it
2025-07-01 22:08:08 +08:00
李通洲 0e61d1134d CMake: fix typo 2025-07-01 21:05:37 +08:00
李通洲 4abb183735 CPUUsage(Windows): add new method using Windows Performance Library 2025-07-01 20:53:46 +08:00
李通洲 d5b56be4ff CMake (SunOS): drop pciaccess dependency 2025-07-01 20:32:45 +08:00
李通洲 1854953d8c Chore (Windows): move perflib_.h to somewhere global 2025-07-01 14:57:40 +08:00
李通洲 2406015c81 Terminal (Linux): ignore init and systemd 2025-06-30 19:41:59 +08:00
李通洲 ec7f14ab96 CpuUsage (Windows): refine KernelTime calculation by removing unused DPC and interrupt time 2025-06-30 19:37:04 +08:00
李通洲 d94cdf4424 CpuUsage (Linux / BSD): include interrupt and softirq times in CPU usage calculations 2025-06-30 19:36:46 +08:00
李通洲 40e57b7698 IO: increase PROC_FILE_BUFFSIZ to avoid possible short reads 2025-06-30 19:16:08 +08:00
李通洲 974c658fff README: add the OpenBSD and DragonFly installation method [ci skip]
Fix https://github.com/fastfetch-cli/fastfetch/issues/1819#issuecomment-3015070008
2025-06-28 23:39:01 +08:00
李通洲 ad0ddfd7f1 Media (macOS): support old macOS version 2025-06-27 16:00:27 +08:00
李通洲 1da8367f55 Media (macOS): simplify now playing handling
Also improve performance
2025-06-27 14:28:45 +08:00
李通洲 bdbc885811 Logo (Builtin): :%s/FG_WHITE/FG_DEFAULT/g
To improve visibility on white background
2025-06-26 22:36:15 +08:00
李通洲 86e5a5997b Display (FreeBSD): silence a compiler warning 2025-06-26 21:44:06 +08:00
李通洲 9832a0e45b GPU (FreeBSD): fix compiling when libdrm is not available
Fix #1820
2025-06-26 21:34:34 +08:00
李通洲 addf674621 OS (Linux): append version string for Ubuntu variants 2025-06-26 21:31:16 +08:00
李通洲 863c5583ef GPU (OpenBSD): fix pci.ids file location
Fix #1819

Signed-off-by: kevlo <kevlo@openbsd.org>
2025-06-25 13:45:49 +08:00
李通洲 45cbc6de83 OS (macOS): force reporting 26 on macOS Tahoe
Fix #1809
2025-06-25 09:19:08 +08:00
李通洲 e68f766b4d OS (Linux): improve RPIOS detection
Ref: https://github.com/fastfetch-cli/fastfetch/issues/1816#issuecomment-2996316164
2025-06-23 22:10:50 +08:00
李通洲 29d7a1acac OS (Linux): use ffStrbufSetStatic where applicatable 2025-06-23 19:41:57 +08:00
李通洲 8d59d14b80 OS (Linux): clean up dietpi related code 2025-06-23 19:41:31 +08:00
Carter Li ed1883909a OS (Linux): detect DietPi
Fix #1816
2025-06-23 18:30:04 +08:00
李通洲 049701a8a9 CI (FreeBSD): run with 14.3 2025-06-23 16:13:40 +08:00
Carter Li 13b7bc89eb Sound (SunOS): rework; drop pulseaudio dependency 2025-06-22 20:35:29 +08:00
Carter Li 92fe44183d Shell (SunOS): ignore leading - 2025-06-22 12:12:49 +08:00
Carter Li 8ebc980c17 GPU (SunOS): simplify 2025-06-22 11:20:19 +08:00
Carter Li dbeb338bda PhysicalDisk (SunOS): rework; support more device types 2025-06-22 11:14:29 +08:00
Carter Li 65ff11a8d0 PhysicalDisk (SunOS): add support 2025-06-22 01:16:50 +08:00
Carter Li 7a73211484 Logo (Builtin): use FG_DEFAULT instead of FG_WHITE 2025-06-21 23:51:40 +08:00
Carter Li ca049997b1 GPU (SunOS): rework GPU detection 2025-06-21 23:22:37 +08:00
李通洲 a9f021ccb9 Chore: remove useless semicolons 2025-06-21 20:46:51 +08:00
Carter Li 55249c2294 BIOS (SunOS): detect BIOS type 2025-06-21 20:46:51 +08:00
李通洲 c13da56959 OS (macOS): remove useless code 2025-06-20 19:28:03 +08:00
Carter Li 665c7cd5d3 Packaging: update debian stuff [ci skip] 2025-06-20 15:02:23 +08:00
Carter Li 469e21cce9 Merge pull request #1813 from fastfetch-cli/dev
Release: v2.46.0
2025-06-20 14:30:06 +08:00
李通洲 925e09c88a Doc: update changelog [ci skip] 2025-06-20 14:28:33 +08:00
李通洲 488454c1aa Logo (Builtin): simplify kali linux 2025-06-20 14:19:05 +08:00
李通洲 c67c52d606 Logo (Builtin): add Kalpa Desktop
Fix #1807
2025-06-20 14:18:21 +08:00
李通洲 e4e11ee509 Release: v2.46.0 2025-06-20 09:51:54 +08:00
李通洲 a3e2592555 Doc: update help.json 2025-06-20 09:51:40 +08:00
Carter Li e0e966dadf Logo (Builtin): rename hydra framework to hydrapwk
Fix #1812
2025-06-20 08:59:53 +08:00
李通洲 b079a8643b Chore: code cleanups 2025-06-19 22:41:30 +08:00
apocelipes 3291a9945f Global: add missing O_CLOEXEC to open() 2025-06-19 22:40:06 +08:00
李通洲 68fd21d0e4 GPU (Linux): fix an issue which vram_usage is bigger t han vram_visible 2025-06-19 22:00:48 +08:00
李通洲 0e1ef96992 GPU (Linux): detect shared vram usage of AMD GPU 2025-06-19 15:54:26 +08:00
李通洲 c377872438 GPU (Linux): correctly call radeon driver 2025-06-19 15:43:37 +08:00
李通洲 4f42d38e4d GPU (FreeBSD): fix mem leaks 2025-06-18 20:20:49 +08:00
李通洲 7b2243496b GPU (Windows): fix build 2025-06-18 18:53:29 +08:00
Carter Li 960a817d03 GPU (Linux): fix building without features 2025-06-18 18:37:30 +08:00
Carter Li 6917f9479e GPU (Linux / FreeBSD): add DRM detection support for old radeon driver
Ref: #1810
2025-06-18 16:41:02 +08:00
Carter Li 8559cc45eb GPU (Linux / FreeBSD): unifies DRM related code and code clean up 2025-06-18 10:01:32 +08:00
李通洲 40e33c676d GPU (FreeBSD): support detection by DRM [wip] 2025-06-17 20:58:09 +08:00
李通洲 d20371040e WM (FreeBSD): fix Hyprland version detection 2025-06-17 20:38:10 +08:00
李通洲 71faf1c7e3 GPU (macOS): detect Metal 4 support 2025-06-17 14:07:18 +08:00
李通洲 d182f3f743 OS (macOS): seems macOS 26 Beta 1 still reports itself as macOS 16. Honor it. 2025-06-17 14:01:22 +08:00
李通洲 39e009b945 CI: upgrade OpenBSD version 2025-06-17 09:30:14 +08:00
李通洲 a1873f3e9e CI: split amd64 and arm64 builds
So we can test both platforms in CI
2025-06-17 09:01:38 +08:00
李通洲 636bcaaaf9 Kmod: remove Chinese comments [ci skip] 2025-06-17 08:43:09 +08:00
李通洲 3fcbd80ef0 Board (macOS): detect board-id if available
Ref: https://github.com/GuillaumeGomez/sysinfo/pull/1545
2025-06-17 00:06:31 +08:00
李通洲 38887e7fbd Logo (Builtin): add GhostFreak
Fix #1801
2025-06-15 12:28:45 +08:00
AVSISP da958e11f9 Logo (Builtin): added AnushOS (#1806)
* Added AnushOS to builtin.c

Added AnushOS config to builtin.c

* Create anushos.txt

Added anushos.txt to ASCII logos

* Update builtin.c

---------

Co-authored-by: Carter Li <CarterLi@users.noreply.github.com>
2025-06-15 12:23:27 +08:00
李通洲 c2ed71c4eb Global: set SetErrorMode(SEM_FAILCRITICALERRORS) globally
Fix #1805
2025-06-15 00:00:22 +08:00
ᡥᠠᡳᡤᡳᠶᠠ ᡥᠠᠯᠠ·ᠨᡝᡴᠣ 猫 2e1ddcf9f8 Logo (Builtin): Add HarmonyOS support (#1804)
* Logo (Builtin): add HarmonyOS

* OS (HarmonyOS): detect HarmonyOS

* Update src/detection/os/os_linux.c

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update os_linux.c

---------

Co-authored-by: Carter Li <CarterLi@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-14 09:03:57 +08:00
Carter Li f1cc2d124c Packages (OpenBSD): fix counting by ignoring hidden folders 2025-06-13 20:38:51 +08:00
Techflash 1e32a95f83 CPU (NetBSD): properly support PowerPC (#1802)
Some devices store their CPU name in hw.model, so check that as well
before giving up.  Tested on NetBSD 10.1 evbppc/wii, and allows it to
detect the CPU as "750 (Revision 2.0)".

---------

Co-authored-by: Carter Li <CarterLi@users.noreply.github.com>
2025-06-11 00:15:40 -05:00
CopticFelo 9e959bc57f WM (MacOS): Added Aerospace WM detection 2025-06-10 11:22:31 +08:00
李通洲 e68406ee22 DE (macOS): report Liquid Glass on macOS 26+ 2025-06-10 10:56:13 +08:00
李通洲 ba69e316b2 OS (MacOS): add macOS 26 Tahoe 2025-06-10 10:48:35 +08:00
李通洲 f3e8e8af52 Logo (Builtin): detect and add TrueNAS Scale 2025-06-10 10:22:13 +08:00
李通洲 c9adab3892 OS (Linux): detect Raspberry Pi OS
Fix #1773
2025-06-10 09:55:13 +08:00
李通洲 c8d1d29017 Disk (Linux): hide /boot/firmware by default 2025-06-10 09:54:11 +08:00
Carter Li 541acca7c0 Logo (Builtin): add xenia_old; update colors of xenia
#1797
2025-06-10 09:13:21 +08:00
Derek Passen ddf5099461 TerminalFont: support rio terminal emulator (#1789)
* Enable terminal font detection for rio terminal emulator

https://rioterm.com
https://rioterm.com/docs/config
https://rioterm.com/docs/config#fonts

* Update src/detection/terminalfont/terminalfont.c

Fix default rio font name

Co-authored-by: Carter Li <CarterLi@users.noreply.github.com>

---------

Co-authored-by: Carter Li <CarterLi@users.noreply.github.com>
2025-06-08 00:00:03 +08:00
李通洲 781a692b06 JsonSchema: document swap.separate 2025-06-07 19:23:25 +08:00
李通洲 9c37f1b370 CPU (Windows): use perflib.h instead of pdh.h for querying CPU temp
Fix #1787
2025-06-07 19:17:46 +08:00
Carter Li a66c26f4df Logo (Builtin): improve colors of bedrock_small
Fix #1790
2025-06-07 17:39:45 +08:00
Carter Li 3bd750bedf Host (Linux): detect Linux Binary Compatibility on FreeBSD
Fix #1786
2025-06-06 15:38:46 +08:00
Carter Li 4a1ada604c Host (Linux): more detailed info of WSL 2025-06-06 14:49:32 +08:00
Noah Michaels e5f57a34a2 Logo (Builtin): Add Fedora2_small (#1785)
* Add 1 more small Fedora logo

* Update builtin.c

---------

Co-authored-by: Carter Li <CarterLi@users.noreply.github.com>
2025-06-05 20:12:44 -05:00
Carter Li 20a3737dce Packaging: update debian stuff [ci skip] 2025-06-05 10:59:16 +08:00
Carter Li e0452d9db5 Merge pull request #1784 from fastfetch-cli/dev
Release: v2.45.0
2025-06-05 10:47:05 +08:00
李通洲 d8e74ba84c Release: v2.45.0 2025-06-05 10:13:56 +08:00
Carter Li 04b13096ac Swap (Haiku): detect detailed info 2025-06-04 22:01:16 +08:00
李通洲 64d4035cae Chore (Haiku): don't use hard-coded page size 2025-06-04 21:26:37 +08:00
Carter Li 5e0ba57f53 Disk (BSD): silence compiler warnings 2025-06-05 04:55:12 +08:00
李通洲 d89263c218 Swap (DragonFly): add support 2025-06-04 20:51:21 +08:00
Carter Li 6a42588786 Swap (SunOS): detect detailed info 2025-06-04 19:36:22 +08:00
Carter Li 5883bf359c Swap (OpenBSD): detect detailed info 2025-06-04 19:05:02 +08:00
Carter Li 6a6b4070ca Swap (Linux): add fallback for Android 2025-06-04 18:35:53 +08:00
Carter Li 2c80cd6d29 Swap (Linux): support detailed info 2025-06-04 16:44:10 +08:00
Carter Li fa4b00b027 Swap (FreeBSD): detect detailed info 2025-06-04 15:30:03 +08:00
李通洲 5fdc924b5d Swap (macOS): detect detailed info 2025-06-04 15:07:05 +08:00
李通洲 3d4a117093 Swap: support separated output 2025-06-04 15:02:02 +08:00
李通洲 7ec0c664c5 Swap (Windows): detect detailed info 2025-06-04 15:01:37 +08:00
李通洲 9d2df589b5 Smbios (DragonFly): acquire SMBIOS info from /dev/mem 2025-06-04 14:22:33 +08:00
李通洲 7107d08e92 DE (DragonFly): fix build 2025-06-04 14:22:33 +08:00
Carter Li 4c34f99c12 Swap (Linux): use /proc/swaps
Preparing for detailed swap usage
2025-06-04 10:37:07 +08:00
Carter Li d7a8c92b46 CI (Linux): fix musl build 2025-06-04 09:05:04 +08:00
李通洲 bbb29ff766 CI (Linux): add missing deps for musl 2025-06-03 21:15:48 +08:00
amnexya 35235b9557 Logo (Builtin): Update logo for Xenia Linux (#1783)
* Update Xenia Linux logo

* Update builtin.c for xenia colours

* Update src/logo/builtin.c

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Carter Li <CarterLi@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-03 21:11:50 +08:00
Carter Li 6b94605804 Disk (BSD): don't ignore sshfs 2025-06-03 18:58:38 +08:00
Carter Li 4b2fa07fdc Packages (Linux): fix dnf package count detection (v2) 2025-06-03 10:53:02 +08:00
Carter Li e203f4eeaf Packages (Linux): fix dnf package count detection
Fix #1777
2025-06-03 09:33:43 +08:00
李通洲 8db70b40e2 CI: add back disabled DFBSD 2025-06-02 22:00:32 +08:00
李通洲 1f967849e5 CMake: fix build of FreeBSD 2025-06-02 19:15:14 +08:00
李通洲 d60b2ddfd4 Disk (Linux): don't ignore sshfs
Fix #1776
2025-06-02 19:09:24 +08:00
李通洲 fb68d8a841 CI (Haiku): add build
Disabled due to https://github.com/cross-platform-actions/action/issues/104
2025-06-02 18:48:16 +08:00
李通洲 047411ba87 CMake: build FreeBSD pkg package 2025-06-02 15:56:18 +08:00
李通洲 08ed14b42a Logo: support "type": "command-raw"
Fix #1780
2025-06-02 11:46:43 +08:00
李通洲 d94a41cc1b Chore: tidy 2025-06-02 11:46:43 +08:00
Anshnk 81b7fb06c1 Fix typo, 15,2 isn't a real mac model number 2025-06-02 11:02:10 +08:00
李通洲 c8debccd16 DE (FreeBSD): support KDE version detection 2025-06-02 10:19:36 +08:00
Carter Li 2853bd15c0 Logo (Builtin): add void2
Ported from hyfetch
2025-05-31 23:28:16 +08:00
Carter Li 2f4146fde8 Logo (Builtin): update default colors of voidlinux
Fix  #1775
2025-05-31 23:18:43 +08:00
李通洲 eeceade14e Logo (Builtin): add rhel_small
Fix #1774
2025-05-31 13:39:40 +08:00
李通洲 1875c78e96 WM: support I3 version detection 2025-05-31 10:41:38 +08:00
李通洲 f389864e17 WM: support FVWM version detection 2025-05-31 10:16:26 +08:00
李通洲 b9317734b9 WM: support CTWM version detection 2025-05-31 10:02:45 +08:00
李通洲 4df4a1de78 Logo (Builtin): add Starry Linux
Fix #1771
2025-05-30 13:56:52 +08:00
李通洲 0cd8c6ead6 Chore: code cleanup 2025-05-30 10:33:37 +08:00
李通洲 f8479dae94 GPU: add more GPU vendors 2025-05-30 10:33:26 +08:00
李通洲 a7d623fa75 JsonSchema: update <module>Format [ci skip] 2025-05-29 10:13:57 +08:00
李通洲 7a8ffb27bd Packages: split code 2025-05-26 15:12:47 +08:00
Carter Li 73c0347469 Merge remote-tracking branch 'origin/dev' into dev 2025-05-26 15:00:58 +08:00
Carter Li fde5f3bd0f Packaging: update debian stuff [ci skip] 2025-05-26 15:00:06 +08:00
李通洲 9e1b1302fb Host (Android): add detection for OnePlus market name
Fix #1768
2025-05-26 14:22:47 +08:00
Carter Li 7e235b6be0 Merge pull request #1766 from fastfetch-cli/dev
Release: v2.44.0
2025-05-23 16:10:12 +08:00
李通洲 f43e1fd614 Release: v2.44.0 2025-05-23 15:41:22 +08:00
Carter Li c7b061eebd DisplayServer (Linux): fix errors on KDE beta
Fix #1765
2025-05-22 09:41:35 +08:00
Carter Li a0f579072f Disk: add --disk-hide-fs
Fix #1762
2025-05-21 16:40:42 +08:00
Carter Li d439ce8eb5 Disk: rename hiddenFolder to hideFolder; add docs 2025-05-21 15:09:19 +08:00
Carter Li e2a714732a Disk: add hiddenFolders (2) 2025-05-21 15:00:42 +08:00
asmeron a993a6f126 Logo (Builtin): Add UBLinux Logo (#1764)
* Logo (Builtin): Add UBLinux Logo

* Update builtin.c

---------

Co-authored-by: asmeron <asmeron@ublinux.com>
Co-authored-by: Carter Li <CarterLi@users.noreply.github.com>
2025-05-20 21:50:34 -05:00
李通洲 8eb8f710d0 Disk: add option --disk-hidden-folders 2025-05-19 18:32:56 +08:00
李通洲 526868e355 Disk (Linux): don't hard code hidden mount points 2025-05-19 15:25:06 +08:00
李通洲 768238cb46 TerminalShell (Linux): ignore script
Fix #1761
2025-05-17 18:04:41 +08:00
Xavier Xiong 2d938042d0 Logo (Builtin): Add Kylin Logo (Remove ANSI codes) (#1760)
* Logo (Builtin): Add Kylin Logo

* Remove all ANSI escape codes from ASCII Logo

* Add color prefix to kylin logo
2025-05-16 01:05:42 -05:00
李通洲 9a54d92e9f Stat: use ESC 7/8 instead of CSI s/u
Fix Apple Terminal compatibility #1755
2025-05-16 10:33:58 +08:00
Collin 839abab744 Doc: Add information of where to find example config files (#1759) [ci skip] 2025-05-15 19:58:36 -05:00
Md. Iftakhar Awal Chowdhury c054570308 fish complete: add --logo-color-[1-9] completion (#1754)
* fish complete: add `--logo-color-[1-9]` completion

* reverted unnecessary changes
2025-05-15 03:18:19 -05:00
Carter Li ed69a7059b Packaging: update debian stuff [ci skip] 2025-05-14 09:51:44 +08:00
Carter Li 6b92659512 Merge pull request #1752 from fastfetch-cli/dev
Release: v2.43.0
2025-05-14 09:41:33 +08:00
Carter Li 7e04305d1c CI: silence spell check errors 2025-05-14 09:25:15 +08:00
Carter Li 87e13543da GPU (Linux): embed asahi_drm.h 2025-05-14 08:59:53 +08:00
Carter Li 7a2cbc060f 3rdparty (yyjson): upgrade to 0.11.1 2025-05-14 08:52:06 +08:00
Carter Li f22d73d473 PhysicalDisk: trim white spaces of serial 2025-05-13 18:29:46 +08:00
李通洲 e629126d73 Doc: update changelog 2025-05-13 15:52:30 +08:00
李通洲 9ac635e2e6 Media (Windows): detect player name (UMP apps only) 2025-05-13 15:46:33 +08:00
李通洲 1b1b0521f4 Doc: update changelog 2025-05-13 13:49:54 +08:00
李通洲 41d0f61ee0 GPU (AMD): remove usage of ADL2_Adapter_VRAMUsage_Get
It reports dedicated GPU memory usage too.

Ref: https://github.com/GPUOpen-LibrariesAndSDKs/display-library/issues/48
2025-05-13 13:39:42 +08:00
李通洲 9de5d9008b Release: v2.43.0 2025-05-13 10:37:52 +08:00
李通洲 576a9cc6fe Revert "Vulkan: use VK_API_VERSION_* instead of deprecated VK_VERSION_*"
Breaks building with old vulkan-headers

This reverts commit 36b0fdbcda.
2025-05-13 10:02:38 +08:00
李通洲 bd61d08afe Sound (macOS): report the volume of muted device as 0% 2025-05-13 09:35:13 +08:00
李通洲 4672b78481 Sound: don't show 255 in custom format
Fix #1750
2025-05-13 09:30:30 +08:00
李通洲 36b0fdbcda Vulkan: use VK_API_VERSION_* instead of deprecated VK_VERSION_* 2025-05-13 09:29:21 +08:00
Carter Li 7626ef6eaa GPU (Linux): fix CI errors
F**k Ubuntu
2025-05-10 21:40:33 +08:00
Carter Li 115108b3f1 GPU (Linux): detect core usage when libamdgpu is not available 2025-05-10 20:57:51 +08:00
Carter Li 154f9f462b GPU (Linux): detect VRAM type of AMD GPUs 2025-05-10 20:57:51 +08:00
Marvin Friedrich a96a9fc31d Smbios: fix transitive include for loff_t (#1746) 2025-05-10 10:49:22 +08:00
李通洲 23b43244c5 GPU (AMD): seems ADL2_Adapter_VRAMUsage_Get reports system mem usage only, not full memory usage
Because VRAMUsage reports a value which is smaller than DedicatedVRAMUsage
2025-05-09 22:46:31 +08:00
Carter Li 9dfb404a0d GPU (AMD): more verbose logs 2025-05-09 22:01:29 +08:00
Carter Li ff3028c656 GPU: don't hide unknown type of GPUs by default
Fix #1742
2025-05-09 21:58:41 +08:00
Carter Li 2f706ed494 Smbios: discard usless values 2025-05-09 21:55:31 +08:00
Carter Li 06427ee62b Media (Linux): fix duplicated playback status 2025-05-09 19:23:28 +08:00
李通洲 fe66eb3df0 GPU (Windows): fix incorrect used shared memory size 2025-05-08 23:20:53 +08:00
李通洲 6e1ab12399 Memory / Swap: always initialize local variables 2025-05-08 23:17:22 +08:00
Samuli Thomasson 484e05eae3 GPU: optionally hide unknown GPUs (#1742)
The current default behavior of not hiding any GPUs is retained. The new
feature of hiding unknown or unrecognized GPUs can be enabled with
hide-type = "unknown".
2025-05-07 22:06:47 +08:00
Joe_ 5d3fb98072 Logo (Builtin): add Hydra Framework logo (#1740)
* Added: Hydra Framework logo

* Remove extra line: hydra.txt
2025-05-07 03:02:36 -05:00
李通洲 0c30590088 Builtin (Logo): new AthenaOS logo
Fix #1741
2025-05-07 10:45:21 +08:00
李通洲 20cd4ce125 Logo (Builtin): sd '\$\{c(\d)\}' '$$$1' * 2025-05-07 10:44:05 +08:00
apocelipes 1c7aa89228 TerminalShell: use ffBinaryExtractStrings result as possible (#1739) 2025-05-06 18:49:29 +08:00
apocelipes f270255770 DisplayServer (Linux): fix xcb_connect error handling (#1735) 2025-05-06 03:18:53 -05:00
李通洲 4b62a3c75b 3rdparty: upgrade yyjson to 0.11.0 2025-05-06 16:12:58 +08:00
李通洲 1557f0c556 Media (macOS): support macOS 15.4
Fix #1737
2025-05-06 16:12:58 +08:00
Carter Li ef7f61309f GPU (Linux): fix asahi linux support again
Found in kernel-headers-6.14.4-400.asahi.fc42.aarch64
2025-05-06 09:27:54 +08:00
李通洲 f59491b25d Disk (Linux): fix possible bug on 32-bit platforms
Fix #1734
2025-05-05 22:05:22 +08:00
李通洲 e3592eb2c3 CPU (FreeBSD): simplify physical core count detection 2025-05-05 13:41:12 +08:00
Carter Li 305776eb94 CPU (SunOS): support physical core count and package count detection 2025-05-02 14:24:30 +08:00
Carter Li 599e0d393d Display: use height to calculate scale factor
Seems more accurate
2025-05-01 21:28:04 +08:00
李通洲 561574ae94 CPU (Windows): always use XxxW 2025-04-30 16:10:53 +08:00
李通洲 3dd78422eb Global: Improve ARRAY_SIZE macro using __is_array 2025-04-30 14:47:37 +08:00
李通洲 5c546ab8e7 Parsing: silence compiler warnings 2025-04-30 14:14:28 +08:00
Carter Li 3e9274040d Packaging: update debian stuff [ci skip] 2025-04-30 14:12:26 +08:00
Carter Li 630d876e2d Merge pull request #1722 from fastfetch-cli/dev
Release: v2.42.0
2025-04-29 14:05:36 +08:00
李通洲 1938be86ff Wifi (NetBSD): fix the ambiguous comment 2025-04-29 13:53:45 +08:00
李通洲 0980d5f0ad Wifi (BSD): correctly prioritize Wi-Fi protocol detection
by using an `if-else if` chain
2025-04-29 13:50:53 +08:00
李通洲 d8c1b3b61b Release: v2.42.0 2025-04-29 10:38:07 +08:00
李通洲 969523ae8a BIOS: normalize the module name
Fix #1721
2025-04-29 10:26:19 +08:00
李通洲 5d960ec744 Uptime: fix non-normalized time being shown
Fix #1720
2025-04-29 10:22:19 +08:00
apocelipes 3b36b8ca57 Global: use ARRAY_SIZE (#1718) 2025-04-28 21:22:04 -05:00
apocelipes 05f14764e6 Bluetooth (Linux): silence an unused variable warning (#1717) 2025-04-28 22:50:46 +08:00
apocelipes 3a180b24e3 Platform: fix a memory leak (#1716) 2025-04-28 22:49:31 +08:00
李通洲 02ab58e001 Doc: update changelog [ci skip] 2025-04-24 09:31:05 +08:00
Carter Li fd158b41e1 Logo (Chafa): fix setting chafa.symbols
Fix #1709
2025-04-24 09:02:45 +08:00
李通洲 89e0ede12f Camera (OpenBSD): add support 2025-04-23 20:09:08 +08:00
李通洲 4d7b2410ef CPU (OpenBSD): fix CPU temperature detection 2025-04-22 21:19:22 +08:00
李通洲 c1f6a2f755 Refactor: inline printError into ffPrintError and remove unused static helper 2025-04-22 14:30:39 +08:00
李通洲 9c455c3b0f Wifi (FreeBSD): fix possible mem leaks 2025-04-20 12:41:06 +08:00
Carter Li d4ea9dfd21 Wifi (NetBSD): add support
Untested
2025-04-20 12:40:47 +08:00
李通洲 08071e6e7e Wifi (OpenBSD): fix file name 2025-04-20 11:49:40 +08:00
李通洲 ec87174f30 CPU (NetBSD): add one more method to detect CPU frequency 2025-04-20 11:43:39 +08:00
李通洲 835e5b51c9 CPU (SunOS): detect CPU temp
Untested
2025-04-20 11:12:08 +08:00
Noa Himesaka 07c5ef255e Logo (Builtin): Add Codex Linux support (#1701)
* feat: add Codex Linux

* Codex.txt: remove empty lines

---------

Co-authored-by: Carter Li <CarterLi@users.noreply.github.com>
2025-04-19 21:22:28 +08:00
李通洲 476b55c17d Logo (Builtin): remove GoralixOS
Ref: #1699
2025-04-19 21:18:13 +08:00
李通洲 4a53cfa312 Logo (Builtin): add Aurora
Fix #1700
2025-04-19 21:11:54 +08:00
李通洲 50ea515476 PhysicalDisk (Linux): don't detect disk type of virtual disks
Fix #1697
2025-04-18 16:10:01 +08:00
xzvf cbd9f72bc8 T2/SDE: upstreaming downstream's logo change (#1695)
* T2/SDE: upstreaming downstream's logo change

T2/SDE port of fastfetch applies two patches, improving the
distribution's logo and adding alternative names. I see no point not
having these upstream.

Downstream's patches are found here:
https://github.com/rxrbln/t2sde/tree/main/package/contrib/fastfetch

The old logo has been renamed to "T2_small".

* Fix ASCII art alignment in t2.txt

---------

Co-authored-by: Carter Li <CarterLi@users.noreply.github.com>
2025-04-17 22:52:45 +08:00
李通洲 29eaa35f4c Color: support #RGB and #RRGGBB
Fix #1694
2025-04-17 10:48:18 +08:00
Carter Li 97c89c39d3 Packaging: update debian stuff [ci skip] 2025-04-16 13:51:09 +08:00
Carter Li 5769791185 Merge pull request #1691 from fastfetch-cli/dev
Release: v2.41.0
2025-04-16 13:29:07 +08:00
李通洲 894c66d793 Processing (Windows): fix macro name __aarch64__
Found by AI
2025-04-16 11:12:36 +08:00
李通洲 75290154b0 Chore: remove Chinese comments [ci skip] 2025-04-16 11:09:03 +08:00
李通洲 b08eea76b1 CI (Linux): enable chafa on Linux aarch64 2025-04-16 10:45:25 +08:00
李通洲 61d83af9ea CI (Linux): bump GH runner for linux-amd64
Ref: https://github.com/actions/runner-images/issues/11101
2025-04-16 10:45:02 +08:00
李通洲 2d497038eb Release: v2.41.0 2025-04-16 09:24:20 +08:00
李通洲 f8a5d5561a Bluetooth (NetBSD): add base implementation
Ref: #1690
2025-04-15 19:06:39 +08:00
李通洲 2e7e68ef23 Doc: add installation instructions for pkgsrc [ci skip]
Fix #1689
2025-04-15 19:04:19 +08:00
李通洲 b812f3ccde Uptime (Windows): use QueryUnbiasedInterruptTime
As suggested by MSDN
2025-04-15 16:41:38 +08:00
李通洲 6da8181bbe CMake: use mincore on WoA 2025-04-15 16:41:38 +08:00
李通洲 a51dd641c1 Processing (Windows): use GetOverlappedResultEx on WoA 2025-04-15 16:41:38 +08:00
李通洲 0d20164d40 CI (Windows): add WoA 2025-04-15 10:59:10 +08:00
李通洲 3320532668 GPU (Linux): add temp detection for Intel GPU
Untested
2025-04-14 18:57:15 +08:00
Carter Li bcc6492115 NetIO (Linux): use openat 2025-04-14 18:48:04 +08:00
naix c60bc8ee5b Logo (Builtin): Add 2 more Alpine logos (#1687)
* Logo (Builtin): Add 2 more Alpine logos

* Remove unnecessary $1 in ASCII logo file

* Add type field to Alpine2 logo configuration

---------

Co-authored-by: naix <naix@noreply.codeberg.org>
Co-authored-by: Carter Li <CarterLi@users.noreply.github.com>
2025-04-14 00:50:45 -05:00
李通洲 4eefab8ccf CPU (Linux): fix build 2025-04-14 10:54:35 +08:00
李通洲 9cda7e20fb Chore: simplify fastfetch.h 2025-04-14 10:28:01 +08:00
李通洲 79d0197dcf Wifi (FreeBSD): remove unused sys headers 2025-04-14 10:04:11 +08:00
李通洲 ba01b1e4ce CPU (Linux): add new ARM part numbers 2025-04-14 09:27:01 +08:00
李通洲 58908f69ba Wifi (OpenBSD): add support
Completely untested.
2025-04-13 00:37:40 +08:00
李通洲 114088b845 Doc: add comments about displaying image logo on Windows [ci skip]
Fix  #1686
2025-04-12 20:38:42 +08:00
李通洲 6e77b592cb WM (FreeBSD): enable Hyprland version detection 2025-04-12 10:48:26 +08:00
李通洲 73bc71e922 CPU (Windows): use PDH to detect thermal temp
No Administrator privileges needed
2025-04-12 10:47:57 +08:00
Anduin Xue 090529ffef Logo (Builtin): Add support for anduinos (#1684)
* Add anduinos

* fix logo.

* Update anduinos.txt
2025-04-10 23:13:26 +08:00
李通洲 3c291f1af9 Platform: retrieve full user name 2025-04-09 16:15:23 +08:00
李通洲 fc31fe4aa4 Merge branch 'master' into dev 2025-04-09 14:39:51 +08:00
李通洲 563f9598be Release: v2.40.4 2025-04-09 14:24:27 +08:00
Carter Li 03bc2dade9 Fastfetch: fix loading presets in {exePath}/presets
Regression of v2.40.0
2025-04-09 14:15:06 +08:00
Carter Li 09d683b706 WM (Linux): remove v from Hyprland version 2025-04-09 14:14:56 +08:00
Carter Li 523a9590b8 Fastfetch: fix loading presets in {exePath}/presets
Regression of v2.40.0
2025-04-08 15:42:58 +08:00
李通洲 3c3188eb05 IO (Windows): support ~ expanding 2025-04-07 16:43:48 +08:00
李通洲 354062118f Chore: update comment 2025-04-07 16:43:48 +08:00
李通洲 85d7390fa8 Util (Windows): use native win32 functions 2025-04-07 16:38:54 +08:00
Carter Li 8509f97054 WM (Linux): remove v from Hyprland version 2025-04-06 17:21:32 +08:00
Rabindra Dhakal 8d5d8b4c90 Packages (Linux): add soar packages count (#1531)
* add soar packages count

* use || instead of concat for better compatibility with older SQLite versions

* convert package flags to 64-bit
2025-04-05 23:54:27 +08:00
李通洲 536ad9594e PhysicalDisk (Linux): add more disk types 2025-04-05 22:35:42 +08:00
李通洲 a57bbbadf4 PhysicalDisk (Linux): don't detect disk type for virtual disks
Fix #1669
2025-04-05 22:35:42 +08:00
李通洲 3def466ee0 Revert "CPU (FreeBSD): remove using of freq_levels"
This reverts commit ed2dd8f2ec.
2025-04-05 13:54:20 +08:00
李通洲 59868c66a0 CPU (FreeBSD): don't assume one SMT group has only two threads
Fix #1670
2025-04-05 13:48:18 +08:00
Carter Li e13eb05073 CPU (Linux): detect physical core count on non-x86 platforms 2025-04-05 12:08:35 +08:00
Carter Li cdda65e6ad Merge pull request #1673 from fastfetch-cli/dev
Release: v2.40.3
2025-04-05 09:14:34 +08:00
Carter Li a7ac89818c Logo (Image): mark kitty image protocol support for warp terminal on macOS 2025-04-05 08:59:35 +08:00
李通洲 06956d2cf4 Release: v2.40.3 2025-04-05 08:42:24 +08:00
李通洲 ac52ea1afb Fastfetch: fix loading example configs from presets directory
Fix #1672
2025-04-05 08:42:24 +08:00
Carter Li b68e0ce8ae Merge pull request #1668 from fastfetch-cli/dev
Release v2.40.2
2025-04-04 19:38:49 +08:00
李通洲 8d6ed2e847 Release: v2.40.2 2025-04-04 19:23:22 +08:00
李通洲 4211d15cdb Doc: fix CI errors (2) 2025-04-04 19:12:01 +08:00
李通洲 2ff8d8864d Doc: fix CI errors 2025-04-04 19:07:56 +08:00
李通洲 884c902d93 Doc: migrate some help texts to Github Wiki pages 2025-04-04 18:59:15 +08:00
李通洲 16c56254b0 Doc: update documents 2025-04-04 18:51:31 +08:00
李通洲 88eaab670f Doc: update README 2025-04-04 16:18:57 +08:00
李通洲 3e7630e074 Fastfetch: enforce .jsonc extension when loading config file
Examples:
1. `-c filename`: load `filename.jsonc`
2. `-c filename.jsonc`: load `filename.jsonc`
3. `-c filename.json`: load `filename.json` and enforce strict JSON syntax (no comment and trailing comma support)
4. `-c filename.ext`: load `filename.ext.jsonc` (`jsonc` extension is enforced)
2025-04-04 14:45:48 +08:00
李通洲 744455d8b7 Logo (Image): default to kitty protocol in warp terminal
Fix #1666
2025-04-04 14:41:06 +08:00
Carter Li bcc8f6d0b8 Merge pull request #1665 from fastfetch-cli/dev
Release v2.40.1
2025-04-04 00:45:57 +08:00
Carter Li 90ca6ee3cd Release: v2.40.1 2025-04-04 00:27:11 +08:00
李通洲 b679185c87 Logo: don't try to find files named - 2025-04-03 22:42:15 +08:00
李通洲 6bbed12083 IO: remove fast path of ffPathExists, which causes too many problems
Fix #1662
2025-04-03 22:38:05 +08:00
李通洲 f04851891e TPM (macOS): fix compiling error on old system
Fix #1659
2025-04-03 16:21:02 +08:00
Carter Li f94d9ca3bd Packaging: update debian stuff [ci skip] 2025-04-03 08:49:01 +08:00
Carter Li f833dda3b9 Merge pull request #1656 from fastfetch-cli/dev
Release: v2.40.0
2025-04-03 08:41:21 +08:00
李通洲 ceecb39bc5 WM (Linux): fix https://github.com/fastfetch-cli/fastfetch/issues/1657#issuecomment-2772749780 2025-04-02 23:22:34 +08:00
Carter Li c957ca7230 WM (Linux): query Hyprland version from hyprland dev header 2025-04-02 19:15:09 +08:00
李通洲 5dfd2676c2 Binary: add comments 2025-04-02 10:35:42 +08:00
李通洲 d650f67ece WM (Linux): correctly fall back to calling wm --version if ffBinaryExtractStrings fails
Fix #1657
2025-04-02 10:35:42 +08:00
李通洲 760e82913a CI: remove Dragonfly BSD
Ref: #1632
2025-04-02 08:53:51 +08:00
Carter Li e64a44a3e6 WM (Linux): fix (?) Hyprland version detection 2025-04-02 00:12:21 +08:00
李通洲 be9cf00b05 Release: v2.40.0 2025-04-01 20:20:06 +08:00
李通洲 52fdabeb2e Uptime: round seconds to the nearest minute
To match the behavior of `uptime` command
2025-04-01 19:40:15 +08:00
李通洲 846f4c003e DisplayServer (Linux): silence compiler errors 2025-04-01 19:15:21 +08:00
李通洲 dc5f2ac577 Util (Windows): fix mem leaks 2025-04-01 19:15:20 +08:00
李通洲 663650cb61 Util (Windows): fix possible errors in Unicode.c 2025-04-01 19:15:20 +08:00
李通洲 45aecae221 Util (Linux): fix executable file check 2025-04-01 19:02:35 +08:00
李通洲 3d3669ae3a FFlist: use uint8_t instead of char to store raw data 2025-04-01 19:02:35 +08:00
李通洲 ac2aba0faf Threading: fix timeout calcuation 2025-04-01 11:07:28 +08:00
李通洲 d0ca944b9c Netif (Linux): support default route detection for ipv6 2025-04-01 10:48:30 +08:00
李通洲 3d7c631abd Wifi: fix code smells 2025-04-01 10:48:04 +08:00
Carter Li abe78823b6 PhysicalMemory (Linux): code refactor 2025-04-01 09:43:37 +08:00
李通洲 7e03b03cb7 Users (Linux): support IPv6 client addr 2025-04-01 09:43:37 +08:00
李通洲 27fe997dc3 Users (Windows): support IPv6 client IP 2025-03-31 23:41:54 +08:00
李通洲 fe46159e40 Uptime (NetBSD): fix boot time calcuation 2025-03-31 23:40:35 +08:00
李通洲 031aa985f1 TPM (macOS): add support 2025-03-31 23:40:01 +08:00
李通洲 07c61f70d9 InitSystem (Haiku): set pid=0 if fails to detect init pid 2025-03-31 23:39:25 +08:00
李通洲 71b05d2594 Doc: update changelog [ci skip] 2025-03-31 21:43:43 +08:00
李通洲 98665d1b82 Revert "CI: build in debug mode"
This reverts commit e05ac797cc.
2025-03-31 19:08:02 +08:00
李通洲 da0eedf888 Swap (Windows): support multiple paging files 2025-03-31 18:56:03 +08:00
李通洲 1133cb619b Swap (OpenBSD): fix mem leaks 2025-03-31 18:56:03 +08:00
李通洲 a091d209cf Swap: fix code smells 2025-03-31 18:44:41 +08:00
李通洲 47c658815b Sound: fix typo and mem leaks 2025-03-31 16:38:58 +08:00
李通洲 b0d0c74073 Doc: update changelog [ci skip] 2025-03-31 10:59:55 +08:00
李通洲 9535b4d480 Chore (Windows): silense compiler warnings 2025-03-31 10:48:14 +08:00
Carter Li c64cbf57d8 fastfetch: load config from fastfetch binary path
Fix #1649
2025-03-31 10:48:09 +08:00
komaru.yml d11235bbe2 Logo (Ascii): Change Nexa Linux logo (#1653) 2025-03-31 08:51:48 +08:00
Angel Gustavo Lopez 3054c6618e Logo (Builtin): change name of Xray-OS 2025-03-30 21:48:47 +08:00
李通洲 f34d51dddc Terminal (Windows): fix file version detection 2025-03-30 16:38:54 +08:00
李通洲 e05ac797cc CI: build in debug mode 2025-03-29 20:42:42 +08:00
李通洲 187059deef GPU (Windows): fix max frequency detection for AMD ODN 2025-03-29 20:42:42 +08:00
李通洲 5c9f184314 GPU (Windows): use ODN as OD7; fix ADL2_Overdrive8_Current_Setting_Get call and some other bugs 2025-03-29 17:03:56 +08:00
李通洲 49725c2cc6 Doc: update changelog [ci skip] 2025-03-28 16:32:13 +08:00
李通洲 eec9a26952 TerminalFont (Windows): support Warp Terminal 2025-03-28 15:26:30 +08:00
李通洲 88d616e978 GPU (Windows): try more OD funcs; add more verbose logs 2025-03-28 14:57:43 +08:00
李通洲 4fccad5d10 Disk (macOS): silense compiler warnings 2025-03-28 14:57:43 +08:00
李通洲 ec18363f51 DNS (macOS): detect DNS entries by SystemConfiguration 2025-03-28 10:49:20 +08:00
Carter Li b87a36785b DNS (Linux): add systemd-resolved support; add verbose logs 2025-03-28 09:50:33 +08:00
李通洲 1d7b212d8d Media: fix code smells 2025-03-27 16:44:14 +08:00
李通洲 4b6f2a9efa Gamepad / Keyboard / Mouse (FreeBSD): break detection earlier 2025-03-27 14:40:33 +08:00
李通洲 bdaf303da4 Keyboard (FreeBSD): fall back to KDGKBINFO if usbhid fails 2025-03-27 14:15:25 +08:00
李通洲 3fb773eedd Gamepad / Mouse / Keyboard (FreeBSD): fix memleaks 2025-03-27 14:08:01 +08:00
李通洲 e73647973d Host (Windows): fix build on WoA 2025-03-27 09:38:32 +08:00
李通洲 d2b3a075b2 GPU (Windows): actually use correct OD fns for recent AMD GPUs 2025-03-27 09:29:21 +08:00
李通洲 f139148745 GPU (Windows): add OverdriveN functions for AMD 2025-03-26 23:55:23 +08:00
Carter Li e2ec2c695c GPU (Windows): fix ADL2_Adapter_AdapterInfoX3_Get result test 2025-03-26 22:22:44 +08:00
李通洲 ba4ec47a8c GPU (Windows): added verbose logs 2025-03-26 21:10:51 +08:00
李通洲 de5ef3842c Global: fix code smells 2025-03-26 16:44:52 +08:00
李通洲 1129ed9be4 Host (macOS): add new models; fix an invalid model ID 2025-03-26 16:27:15 +08:00
李通洲 0d4f1544c7 Chore: fix code smell 2025-03-26 14:42:55 +08:00
李通洲 e68a9476b5 Disk (SunOS): remove creation time detection support
ctim is `Timestamp of last file status change`, not creation time
2025-03-26 11:02:57 +08:00
李通洲 17556c7a95 Util/debug: add missing #pragma once 2025-03-26 09:47:33 +08:00
李通洲 eca9f626a5 Separator: fix outputColor doesn't work when length is set
Fix #1644
2025-03-25 23:22:25 +08:00
李通洲 7562e05123 Chore: fix a lot code smell 2025-03-25 22:08:50 +08:00
李通洲 bf17f2b4b9 LocalIP: change {name} to {ifname} in --localip-key-format for consistancy
Breaking change.

Fix #1639
2025-03-25 22:08:50 +08:00
李通洲 88e193e9fd GPU: fix code smell 2025-03-25 22:08:50 +08:00
李通洲 e474a47fad GPU (General): fix GPU device type detection 2025-03-25 22:08:50 +08:00
李通洲 c77fb71a69 Battery (NetBSD): report remaining time 2025-03-25 22:08:49 +08:00
李通洲 48dd5976e1 Battery (Linux): fix critical state detection 2025-03-25 22:08:49 +08:00
李通洲 093f7e438b Battery (macOS): fix manufacture date detection 2025-03-25 22:08:49 +08:00
李通洲 0a0c1745b3 GPU (macOS): fix code smell 2025-03-25 22:08:49 +08:00
Techflash 7b5dc58140 CPU (Linux): fix CPU detection on some PPC platforms (#1640)
On some PowerPC devices (notably the Nintendo Wii and Nintendo Wii U),
fastfetch detects the CPU incorrectly.  It goes down the code path
of 'detectSocName()', and actually matches the model of the device
itself... as the CPU model name.  This is obviously incorrect, and
leads to reporting such as 'CPU: wii'.  Disable this code path
alltogether on PPC to prevent this, and just let it pull from cpuinfo.
This lets it have correct CPU reporting, such as on the Wii, giving
'CPU: 750CL @ 0.73GHz'.
2025-03-25 03:05:23 -05:00
李通洲 8681d2f74a GPU (Windows): fix code smells 2025-03-25 00:14:03 +08:00
李通洲 2b20ed873c GPU: update JSON result structure; fix segfault and memleaks 2025-03-24 22:56:00 +08:00
李通洲 ae3c15b7fd GPU (Windows): support VMEM type detection via nvapi
Ref #993
2025-03-24 21:43:09 +08:00
李通洲 8dafd8f300 GPU (Windows): rewrite implementation for AMD GPUs using ADL SDK
Detect more information including memory type
2025-03-24 21:43:09 +08:00
李通洲 c9a1765f29 GPU (Windows): support memory type detection for Intel dGPUs 2025-03-24 15:22:34 +08:00
李通洲 cc246ea239 GPU: prepare for memory type & shared memory usage detection 2025-03-24 15:21:14 +08:00
李通洲 0ae5fceb07 GPU (Windows): add display-library for future use 2025-03-23 23:53:01 +08:00
李通洲 6dd18050be IO: don't suppress IO in debug mode 2025-03-23 21:56:32 +08:00
李通洲 9eca6e0b48 Bootmgr: report boot order 2025-03-23 21:30:53 +08:00
李通洲 4d58d1be66 Smbios (OpenBSD): add comments for UEFI systems [ci skip] 2025-03-23 20:30:31 +08:00
Carter Li 6694388969 Logo (Builtin): fix opensuse-tumbleweed_small
Fix #1636
2025-03-23 17:22:02 +08:00
Carter Li f7058cd125 Wifi (Linux): add verbose logs 2025-03-23 17:19:43 +08:00
李通洲 80033b656f Wifi (DragonFly): fix building 2025-03-23 12:23:30 +08:00
李通洲 1c719fa743 Bootmgr (BSD): add support for OpenBSD and NetBSD 2025-03-23 12:08:15 +08:00
李通洲 a9f5722fd9 BIOS (OpenBSD): check bios type 2025-03-23 11:34:02 +08:00
李通洲 0952d7917f Smbios: add verbose debug logs 2025-03-23 11:19:49 +08:00
李通洲 a3f50f32bf Smbios (OpenBSD): add support for legency BIOS 2025-03-23 11:19:49 +08:00
李通洲 ab1bfffbd4 util/debug: add missing headers 2025-03-23 10:52:08 +08:00
李通洲 41d6187f11 Wifi (FreeBSD): use ioctl to improve performance
And support more features
2025-03-23 09:46:44 +08:00
Techflash d4b175b146 Logo (Builtin): Change WiiLinuxNgx to more generic name (#1633)
Wii-Linux-Ngx is no longer the most up to date version of Linux for the Wii.
This change retains the original name for compatibility sake, and because
Neagix's version does indeed still exist.  It moves the ASCII art to a more
generic file path, and introduces 2 new aliases for it: Wii-Linux, and WiiLinux.
2025-03-21 17:21:54 +08:00
Carter Li 8905962389 Packaging: update debian stuff [ci skip] 2025-03-21 11:03:29 +08:00
李通洲 d9d34ccbbb Terminal (macOS): fix Warp Terminal pid detection 2025-03-21 10:08:26 +08:00
李通洲 d21048c165 Presets: update examples/{24,26} [ci skip] 2025-03-21 09:43:06 +08:00
Carter Li 8b0c32a35f Merge pull request #1631 from fastfetch-cli/dev
Release v2.39.1
2025-03-20 23:24:14 +08:00
李通洲 db269d29e8 Release: v2.39.1 2025-03-20 23:16:13 +08:00
李通洲 f9f628eae6 Networking: request HTTP/1.0, as we don't support chunked response
Fix #1629
2025-03-20 23:08:41 +08:00
Carter Li 92e9fbf2eb Packaging: update debian stuff [ci skip] 2025-03-20 10:41:30 +08:00
Carter Li db6e4f4bfc Merge pull request #1625 from fastfetch-cli/dev
Release: v2.39.0
2025-03-20 09:48:26 +08:00
李通洲 b662db452f Packages (Linux): add pkgsrc detection
We will not add pkgsrc detection for macOS unless someone can verify it.

Ref: https://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/sysutils/fastfetch/patches/patch-src_detection_packages_packages__linux.c?rev=1.1;content-type=text%2Fplain
2025-03-19 14:59:59 +08:00
李通洲 0d2ccb5fe5 Logo (Builtin): add NetBSD2
Ref: https://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/sysutils/fastfetch/patches/patch-src_logo_ascii_netbsd2.txt?rev=1.1;content-type=text%2Fplain
2025-03-19 14:49:49 +08:00
apocelipes d33b5d60b6 Display (Linux): fix the error check for ffReadFileData (#1622) 2025-03-18 19:51:51 +08:00
李通洲 ef5d12395b Release: v2.39.0 2025-03-18 16:25:35 +08:00
李通洲 e18c261054 Networking (FreeBSD): support fast path without TFO enabled 2025-03-18 14:18:53 +08:00
Carter Li 8851821484 Networking: don't enable TFO if server doesn't support it 2025-03-18 10:53:02 +08:00
Carter Li 3489cc8fe8 Networking: don't enable HTTP compression if server doesn't support it 2025-03-18 10:19:32 +08:00
Carter Li 28bc97b92b Networking (Linux): remove unnecessary variables 2025-03-18 09:51:11 +08:00
李通洲 dbc5a7961e Networking (Linux): don't generate SIGPIPE 2025-03-17 23:13:44 +08:00
李通洲 5f43f63990 Networking (Windows): more verbose log 2025-03-17 22:54:47 +08:00
李通洲 b775fe7486 Networking (macOS): support TFO 2025-03-17 15:59:39 +08:00
李通洲 60eaa326a2 Networking (BSD): support TCP_FASTOPEN 2025-03-17 09:07:30 +08:00
李通洲 672d4ad543 Completion (Bash): Use fastfetch --help-raw for auto-completion
Fix #1619
2025-03-16 18:35:50 +08:00
李通洲 96e9e61437 Networking (Windows): print readable error message 2025-03-16 10:38:04 +08:00
李通洲 dbc6f70f19 Networking (Windows): fix libz loading; use TCP_FASTOPEN if available 2025-03-16 10:09:33 +08:00
Carter Li dfc9bc265c Networking: silence compiler warnings 2025-03-16 09:51:50 +08:00
Carter Li 2ce511c4d3 Networking (Linux): handle a case when sendto() reports EINPROGRESS 2025-03-16 09:40:12 +08:00
李通洲 99415a3841 Networking: move files to a sub folder 2025-03-15 23:47:02 +08:00
李通洲 244625d26a Networking (Windows): apply the same optimizations of *nix's 2025-03-15 23:35:58 +08:00
李通洲 840434e709 Netif (Windows): use GetIpForwardTable2 to support IPv6 2025-03-15 22:37:49 +08:00
Carter Li 72afa9ef99 Networking (Linux): improve performance by TFO and response compression 2025-03-15 22:35:11 +08:00
李通洲 7400f14322 Netif (DragonFly): use code of OpenBSD 2025-03-14 23:54:03 +08:00
李通洲 85654316c7 NetIF (OpenBSD): fix default route detection 2025-03-14 22:15:20 +08:00
李通洲 8ecd58dd14 Doc: update changelog [ci skip] 2025-03-14 16:12:16 +08:00
李通洲 65c7f68c31 Wifi (macOS): remove usage of Apple80211
It's no longer useful in Sequoia
2025-03-14 15:53:08 +08:00
李通洲 bf6d0f871a Completions (Bash): remove --lib-*
They are removed long ago
2025-03-14 15:32:22 +08:00
李通洲 3cd7c6c916 OpenGL: drop OSMesa backend
Fix #1618
2025-03-14 15:30:52 +08:00
李通洲 3227e934de Logo (Builtin): add Bredos
Fix #1615
2025-03-14 09:43:16 +08:00
WolfTech Innovations b66a009046 Logo (Builtin): Change FoxOS to WolfOS (#1534)
* Update builtin.c

* Update and rename foxos.txt to wolfos.txt

* Update builtin.c

* Update builtin.c

* Update builtin.c

* Logo (Builtin): move WolfOS to the correct place

* Update wolfos.txt

* Update src/logo/builtin.c

Co-authored-by: Levvie - she/her <11600822+ItzLevvie@users.noreply.github.com>

* Update src/logo/builtin.c

Co-authored-by: Levvie - she/her <11600822+ItzLevvie@users.noreply.github.com>

---------

Co-authored-by: komaru <winbo.yml@proton.me>
Co-authored-by: Levvie - she/her <11600822+ItzLevvie@users.noreply.github.com>
2025-03-11 08:48:39 +08:00
李通洲 6ef4f62d5b Terminal (Windows): detect warp version 2025-03-06 22:11:36 +08:00
李通洲 c038024108 Wifi (macOS): improve performance of SSID detection on Sequoia
Fix #1597
Thanks @torma616 for the information
2025-03-06 16:04:22 +08:00
李通洲 df49a01827 Merge remote-tracking branch 'origin/master' into dev 2025-03-06 15:16:07 +08:00
Carter Li 924c670915 Packaging: update debian stuff [ci skip] 2025-03-05 14:59:16 +08:00
李通洲 be89dff12a Kmod (NetBSD): add __attribute__((__packed__)) to ensure memory layout 2025-03-04 23:23:46 +08:00
李通洲 c1807a1108 CI: remove unnecessary deps 2025-03-04 23:23:46 +08:00
Matheus Castello b569acbb5d Logo (Builtin): Add Common Torizon OS as a variant 2025-03-04 21:57:29 +08:00
李通洲 6e571a3163 Display (Windows): prefer DISPLAYCONFIG_DEVICE_INFO_GET_ADVANCED_COLOR_INFO_2 2025-03-04 21:13:48 +08:00
李通洲 01e78e2179 Kmod (NetBSD): add support 2025-03-03 20:27:14 +08:00
Carter Li 1b219a9d5c Merge pull request #1596 from fastfetch-cli/dev
Release: v2.38.0
2025-03-03 13:30:58 +08:00
李通洲 0ac01003b2 CI: try fixing CI failures 2025-03-03 10:33:33 +08:00
李通洲 a36bdfabd0 Release: v2.38.0 2025-03-03 10:18:13 +08:00
李通洲 570abb194a Chore: update image logo
Make the rocket bigger, so it's more visible in small size
2025-03-03 10:12:21 +08:00
Carter Li 4e00f37be9 Camera (macOS): silence compiler warnings 2025-03-02 10:43:54 +08:00
李通洲 334afc9838 Camera (macOS): fix crashing on old macOS version
Fix #1594
2025-03-02 10:24:02 +08:00
李通洲 64f9e53a36 CI (macOS): remove CodeQL
It slows down the CI greatly, but never reports anything useful.
2025-03-02 10:18:00 +08:00
Yurin Doctrine b94c6ab8d5 Logo (Builtin): Add Shebang Linux (#1592)
* add src/logo/ascii/shebang.txt

Support for Shebang Linux

* add Shebang to src/logo/builtin.c

Support for Shebang Linux

* fix Shebang order in builtin.c
2025-03-01 20:00:18 +08:00
李通洲 38ea333644 Doc: update supported platforms 2025-02-28 16:19:05 +08:00
李通洲 efbdaf7aaf Logo (Builtin): update fastfetch logo to match the svg one 2025-02-28 16:18:43 +08:00
李通洲 aee7b37fc8 Chore (Windows): set exe file icon to fastfetch logo 2025-02-28 15:44:31 +08:00
李通洲 664460cd34 Logo: add fastfetch logo 2025-02-28 15:06:39 +08:00
李通洲 a66e1b2e6d Doc: fix SI size prefix description
Fix #1589
2025-02-27 21:13:58 +08:00
李通洲 8000574a82 Doc: update changelog [ci skip] 2025-02-27 16:16:05 +08:00
李通洲 2eae5a86d2 Camera (macOS): try fixing segfault in macOS 10.15 2025-02-27 00:00:05 +08:00
李通洲 75da934815 Brightness: detect & print screen type 2025-02-26 09:31:09 +08:00
Carter Li ac71ebcad9 Terminal (Linux): support termite version detection 2025-02-26 09:28:18 +08:00
koraynilay 383a6c8a05 TerminalFont (Linux): support termite terminal (#1588)
currently developed termite fork: https://github.com/aperezdc/termite
2025-02-26 09:12:53 +08:00
李通洲 8e79fde0d9 JsonSchema: update format json [ci skip] 2025-02-25 10:34:16 +08:00
Kerem Gökcek 4f4622eab9 Packages (Linux): Add support for Pisi Linux (#1580) 2025-02-24 15:29:14 +08:00
Carter Li a2327b7350 GPU: support percentage num & bar in custom format
Fix #1583
2025-02-24 15:19:40 +08:00
李通洲 b76ada7f30 Logo (Builtin): simplify 2025-02-24 15:19:40 +08:00
TurtleMeds 59b568a6d0 Logo (Builtin): Added Bedrock Linux small ASCII logo (#1582)
* Logo (Builtin): Added Bedrock Linux small ASCII logo

* Logo (Builtin): fixed spacing of small bedrock logo

* Update bedrock_small.txt

---------

Co-authored-by: Carter Li <CarterLi@users.noreply.github.com>
2025-02-24 14:56:04 +08:00
Carter Li 3d6bd26e59 Bootmgr (Linux): fix secure boot testing
Fix #1584
2025-02-24 13:57:38 +08:00
李通洲 4e17688b7c Logo (Builtin): simplify os names 2025-02-21 14:31:21 +08:00
李通洲 f34548621f OS (Linux): fix VanillaOS detection 2025-02-21 10:32:34 +08:00
李通洲 7a2e071081 Builtin (Logo): simplify linuxmint handling 2025-02-21 09:02:26 +08:00
李通洲 de7b57d807 Logo (Builtin): add opensuse-tumbleweed_small 2025-02-21 08:48:30 +08:00
李通洲 6de9d0c024 Disk: add {mountpoint} and {mount-from} in custom output format
Fix #1577
2025-02-20 19:58:10 +08:00
李通洲 8f69533f30 Presets: fix OS key in examples/25 2025-02-20 19:48:08 +08:00
李通洲 d463853aeb DateTime (Windows): fix day-pretty output in custom format 2025-02-20 19:47:27 +08:00
李通洲 1047d1cf6e Presets: add a new example 2025-02-20 16:39:32 +08:00
李通洲 0bfa12c38c OS: allow customize key format with kernel name and distro name 2025-02-20 15:59:28 +08:00
李通洲 c8e4962cfd Battery: add missing {icon} in key format 2025-02-20 15:58:38 +08:00
李通洲 171005b6a3 Chassis (macOS): add support
Based on model string matching
2025-02-20 15:57:57 +08:00
李通洲 8526f4a021 JsonSchema: update format schema 2025-02-20 10:31:41 +08:00
François Revol 3e5d129248 Battery (Haiku): handle empty slots
My ThinkPad has a second slot for external batteries.
2025-02-19 22:21:43 +08:00
Carter Li 6e98db3bf3 Packaging: update debian stuff [ci skip] 2025-02-19 15:44:54 +08:00
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
Carter Li 865929b173 Merge pull request #1526 from fastfetch-cli/dev
Release: v2.35.0
2025-01-26 10:14:38 +08:00
李通洲 9324136f52 Thread: optimise locking (unused though) 2025-01-26 09:49:31 +08:00
李通洲 f601d2d9f5 CPU (Linux): add comments 2025-01-26 09:47:31 +08:00
李通洲 54de7c8c96 Release: v2.35.0 2025-01-25 23:03:47 +08:00
李通洲 3bb3bd542e PhysicalDisk: change temp range to 50-70 °C
Fix #1525
2025-01-25 21:41:00 +08:00
李通洲 e6e7572bc2 Doc: update changelog again [ci skip] 2025-01-25 11:01:35 +08:00
李通洲 884d256a34 Doc: update changelog [ci skip] 2025-01-24 21:14:21 +08:00
Carter Li ed8430fb2f Doc: update json_schema [ci skip] 2025-01-24 14:17:19 +08:00
Carter Li 7fc1f0098e Doc: update changelog [ci skip] 2025-01-24 14:08:01 +08:00
Carter Li 3839ee60d6 Disk / Users: support duration printing in custom format 2025-01-24 14:05:16 +08:00
Carter Li 6f266a1609 Doc: update changelog 2025-01-24 10:13:31 +08:00
Carter Li 026489c934 CPU (Android): add QS8E for Galaxy 2025-01-24 10:05:24 +08:00
Carter Li 1d03747ec3 CMake: add option -DCUSTOM_LSB_RELEASE_PATH 2025-01-24 09:57:15 +08:00
Carter Li a2919f5b2e OS (Linux): acquire more os info from lsb-release if missing from os-release
Fix #1521
2025-01-24 09:57:15 +08:00
Carter Li 680978b0d3 Logo (Builtin): fix more escape problems
Ref: #1522
2025-01-24 09:57:15 +08:00
Carter Li af813dee00 Logo (Builtin): fix OpenBSD & OpenBSD_small
Fix #1522
2025-01-24 08:44:44 +08:00
User8395 c281c46fff Logo (Builtin): Add KDE Linux logo (#1523)
* Add KDE Linux logo

* Update coloring
2025-01-24 08:44:27 +08:00
Carter Li 1f5e56c69e CPU (Android): detect new QS8E 2025-01-23 19:33:42 +08:00
Carter Li 35d431dd3f CPU (Linux): detect SOC name on RISCV
Fix #1519
2025-01-22 22:19:23 +08:00
李通洲 6a2e8de563 Doc: update changelog [ci skip] 2025-01-22 15:48:52 +08:00
李通洲 9528cf96f0 Presets: fix percentage number printing in examples/20 [ci skip] 2025-01-22 09:01:08 +08:00
Carter Li 66deb4316b Disk (NetBSD): silence compiler warnings
Ref: https://github.com/NetBSD/pkgsrc/blob/ef998fe87c836293a337726e5f212011d4ee0327/sysutils/fastfetch/patches/patch-src_detection_disk_disk__bsd.c
2025-01-21 09:41:40 +08:00
Carter Li 61e9db97b9 Doc: update feature_request issue template 2025-01-21 08:52:07 +08:00
Carter Li 66fbda9542 Display (Linux): return reason if errored 2025-01-21 08:44:24 +08:00
李通洲 5137a9e7a4 Packages: fix file type check 2025-01-18 19:34:50 +08:00
李通洲 f76981c241 Packages (SunOS): fix building 2025-01-17 15:58:09 +08:00
李通洲 85050f7ff1 Packages: add pkgsrc; code refactor
Fix #1515
2025-01-17 11:01:47 +08:00
李通洲 0b39d6fc59 Doc: update issue templates [ci skip] 2025-01-16 15:13:41 +08:00
李通洲 b7dd7fea0a CI: add linux-armv6 2025-01-16 10:20:34 +08:00
李通洲 cc51596e5c OpenGL: suppress output of EGL again
oops...
2025-01-15 21:39:21 +08:00
李通洲 b566ffe81b Doc: update more issue templates [ci skip] 2025-01-15 14:15:03 +08:00
李通洲 60c06a888c Doc: split bug report issue template into smaller parts [ci skip] 2025-01-15 13:47:04 +08:00
Carter Li 8ceda02bbb CPU (Linux): query SOC name in cpuinfo for aarch64
Fix #1510
2025-01-14 13:54:27 +08:00
Carter Li c005bc50c2 TerminalShell (Linux): ignore proot 2025-01-14 13:46:59 +08:00
Carter Li 52411f6e37 Logo (Builtin): update netbsd small 2025-01-14 10:38:27 +08:00
Carter Li 31f620c041 Logo (Builtin): add Arch Old
Fix #1511
2025-01-14 10:38:21 +08:00
Carter Li fdbd8d9ad5 Chore: forbid using of VLAs 2025-01-14 10:28:22 +08:00
Carter Li 1cad1dfdb0 Packaging: update debian stuff [ci skip] 2025-01-13 16:16:32 +08:00
Carter Li 4a1037d2b6 Merge pull request #1509 from fastfetch-cli/dev
Release: v2.34.1
2025-01-13 15:57:52 +08:00
Carter Li dbcd5b922a Sound: fix a memleak 2025-01-13 15:39:16 +08:00
Carter Li 8982b860f9 Chore: fix spelling 2025-01-13 15:15:28 +08:00
Carter Li 373b4353bb CPU (BSD): improve base freq detection 2025-01-13 15:06:18 +08:00
Carter Li ace336dfa9 Release: v2.34.1 2025-01-13 14:55:53 +08:00
CELESTIFYX Team 4060626382 fix(logo): Rename *_LOGO_SMARTOS to *_LOGO_SNIGDHAOS (#1502) 2025-01-13 13:48:02 +08:00
李通洲 9f9e3dd931 Logo (Builtin): add Oreon 2025-01-13 13:42:20 +08:00
李通洲 3ed5a250a4 Logo (Builtin): add HeliumOS 2025-01-13 13:39:07 +08:00
carterli fc969b01c7 Memory (NetBSD): change formula to be consistant with other systems 2025-01-13 10:47:25 +08:00
carterli 41e22ea866 Memory (OpenBSD): update formula to be consistant with other systems 2025-01-13 10:47:25 +08:00
李通洲 0b4a6055c6 Logo (Builtin): add netbsd_small 2025-01-13 10:41:11 +08:00
Carter Li b340d4e149 CI: fix build 2025-01-12 12:10:10 +08:00
Carter Li 878e516880 DisplayServer (Linux): upgrade wayland protocol kde-output-device-v2
Ref: #1504
2025-01-12 11:23:42 +08:00
Carter Li 4e3673a2bb DisplayServer (Linux): check HDR support with xx_color_manager_v4_interface (WIP) 2025-01-11 13:10:07 +08:00
李通洲 10c8c1b4bf Media (Linux): use file name as media name if song title is not available 2025-01-10 22:17:36 +08:00
李通洲 17e3853f38 CPU (FreeBSD): bind process to the first 2 cores 2025-01-10 21:14:51 +08:00
李通洲 1bc41dfa54 chore: remove unnecessary NULL checks
Fix #1494
2025-01-10 14:01:48 +08:00
李通洲 8c227ae4b8 TerminalFont (macOS): fix Ghostty termfont detection
`~/Library/Application Support/com.mitchellh.ghostty/config` is generated as an empty file if the settings dialog is opened

Fix #1495
2025-01-10 09:41:19 +08:00
李通洲 c5c2589f4d GPU: set GPU vendor string when using OpenGL backend 2025-01-10 08:48:29 +08:00
Carter Li b273693842 Packaging: update debian stuff [ci skip] 2025-01-09 09:06:41 +08:00
Carter Li 52de8df1f9 Merge pull request #1492 from fastfetch-cli/dev
Release: v2.34.0
2025-01-09 09:02:12 +08:00
李通洲 be99c4ca6e Media (Linux): remove unused variables 2025-01-09 08:50:56 +08:00
李通洲 8133c3365f Doc: update JSON schema [ci skip] 2025-01-08 22:29:49 +08:00
李通洲 6226ccc70e Processing (Windows): fix get current process 2025-01-08 20:37:35 +08:00
李通洲 88917cb14f OpenGL (EGL): try GLES 2.0+; then fallback to 1.1 if failed 2025-01-08 20:13:01 +08:00
Carter Li a93e2aafdb Release: v2.34.0 2025-01-08 16:26:06 +08:00
李通洲 5848b5fc24 OpenGL (Android): enable support 2025-01-08 16:09:41 +08:00
李通洲 934b6291e3 OpenGL (Android): request GLES 2+ 2025-01-08 15:38:55 +08:00
李通洲 90068ab474 Battery (NetBSD): fix battery percentage detection 2025-01-08 13:46:08 +08:00
Carter Li 5567e6cc5e Packages (Linux): rename am-user to appman 2025-01-08 10:56:55 +08:00
Carter Li 8b3017c0d9 Packages (Linux): remove possible final newlines in am config 2025-01-08 10:28:13 +08:00
Carter Li f9f15ba844 General: don't suppress the output of preRun
Fix #1489
2025-01-08 09:46:41 +08:00
Carter Li b282ac5d47 Packages (Linux): support am-user
Fix #771
2025-01-08 09:46:12 +08:00
Carter Li 6577884417 WMDE: detect Sway by env variables 2025-01-08 08:50:53 +08:00
李通洲 c4ee606955 CPU (Android): check for MTK D9X00 SOCs 2025-01-08 08:39:09 +08:00
Bahar KURT 59c80820f2 feat: Add Rhino Linux ASCII (#1487)
Cramp all additions into one commit because I like to do it that
way. xD

Co-authored-by: Bahar KURT <kurtbahartr@users.noreply.github.com>
2025-01-07 21:30:22 +08:00
李通洲 c11e14f7e1 CMake (Android): set rpath for system Android libs
So that Vulkan & OpenCL can find them
2025-01-07 15:38:47 +08:00
Carter Li ab6a770155 Sound: detect platform API
Ref: #1454
2025-01-07 15:38:38 +08:00
李通洲 0e99486efe Processing (Windows): early return if OpenProcess failed 2025-01-07 08:35:57 +08:00
Eshan Roy f82f3002e4 Logo (Builtin): add snigdhaos ascii (#1485)
* feat: add snigdhaos ascii

* feat: insert builtin data
2025-01-06 23:49:48 +08:00
Angel Gustavo Lopez 0bed182784 fixing fastfetch wrong colors for xray_os logo (#1486) 2025-01-06 19:54:38 +08:00
Carter Li d39be955b1 Doc: update changelog [ci skip] 2025-01-06 14:39:29 +08:00
CaKrome 3b2790cccc CI (Linux): add Linux ppc64le platform (#1484) 2025-01-06 13:55:13 +08:00
Carter Li 3ea0406b69 CPU (Linux): fix var content was unexpectedly modified 2025-01-06 10:57:29 +08:00
李通洲 6429c20466 OS: prefer pretty names
Hopefully we can end the controversy.

Fix #1483 #1038
2025-01-06 08:58:14 +08:00
李通洲 88ebeb21e2 CPU: fix core count output in multi-package platforms
Fix #1413
2025-01-05 19:38:16 +08:00
Carter Li f28f5e2874 CPU (Linux): detect TZ temp if CPU temp is not available 2025-01-05 17:28:01 +08:00
Carter Li 637c37e81c Packages (macOS): remove redundant tokens 2025-01-05 17:28:01 +08:00
Simon Quigley b2c779dea9 Logo (Builtin): add the Lubuntu logo (#1481)
* Add the Lubuntu logo

* Lubuntu uses LXQt, not LXDE
2025-01-05 11:08:27 +08:00
李通洲 89d636447b Doc: update README [ci skip] 2025-01-03 13:56:48 +08:00
Carter Li 3dc51d5f88 FFstrbuf: improve performance of copying static strings 2025-01-03 10:59:01 +08:00
Carter Li 60ff89c794 Terminal (Linux): fix detection of pk-command-not-found
Fix #1467
2025-01-03 10:32:16 +08:00
Carter Li f973572c5a TerminalShell (Linux): relax detection of terminals in NixOS
Fix #1479
2025-01-03 10:18:44 +08:00
Carter Li ea78665971 Doc: update README.md 2025-01-03 10:16:38 +08:00
Carter Li 80b48dd2d1 Logo (Image): mark ghostty supports kitty image protocol 2025-01-03 09:55:38 +08:00
Carter Li df6eed7a02 TerminalSize (Linux): enable fast path when stdout is redirected. 2025-01-03 09:50:59 +08:00
李通洲 c9ac09f9eb WM (Linux): detect WM version 2025-01-02 20:19:15 +08:00
Carter Li 67597e4566 WM (Linux): add sway version detection 2025-01-02 16:36:31 +08:00
李通洲 611de77980 Terminal (macOS): improve performance of kitty version 2025-01-02 16:35:53 +08:00
李通洲 0fde835629 WM (Windows): detect version of DWM 2025-01-02 16:35:53 +08:00
李通洲 f373e07847 WM (Linux): don't crash if no wm is detected 2025-01-02 16:35:53 +08:00
李通洲 89e4403cc8 WM (macOS): add WindowServer version detection 2025-01-02 16:35:53 +08:00
李通洲 c68d21e215 WM: report version field in custom and JSON output 2025-01-02 16:35:53 +08:00
Christopher Kaster f14cd2c6e8 WM: Add support for detecting window manager versions, add support for Hyprland version (#1472) 2025-01-02 10:13:28 +08:00
Carter Li d58d786c83 Logo (Image): add --kitty-icat; honor --logo-height if set 2024-12-31 15:43:01 +08:00
Carter Li 9f37557177 Logo (Image): support generate image data via kitten icat 2024-12-31 15:30:26 +08:00
李通洲 aa63c4f5f2 Revert "GPU: support detection by EGLext"
Works only for NVIDIA GPUs

This reverts commits 9ef8580d93 and 9342d74c93.
2024-12-31 13:57:06 +08:00
李通洲 a378d2ad62 Brightness (FreeBSD): fix backlight name detection 2024-12-30 11:12:06 +08:00
Carter Li 2ab2dd4d48 TerminalFont (macOS): fix ghostty font detection; default to JetBrains Mono
Ref: https://github.com/fastfetch-cli/fastfetch/issues/1466#issuecomment-2564379883
2024-12-30 10:43:28 +08:00
Peter Zmanovsky 2a83b86ba4 Platform (Linux): fix exe path detection (#1468)
On error, -1 is returned from readlink()
2024-12-29 09:53:20 +08:00
李通洲 d967d05019 Bluetooth (DragonFly): disable module to fix build 2024-12-28 22:13:49 +08:00
李通洲 9ef8580d93 GPU (EGLext): fix build on old systems 2024-12-28 21:50:08 +08:00
Carter Li 813b80c5a8 TerminalFont: support Ghostty
Fix #1466
2024-12-28 15:34:41 +08:00
Carter Li ddce9b2357 GPU: rename ffGetGPUVendorString to ffGPUGetVendorString 2024-12-28 15:26:17 +08:00
Carter Li 9342d74c93 GPU: support detection by EGLext
Support multi-gpus
2024-12-28 15:25:22 +08:00
Carter Li d6028370e7 Bluetooth (FreeBSD): add support (not tested) 2024-12-27 14:49:15 +08:00
李通洲 e425d7df63 CI: update *BSD versions 2024-12-27 14:11:53 +08:00
李通洲 a4a2ae7d67 Host (macOS): fix thunderbolt version of new MBPs
Fix #1465
2024-12-27 14:07:17 +08:00
Carter Li 99aa0638cc Packaging: update debian stuff [ci skip] 2024-12-26 09:47:44 +08:00
Carter Li 1a9e637134 Merge pull request #1464 from fastfetch-cli/dev
Release: v2.33.0
2024-12-26 09:37:25 +08:00
李通洲 f322405c04 Release: v2.33.0 2024-12-26 09:08:33 +08:00
Carter Li e4202635af Doc: update changelog [ci skip] 2024-12-25 10:47:36 +08:00
Carter Li 2f13ee3814 Media (Linux): set player name manually for musikcube 2024-12-25 10:47:36 +08:00
Carter Li 2bfde87f84 Logo (Builtin): add GoralixOS
Fix #1462
2024-12-25 10:47:36 +08:00
Carter Li f38a51c9bc Media: make it able to print player info in custom format 2024-12-25 09:04:10 +08:00
Carter Li 28ec935c42 Media (Linux): report player name 2024-12-25 08:50:28 +08:00
李通洲 d939f95c69 Vulkan (Android): hard code path of libvulkan.so, so that users don't need to install vulkan-loader wrapper of termux 2024-12-24 21:20:03 +08:00
李通洲 e0fd5111fe Media (Linux): Fix #1461 (WIP) 2024-12-24 19:38:43 +08:00
李通洲 4736031538 Doc: update changelog [ci skip] 2024-12-22 22:19:02 +08:00
李通洲 66085c087e Logo (Builtin): add NurOS
Fix #1456
2024-12-22 21:48:18 +08:00
李通洲 e0253d71c0 Doc: add comments for running fastfetch in root 2024-12-22 20:45:51 +08:00
李通洲 dadd4bfab6 DiskIO (OpenBSD): remove debug output 2024-12-22 20:43:36 +08:00
李通洲 2f3861e732 PhysicalMemory: clean up garbage data 2024-12-22 20:27:27 +08:00
李通洲 851f271ed5 CPU (NetBSD): fix typo 2024-12-22 14:20:32 +08:00
Carter Li d3e40f625b Battery (OpenBSD): fix build 2024-12-22 09:30:42 +08:00
Carter Li 7c1991c2e3 Battery (NetBSD): add support 2024-12-21 23:54:30 +08:00
李通洲 b8048ee488 Bluetooth (BSD): disable
bluez is Linux specific
2024-12-21 23:54:30 +08:00
李通洲 b99f54b9f4 CPU (NetBSD): trim CPU vendor 2024-12-21 23:54:30 +08:00
Carter Li b38d7a4919 Brightness (NetBSD): don't error out if the screen idx isn't 0 2024-12-21 23:54:30 +08:00
李通洲 45f7e2c0b2 Version (NetBSD): report sysname 2024-12-21 23:54:30 +08:00
李通洲 5a8dda27ff CPU (NetBSD): support temp and frequency detection 2024-12-21 23:54:30 +08:00
李通洲 1ea3264b13 SMBIOS (NetBSD): add more data 2024-12-21 23:54:30 +08:00
Carter Li 852a729581 Battary (NetBSD): some basic investigation of acpi battery detection 2024-12-21 23:54:30 +08:00
Carter Li 0f454b7140 Battery (OpenBSD): add support 2024-12-21 23:54:30 +08:00
Carter Li 9c47a3a9e7 Brightness (OpenBSD): add support
Requires root permission. Not tested
2024-12-21 23:54:30 +08:00
李通洲 4adf7fda28 Brightness (NetBSD): add support for builtin display 2024-12-21 23:54:30 +08:00
李通洲 e2fc83fd48 Bluetooth (Windows): silence compiler warnings 2024-12-21 23:54:30 +08:00
Robin Candau dd41dfa000 CMake: Add a cmake option to make flashfetch target optional (#1455)
Introduces the `-DBUILD_FLASHFETCH='ON'/'OFF'` build option so one can skip the `flashfetch` target (both from executable and install targets, option at `ON` by default to preserve compatibility with the current default behavior).
This is useful when distributing pre-built downstream packages (e.g. for Linux distributions packaging `fastfetch`) as building and shipping the `flashfetch` binary in such pre-built packages serves little to no purpose.
2024-12-21 23:53:02 +08:00
Carter Li 14d6157901 PhysicalDisk (Linux): fix interconnect type detection
Regression of b5a9d64

Fix #1453
2024-12-20 16:38:30 +08:00
Carter Li 74586a9df1 Bluetooth (Linux): improve performance
1. ignore unpaired devices
2. ignore disconnected devices when `showDisconnected == false`
2024-12-20 15:57:17 +08:00
Carter Li c5d4b20729 TerminalShell (Android): ignore proot 2024-12-20 15:57:17 +08:00
李通洲 b152b383a2 Bluetooth (Windows): optimise
1. don't report disconnected devices if `showDisconnected == false`
2. don't report unknown devices
3. don't report errors when no devices found
2024-12-20 15:57:17 +08:00
李通洲 ae26692ef6 Bluetooth (macOS): don't report disconnected devices if showDisconnected == false 2024-12-20 15:57:17 +08:00
Carter Li 4f807f26a9 Bluetooth (Linux): improve performance when showDisconnected == false
If no connected devices found, no dbus calls will be emitted

Fix #1450
2024-12-20 15:57:02 +08:00
Carter Li 4bef801337 BluetoothRadio (Linux): improve performance by reducing size of dbus response 2024-12-20 15:56:48 +08:00
李通洲 41240e9460 FFlist: fix return value of ffListPop 2024-12-20 11:12:14 +08:00
JohnTheCoolingFan 3bb82423b3 OS (Linux): Refactor Armbian version detection and add support for ubuntu-based armbian detection (#1447)
* Add support for detection of Armbian as Ubuntu flavor

Ubuntu can be used to build Armbian, it is one of the official bases for
Armbian. This allows the detection of Armbian in case it is based on
Ubuntu.

* Refactor Armbian detection

* Armbian: set idLike to id before setting id to "armbian"

* Tidy up detectArmbianVersion
2024-12-19 16:18:42 +08:00
李通洲 b87df82d58 Shell (Windows): use $POWERSHELL_VERSION if available 2024-12-19 11:00:16 +08:00
Carter Li c145ce49a5 Merge pull request #1446 from fastfetch-cli/dev
Release: v2.32.1
2024-12-18 14:41:21 +08:00
李通洲 8c4fb5d6d4 Release: v2.32.1 2024-12-18 14:25:44 +08:00
李通洲 eae0fee032 Packages (OpenBSD): fix a typo that prevents package counting from working 2024-12-18 14:24:13 +08:00
Carter Li 4472a13f41 Packaging: update debian stuff 2024-12-18 14:22:56 +08:00
Carter Li 5b001d6bd6 Merge pull request #1445 from fastfetch-cli/dev
Release: v2.32.0
2024-12-18 10:38:44 +08:00
Carter Li 1b52029fce Release: v2.32.0 2024-12-18 09:58:46 +08:00
Carter Li 2176ea2937 Revert "Display (Linux): prefer detecting physical size from EDID"
Try fixing #1444

This reverts commit 5f3ce50022.
2024-12-18 09:28:42 +08:00
李通洲 ac2266c72f Wifi (FreeBSD): early break if the interface is not associated 2024-12-17 20:55:33 +08:00
Eva 0dc40a2632 WM (Linux): added ratpoison window manager (#1442) 2024-12-17 10:49:55 +08:00
李通洲 ca975f8e81 Version: fix format parameter name
Fix #1443
2024-12-17 10:24:18 +08:00
Kevin c4c6fe6668 Logo (Builtin): improved debian ascii logo (#1441) 2024-12-16 12:05:18 +08:00
Carter Li 0a00f5721e OpenGL (NetBSD): try fixing build 2024-12-14 22:22:35 +08:00
李通洲 69f180beea Display (FreeBSD): don't try to use /sys on FreeBSD 2024-12-14 22:22:35 +08:00
李通洲 0e9cdf75b5 WM (FreeBSD): improve WM detection for Wayland 2024-12-14 22:22:35 +08:00
Carter Li 7d7e219c0a OpenGL (NetBSD): fix build 2024-12-14 13:34:42 +08:00
Carter Li 4937ccfa81 OpenGL (EGL): prefer surfaceless display 2024-12-14 12:56:40 +08:00
JohnTheCoolingFan d0d29c163b Add Armbian-unofficial detection (#1436) 2024-12-14 12:56:13 +08:00
Carter Li 901e0eb177 Logo (Builtin): add Ultramarine Small
Fix #1438
2024-12-14 12:00:33 +08:00
Carter Li 87446e6eef WM (OpenBSD): fix process enumeration 2024-12-14 00:18:41 +08:00
Carter Li bfaa73a2c7 Display (Linux): clean up 2024-12-14 00:05:28 +08:00
Carter Li 373e288d03 WM: add support for fvwm (OpenBSD) and ctwm (NetBSD) 2024-12-14 00:05:02 +08:00
李通洲 82170ceab0 Scripts: fix typo 2024-12-13 16:05:37 +08:00
Carter Li 009a7888b5 OpenGL (Linux): suppress IO
Fix #1435
2024-12-13 15:40:36 +08:00
Carter Li ab1a11c9fa CPU (ARM): add more apple cores 2024-12-13 15:29:24 +08:00
Carter Li 68746275f8 CPU (Linux): detect Virtualized Apple Silicon 2024-12-13 15:28:59 +08:00
李通洲 491cfb94b6 Doc: update changelog [ci skip] 2024-12-12 16:01:56 +08:00
李通洲 79c8919431 Logo (Builtin): add Serpent OS
Ref: https://github.com/serpent-os/recipes/blob/main/f/fastfetch/pkg/0001-logo-Port-our-neofetch-Serpent-OS-logo-from-ermo.patch
2024-12-12 15:43:43 +08:00
李通洲 e98afa8315 JsonSchema: fix typo 2024-12-11 16:41:48 +08:00
李通洲 86783c033b OS (Linux): detect Linux Lite
Fix #1434
2024-12-11 16:40:02 +08:00
李通洲 f01944de41 JsonSchema: add documentation of format args 2024-12-11 16:12:55 +08:00
李通洲 ebfdeef25c Fastfetch: add -h format-json 2024-12-11 16:12:03 +08:00
李通洲 9a36d63d18 Global: refactor code of -h <module>-format 2024-12-11 10:47:02 +08:00
李通洲 e45ff546ed Host: silence compiler warnings 2024-12-10 09:35:52 +08:00
李通洲 2700390371 Host (Sun): fix build 2024-12-09 23:07:24 +08:00
Carter Li 5c01685d69 Host: detect mac model in FreeBSD & Windows 2024-12-09 21:44:31 +08:00
Carter Li d897472572 Edid: use screen size in DTD if make sense 2024-12-06 19:20:06 +08:00
Carter Li 8410a66277 Host (Linux): report mac product name 2024-12-06 18:31:33 +08:00
Carter Li 856d229b36 Wifi (Linux): fix bssid formatting 2024-12-06 09:14:30 +08:00
李通洲 b33692aa7d Logo: randomly select one if the logo source expands to multiple files
Fix #1426
2024-12-05 14:16:30 +08:00
李通洲 e90c5cb241 GPU (OpenBSD): fix pci.ids file location 2024-12-05 08:37:41 +08:00
Carter Li 03cd283755 Packaging: update debian stuff [ci skip] 2024-12-04 08:43:33 +08:00
Carter Li 58a1d965cb Merge pull request #1425 from fastfetch-cli/dev
Release: v2.31.0
2024-12-03 15:00:54 +08:00
Carter Li 6edf763f2b Display (Linux): detect bit depth when libdrm is used 2024-12-03 10:55:00 +08:00
Carter Li ab200d7e4a Terminal: Support sakura version & font detection
Fix #1424
2024-12-02 19:10:47 +08:00
Carter Li dfe36daf79 Release: v2.31.0 2024-12-02 16:36:12 +08:00
李通洲 e9ab67b380 Processing (Linux): interrupt poll & read syscalls when the child process is exited
Fix #1418
2024-12-02 16:02:04 +08:00
Carter Li f073f4882c Wifi (Linux): detect Wifi-7 2024-12-01 18:16:05 +08:00
李通洲 692ad502df Wifi (Windows): make unit of bitrates be consistant
Also fix a copy & paste bug
2024-11-30 23:50:06 +08:00
Raymond Kemboi 3004ce8565 Completion (Zsh): fix syntax error in completion file (#1421)
A syntax error in the file caused the following output when trying to trigger completions in `zsh` (pressing <TAB>):

```zsh
$ fastfetch    File "<stdin>", line 15
    command_prefix = f"--logo-color-{i}[{flag["desc"]} ({i})]"
                                               ^^^^
SyntaxError: f-string: unmatched '['
```
This fix replaces single quotes with double quotes in the f-strings in lines 37 and 41.
2024-11-29 10:25:58 +08:00
Ryan ee8801b54d WM (Linux): fix wl-restart parsing (#1422)
Make the WM name in `wl-restart -n 5 Hyprland` parse as "Hyprland"
instead of "-n".
2024-11-29 08:34:40 +08:00
李通洲 bbe239647b Logo (Builtin): add Windows Server 2025
Fix #1420
2024-11-28 21:55:21 +08:00
Carter Li 77c06193d6 GPU (Linux): detect GPU NV type 2024-11-28 21:28:35 +08:00
李通洲 90bbefe11a CPU (Windows): code cleanup 2024-11-26 22:02:57 +08:00
Carter Li 69a7e64e48 CPU (Linux): support up to 128-socket boards 2024-11-26 21:49:28 +08:00
Carter Li ee564de461 CPU: change cpuCount to packages; support custom format
Fix #1413
2024-11-26 21:37:15 +08:00
Carter Li 9955e9da02 CPU: remove duplicate whitespaces in CPU name
Eg. `Intel(R) Xeon(R) CPU           E5620  @ 2.40GHz`
2024-11-26 21:27:36 +08:00
Carter Li 8b41cbd508 CPU (Linux): refactor; fix cpu count detection 2024-11-26 16:05:01 +08:00
AzimovParviz 7535ce8a18 Support for dual CPU systems (#1417)
* [macOS] Added support for dual CPUs on Mac computers

Signed-off-by: Koneko <azimovp17@gmail.com>

* Change how number of cores is displayed when the system is dual CPU

* Support for dual CPU on Windows

* Dual CPU detection on Linux basic implementation

---------

Signed-off-by: Koneko <azimovp17@gmail.com>
2024-11-26 08:53:01 +08:00
李通洲 b76eb87510 CI: fix building on macOS 2024-11-25 22:46:57 +08:00
李通洲 0cd7aeac19 Display (macOS): don't crash with NULL pointer references
Fix #1393
2024-11-25 22:23:24 +08:00
Carter Li 04088b5b2c Logo (Builtin): update MidOS
Fix #1409
2024-11-25 14:31:07 +08:00
Carter Li e77c3119ca OS (Linux): check for lmde
Fix #1415
2024-11-25 14:20:52 +08:00
Carlos Henrique Lima Melara 3463fc331f Scripts: use datetime to get date and set timezone to UTC (#1410)
This will ensure the package is reproducible even in different
timezones.
2024-11-24 10:22:57 +08:00
李通洲 64287eed21 Display: change physical size detection to use basic display parameters
Some monitor report invalid data in DTD.
Ref: #1406
2024-11-24 01:02:06 +08:00
李通洲 1b835544b6 Users: fix invalid var name
Fix #1408
2024-11-23 22:44:45 +08:00
Carter Li 55352be0cc Wifi (FreeBSD): support channel & frequency detection 2024-11-23 12:21:48 +08:00
Carter Li c0be2637a8 Wifi (Android): silence compiler warnings 2024-11-22 15:37:01 +08:00
Carter Li 864fb918bc Chore: silence some warnings 2024-11-22 14:20:50 +08:00
Carter Li 2197cfb06d Wifi (Android): report more props 2024-11-22 13:53:04 +08:00
Carter Li 94f8ff938b Wifi: print channel band 2024-11-22 11:01:54 +08:00
Carter Li 7000317841 Wifi (Linux): detect frequency & channel number 2024-11-22 10:31:12 +08:00
李通洲 06055cc6c3 Wifi (macOS): fix build on old OS version 2024-11-21 22:03:25 +08:00
李通洲 601b9706b5 Display: report ppi to 0 if screen size is not available 2024-11-21 21:44:05 +08:00
李通洲 d48c76b597 Wifi: detect channel and frequency 2024-11-21 21:37:30 +08:00
李通洲 9a1d18556d Display: don't report screen size when display is mirrored
Fix #1406
2024-11-21 15:29:14 +08:00
李通洲 71b073e1bf CMake: fix possible linking errors in BINARY_LINK_TYPE=dynamic mode 2024-11-20 22:13:10 +08:00
Carter Li a567268ca1 Display (Linux): fix preferred resolution detection for wayland 2024-11-20 21:38:18 +08:00
李通洲 8b62ad72f7 Display (FreeBSD): fix build 2024-11-20 16:39:01 +08:00
李通洲 cee880cb83 Display: print preferred resolution & refresh rate in custom format
Fix #1406
2024-11-20 16:39:01 +08:00
李通洲 925c3471c2 Display: add scale factor in custom format 2024-11-20 16:39:01 +08:00
李通洲 7948e627b0 Display (Android): fix build 2024-11-20 16:39:01 +08:00
李通洲 4cca63a299 Display (Windows): detect preferred resolution & refresh rate 2024-11-20 16:39:01 +08:00
李通洲 21a35769a7 Display (macOS): detect maximum resolution & refresh rate 2024-11-20 16:39:01 +08:00
Carter Li fa9290088d Display (Linux): detect preferred resolution and refresh rate 2024-11-20 16:38:53 +08:00
Carter Li 3d5133eaba DisplayServer (Linux): remove support of xcb & xlib
They don't support multi-monitors. Prefer libdrm.
2024-11-20 09:37:32 +08:00
Carter Li 4cbcd0f107 Wifi (Linux): improve performance 2024-11-20 08:43:41 +08:00
Carter Li fdc9bee4b3 DBus: use general.processingTimeout as its timeout instead hard coding 2024-11-20 08:43:41 +08:00
Carter Li 16b7a4a1be Media (Linux): improve performance of dbus communication 2024-11-20 08:43:41 +08:00
R0CKSTAR 465170428f mtgpu: header file cleanup for forward compatibility (#1405)
Signed-off-by: Xiaodong Ye <yeahdongcn@gmail.com>
2024-11-19 19:36:12 +08:00
Carter Li e953ed9d88 Packaging: update debian stuff [ci skip] 2024-11-18 15:47:48 +08:00
Carter Li 6d45fe61b5 Merge pull request #1404 from fastfetch-cli/dev
Release: v2.30.1
2024-11-18 14:57:05 +08:00
李通洲 efc8504607 CMake: check return code of python scripts 2024-11-18 14:08:53 +08:00
李通洲 a9a08d8a80 Release: v2.30.1 2024-11-18 13:40:08 +08:00
李通洲 7f63ec1315 CMake: fix the destination where fastfetch_pciids.c.inc is generated 2024-11-18 13:36:31 +08:00
Masato TOYOSHIMA 6cbbe334b5 CMake: Fixed the destination where fastfetch.1 is generated. (#1403)
* Fixed the destination where fastfetch.1 is generated.

* Update CMakeLists.txt

Reappend trailing new line

---------

Co-authored-by: Carter Li <CarterLi@users.noreply.github.com>
2024-11-18 13:32:49 +08:00
Carter Li 4bde8d3fb3 Packaging: update debian stuff [ci skip] 2024-11-18 09:36:46 +08:00
Carter Li 62dcd1257e Merge pull request #1401 from fastfetch-cli/dev
Release: v2.30.0
2024-11-18 09:21:24 +08:00
Carter Li dbb6a4b265 Release: v2.30.0 2024-11-18 09:04:17 +08:00
Carter Li a73a3089af Doc: remove guix package installer as it's outdated [ci skip] 2024-11-18 08:40:45 +08:00
李通洲 dcdf2b570e Display: concat flags 2024-11-15 20:01:56 +08:00
李通洲 ba7d3ed27b GPU (Windows): fix a bad assignment 2024-11-15 19:47:24 +08:00
Carter Li b7a9fe58b4 Terminal (Linux): support tilix version detection 2024-11-15 16:18:43 +08:00
李通洲 e5451b6826 NetIO (BSD): remove unnecessary checks
Seems...
2024-11-15 15:13:09 +08:00
李通洲 9f314a208b NetIO (BSD): add txDrops detection if supported 2024-11-15 15:13:09 +08:00
李通洲 56eb8b80c6 NetIO (macOS): fix 32bit trancation 2024-11-15 15:11:55 +08:00
Dariqq 563ed58b4f Scripts: gen-man.py honors SOURCE_DATE_EPOCH. (#1400) 2024-11-15 08:50:47 +08:00
李通洲 b8ec07092a Logo (Builtin): update openSUSE Tumbleweed
Fix #1398
2024-11-15 08:41:14 +08:00
李通洲 e77a4e8262 Doc: update changelog [ci skip] 2024-11-14 16:40:45 +08:00
李通洲 782af250ff Percent: in custom format, only set num and bar string if enabled in percent config
Also fix `percentage-bar` printing in Brightness module
2024-11-14 15:45:25 +08:00
李通洲 6801fe3d9c Doc: update schema for percent type config 2024-11-14 14:26:18 +08:00
李通洲 1c41c6ccb1 Percent: allow use enum to set type value in JSON config 2024-11-14 14:21:55 +08:00
李通洲 c9e3f8d95c Global: support percent type config in module level 2024-11-14 13:52:02 +08:00
李通洲 97e1b987dd Global: pack all enums and make flag enums unsigned 2024-11-14 11:00:44 +08:00
Carter Li e821a99873 CPU (Linux): add more Apple SOC code names 2024-11-13 16:44:24 +08:00
李通洲 bad85a557a Host (Android): detect marketing name of vivo smartphone 2024-11-13 15:53:14 +08:00
李通洲 1d92bf864a IO (macOS): fix logo fails to load from symlinked files
Fix #1395
2024-11-13 15:15:50 +08:00
李通洲 2cfc8ec0db Processing (macOS): fix exe path detection 2024-11-13 10:46:30 +08:00
李通洲 5efb87997b Util (macOS): cleanup cf_helpers.c 2024-11-13 10:38:40 +08:00
李通洲 d7fa0417ed CMake: use gen-man.py to generate man file 2024-11-13 10:24:57 +08:00
李通洲 fe57b28581 Scripts: clean up gen-man.py 2024-11-13 10:18:11 +08:00
李通洲 5a1be2535b Scripts: make gen-pciids.py executable 2024-11-13 10:17:06 +08:00
Tibo bccf241816 Scripts: Add python script to generate man page (#1392)
*  Add man generating script

*  Add arguments and description

* 🐛 Add shebang

* 📝 Add documentation & text for sections

* 🐛 Fix italic text (italic is not supported for man pages)

* 🗑️ Remove .1 generated file

* ✏️ Fix type "abbreviation" gen-man.py:24

* 🐛 Fix invalid escape sequence

*  Add version finder

*  Example & config sections

* 🗑️ Delete generated .1 file

---------

Co-authored-by: tgallone <thibaut.gallone@etu.unistra.fr>
2024-11-13 09:13:13 +08:00
李通洲 c70c37c50c GPU (macOS): apply the same logic as CPU just in case 2024-11-12 22:58:22 +08:00
李通洲 644458bc74 CPU (macOS): try fixing CPU freq detection on Apple M4
Fix #1394
2024-11-12 22:34:57 +08:00
李通洲 e618303343 Media (macOS): try fixing error CFStringGetCString() failed 2024-11-12 21:52:12 +08:00
李通洲 748b7df0d7 Smbios: clean up more garbage values
Ref: #1391
2024-11-12 10:45:09 +08:00
李通洲 7c8250c68c StringUtil: rename ffStrCopy and correctly reflect its usage 2024-11-11 18:02:23 +08:00
Carter Li c368908b7d Shell (macOS): try fixing segfault in old macOS
Ref: #1388
2024-11-11 17:49:49 +08:00
李通洲 830c71ddc4 DisplayServer (NetBSD): detect WM / DE by process name 2024-11-11 17:37:01 +08:00
李通洲 5e7d9ed45e Packages (Linux): add qi support 2024-11-11 17:37:01 +08:00
Carter Li 4799f9277e Revert "IO: optimize createSubfolders (#1382)" (#1390)
This reverts commit 0284e4ccc4.
2024-11-11 17:33:22 +08:00
apocelipes 0a61031463 tests: add FFstrbuf smallest allocation test & minor fix (#1387) 2024-11-11 07:58:24 +08:00
Tibo G 07d0743a18 Logo (Builtin): add cosmicDE logo (#1386)
* add cosmicDE logo

* Update cosmic.txt

* Update builtin.c

---------

Co-authored-by: tgallone <thibaut.gallone@etu.unistra.fr>
Co-authored-by: Carter Li <CarterLi@users.noreply.github.com>
2024-11-11 00:43:43 +08:00
Emily Astranova f989a1a982 Doc: fix typo in README (#1385) [ci skip]
Changed "deserved" to "derived"
2024-11-10 23:37:29 +08:00
李通洲 f9713d5ee2 OS (Android): display android icon 2024-11-10 13:57:57 +08:00
李通洲 4f9645e7ff Logo (Builtin): add Unifi 2024-11-10 13:35:22 +08:00
Carter Li 08a92a4324 CPU (OpenBSD): support CPU temp detection 2024-11-10 13:28:48 +08:00
李通洲 d10c14721a Disk: be able to print disk indices 2024-11-10 13:07:30 +08:00
李通洲 4534f18525 Battery: don't print index in multi-battery device 2024-11-10 13:07:12 +08:00
Carter Li f98e6c9d4e Sound (BSD): trim device names 2024-11-10 12:47:26 +08:00
Carter Li 59c666515a Version (MidnightBSD): support libc version detection 2024-11-10 12:47:26 +08:00
李通洲 7fab6f27ee Packages (BSD): support mport 2024-11-10 12:47:26 +08:00
李通洲 7d406bbae1 Logo (Builtin): add MidnightBSD 2024-11-10 12:47:26 +08:00
apocelipes 7b81ffc8e4 FFstrbuf: fix small FFstrbuf allocations in ffStrbufEnsureFree (#1383) 2024-11-10 08:27:57 +08:00
apocelipes 0284e4ccc4 IO: optimize createSubfolders (#1382) 2024-11-10 08:27:34 +08:00
Carter Li 837903e845 DisplayServer: fix deprecation warnings 2024-11-09 21:36:48 +08:00
xiaoran007 3fa0d1ab19 Host (macOS): add HwModel support for new Mac (2024) (#1381)
* host(macOS): add HwModel support for new Mac (iMac, Mac mini and Macbook Pro 2024)

* Update host_apple.c

---------

Co-authored-by: Carter Li <CarterLi@users.noreply.github.com>
2024-11-09 20:32:35 +08:00
李通洲 07f2a71b3c Bluetooth (Windows): detect battery level 2024-11-09 20:23:25 +08:00
李通洲 acb38fa3ee Bluetooth (Windows): detect battery (WIP) 2024-11-06 08:25:54 +08:00
李通洲 7396208809 Logo (Builtin): fix Lilidog
Fix #1373
2024-11-06 08:25:48 +08:00
李通洲 2389d7b580 FFstrbuf: correct definition of StrStrIA 2024-11-06 08:25:06 +08:00
李通洲 8f750da559 Bluetooth (Windows): fix mac address detection 2024-11-06 08:25:06 +08:00
Lucas Holt f69a9dab33 CMake: Add initial support for MidnightBSD (#1377)
* Add initial support for MidnightBSD

* Cleanup some issues identified through code review.

Add libzfs check as MidnightBSD does have zfs.

* Add MidnightBSD check to the version.c detection

* Remove `OR MidnightBSD` tests

* Clean up

---------

Co-authored-by: Carter Li <CarterLi@users.noreply.github.com>
2024-11-06 00:17:23 +08:00
李通洲 9a34cb98dc Bluetooth (macOS): normalize mac address strings 2024-11-05 16:39:04 +08:00
李通洲 ef974ef8c0 Bluetooth (macOS): support battery level detection 2024-11-05 11:06:54 +08:00
李通洲 40671c78f1 Monitor: don't display () if display name is not available 2024-11-05 10:01:43 +08:00
李通洲 211fd4b197 Display: add hdr-compatible
Fix #1376
2024-11-05 09:59:25 +08:00
Carter Li 722063401c Packaging: update debian stuff [ci skip] 2024-11-04 15:06:33 +08:00
681 changed files with 36450 additions and 11539 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
[codespell]
check-filenames =
builtin = clear,rare,usage,informal
skip = */.git,*/cmake-build-*,*/.idea,*/completions,*/presets,*/screenshots,*/tests,*/3rdparty,*/logo/ascii
ignore-words-list = iterm,compiletime,unknwn,pengwin,siduction,master,slave,sur,doas,conexant,ags
skip = */.git,*/cmake-build-*,*/.idea,*/completions,*/presets,*/screenshots,*/tests,*/3rdparty,*/logo/ascii,./src/detection/gpu/asahi_drm.h
ignore-words-list = iterm,compiletime,unknwn,pengwin,siduction,master,slave,sur,doas,conexant,ags,bu
-80
View File
@@ -1,80 +0,0 @@
---
name: Bug report
about: Create a report to help us improve
title: '[BUG] '
labels: bug
assignees: ''
---
Be sure to read the [FAQ](https://github.com/fastfetch-cli/fastfetch?tab=readme-ov-file#faq) before submitting a new issue.
<!-- We will try hard to solve the issue. However since platforms and hardwares vary greatly, it can be hard to find the root cause of an issue. Providing the following information may help us greatly. Thanks in advance! -->
# General description of bug:
* What happened:
* What should happen:
* Fastfetch version used: <!-- please use the latest version, if possible -->
* Did it work in an older version: <!-- if yes, which version -->
* Where did you get the binary: <!-- GitHub release / GitHub Actions / installed with a package manager (please tell us which package manager you used!) / built from source yourself -->
* Does this issue still occur in [the latest dev build](https://github.com/fastfetch-cli/fastfetch/actions/)?
# Often helpful information:
Screenshot:
<!-- Paste the screenshot here -->
The content of the configuration file you use (if any):
```
// Paste here
```
Output of `fastfetch -c ci.jsonc --format json`:
<!--
Note that this output will contain you public IP. If it is not relevant for the issue, feel free to remove it before uploading.
-->
```
// Paste here
```
Output of `fastfetch --list-features`:
```
// Paste here
```
## If fastfatch crashed or froze
Paste the stacktrace here. You may get it with:
```shell
# You may need Ctrl+C to stop the process if it freezes
gdb -q -ex 'set confirm off' -ex run -ex 'bt full' -ex quit --args /path/to/fastfetch
```
If you are able to identify which module crashed, the strace can be helpful too
```shell
strace /path/to/fastfetch --multithreading false -s {MODULE} --pipe
```
If you cannot do the instructions above, please upload the core dump file:
## If fastfetch is slow
Use `time fastfetch --stat` to show time usage for each module.
## If an image or logo didn't show
<!-- Please make sure your terminal supports the image protocol you used. Note that GNOME Terminal doesn't support any image protocols. -->
* The image protocol you used:
* The terminal you used:
* Upload the image file here, or paste the image URL:
* Does it work with `--logo-width {WIDTH} --logo-height {HEIGHT}`?
## If fastfetch behaves incorrectly on shell startup
* The bug is reproducible with a clean shell configuration (i.e. `fastfetch` is the only line in `.zshrc` or `~/.config/fish/config.fish`):
* Does `sleep 1` before running `fastfetch` work?
+113
View File
@@ -0,0 +1,113 @@
name: Crash Bug Report
description: If fastfetch crashes or freezes
title: "[BUG] "
labels: ["bug", "crash", "triage"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report! We will try hard to solve the issue.
However since platforms and hardwares vary greatly, it can be hard to find the root cause of an issue.
Providing the following information may help us greatly. Thanks in advance!
- type: checkboxes
attributes:
label: Read the FAQ first
description: Please check if the issue is already covered in the FAQ.
options:
- label: I have checked the FAQ but the issue is not covered
required: true
- type: markdown
attributes:
value: "### General description of the bug"
- type: textarea
attributes:
label: Description
description: A clear and concise description of what the bug is.
placeholder: I was trying to [...] but [...]
validations:
required: true
- type: input
attributes:
label: Version used
description: Fastfetch version used. Please use the latest version (found in the [releases](https://github.com/fastfetch-cli/fastfetch/releases)) if possible.
placeholder: Result of `fastfetch --version`
validations:
required: true
- type: dropdown
attributes:
label: Bug prevalence
description: How often does the bug occur?
options:
-
- Always
- Sometimes
- Rarely
- Once
- Other
validations:
required: true
- type: dropdown
attributes:
label: Regression
description: Did it work in an older version?
options:
-
- Not sure
- 'Yes'
- 'No'
validations:
required: true
- type: dropdown
attributes:
label: Installation
description: Where did you install fastfetch from?
options:
-
- GitHub Releases
- GitHub Actions (nightly)
- Built from source
- Package manager
validations:
required: true
- type: input
attributes:
label: Package manager
description: Which package manager did you use if applicable?
placeholder: e.g. `apt`, `pacman`, `brew`, `scoop`
- type: markdown
attributes:
value: '### Often helpful information'
- type: textarea
attributes:
label: Screenshots
description: If applicable, add screenshots to help explain your problem.
- type: textarea
attributes:
label: Configuration
description: If applicable, paste your configuration file here.
placeholder: cat ~/.config/fastfetch/config.jsonc
render: jsonc
- type: markdown
attributes:
value: |
Paste the stacktrace here. You may get it with:
```shell
# You may need Ctrl+C to stop the process if it freezes
gdb -q -ex 'set confirm off' -ex run -ex 'bt full' -ex quit --args /path/to/fastfetch
```
If you are able to identify which module crashed, the strace can be helpful too
```shell
strace /path/to/fastfetch --multithreading false -s {MODULE} --pipe
```
If you cannot do the instructions above, please upload the core dump file if available.
- type: textarea
attributes:
label: Stacktrace
description: Paste the stacktrace or core dump file here.
render: text
validations:
required: true
@@ -0,0 +1,106 @@
name: General Bug Report
description: If something is not working as expected (wrong output, missing info, etc)
title: "[BUG] "
labels: ["bug", "triage"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report! We will try hard to solve the issue.
However since platforms and hardwares vary greatly, it can be hard to find the root cause of an issue.
Providing the following information may help us greatly. Thanks in advance!
- type: checkboxes
attributes:
label: Read the FAQ first
description: Please check if the issue is already covered in the FAQ.
options:
- label: I have checked the FAQ but the issue is not covered
required: true
- type: markdown
attributes:
value: "### General description of the bug"
- type: textarea
attributes:
label: Description
description: A clear and concise description of what the bug is.
placeholder: I was trying to [...] but [...]
validations:
required: true
- type: input
attributes:
label: Version used
description: Fastfetch version used. Please use the latest version (found in the [releases](https://github.com/fastfetch-cli/fastfetch/releases)) if possible.
placeholder: Result of `fastfetch --version`
validations:
required: true
- type: dropdown
attributes:
label: Bug prevalence
description: How often does the bug occur?
options:
-
- Always
- Sometimes
- Rarely
- Once
- Other
validations:
required: true
- type: dropdown
attributes:
label: Regression
description: Did it work in an older version?
options:
-
- Not sure
- 'Yes'
- 'No'
validations:
required: true
- type: dropdown
attributes:
label: Installation
description: Where did you install fastfetch from?
options:
-
- GitHub Releases
- GitHub Actions (nightly)
- Built from source
- Package manager
validations:
required: true
- type: input
attributes:
label: Package manager
description: Which package manager did you use if applicable?
placeholder: e.g. `apt`, `pacman`, `brew`, `scoop`
- type: markdown
attributes:
value: '### Often helpful information'
- type: textarea
attributes:
label: Screenshots
description: If applicable, add screenshots to help explain your problem.
- type: textarea
attributes:
label: Configuration
description: If applicable, paste your configuration file here.
placeholder: cat ~/.config/fastfetch/config.jsonc
render: jsonc
- type: textarea
attributes:
label: System information
description: Output of `fastfetch -c all.jsonc --stat --format json`
placeholder: |
Note that this output will contain you public IP.
If it is not relevant for the issue, feel free to remove it before uploading.
render: jsonc
validations:
required: true
- type: textarea
attributes:
label: Features built-in
description: Output of `fastfetch --list-features`
render: text
validations:
required: true
+129
View File
@@ -0,0 +1,129 @@
name: Logo Bug Report
description: If my image logo is not displayed correctly
title: "[BUG] "
labels: ["bug", "logo", "triage"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report! We will try hard to solve the issue.
However since platforms and hardwares vary greatly, it can be hard to find the root cause of an issue.
Providing the following information may help us greatly. Thanks in advance!
- type: checkboxes
attributes:
label: Read the FAQ first
description: Please check if the issue is already covered in the FAQ.
options:
- label: I have checked the FAQ but the issue is not covered
required: true
- type: markdown
attributes:
value: "### General description of the bug"
- type: textarea
attributes:
label: Description
description: A clear and concise description of what the bug is.
placeholder: I was trying to [...] but [...]
validations:
required: true
- type: input
attributes:
label: Version used
description: Fastfetch version used. Please use the latest version (found in the [releases](https://github.com/fastfetch-cli/fastfetch/releases)) if possible.
placeholder: Result of `fastfetch --version`
validations:
required: true
- type: dropdown
attributes:
label: Bug prevalence
description: How often does the bug occur?
options:
-
- Always
- Sometimes
- Rarely
- Once
- Other
validations:
required: true
- type: dropdown
attributes:
label: Regression
description: Did it work in an older version?
options:
-
- Not sure
- 'Yes'
- 'No'
validations:
required: true
- type: dropdown
attributes:
label: Installation
description: Where did you install fastfetch from?
options:
-
- GitHub Releases
- GitHub Actions (nightly)
- Built from source
- Package manager
validations:
required: true
- type: input
attributes:
label: Package manager
description: Which package manager did you use if applicable?
placeholder: e.g. `apt`, `pacman`, `brew`, `scoop`
- type: markdown
attributes:
value: '### Often helpful information'
- type: textarea
attributes:
label: Screenshots
description: If applicable, add screenshots to help explain your problem.
- type: textarea
attributes:
label: Configuration
description: If applicable, paste your configuration file here.
placeholder: cat ~/.config/fastfetch/config.jsonc
render: jsonc
- type: markdown
attributes:
value: |
#### If an image or logo didn't show
Please make sure your terminal supports the image protocol you used.
Note that GNOME Terminal doesn't support any image protocols as of now
Some tips:
1. Try `fastfetch --show-errors` to see if there are any errors.
2. Try `fastfetch --logo-width {WIDTH} --logo-height {HEIGHT}`. Some protocols may require a image size being set.
- type: input
attributes:
label: Image protocol
description: The image protocol you used
validations:
required: true
- type: input
attributes:
label: Terminal
description: The terminal you used
validations:
required: true
- type: textarea
attributes:
label: Image tried
description: Upload the image file, or paste the image URL here
validations:
required: true
- type: textarea
attributes:
label: Error message
description: Error message printed by `fastfetch -s none --show-errors`, if any
- type: textarea
attributes:
label: Features built-in
description: Output of `fastfetch --list-features`
render: text
validations:
required: true
-18
View File
@@ -1,18 +0,0 @@
---
name: Feature request
about: Suggest an idea for this project
title: '[FEAT] '
labels: enhancement
assignees: ''
---
Be sure to read [FAQ](https://github.com/fastfetch-cli/fastfetch?tab=readme-ov-file#faq) before submitting a new issue.
## Wanted features:
<!-- Your features here -->
## Motivation:
<!-- Your motivation here -->
@@ -0,0 +1,40 @@
name: Feature Request
description: Suggest an idea for this project
title: "[FEAT] "
labels: ["enhancement"]
body:
- type: markdown
attributes:
value: |
Fastfetch is a system information tool. We only accept hardware or system level software feature requests.
For most personal uses, I recommend using `Command` module to detect it yourself, which can be used to grab output from a custom shell script:
```jsonc
// This module shows the git version
{
"modules": [
{
"type": "command",
"key": "Git",
"text": "git version",
"format": "{~12}" // cut the first 12 characters
}
]
}
```
- type: textarea
attributes:
label: Description
description: A clear and concise description of what the feature is.
validations:
required: true
- type: textarea
attributes:
label: Motivation
description: Why do you want this feature? Why doesn't `Command` module suffice for you?
validations:
required: true
- type: textarea
attributes:
label: Additional context
description: Add any other context or screenshots about the feature request here.
-23
View File
@@ -1,23 +0,0 @@
---
name: Logo request
about: Request a new logo
title: '[LOGO] '
labels: logo request
assignees: ''
---
Tip: A logo can be displayed by fastfetch without getting into fastfetch's official repo. For highly customized logo for personal use, it's recommended to keep it locally. Please refer to https://github.com/fastfetch-cli/fastfetch/wiki/Migrate-Neofetch-Logo-To-Fastfetch
# OS
```
Paste content of /etc/os-release and /etc/lsb-release here. If none of these files exist, describe a way to identify the distro
```
# Ascii
An ASCII logo should not take up too much space (smaller than 50x20 characters). Please also include the color codes if not available in `os-release`
```
Paste ascii art here.
```
+38
View File
@@ -0,0 +1,38 @@
name: Logo Request
description: Request a new ASCII logo for your favorite distro
title: "[LOGO] "
labels: ["logo request"]
body:
- type: markdown
attributes:
value: |
Tip: A logo can be displayed by fastfetch without getting into fastfetch's official repo.
For highly customized logo for personal use, it's recommended to keep it locally.
Please refer to https://github.com/fastfetch-cli/fastfetch/wiki/Migrate-Neofetch-Logo-To-Fastfetch
- type: textarea
attributes:
label: OS
description: Paste content of `/etc/os-release` and `/etc/lsb-release` here. If none of these files exist, describe a way to identify the distro
placeholder: cat /etc/os-release
validations:
required: true
- type: textarea
attributes:
label: ASCII Art
description: An ASCII logo should not take up too much space (smaller than 50x20 characters). Please also include the color codes if not available in `os-release`
placeholder: Paste ASCII art here
validations:
required: true
- type: input
attributes:
label: Original Image
description: If the ASCII art is based on an image, please provide a link to the original image
placeholder: Image URL or distro website URL
- type: checkboxes
attributes:
label: Checklist
options:
- label: The ASCII art is smaller than 50x20 characters (width x height)
required: true
- label: The ASCII art contains color codes, or the color codes are available in `os-release`
required: true
+422 -118
View File
@@ -35,7 +35,7 @@ jobs:
run: uname -a
- name: configure project
run: cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_INSTALL_PREFIX=/usr . -DENABLE_VULKAN=OFF -DENABLE_WAYLAND=OFF -DENABLE_XCB_RANDR=OFF -DENABLE_XCB=OFF -DENABLE_XRANDR=OFF -DENABLE_X11=OFF -DENABLE_DRM=OFF -DENABLE_DRM_AMDGPU=OFF -DENABLE_GIO=OFF -DENABLE_DCONF=OFF -DENABLE_DBUS=OFF -DENABLE_XFCONF=OFF -DENABLE_SQLITE3=OFF -DENABLE_RPM=OFF -DENABLE_IMAGEMAGICK7=OFF -DENABLE_IMAGEMAGICK6=OFF -DENABLE_CHAFA=OFF -DENABLE_ZLIB=OFF -DENABLE_EGL=OFF -DENABLE_GLX=OFF -DENABLE_OSMESA=OFF -DENABLE_OPENCL=OFF -DENABLE_FREETYPE=OFF -DENABLE_PULSE=OFF -DENABLE_DDCUTIL=OFF -DENABLE_ELF=OFF -DENABLE_DIRECTX_HEADERS=OFF -DENABLE_THREADS=OFF
run: cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_INSTALL_PREFIX=/usr . -DENABLE_VULKAN=OFF -DENABLE_WAYLAND=OFF -DENABLE_XCB_RANDR=OFF -DENABLE_XCB=OFF -DENABLE_XRANDR=OFF -DENABLE_X11=OFF -DENABLE_DRM=OFF -DENABLE_DRM_AMDGPU=OFF -DENABLE_GIO=OFF -DENABLE_DCONF=OFF -DENABLE_DBUS=OFF -DENABLE_XFCONF=OFF -DENABLE_SQLITE3=OFF -DENABLE_RPM=OFF -DENABLE_IMAGEMAGICK7=OFF -DENABLE_IMAGEMAGICK6=OFF -DENABLE_CHAFA=OFF -DENABLE_ZLIB=OFF -DENABLE_EGL=OFF -DENABLE_GLX=OFF -DENABLE_OPENCL=OFF -DENABLE_FREETYPE=OFF -DENABLE_PULSE=OFF -DENABLE_DDCUTIL=OFF -DENABLE_ELF=OFF -DENABLE_DIRECTX_HEADERS=OFF -DENABLE_THREADS=OFF
- name: build project
run: cmake --build . --target package --verbose -j4
@@ -56,11 +56,11 @@ jobs:
run: ldd fastfetch
- name: run tests
run: ctest
run: ctest --output-on-failure
linux-amd64:
name: Linux-amd64
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
permissions:
security-events: write
contents: read
@@ -73,13 +73,19 @@ 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 ocl-icd-opencl-dev libpulse-dev libdrm-dev libelf-dev libddcutil-dev directx-headers-dev
- name: install linuxbrew packages
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
/home/linuxbrew/.linuxbrew/bin/brew install imagemagick chafa ddcutil --ignore-dependencies
/home/linuxbrew/.linuxbrew/bin/brew install imagemagick chafa --ignore-dependencies
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
@@ -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,50 @@ 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 ocl-icd-opencl-dev libpulse-dev libdrm-dev libelf-dev directx-headers-dev libchafa-dev libddcutil-dev rpm
- name: install linuxbrew packages
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
/home/linuxbrew/.linuxbrew/bin/brew install imagemagick chafa --ignore-dependencies
- 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 -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,9 +190,9 @@ jobs:
name: fastfetch-linux-aarch64
path: ./fastfetch-*.*
linux-armv7:
name: Linux-armv7
runs-on: ubuntu-22.04
linux-armv7l:
name: Linux-armv7l
runs-on: ubuntu-24.04
permissions:
security-events: write
contents: read
@@ -169,7 +201,7 @@ jobs:
uses: actions/checkout@v4
- name: run VM
uses: uraimo/run-on-arch-action@v2
uses: uraimo/run-on-arch-action@v3
id: runcmd
with:
arch: armv7
@@ -181,7 +213,7 @@ jobs:
# CMake installed by apt has bug `list sub-command REMOVE_ITEM requires two or more arguments`
wget --no-check-certificate https://apt.kitware.com/ubuntu/pool/main/c/cmake/{cmake_3.29.2-0kitware1ubuntu20.04.1_armhf.deb,cmake-data_3.29.2-0kitware1ubuntu20.04.1_all.deb}
dpkg -i *.deb
apt-get install -y make g++ libvulkan-dev libwayland-dev libxrandr-dev libxcb-randr0-dev libdconf-dev libdbus-1-dev libmagickcore-dev libxfconf-0-dev libsqlite3-dev librpm-dev libegl-dev libglx-dev libosmesa6-dev ocl-icd-opencl-dev libpulse-dev libdrm-dev libelf-dev directx-headers-dev rpm
apt-get install -y make g++ libvulkan-dev libwayland-dev libxrandr-dev libxcb-randr0-dev libdconf-dev libdbus-1-dev libmagickcore-dev libxfconf-0-dev libsqlite3-dev librpm-dev libegl-dev libglx-dev ocl-icd-opencl-dev libpulse-dev libdrm-dev libelf-dev directx-headers-dev rpm
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_INSTALL_PREFIX=/usr .
cmake --build . --target package --verbose -j4
./fastfetch --list-features
@@ -189,17 +221,17 @@ 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-riscv64:
name: Linux-riscv64
runs-on: ubuntu-22.04
linux-armv6l:
name: Linux-armv6l
runs-on: ubuntu-24.04
permissions:
security-events: write
contents: read
@@ -208,15 +240,16 @@ jobs:
uses: actions/checkout@v4
- name: run VM
uses: uraimo/run-on-arch-action@v2
uses: uraimo/run-on-arch-action@v3
id: runcmd
with:
arch: riscv64
distro: ubuntu22.04
arch: armv6
distro: bookworm
githubToken: ${{ github.token }}
run: |
uname -a
apt-get update && apt-get install -y cmake make g++ libvulkan-dev libwayland-dev libxrandr-dev libxcb-randr0-dev libdconf-dev libdbus-1-dev libmagickcore-dev libxfconf-0-dev libsqlite3-dev librpm-dev libegl-dev libglx-dev libosmesa6-dev ocl-icd-opencl-dev libpulse-dev libdrm-dev libddcutil-dev libchafa-dev libelf-dev directx-headers-dev rpm
apt-get update && apt-get install -y wget
apt-get install -y cmake make g++ libvulkan-dev libwayland-dev libxrandr-dev libxcb-randr0-dev libdconf-dev libdbus-1-dev libmagickcore-dev libxfconf-0-dev libsqlite3-dev librpm-dev libegl-dev libglx-dev 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
@@ -224,7 +257,42 @@ 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-armv6l
path: ./fastfetch-*.*
linux-riscv64:
name: Linux-riscv64
runs-on: ubuntu-24.04
permissions:
security-events: write
contents: read
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: run VM
uses: uraimo/run-on-arch-action@v3
id: runcmd
with:
arch: riscv64
distro: ubuntu22.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 ocl-icd-opencl-dev libpulse-dev libdrm-dev libddcutil-dev libchafa-dev libelf-dev directx-headers-dev rpm
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_INSTALL_PREFIX=/usr .
cmake --build . --target package --verbose -j4
./fastfetch --list-features
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
@@ -232,6 +300,76 @@ jobs:
name: fastfetch-linux-riscv64
path: ./fastfetch-*.*
linux-ppc64le:
name: Linux-ppc64le
runs-on: ubuntu-24.04
permissions:
security-events: write
contents: read
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: run VM
uses: uraimo/run-on-arch-action@v3
id: runcmd
with:
arch: ppc64le
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 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-ppc64le
path: ./fastfetch-*.*
linux-s390x:
name: Linux-s390x
runs-on: ubuntu-24.04
permissions:
security-events: write
contents: read
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: run VM
uses: uraimo/run-on-arch-action@v3
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 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
@@ -240,19 +378,17 @@ jobs:
- name: setup alpine linux
uses: jirutka/setup-alpine@master
with:
branch: v3.19
- name: install dependencies
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 libxrandr-dev rpm-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}
@@ -263,7 +399,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
@@ -272,9 +408,9 @@ jobs:
name: fastfetch-musl-amd64
path: ./fastfetch-*.*
macos-universal:
name: macOS-universal
runs-on: macos-12
macos-amd64:
name: macOS-amd64
runs-on: macos-13
permissions:
security-events: write
contents: read
@@ -289,20 +425,12 @@ jobs:
run: |
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install --overwrite vulkan-loader vulkan-headers molten-vk imagemagick chafa
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: c
- name: configure project
run: cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_OSX_ARCHITECTURES='arm64;x86_64' .
run: cmake -DSET_TWEAK=Off -DBUILD_TESTS=On .
- name: build project
run: cmake --build . --target package --verbose -j4
- name: perform CodeQL analysis
uses: github/codeql-action/analyze@v3
- name: list features
run: ./fastfetch --list-features
@@ -319,12 +447,59 @@ jobs:
run: otool -L fastfetch
- name: run tests
run: ctest
run: ctest --output-on-failure
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: fastfetch-macos-universal
name: fastfetch-macos-amd64
path: ./fastfetch-*.*
macos-aarch64:
name: macOS-aarch64
runs-on: macos-latest
permissions:
security-events: write
contents: read
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: uname -a
run: uname -a
- name: install required packages
run: |
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install --overwrite vulkan-loader vulkan-headers molten-vk imagemagick chafa
- name: configure project
run: cmake -DSET_TWEAK=Off -DBUILD_TESTS=On .
- 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: otool -L fastfetch
- name: run tests
run: ctest --output-on-failure
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: fastfetch-macos-aarch64
path: ./fastfetch-*.*
sunos-amd64:
@@ -351,7 +526,7 @@ jobs:
time ./fastfetch -c presets/ci.jsonc --format json
time ./flashfetch
ldd fastfetch
ctest
ctest --output-on-failure
cpack
- name: upload artifacts
@@ -377,19 +552,19 @@ jobs:
architecture: x86-64
cpu_count: 4
shell: bash
version: '14.1'
version: '14.3'
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 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
@@ -397,41 +572,6 @@ jobs:
name: fastfetch-freebsd-amd64
path: ./fastfetch-*.*
dragonfly-amd64:
name: DragonFly-amd64
runs-on: ubuntu-latest
permissions:
security-events: write
contents: read
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: run VM
uses: vmactions/dragonflybsd-vm@v1
with:
usesh: yes
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
run: |
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=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
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: fastfetch-dragonfly-amd64
path: ./fastfetch-*.*
openbsd-amd64:
name: OpenBSD-amd64
runs-on: ubuntu-latest
@@ -449,18 +589,18 @@ jobs:
architecture: x86-64
cpu_count: 4
shell: bash
version: '7.5'
version: '7.7'
run: |
uname -a
sudo pkg_add -r cmake git pkgconf wayland vulkan-headers vulkan-loader glib2 dconf dbus sqlite3 xfconf imagemagick chafa pulseaudio 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
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,18 +625,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 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
@@ -504,6 +644,106 @@ jobs:
name: fastfetch-netbsd-amd64
path: ./fastfetch-*.*
dragonfly-amd64:
name: DragonFly-amd64
runs-on: ubuntu-latest
if: false
permissions:
security-events: write
contents: read
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: run VM
uses: vmactions/dragonflybsd-vm@v1
with:
usesh: yes
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 opencl ocl-icd v4l_compat chafa libelf
run: |
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 --output-on-failure
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: fastfetch-dragonfly-amd64
path: ./fastfetch-*.*
haiku-amd64:
name: Haiku-amd64
runs-on: ubuntu-latest
permissions:
security-events: write
contents: read
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: Fixup VM
uses: cross-platform-actions/action@master
with:
operating_system: haiku
version: 'r1beta5'
architecture: x86-64
cpu_count: 4
shell: bash
sync_files: false
shutdown_vm: false
run: |
mv '/home/runner/work' '/boot/home/work'
ln -sf '/boot/home/work' '/home/runner/work'
- name: Sync files to VM
uses: cross-platform-actions/action@master
with:
operating_system: haiku
version: 'r1beta5'
architecture: x86-64
cpu_count: 4
shell: bash
sync_files: runner-to-vm
shutdown_vm: false
run: |
chown -R $(id -u):$(id -g) $(pwd)
ls -l
- name: run VM
uses: cross-platform-actions/action@master
with:
operating_system: haiku
version: 'r1beta5'
architecture: x86-64
cpu_count: 4
shell: bash
sync_files: vm-to-runner
run: |
uname -a
pkgman install -y git dbus_devel mesa_devel libelf_devel imagemagick_devel opencl_headers ocl_icd_devel vulkan_devel zlib_devel chafa_devel cmake gcc make pkgconfig python3.10
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
ctest --output-on-failure
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: fastfetch-haiku-amd64
path: ./fastfetch-*.*
windows-amd64:
name: Windows-amd64
runs-on: windows-latest
@@ -536,8 +776,67 @@ jobs:
- name: copy necessary dlls
run: cp /clang64/bin/{OpenCL,vulkan-1}.dll .
- name: download amd_ags
run: curl -LO https://github.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/raw/master/ags_lib/lib/amd_ags_x64.dll
- 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: create zip archive
run: 7z a -tzip -mx9 -bd -y fastfetch-windows-amd64.zip LICENSE *.dll fastfetch.exe flashfetch.exe presets
- name: create 7z archive
run: 7z a -t7z -mx9 -bd -y fastfetch-windows-amd64.7z LICENSE *.dll fastfetch.exe flashfetch.exe presets
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: fastfetch-windows-amd64
path: ./fastfetch-windows-amd64.*
windows-aarch64:
name: Windows-aarch64
runs-on: windows-11-arm
permissions:
security-events: write
contents: read
defaults:
run:
shell: msys2 {0}
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: setup-msys2
uses: msys2/setup-msys2@v2
with:
msystem: CLANGARM64
update: true
install: git mingw-w64-clang-aarch64-7zip mingw-w64-clang-aarch64-cmake mingw-w64-clang-aarch64-clang mingw-w64-clang-aarch64-vulkan-loader mingw-w64-clang-aarch64-vulkan-headers mingw-w64-clang-aarch64-opencl-icd mingw-w64-clang-aarch64-opencl-headers mingw-w64-clang-aarch64-cppwinrt mingw-w64-clang-aarch64-imagemagick
- name: print msys version
run: uname -a
- name: configure project
run: env PKG_CONFIG_PATH=/clangarm64/lib/pkgconfig/:$PKG_CONFIG_PATH cmake -DSET_TWEAK=Off -DBUILD_TESTS=On .
- name: build project
run: cmake --build . --verbose -j4
- name: copy necessary dlls
run: cp /clangarm64/bin/{OpenCL,vulkan-1}.dll .
- name: list features
run: ./fastfetch --list-features
@@ -555,19 +854,19 @@ 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
run: 7z a -tzip -mx9 -bd -y fastfetch-windows-aarch64.zip LICENSE *.dll fastfetch.exe flashfetch.exe presets
- name: create 7z archive
run: 7z a -t7z -mx9 -bd -y fastfetch-windows-amd64.7z LICENSE *.dll fastfetch.exe flashfetch.exe presets
run: 7z a -t7z -mx9 -bd -y fastfetch-windows-aarch64.7z LICENSE *.dll fastfetch.exe flashfetch.exe presets
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: fastfetch-windows-amd64
path: ./fastfetch-windows-amd64.*
name: fastfetch-windows-aarch64
path: ./fastfetch-windows-aarch64.*
release:
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'fastfetch-cli/fastfetch'
@@ -576,16 +875,21 @@ jobs:
needs:
- linux-amd64
- linux-aarch64
- linux-armv7
- linux-armv7l
- linux-armv6l
- linux-riscv64
- linux-ppc64le
- linux-s390x
- musl-amd64
- macos-universal
- macos-amd64
- macos-aarch64
- freebsd-amd64
- openbsd-amd64
- netbsd-amd64
- dragonfly-amd64
- sunos-amd64
- haiku-amd64
- windows-amd64
- windows-aarch64
permissions:
contents: write
steps:
+686 -1
View File
@@ -1,3 +1,688 @@
# 2.48.1
Features:
* Add support for detecting Openbox WM version (WM, Linux)
* Improve reliability of child process spawning on Windows (Windows)
* Add a new option `--packages-combined`, which combines related package managers into single counts (#1851, Packages)
* For example: if you have both `flatpak-system` and `flatpak-user` packages installed, they will be combined into a single `flatpak` count with `--packages-combined` enabled.
* Add `modules[n].condition` to conditionally enable modules on different platforms
* Useful when sharing configuration files across platforms
* For example:
```jsonc
{
"type": "custom",
"format": "This string will be printed on Intel macOS only",
"condition": {
"system": "macOS", // Can be an array, optional
"arch": "x86_64" // Can be an array, optional too
}
}
```
Bugfixes:
* Revert the change of `posix_spawn` in v2.48.0 for Android and OpenBSD (Android / OpenBSD)
* Fix completion for Android 7 (Required by Termux)
# 2.48.0
Features:
* Add support for detecting Fedora variants (#1830, OS, Linux)
* Currently supported variants: CoreOS, Kinoite, Sericea, Silverblue
* Optimize GPU detection on Windows when `--gpu-driver-specific` is not used (GPU, Windows)
* Improve accuracy of GPU type detection. Previously it was guessed based on the dedicated vmem size, which causes issues on newer AMD integrated GPUs such as 9000 HX and AI 9 HX series. Supported on Windows 8.1 or later.
* Add support for generic frequency detection of GPU 3D engine on Windows 11 22H2 or later.
* Improve performance. GPU temperature detection is significantly improved when `--gpu-driver-specific` is not used.
* Improve performance and security when spawning child processes by replacing `fork-exec` with `posix_spawn` (*nix)
* Improve accuracy of sound device detection on macOS (Sound, macOS)
* Trim leading and trailing whitespaces in disk serial numbers (PhysicalDisk)
* Add `/etc/profiles/per-user` detection for Nix user packages (#1782, Packages, Linux)
* Introduce `years` (whole years as integer), `days-of-year` (days since the last anniversary) and `years-fraction` (years as fraction, e.g. 1.5 means 1 year and 6 months) formatting placeholder to `Disk` (since disk creation), `Users` (since user login) and `Uptime` (since system boot) modules
* For example: `fastfetch -s disk --disk-key 'OS Installation' --disk-format '{years} years {days-of-year} days'`
* Add `--fraction-ndigits` option to specify the number of digits after the decimal point when displaying ordinary fractional values
* Typically used with `{years-fraction}` above
* This option does not affect percentage values, sizes, etc, which are controlled by individual options.
Bugfixes:
* Fix compilation issues when not using `-DBINARY_LINK_TYPE=dlopen`
* Regression from v2.47.0
* Note: this option was added for debugging purposes only and is not recommended for production use
* Replace `MTLDevice::hasUnifiedMemory` with `MTLDevice::location` for GPU type Detection (GPU, macOS)
* This should resolve the issue where discrete GPUs were detected as integrated GPUs on Intel MacBooks with multi-GPU configurations.
* Prevent text files from being loaded as image files (#1843, Logo)
Logos:
* Add Minimal System
* Add AxOS
* Rename Ada to Xray OS
# 2.47.0
Features:
* Various improvements for Solaris / OpenIndiana support
* Support BIOS (UEFI or legacy) type detection (BIOS)
* Support physical disk detection (PhysicalDisk)
* Remove leading `-` from login shells (Shell)
* Improve GPU detection performance (GPU)
* Drop `libpciaccess` dependency
* Use native API to detect sound devices (Sound)
* Drop `PulseAudio` dependency
* Improve DietPi OS and Raspberry Pi OS detection (#1816, OS, Linux)
* Force reporting version 26 on macOS Tahoe (OS, macOS)
* Append version string to Ubuntu variants (OS, Linux)
* Improve performance of media detection for macOS 15.4+ (Media, macOS)
* Increase `PROC_FILE_BUFFSIZ` to avoid possible short reads (Linux)
* Fix potential bugs in `DiskIO`, `NetIO` and `CPUUsage` modules
* Improve accuracy of CPU usage calculations by including interrupt and softirq times (CPUUsage, Linux / *BSD)
* Ignore `init` and `systemd` processes when detecting terminals (Terminal, Linux)
* Improve accuracy of CPU usage detection on Windows 10+ with perflib, which matches values reported by Task Manager (CPUUsage, Windows)
Bugfixes:
* Fix `pci.ids` file location (#1819, GPU, OpenBSD)
* Fix compiling on FreeBSD when `libdrm` support is disabled (#1820, GPU, FreeBSD)
Logos:
* Improve visibility on white-background terminals for some logos by replacing white with the default foreground color
* According to Wikipedia, the default foreground color is implementation-defined. It's usually black for white themes and white for dark themes. However, some terminals, notably Konsole with the default theme, use a different color, which may cause issues with some logos.
* Add Xubuntu
# 2.46.0
Features:
* Support Rio terminal font detection (#1789, TerminalFont, Linux)
* Support GPU detection by DRM on FreeBSD (GPU, FreeBSD)
* Enable by `--gpu-detection-method auto`
* Require proper DRM drivers installed and loaded
* Support PowerPC CPU detection on NetBSD (#1802, CPU, NetBSD)
* Support Aerospace WM detection (#1796, WM, macOS)
* Improve Raspberry Pi OS for RPI5 detection (#1773, OS, Linux)
* Support Linux Binary Compatibility detection on FreeBSD (#1786, Host, Linux)
* Use `board-id` as board name if available (Board, macOS)
* Intel only
* Support shared VRAM usage detection for AMD GPUs (GPU, Linux)
* Use `perflib.h` instead of `pdh.h` for CPU temperature querying to get rid of `pdh.dll` dependency (#1787, CPU, Windows)
* Support GPU info detection for old ATI radeon driver (#1810, GPU, Linux)
* Add macOS 26 Tahoe support (macOS)
* Report macOS 26 code name (OS)
* Report Liquid Glass DE on macOS 26+ (DE)
* Detect Metal 4 support (GPU)
Bugfixes:
* Fix packages counting by ignoring hidden folders (Packages, OpenBSD)
* Fix Hyprland version detection (WM, FreeBSD)
* Don't show `Please insert a disk into drive D:` error dialogs (#1805, Disk, Windows)
* Hide `/boot/firmware` by default (Disk, Linux)
Logos:
* Rename Hydra Framework to HydraPwk (#1812)
* Add AnushOS (#1806)
* Add HarmonyOS (#1804)
* Add GhostFreak (#1801)
* Add TrueNAS Scale (#1795)
* Add Fedora2_small (#1785)
* Add xenia_old; update colors of xenia (#1797)
* Improve colors of bedrock_small (#1790)
* Add Kalpa Desktop (#1807)
# 2.45.0
Features:
* Support OnePlus marketing name detection (#1768, Host, Android)
* Recognize additional GPU vendors (GPU, Linux)
* Support CTWM, FVWM and I3 window manager version detection (WM)
* Support KDE version detection on *BSD (DE, FreeBSD)
* Support `"logo": { "type": "command-raw" }` to run a command and display its output as logo (#1780, Logo)
* Useful for displaying custom logos generated by other programs such as `pokeget`: `{ "type": "command-raw", "source": "pokeget random --hide-name" }`
* Supported in JSONC config file only. `pokeget random --hide-name | fastfetch --file-raw -` should be used in shell.
* Acquire SMBIOS information on DragonFly BSD from `/dev/mem`; legacy BIOS only (PhysicalMemory, DragonFly)
* Support swap usage detection on DragonFly BSD (Swap, DragonFly)
* Support `--swap-separate` to display detailed swap devices on separate lines (Swap)
Bugfixes
* Fix MacBook Air model name (#1779, Host, macOS)
* Don't ignore sshfs mountpoints (#1776, Disk, Linux / FreeBSD)
* Fix dnf package count detection (#1777, Packages, Linux)
Logos:
* Add Starry Linux (#1771)
* Add rhel_small (#1774)
* Update color palette of voidlinux (#1775)
* Add void2
* Update Xenia Linux (#1783)
# 2.44.0
Features:
* Add option `--disk-hide-folders` and `--disk-hide-fs` to hide specific mountpoints and filesystems in Disk module (Disk)
* `--disk-hide-folders` defaults to `/efi:/boot:/boot/efi` on Linux and *BSD. Previously these EFI-related folders were hardcoded to be hidden on Linux.
Bugfixes:
* Fix Apple Terminal compatibility with `--stat` (macOS, #1755)
* Ignore `/usr/bin/script` when detecting shell and terminal (Terminal / Shell, #1761)
* Fix compatibility with KDE Plasma 6.4 which is in beta currently (Display, Linux, #1765)
Logos:
* Add Kylin (#1760)
* Add UBLinux (#1764)
# 2.43.0
Features:
* Support physical core count and package count detection on Solaris (CPU, SunOS)
* Improve physical core count detection on FreeBSD (CPU, FreeBSD)
* Add option to hide unknown GPUs (GPU)
* Detect VRAM type of AMD GPUs on Linux (GPU, Linux)
* Support playing media detection on macOS 15.4 (#1737, Media, macOS)
* Whether it works on newer versions is unknown
* Detect player name for Windows UMP apps (Media, Windows)
Bugfixes:
* Fix disk usage detection on 32-bit Linux (#1734, Disk, Linux)
* Fix compiling on Asahi Linux (GPU, Linux)
* Fix duplicated playback status (Media, Linux)
* Don't show 255 in custom format when muted on macOS (#1750, Sound, macOS)
* Remove shared memory detection for AMD GPUs, which doesn't work as expected (GPU, Windows)
Logos:
* new AthenaOS
* add Hydra Framework
# 2.42.0
Changes:
* Normalize the module name `Bios` to `BIOS` (#1721)
* No configuration file changes are required because fastfetch parses module names case-insensitively.
Bugfixes:
* Disable disk type detection for virtual disks (PhysicalDisk, Linux, #1669)
* Fix incorrect CPU temperature reporting (CPU, OpenBSD)
* Fix setting `logo.chafa.symbols` in JSON configuration (Logo, #1709)
* Fix non-normalized time display (Uptime, #1720)
* Miscellaneous minor fixes
Features:
* Add CPU temperature detection support (CPU, SunOS)
* Improve CPU frequency detection (CPU, NetBSD)
* Add Wi-Fi detection support (Wifi, NetBSD)
* Add Webcam detection support (Camera, OpenBSD)
* Requires root privileges
Logos:
* Remove GoralixOS logo (#1699)
* Add Aurora logo (#1700)
* Add Codex Linux logo (#1701)
# 2.41.0
Changes:
* Due to [the deprecation](https://github.com/actions/runner-images/issues/11101), Linux x86_64 binaries are now built with Ubuntu 22.04 (Glibc 2.35, Debian 12)
* You can always build fastfetch yourself on your own. Please don't report bugs related to this change.
Features:
* Support physical core count detection on non-x86 platforms (CPU, Linux / FreeBSD)
* Support CPU frequency detection on PPC64 (CPU, FreeBSD)
* Support soar packages count detection (Packages, Linux)
* Support `~` path expanding on Windows (Logo, Windows)
* Support retrieving full user name (Title)
* Exposed with `--title-format '{full-user-name}'`
* Improve CPU (thermal zone) temperature detection on Windows (CPU, Windows)
* Administrator privileges are no longer needed
* Support base Wifi info detection on OpenBSD (Wifi, OpenBSD)
* To be tested
* Support GPU temperature detection for Intel dGPU on Linux (GPU, Linux)
* To be tested
* Add new ARM CPU part numbers (CPU, Linux)
* Add base implementation of Bluetooth device detection (Bluetooth, NetBSD, #1690)
* Some small improvements
Logo:
* Add anduinos
* Add 2 more Alpine logos
# 2.40.4
Bugfixes:
* Fix loading presets config on Windows (Windows, #1682)
* Regression of v2.40.0
* Remove the prefix `v` of Hyprland version on Arch Linux (WM, Linux)
# 2.40.3
Bugfixes:
* Fix loading example configs from presets directory (#1672)
* Regression of v2.40.2
* Mark kitty image protocol support for warp terminal on macOS too (Logo)
# 2.40.2
Changes:
* Since v2.40.0, we've been loading config files from the directory where the fastfetch binary is located. However, this approach may lead to loading unexpected files. For example, `fastfetch -c groups` would attempt to load `/usr/bin/groups`. Therefore, we now enforce the `.jsonc` extension when loading config files. Examples:
1. `-c filename`: loads `filename.jsonc`
2. `-c filename.jsonc`: loads `filename.jsonc`
3. `-c filename.json`: loads `filename.json` and enforces strict JSON syntax (no comments or trailing commas)
4. `-c filename.ext`: loads `filename.ext.jsonc` (`.jsonc` extension is enforced)
Features:
* Mark kitty image protocol support for warp terminal (Logo)
* Documentation improvements
# 2.40.1
Bugfixes:
* Fix compiling error on old intel platform (TPM, macOS)
* Fix `--file-raw -` no longer working (Logo, #1659)
* Regression of v2.40.0
# 2.40.0
Changes:
* In `key-format` of `LocalIP` module, `{name}` has been renamed to `{ifname}` for consistency (LocalIP, #1639)
Features:
* Support Warp Terminal font detection (TerminalFont, Windows)
* Support more AMD GPU information using ADL SDK, including memory type detection (GPU, Windows)
* Support Intel dGPU memory type detection (GPU, Windows)
* Support Nvidia VMEM type detection via NVAPI (GPU, Windows, #993)
* Support Boot manager detection for OpenBSD and NetBSD (Bootmgr, OpenBSD / NetBSD)
* Use `SystemConfiguration` for DNS entries detection (DNS, macOS)
* Add `systemd-resolved` support for DNS module (DNS, Linux, #1646)
* Improve performance and accuracy of Wifi detection on FreeBSD using ioctl (Wifi, FreeBSD)
* Support remaining time reporting for batteries on NetBSD (Battery, NetBSD)
* Add new Mac models support (Host, macOS)
* Load config from fastfetch binary path with `--config` option (#1649)
* Support TPM detection on macOS (TPM, macOS)
* Support IPv6 client address report (Users, Linux / Windows)
* Support default route detection for IPv6 (LocalIP, Linux)
* Round seconds to the nearest minute to match the behavior of `uptime` command (Uptime)
Bugfixes:
* Fix `outputColor` not working when `length` is set in Separator module (#1644)
* Fix CPU detection on PowerPC platforms (#1640, CPU, Linux)
* Fix battery manufacture date detection (Battery, macOS)
* Fix battery critical state detection (Battery, Linux)
* Fix Warp Terminal PID detection (Terminal, macOS)
* Remove disk creation time detection support on SunOS as ctim is file status change timestamp, not creation time (Disk, SunOS)
* Fall back to KDGKBINFO if `usbhid` fails (Keyboard, FreeBSD)
* Fix multiple paging file support (Swap, Windows)
* Fix memleaks, code smells in multiple modules
* Fix boot time calculation on NetBSD (Uptime, NetBSD)
* Temporarily fix Hyprland version detection (WM, Linux, #1657)
Logo:
* Fix opensuse-tumbleweed_small (#1636)
* Change WiiLinuxNgx to more generic name with aliases Wii-Linux and WiiLinux (#1633)
* Change name of Xray-OS to Ada (#1651)
* Change Nexa Linux logo (#1653)
# 2.39.1
Bugfixes:
* Fix a regression that PublicIP detection fails randomly (PublicIP, #1629)
# 2.39.0
Changes:
* OSMesa backend for OpenGL detection is removed (#1618)
* Fastfetch no longer tries to use the private framework `Apple80211` to acquire SSID for Wifi module, which is only useful for macOS Sonoma (Wifi, macOS)
Features:
* Improve accuracy of HDR support on Windows 11 24H2 (Display, Windows)
* Improve performance of SSID detection on macOS Sequoia (Wifi, macOS, #1597)
* Support warp terminal version detection on Windows (Terminal, Windows)
* Support default route detection on OpenBSD & DragonFly BSD (LocalIP, OpenBSD / DragonFly)
* Improve bash completion script
* Improve performance of networking (PublicIP / Weather)
* Support pkgsrc package manager detection on Linux (Packages, Linux)
Logo:
* Add Common Torizon OS
* Change FoxOS to WolfOS
* Add Bredos
* Add NetBSD2
# 2.38.0
Bugfixes:
* Fix empty battery slots handling (Battery, Haiku, #1575)
* Fix `{day-pretty}` output in custom format (DateTime, Windows)
* Fix VanillaOS detection (OS, Linux)
* Fix secure boot testing (Bootmgr, Linux, #1584)
* Fix the SI unit "kB" in help message (#1589)
* Fix segfault on macOS 10.15 when using the binary downloaded from Github Releases (Camera, macOS, #1594)
Features:
* Support Chassis module in macOS (Chassis, macOS)
* Allow customize key format with kernel name and distro name (OS)
* Add missing `{icon}` in custom key format (Battery)
* Add missing `{mountpoint}` and `{mount-from}` in custom output format (Disk, #1577)
* Support percentage num & bar in custom format (GPU, #1583)
* Support `pisi` package manager detection (Packages, Linux)
* Support termite terminal font detection (TerminalFont, Linux)
* Report monitor type in Brightness module (Brightness)
Logo:
* Add `opensuse-tumbleweed_small`
* Add `Bedrock_small`
* Add `fastfetch`
* Remove some unnecessary distro names
# 2.37.0
Changes:
* 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:
* Suppress output of EGL again (#1513, GPU, Linux)
* Regression of 2.34.0
Features:
* Show SOC name reported in `cpuinfo` if available (#1510, CPU, Linux)
* Change package manager name of NetBSD from `pkg` to `pkgsrc` (#1515, Packages, NetBSD)
* Detect SOC name on RISCV (#1519, CPU, Linux)
* Report marketing name of new QS8Es (CPU, Android)
* Acquire acquire more os info from lsb-release if missing from os-release (#1521)
* CMake: add option `-DCUSTOM_LSB_RELEASE_PATH` to specify the path of `lsb-release` file
* `-DCUSTOM_OS_RELEASE_PATH` has been supported since `v2.11.4`
* Report more SOC names on Android (CPU, Android)
* Support duration printing in custom format (Disk / Users)
* For example:
```jsonc
{
"modules": [
{
"key": "OS Installation Date", // No longer need to write bash scripts
"type": "disk",
"folders": "/", // Different OSes may need to specify different folders
"format": "{create-time:10} [{days} days]" // Reports the creation date of the root folder
}
]
}
```
Logo:
* Add Arch_old
* Update key color of NetBSD_small
* Fix OpenBSD and many other ascii logos (#1522)
# 2.34.1
An early release to fix KDE Plasma 6.3 compatibility. Hopefully it can be accepted by package managers before KDE 6.3 is officially released.
To package managers: if you find fastfetch bugs, it's highly appreciated if you can report them to the upstream, so that all users can benefit from the fix, instead of maintaining out-of-tree patches. Thanks!
Features:
* Report vendor name when detecting GPUs by OpenGL
* Note: the vendor name is actually the creator of the OpenGL driver (such as `Mesa`) and may not be the same as the GPU vendor.
Bugfixes:
* Fix Ghostty termfont detection (#1495, TerminalFont, macOS)
* Fix compatibility with KDE Plasma 6.3 (#1504, Display, Linux)
* Make memory usage detection logic consistent with other systems (Memory, OpenBSD / NetBSD)
* Report media file name if media title is not available (Media)
* Fix max frequency detection for CPUs with both performance and efficiency cores (CPU, FreeBSD)
Logo:
* Add HeliumOS
* Add Oreon
* Update SnigdhaOS
# 2.34.0
Changes:
* We now print distro pretty name if available (OS)
* This is a long requested feature. However, it may break some distros. File a bug with the content of `/etc/os-release` if it breaks your distro.
Bugfixes:
* Fix thunderbolt version of new MBPs (#1465, Host, macOS)
* Fix backlight name detection on FreeBSD (Brightness, FreeBSD)
* Fix Terminal detection when running fastfetch in `pk-command-not-found` (#1467, Terminal, Linux)
* Relax detection of terminals in NixOS (#1479, Terminal, Linux)
* Should fix konsole, ghostty and maybe others
* Fix core count output in multi-package platforms (CPU)
* Don't suppress the output of `preRun` (#1489)
* Fix battery percentage detection (Battery, NetBSD)
Features:
* Support ghostty terminal font detection (TerminalFont, Linux / macOS)
* Support `kitty-icat` image protocol, which uses `kitten icat` to generate image data
* Pros: support tmux; support gif animations; good performance
* Cons: due to the limitation of `kitten icat`, we need to clear the screen before displaying the image logo
* Support WM version detection (WM)
* In Linux, Hyprland & sway are supported currently
* Improve performance when stdout is redirected (TerminalSize)
* Report thermal zone temp if CPU temp is not available (CPU, Linux)
* Report sound server (Pipewire or PulseAudio) if available (#1454, Sound, Linux)
* Enable OpenGL & OpenCL detection on Android (OpenGL / OpenCL, Android)
* Detect & report MediaTek Dimensity 9000+ SOC name (CPU, Android)
* Support appman (am-user) package manager detection (Packages, Linux)
Logo:
* Add Lubuntu
* Update Xray_os
* Add SnigdhaOS
* Add Rhino Linux
# 2.33.0
Changes:
* Introduce a new CMake flag `-DBUILD_FLASHFETCH=OFF` to disable building flashfetch binaries
* Package managers are encouraged to enable it. See <https://github.com/fastfetch-cli/fastfetch/discussions/627> for detail
Bugfixes:
* Fix interconnect type detection (#1453, PhysicalDisk, Linux)
* Regression of v2.28
* Don't report `proot` as terminal (Terminal, Android)
* Remove a debug output (DiskIO, OpenBSD)
* Fix media detection for some players (#1461, Media, Linux)
* Regression of v2.32
Features:
* Use `$POWERSHELL_VERSION` as PowerShell version if available (Shell, Windows)
* Fetching Windows PowerShell version can be very slow. Add `$env:POWERSHELL_VERSION = $PSVersionTable.PSVersion.ToString()` in `$PROFILE` before running `fastfetch` to improve the performance of `Shell` module
* Add support for ubuntu-based armbian detection (#1447, OS, Linux)
* Improve performance of Bluetooth detection (Bluetooth)
* We no longer report disconnected bluetooth devices in `--format json` when `--bluetooth-show-disconnected` isn't specified
* Support brightness level detection for builtin displays (Brightness, OpenBSD / NetBSD)
* Requires root permission on OpenBSD
* Support battery level detection (Battery, OpenBSD / NetBSD)
* Support CPU temperature detection in NetBSD (CPU, NetBSD)
* Hard code path of `libvulkan.so` for Android
* So that users don't need to install the vulkan-loader wrapper of termux
Logo:
* Add NurOS
* Add GoralixOS
# 2.32.1
A hotfix for OpenBSD. No changes to other platforms.
Bugfixes:
* Fix package count detection on OpenBSD (Packages, OpenBSD)
# 2.32.0
Bugfixes:
* Fix `pci.ids` file location on OpenBSD (GPU, OpenBSD)
* It's normally unused because enumerating PCI devices on OpenBSD requires root privileges
* Fix bssid formatting (Wifi, Linux)
* Fix Linux Lite distro detection (#1434, OS, Linux)
* Suppress XE driver warnings from Mesa (#1435, OpenGL, Linux)
* Fix format parameter name (#1443, Version)
* Don't report useless information when Wifi is disabled (Wifi, FreeBSD)
* Currently there are issues when the SSID contains whitespaces. More fixes are expected in the future.
* Always use physical size reported by X11 server to avoid inconsistent results (#1444, Display, Linux)
Features:
* Randomly select one if the logo source expands to multiple files (#1426, Logo)
* Report mac product name when running Linux in MacBook (Host, Linux / FreeBSD)
* Use screen size reported in DTD if make sense (Display)
* Detect Virtualized Apple Silicon CPUs (CPU, Linux)
* Add detection support for fvwm and ctwm (WM, OpenBSD / NetBSD)
* Add Armbian-unofficial detection (OS, Linux)
* Prefer surfaceless display when connect EGL (OpenGL)
* Improve accuracy of WM detection on FreeBSD (WM, FreeBSD)
* Add ratpoison window manager (WM, Linux)
Logo:
* Update Linux Lite
* Add Serpent OS
* Add Ultramarine Small
* Update Debian
# 2.31.0
Bugfixes:
* Improve performance of media detection; fix musikcube detection (Media, Linux)
* After the change, `general.processingTimeout` will also control the timeout of dbus remote calls
* Fix invalid variable names (#1408, Users)
* Change physical size detection to use basic display parameters (#1406)
* Fix possible sigfaults when detecting displays (#1393)
* Fix Nvidia card type detection
* Fix wl-restart parsing (#1422, WM, Linux)
* Fix syntax error in completion file (#1421)
* Fix hunging when using `ssh-agent` as command text (#1418, Command, macOS)
Features:
* Remove support of xcb & xlib and xrandr extension is always required (Display)
* Support preferred resolution & refresh rate detection
* On macOS there is no preferred resolution reported and maximum available resolution is reported instead.
* `--display-format {preferred-width}x{preferred-height}@{preferred-refresh-rate}`
* Report scale factor in custom format (Display)
* `--display-format {scale-factor}`
* Detect current Wi-Fi channel and maximum frequency (Wifi)
* Report processor package count (#1413, CPU)
* Remove duplicate whitespaces in CPU name
* Support sakura terminal version & font detection (Terminal / TerminalFont, Linux)
Logo:
* Fix LMDE
* Update MidOS
* Add Windows Server 2025
# 2.30.1
Bugfixes:
* Fix the destination where `fastfetch.1` is generated (#1403)
# 2.30.0
Changes:
* Percent: bar type must be enabled in `percent.type` before using percent bar in custom format
Features:
* Port to MidnightBSD; add mport package manager support
* Support bluetooth battery detection for macOS and Windows (Bluetooth, macOS / Windows)
* Support M4 model detection (Host, macOS)
* Support CPU temperature detection on OpenBSD (CPU, OpenBSD)
* Display Android icon in Android devices (OS, Android)
* Support qi package manager detection (Packages, Linux)
* Detect WM / DE by enumerating running processes (WM / DE, NetBSD)
* Generate manual pages from `help.json` (Doc)
* Detect marketing name of vivo smartphone (Host, Android)
* Add txDrops detection if supported (NetIO, *BSD)
* Support tilix version detection (Terminal, Linux)
* Support percent type config in module level. Example:
```jsonc
{
"type": "memory",
"percent": {
"green": 20, // [0%, 20%) will be displayed in green
"yellow": 40, // [20, 40) will be displayed in yellow and [40, 100] will be displayed in red
"type": [ // Display percent value in monochrome bar, same as 10
"bar",
"bar-monochrome"
]
}
}
```
Bugfixes:
* Don't display `()` in key if display name is not available (Display)
* Fix & normalize bluetooth mac address detection (Bluetooth, macOS / Windows)
* Don't print index in multi-battery devices (Battery)
* Fix segfault in macOS (#1388, macOS)
* Fix `CFStringGetCString() failed` errors (#1394, Media, macOS)
* Fix CPU frequency detection on Apple M4 (#1394, CPU, macOS)
* Fix exe path detection on macOS (Shell / Terminal, macOS)
* Fix logo fails to load from symlinked files on macOS (#1395, Logo, macOS)
* Fix 32-bit truncation (NetIO, macOS)
Logos:
* Fix Lilidog
* Add MidnightBSD
* Add Unifi
* Add Cosmic DE
* Update openSUSE Tumbleweed
# 2.29.0
Changes:
@@ -406,7 +1091,7 @@ Bugfixes:
* Fix some presets
* Better detection for XTerm terminal fonts (#1095, TerminalFont, Linux)
* Remove debug output (#1097, Windows)
* Fix command line option `--gpu-hide-type` doesn't work (#1098, GPU)
* Fix flag `--gpu-hide-type` doesn't work (#1098, GPU)
* Fix wrong date on Raspbian 10 (#1108, DateTime, Linux)
* Use `brightness` instead of `actuall_brightness` when detecting current brightness level (Brightness, Linux)
* Ref: https://bugzilla.kernel.org/show_bug.cgi?id=203905
+352 -127
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.29.0
VERSION 2.48.1
LANGUAGES C
DESCRIPTION "Fast neofetch-like system information tool"
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
@@ -20,6 +20,9 @@ elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
set(FreeBSD TRUE CACHE BOOL "..." FORCE)
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD")
set(OpenBSD TRUE CACHE BOOL "..." FORCE)
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "MidnightBSD")
set(FreeBSD TRUE CACHE BOOL "..." FORCE)
set(MidnightBSD TRUE CACHE BOOL "..." FORCE)
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "NetBSD")
set(NetBSD TRUE CACHE BOOL "..." FORCE)
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "DragonFly")
@@ -27,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()
@@ -51,45 +56,44 @@ 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_XCB "Enable xcb" 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)
cmake_dependent_option(ENABLE_X11 "Enable x11" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS" OFF)
cmake_dependent_option(ENABLE_DRM "Enable libdrm" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS" OFF)
cmake_dependent_option(ENABLE_DRM_AMDGPU "Enable libdrm_amdgpu" ON "LINUX" OFF)
cmake_dependent_option(ENABLE_DRM_AMDGPU "Enable libdrm_amdgpu" ON "LINUX OR FreeBSD" 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 WIN32 OR SunOS" OFF)
cmake_dependent_option(ENABLE_GLX "Enable glx" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD 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_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_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" 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)
cmake_dependent_option(ENABLE_PCIACCESS "Enable libpciaccess" ON "NetBSD OR OpenBSD" OFF)
option(ENABLE_SYSTEM_YYJSON "Use system provided (instead of fastfetch embedded) yyjson library" OFF)
option(ENABLE_ASAN "Build fastfetch with ASAN (address sanitizer)" OFF)
option(ENABLE_LTO "Enable link-time optimization in release mode if supported" ON)
option(BUILD_FLASHFETCH "Build flashfetch" ON) # Also build the flashfetch binary
option(BUILD_TESTS "Build tests" OFF) # Also create test executables
option(SET_TWEAK "Add tweak to project version" ON) # This is set to off by github actions for release builds
option(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")
@@ -98,7 +102,7 @@ if(NOT BINARY_LINK_TYPE IN_LIST BINARY_LINK_TYPE_OPTIONS)
message(FATAL_ERROR "BINARY_LINK_TYPE must be one of ${BINARY_LINK_TYPE_OPTIONS}")
endif()
set(PACKAGE_MANAGERS AM APK BREW CHOCO DPKG EMERGE EOPKG FLATPAK GUIX LINGLONG LPKG LPKGBUILD MACPORTS NIX OPKG PACMAN PACSTALL PALUDIS PKG PKGTOOL RPM SCOOP SNAP SORCERY WINGET XBPS)
set(PACKAGE_MANAGERS AM APK BREW CHOCO DPKG EMERGE EOPKG FLATPAK GUIX LINGLONG LPKG LPKGBUILD MACPORTS NIX OPKG PACMAN PACSTALL PALUDIS PISI PKG PKGTOOL RPM SCOOP SNAP SOAR SORCERY WINGET XBPS)
foreach(package_manager ${PACKAGE_MANAGERS})
if(package_manager STREQUAL "WINGET")
option(PACKAGES_DISABLE_${package_manager} "Disable ${package_manager} package manager detection by default" ON)
@@ -132,12 +136,12 @@ else()
message(STATUS "Threads type: disabled")
endif()
set(WARNING_FLAGS "-Wall -Wextra -Wconversion -Werror=uninitialized -Werror=return-type")
set(WARNING_FLAGS "-Wall -Wextra -Wconversion -Werror=uninitialized -Werror=return-type -Werror=vla")
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}")
@@ -253,6 +257,7 @@ endfunction(fastfetch_load_text)
find_package(Python)
if(Python_FOUND)
message(STATUS "Minifying 'help.json'")
execute_process(COMMAND ${Python_EXECUTABLE} -c "import json,sys;json.dump(json.load(sys.stdin),sys.stdout,separators=(',',':'))"
INPUT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/src/data/help.json"
OUTPUT_VARIABLE DATATEXT_JSON_HELP)
@@ -260,25 +265,66 @@ if(Python_FOUND)
message(ERROR "DATATEXT_JSON_HELP is empty, which should not happen!")
endif()
else()
message(STATUS "Python3 is not found, 'help.json' will not be minified")
message(WARNING "Python3 is not found, 'help.json' will not be minified")
file(READ "src/data/help.json" DATATEXT_JSON_HELP)
endif()
if(ENABLE_EMBEDDED_PCIIDS AND NOT EXISTS "fastfetch_pciids.c.inc")
if(ENABLE_EMBEDDED_PCIIDS AND NOT EXISTS "${PROJECT_BINARY_DIR}/fastfetch_pciids.c.inc")
if(Python_FOUND)
execute_process(COMMAND ${Python_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/scripts/gen-pciids.py"
OUTPUT_FILE "fastfetch_pciids.c.inc")
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" "${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()
message(STATUS "Python3 is not found, 'fastfetch_pciids.c.inc' will not be generated")
message(WARNING "Python3 is not found, 'fastfetch_pciids.c.inc' will not be generated")
set(ENABLE_EMBEDDED_PCIIDS OFF)
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"
OUTPUT_FILE "${PROJECT_BINARY_DIR}/fastfetch.1"
RESULT_VARIABLE PYTHON_MANPAGE_RETCODE)
if(NOT PYTHON_MANPAGE_RETCODE EQUAL 0)
message(FATAL_ERROR "Failed to generate 'fastfetch.1'")
endif()
else()
message(WARNING "Python3 is not found, use basic 'fastfetch.1.in' instead")
string(TIMESTAMP FASTFETCH_BUILD_DATE "%d %B %Y" UTC)
configure_file(doc/fastfetch.1.in fastfetch.1 @ONLY)
endif()
fastfetch_encode_c_string("${DATATEXT_JSON_HELP}" DATATEXT_JSON_HELP)
fastfetch_load_text(src/data/structure.txt DATATEXT_STRUCTURE)
fastfetch_load_text(src/data/help_footer.txt DATATEXT_HELP_FOOTER)
fastfetch_load_text(src/data/help_color.txt DATATEXT_HELP_COLOR)
fastfetch_load_text(src/data/help_format.txt DATATEXT_HELP_FORMAT)
configure_file(src/fastfetch_config.h.in fastfetch_config.h @ONLY)
configure_file(src/fastfetch_datatext.h.in fastfetch_datatext.h @ONLY)
@@ -286,20 +332,16 @@ if(APPLE)
configure_file(src/util/apple/Info.plist.in Info.plist @ONLY)
endif()
string(TIMESTAMP FASTFETCH_BUILD_DATE "%d %B %Y" UTC)
configure_file(doc/fastfetch.1.in fastfetch.1 @ONLY)
####################
# Ascii image data #
####################
file(GLOB LOGO_FILES "src/logo/ascii/*.txt")
file(GLOB LOGO_FILES CONFIGURE_DEPENDS "src/logo/ascii/*.txt")
set(LOGO_BUILTIN_H "#pragma once\n#pragma GCC diagnostic ignored \"-Wtrigraphs\"\n\n")
foreach(file ${LOGO_FILES})
fastfetch_load_text("${file}" content)
get_filename_component(file "${file}" NAME_WE)
string(TOUPPER "${file}" file)
string(REGEX REPLACE "\\$\\{c([0-9]+)\\}" "$\\1" content "${content}")
set(LOGO_BUILTIN_H "${LOGO_BUILTIN_H}#define FASTFETCH_DATATEXT_LOGO_${file} ${content}\n")
endforeach()
file(GENERATE OUTPUT logo_builtin.h CONTENT "${LOGO_BUILTIN_H}")
@@ -318,6 +360,7 @@ set(LIBFASTFETCH_SRC
src/common/library.c
src/common/modules.c
src/common/netif/netif.c
src/common/networking/networking_common.c
src/common/option.c
src/common/parsing.c
src/common/printing.c
@@ -446,7 +489,7 @@ if(LINUX)
src/common/dbus.c
src/common/io/io_unix.c
src/common/netif/netif_linux.c
src/common/networking_linux.c
src/common/networking/networking_linux.c
src/common/processing_linux.c
src/detection/battery/battery_linux.c
src/detection/bios/bios_linux.c
@@ -481,9 +524,11 @@ if(LINUX)
src/detection/displayserver/linux/xlib.c
src/detection/font/font_linux.c
src/detection/gpu/gpu_linux.c
src/detection/gpu/gpu_drm.c
src/detection/gpu/gpu_pci.c
src/detection/gtk_qt/gtk.c
src/detection/host/host_linux.c
src/detection/host/host_mac.c
src/detection/icons/icons_linux.c
src/detection/initsystem/initsystem_linux.c
src/detection/keyboard/keyboard_linux.c
@@ -514,7 +559,7 @@ if(LINUX)
src/detection/users/users_linux.c
src/detection/wallpaper/wallpaper_linux.c
src/detection/wifi/wifi_linux.c
src/detection/wm/wm_nosupport.c
src/detection/wm/wm_linux.c
src/detection/de/de_linux.c
src/detection/wmtheme/wmtheme_linux.c
src/detection/camera/camera_linux.c
@@ -526,7 +571,7 @@ elseif(ANDROID)
list(APPEND LIBFASTFETCH_SRC
src/common/io/io_unix.c
src/common/netif/netif_linux.c
src/common/networking_linux.c
src/common/networking/networking_linux.c
src/common/processing_linux.c
src/detection/battery/battery_android.c
src/detection/bios/bios_android.c
@@ -592,13 +637,12 @@ elseif(FreeBSD)
src/common/dbus.c
src/common/io/io_unix.c
src/common/netif/netif_bsd.c
src/common/networking_linux.c
src/common/networking/networking_linux.c
src/common/processing_linux.c
src/common/sysctl.c
src/detection/battery/battery_bsd.c
src/detection/bios/bios_bsd.c
src/detection/bluetooth/bluetooth_linux.c
src/detection/bluetoothradio/bluetoothradio_linux.c
src/detection/bluetoothradio/bluetoothradio_nosupport.c
src/detection/board/board_bsd.c
src/detection/bootmgr/bootmgr_bsd.c
src/detection/brightness/brightness_bsd.c
@@ -628,9 +672,11 @@ elseif(FreeBSD)
src/detection/displayserver/linux/xlib.c
src/detection/font/font_linux.c
src/detection/gpu/gpu_bsd.c
src/detection/gpu/gpu_drm.c
src/detection/gpu/gpu_pci.c
src/detection/gtk_qt/gtk.c
src/detection/host/host_bsd.c
src/detection/host/host_mac.c
src/detection/lm/lm_linux.c
src/detection/icons/icons_linux.c
src/detection/initsystem/initsystem_linux.c
@@ -660,8 +706,7 @@ elseif(FreeBSD)
src/detection/uptime/uptime_bsd.c
src/detection/users/users_linux.c
src/detection/wallpaper/wallpaper_linux.c
src/detection/wifi/wifi_bsd.c
src/detection/wm/wm_nosupport.c
src/detection/wm/wm_linux.c
src/detection/de/de_linux.c
src/detection/wmtheme/wmtheme_linux.c
src/detection/camera/camera_linux.c
@@ -669,31 +714,42 @@ elseif(FreeBSD)
src/util/platform/FFPlatform_unix.c
src/util/binary_linux.c
)
if(DragonFly)
list(APPEND LIBFASTFETCH_SRC
src/detection/bluetooth/bluetooth_nosupport.c
src/detection/wifi/wifi_nosupport.c
)
else()
list(APPEND LIBFASTFETCH_SRC
src/detection/bluetooth/bluetooth_bsd.c
src/detection/wifi/wifi_bsd.c
)
endif()
elseif(NetBSD)
list(APPEND LIBFASTFETCH_SRC
src/common/dbus.c
src/common/io/io_unix.c
src/common/netif/netif_bsd.c
src/common/networking_linux.c
src/common/networking/networking_linux.c
src/common/processing_linux.c
src/common/sysctl.c
src/detection/battery/battery_nosupport.c
src/detection/battery/battery_nbsd.c
src/detection/bios/bios_nbsd.c
src/detection/bluetooth/bluetooth_linux.c
src/detection/bluetoothradio/bluetoothradio_linux.c
src/detection/bluetooth/bluetooth_bsd.c
src/detection/bluetoothradio/bluetoothradio_nosupport.c
src/detection/board/board_nbsd.c
src/detection/bootmgr/bootmgr_nosupport.c
src/detection/brightness/brightness_nosupport.c
src/detection/bootmgr/bootmgr_bsd.c
src/detection/brightness/brightness_nbsd.c
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
@@ -723,16 +779,16 @@ elseif(NetBSD)
src/detection/localip/localip_linux.c
src/detection/gamepad/gamepad_nosupport.c
src/detection/media/media_linux.c
src/detection/memory/memory_obsd.c
src/detection/memory/memory_nbsd.c
src/detection/mouse/mouse_nosupport.c
src/detection/netio/netio_bsd.c
src/detection/opengl/opengl_linux.c
src/detection/os/os_nbsd.c
src/detection/packages/packages_obsd.c
src/detection/packages/packages_nbsd.c
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
@@ -742,8 +798,8 @@ elseif(NetBSD)
src/detection/uptime/uptime_bsd.c
src/detection/users/users_linux.c
src/detection/wallpaper/wallpaper_linux.c
src/detection/wifi/wifi_nosupport.c
src/detection/wm/wm_nosupport.c
src/detection/wifi/wifi_nbsd.c
src/detection/wm/wm_linux.c
src/detection/de/de_linux.c
src/detection/wmtheme/wmtheme_linux.c
src/detection/camera/camera_linux.c
@@ -756,26 +812,26 @@ elseif(OpenBSD)
src/common/dbus.c
src/common/io/io_unix.c
src/common/netif/netif_bsd.c
src/common/networking_linux.c
src/common/networking/networking_linux.c
src/common/processing_linux.c
src/common/sysctl.c
src/detection/battery/battery_nosupport.c
src/detection/bios/bios_nosupport.c
src/detection/bluetooth/bluetooth_linux.c
src/detection/bluetoothradio/bluetoothradio_linux.c
src/detection/board/board_nosupport.c
src/detection/bootmgr/bootmgr_nosupport.c
src/detection/brightness/brightness_nosupport.c
src/detection/battery/battery_obsd.c
src/detection/bios/bios_windows.c
src/detection/bluetooth/bluetooth_nosupport.c
src/detection/bluetoothradio/bluetoothradio_nosupport.c
src/detection/board/board_windows.c
src/detection/bootmgr/bootmgr_bsd.c
src/detection/brightness/brightness_obsd.c
src/detection/btrfs/btrfs_nosupport.c
src/detection/chassis/chassis_nosupport.c
src/detection/chassis/chassis_windows.c
src/detection/cpu/cpu_obsd.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_obsd.c
src/detection/displayserver/linux/displayserver_linux.c
src/detection/displayserver/linux/drm.c
@@ -814,7 +870,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
@@ -824,20 +880,21 @@ elseif(OpenBSD)
src/detection/uptime/uptime_bsd.c
src/detection/users/users_obsd.c
src/detection/wallpaper/wallpaper_linux.c
src/detection/wifi/wifi_nosupport.c
src/detection/wm/wm_nosupport.c
src/detection/wifi/wifi_obsd.c
src/detection/wm/wm_linux.c
src/detection/de/de_linux.c
src/detection/wmtheme/wmtheme_linux.c
src/detection/camera/camera_linux.c
src/detection/zpool/zpool_nosupport.c
src/util/platform/FFPlatform_unix.c
src/util/binary_linux.c
src/util/smbiosHelper.c
)
elseif(APPLE)
list(APPEND LIBFASTFETCH_SRC
src/common/io/io_unix.c
src/common/netif/netif_bsd.c
src/common/networking_linux.c
src/common/networking/networking_linux.c
src/common/processing_linux.c
src/common/sysctl.c
src/detection/battery/battery_apple.c
@@ -848,13 +905,13 @@ elseif(APPLE)
src/detection/bootmgr/bootmgr_apple.c
src/detection/brightness/brightness_apple.c
src/detection/btrfs/btrfs_nosupport.c
src/detection/chassis/chassis_nosupport.c
src/detection/chassis/chassis_apple.c
src/detection/cpu/cpu_apple.c
src/detection/cpucache/cpucache_apple.c
src/detection/cpuusage/cpuusage_apple.c
src/detection/cursor/cursor_apple.m
src/detection/disk/disk_bsd.c
src/detection/dns/dns_linux.c
src/detection/dns/dns_apple.c
src/detection/physicaldisk/physicaldisk_apple.c
src/detection/physicalmemory/physicalmemory_apple.m
src/detection/diskio/diskio_apple.c
@@ -863,6 +920,7 @@ elseif(APPLE)
src/detection/gpu/gpu_apple.c
src/detection/gpu/gpu_apple.m
src/detection/host/host_apple.c
src/detection/host/host_mac.c
src/detection/icons/icons_nosupport.c
src/detection/initsystem/initsystem_linux.c
src/detection/keyboard/keyboard_apple.c
@@ -875,7 +933,7 @@ elseif(APPLE)
src/detection/media/media_apple.m
src/detection/memory/memory_apple.c
src/detection/mouse/mouse_apple.c
src/detection/netio/netio_bsd.c
src/detection/netio/netio_apple.c
src/detection/opengl/opengl_apple.c
src/detection/os/os_apple.m
src/detection/packages/packages_apple.c
@@ -887,12 +945,12 @@ elseif(APPLE)
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/tpm/tpm_apple.c
src/detection/uptime/uptime_bsd.c
src/detection/users/users_linux.c
src/detection/wallpaper/wallpaper_apple.m
src/detection/wifi/wifi_apple.m
src/detection/wm/wm_apple.c
src/detection/wm/wm_apple.m
src/detection/de/de_nosupport.c
src/detection/wmtheme/wmtheme_apple.m
src/detection/camera/camera_apple.m
@@ -907,11 +965,12 @@ elseif(WIN32)
list(APPEND LIBFASTFETCH_SRC
src/common/io/io_windows.c
src/common/netif/netif_windows.c
src/common/networking_windows.c
src/common/networking/networking_windows.c
src/common/processing_windows.c
src/detection/battery/battery_windows.c
src/detection/bios/bios_windows.c
src/detection/bluetooth/bluetooth_windows.c
src/detection/bluetooth/bluetooth_windows.cpp
src/detection/bluetoothradio/bluetoothradio_windows.c
src/detection/board/board_windows.c
src/detection/bootmgr/bootmgr_windows.c
@@ -919,7 +978,6 @@ elseif(WIN32)
src/detection/btrfs/btrfs_nosupport.c
src/detection/chassis/chassis_windows.c
src/detection/cpu/cpu_windows.c
src/detection/cpu/cpu_windows.cpp
src/detection/cpucache/cpucache_windows.c
src/detection/cpuusage/cpuusage_windows.c
src/detection/cursor/cursor_windows.c
@@ -930,6 +988,7 @@ elseif(WIN32)
src/detection/dns/dns_windows.c
src/detection/font/font_windows.c
src/detection/gpu/gpu_windows.c
src/detection/host/host_mac.c
src/detection/host/host_windows.c
src/detection/icons/icons_windows.c
src/detection/initsystem/initsystem_nosupport.c
@@ -971,15 +1030,17 @@ elseif(WIN32)
src/util/windows/registry.c
src/util/windows/unicode.c
src/util/windows/wmi.cpp
src/util/windows/version.c
src/util/platform/FFPlatform_windows.c
src/util/binary_windows.c
src/util/debug_windows.c
)
elseif(SunOS)
list(APPEND LIBFASTFETCH_SRC
src/common/dbus.c
src/common/io/io_unix.c
src/common/netif/netif_bsd.c
src/common/networking_linux.c
src/common/networking/networking_linux.c
src/common/processing_linux.c
src/detection/battery/battery_nosupport.c
src/detection/bios/bios_windows.c
@@ -996,7 +1057,7 @@ elseif(SunOS)
src/detection/bluetoothradio/bluetoothradio_nosupport.c
src/detection/disk/disk_sunos.c
src/detection/dns/dns_linux.c
src/detection/physicaldisk/physicaldisk_nosupport.c
src/detection/physicaldisk/physicaldisk_sunos.c
src/detection/physicalmemory/physicalmemory_linux.c
src/detection/diskio/diskio_sunos.c
src/detection/displayserver/linux/displayserver_linux.c
@@ -1036,7 +1097,7 @@ elseif(SunOS)
src/detection/poweradapter/poweradapter_nosupport.c
src/detection/processes/processes_linux.c
src/detection/gtk_qt/qt.c
src/detection/sound/sound_linux.c
src/detection/sound/sound_sunos.c
src/detection/swap/swap_sunos.c
src/detection/terminalfont/terminalfont_linux.c
src/detection/terminalshell/terminalshell_linux.c
@@ -1055,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/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)
@@ -1079,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)
@@ -1109,6 +1243,14 @@ else()
endif()
endif()
if(ANDROID)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,/vendor/lib64 -Wl,-rpath,/system/lib64")
else()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,/vendor/lib -Wl,-rpath,/system/lib")
endif()
endif()
if(LINUX AND EXISTS "/lib/ld-musl-${CMAKE_HOST_SYSTEM_PROCESSOR}.so.1")
execute_process(COMMAND "/lib/ld-musl-${CMAKE_HOST_SYSTEM_PROCESSOR}.so.1"
ERROR_VARIABLE LD_MUSL_RESULT)
@@ -1123,17 +1265,25 @@ if(APPLE AND EXISTS "/usr/bin/otool")
target_compile_definitions(libfastfetch PUBLIC FF_LIBSYSTEM_VERSION="${CMAKE_MATCH_1}")
endif()
endif()
if(FreeBSD AND EXISTS "/usr/local/bin/objdump")
if(MidnightBSD AND EXISTS "/usr/bin/objdump")
execute_process(COMMAND /bin/sh -c "/usr/bin/objdump -T /lib/libc.so.* | grep 'FBSD_[0-9][0-9]*\\.[0-9][0-9]*' -o | sort -Vru | head -1"
OUTPUT_VARIABLE OBJDUMP_T_RESULT)
if("${OBJDUMP_T_RESULT}" MATCHES "FBSD_([0-9]+\\.[0-9]+)")
message(STATUS "Found FBSD ${CMAKE_MATCH_1}")
target_compile_definitions(libfastfetch PUBLIC FF_FBSD_VERSION="${CMAKE_MATCH_1}")
endif()
elseif(FreeBSD AND EXISTS "/usr/local/bin/objdump")
execute_process(COMMAND /bin/sh -c "/usr/local/bin/objdump -T /lib/libc.so.* | grep 'FBSD_[0-9][0-9]*\\.[0-9][0-9]*' -o | sort -Vru | head -1"
OUTPUT_VARIABLE OBJDUMP_T_RESULT)
if("${OBJDUMP_T_RESULT}" MATCHES "FBSD_([0-9]+\\.[0-9]+)")
message(STATUS "Found FBSD ${CMAKE_MATCH_1}")
target_compile_definitions(libfastfetch PUBLIC FF_FBSD_VERSION="${CMAKE_MATCH_1}")
endif()
endif()
if(DragonFly AND EXISTS "/usr/local/bin/objdump")
elseif(DragonFly AND EXISTS "/usr/local/bin/objdump")
execute_process(COMMAND /bin/sh -c "/usr/local/bin/objdump -T /lib/libc.so.* | grep 'DF[0-9][0-9]*\\.[0-9][0-9]*' -o | sort -Vru | head -1"
OUTPUT_VARIABLE OBJDUMP_T_RESULT)
if("${OBJDUMP_T_RESULT}" MATCHES "DF([0-9]+\\.[0-9]+)")
message(STATUS "Found DF ${CMAKE_MATCH_1}")
target_compile_definitions(libfastfetch PUBLIC FF_DF_VERSION="${CMAKE_MATCH_1}")
endif()
endif()
@@ -1143,7 +1293,7 @@ if(LINUX)
elseif(ANDROID)
target_compile_definitions(libfastfetch PUBLIC _GNU_SOURCE _XOPEN_SOURCE _FILE_OFFSET_BITS=64 "$<$<CONFIG:DEBUG>:__BIONIC_FORTIFY>" "$<$<CONFIG:DEBUG>:__BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED>")
elseif(WIN32)
target_compile_definitions(libfastfetch PUBLIC _GNU_SOURCE WIN32_LEAN_AND_MEAN=1 _WIN32_WINNT=0x0A00 NOMINMAX) # "$<$<CONFIG:Release>:_FORTIFY_SOURCE=3>"
target_compile_definitions(libfastfetch PUBLIC _GNU_SOURCE WIN32_LEAN_AND_MEAN _WIN32_WINNT=0x0A00 NOMINMAX UNICODE) # "$<$<CONFIG:Release>:_FORTIFY_SOURCE=3>"
elseif(APPLE)
target_compile_definitions(libfastfetch PUBLIC _GNU_SOURCE _XOPEN_SOURCE __STDC_WANT_LIB_EXT1__ _FILE_OFFSET_BITS=64 _DARWIN_C_SOURCE)
elseif(OpenBSD)
@@ -1157,6 +1307,18 @@ 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)
include(CheckStructHasMember)
set(CMAKE_REQUIRED_DEFINITIONS "-D_IFI_OQDROPS=1")
CHECK_STRUCT_HAS_MEMBER("struct if_data" ifi_oqdrops net/if.h HAVE_IFI_OQDROPS LANGUAGE C)
if(HAVE_IFI_OQDROPS)
target_compile_definitions(libfastfetch PUBLIC _IFI_OQDROPS FF_HAVE_IFI_OQDROPS)
endif()
unset(CMAKE_REQUIRED_DEFINITIONS)
endif()
if(HAVE_STATX)
@@ -1167,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})
@@ -1179,10 +1345,17 @@ if(NOT "${CUSTOM_OS_RELEASE_PATH}" STREQUAL "")
message(STATUS "Custom file path of os_release: ${CUSTOM_OS_RELEASE_PATH}")
target_compile_definitions(libfastfetch PRIVATE FF_CUSTOM_OS_RELEASE_PATH=${CUSTOM_OS_RELEASE_PATH})
endif()
if(NOT "${CUSTOM_LSB_RELEASE_PATH}" STREQUAL "")
message(STATUS "Custom file path of lsb_release: ${CUSTOM_LSB_RELEASE_PATH}")
target_compile_definitions(libfastfetch PRIVATE FF_CUSTOM_LSB_RELEASE_PATH=${CUSTOM_LSB_RELEASE_PATH})
endif()
if(NOT BINARY_LINK_TYPE STREQUAL "dlopen")
message(STATUS "Enabling custom link type: ${BINARY_LINK_TYPE}")
target_compile_definitions(libfastfetch PRIVATE FF_DISABLE_DLOPEN=1)
if(NOT WIN32)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--copy-dt-needed-entries")
endif()
endif()
function(ff_lib_enable VARNAME PKGCONFIG_NAMES CMAKE_NAME)
@@ -1238,18 +1411,10 @@ ff_lib_enable(XCB_RANDR
"xcb-randr"
"XcbRandr"
)
ff_lib_enable(XCB
"xcb"
"Xcb"
)
ff_lib_enable(XRANDR
"xrandr"
"XRandr"
)
ff_lib_enable(X11
"x11"
"X11"
)
ff_lib_enable(DRM
"libdrm"
"Libdrm"
@@ -1313,10 +1478,6 @@ else()
"GL"
)
endif()
ff_lib_enable(OSMESA
"osmesa"
"OSMesa"
)
ff_lib_enable(OPENCL
"OpenCL"
"OpenCL"
@@ -1374,6 +1535,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
@@ -1407,7 +1571,6 @@ elseif(APPLE)
PRIVATE "-F /System/Library/PrivateFrameworks"
PRIVATE "-weak_framework DisplayServices"
PRIVATE "-weak_framework MediaRemote"
PRIVATE "-weak_framework Apple80211"
)
elseif(WIN32)
target_link_libraries(libfastfetch
@@ -1419,17 +1582,25 @@ elseif(WIN32)
PRIVATE "ws2_32"
PRIVATE "ntdll"
PRIVATE "version"
PRIVATE "setupapi"
PRIVATE "hid"
PRIVATE "wtsapi32"
PRIVATE "imagehlp"
PRIVATE "cfgmgr32"
PRIVATE "winbrand"
PRIVATE "propsys"
PRIVATE "secur32"
)
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64")
# WoA only works on Windows 10 or higher
target_link_libraries(libfastfetch
PRIVATE "mincore"
)
endif()
elseif(FreeBSD)
target_link_libraries(libfastfetch
PRIVATE "m"
PRIVATE "usbhid"
PRIVATE "bluetooth"
)
if(NOT DragonFly)
target_link_libraries(libfastfetch
@@ -1444,10 +1615,13 @@ elseif(OpenBSD)
target_link_libraries(libfastfetch
PRIVATE "m"
PRIVATE "kvm"
PRIVATE "sndio"
)
elseif(NetBSD)
target_link_libraries(libfastfetch
PRIVATE "bluetooth"
PRIVATE "m"
PRIVATE "prop"
)
elseif(SunOS)
target_link_libraries(libfastfetch
@@ -1457,6 +1631,7 @@ elseif(SunOS)
PRIVATE "proc"
PRIVATE "zfs"
PRIVATE "nvpair"
PRIVATE "devinfo"
)
elseif(ANDROID)
CHECK_LIBRARY_EXISTS(-l:libandroid-wordexp.a wordexp "" HAVE_LIBANDROID_WORDEXP_STATIC)
@@ -1472,6 +1647,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
@@ -1574,41 +1760,52 @@ target_link_libraries(fastfetch
PRIVATE libfastfetch
)
add_executable(flashfetch
src/flashfetch.c
)
target_compile_definitions(flashfetch
PRIVATE FASTFETCH_TARGET_BINARY_NAME=flashfetch
)
target_link_libraries(flashfetch
PRIVATE libfastfetch
)
# Prevent fastfetch from linking to libstdc++
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "")
set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "")
set_target_properties(fastfetch PROPERTIES LINKER_LANGUAGE C)
set_target_properties(flashfetch PROPERTIES LINKER_LANGUAGE C)
if(WIN32)
target_sources(fastfetch
PRIVATE src/util/windows/version.rc
)
target_sources(flashfetch
PRIVATE src/util/windows/version.rc
)
elseif(APPLE)
target_link_options(fastfetch
PRIVATE LINKER:-sectcreate,__TEXT,__info_plist,Info.plist
)
target_link_options(flashfetch
PRIVATE LINKER:-sectcreate,__TEXT,__info_plist,Info.plist
)
endif()
if(BINARY_LINK_TYPE STREQUAL "static")
target_link_options(fastfetch PRIVATE "-static")
target_link_options(flashfetch PRIVATE "-static")
endif()
# Apply all above parameters to flashfetch if it is built
if (BUILD_FLASHFETCH)
add_executable(flashfetch
src/flashfetch.c
)
target_compile_definitions(flashfetch
PRIVATE FASTFETCH_TARGET_BINARY_NAME=flashfetch
)
target_link_libraries(flashfetch
PRIVATE libfastfetch
)
set_target_properties(flashfetch PROPERTIES LINKER_LANGUAGE C)
if(WIN32)
target_sources(flashfetch
PRIVATE src/util/windows/version.rc
)
elseif(APPLE)
target_link_options(flashfetch
PRIVATE LINKER:-sectcreate,__TEXT,__info_plist,Info.plist
)
endif()
if(BINARY_LINK_TYPE STREQUAL "static")
target_link_options(flashfetch PRIVATE "-static")
endif()
endif()
###################
@@ -1637,10 +1834,26 @@ if (BUILD_TESTS)
PRIVATE libfastfetch
)
add_executable(fastfetch-test-color
tests/color.c
)
target_link_libraries(fastfetch-test-color
PRIVATE libfastfetch
)
add_executable(fastfetch-test-duration
tests/duration.c
)
target_link_libraries(fastfetch-test-duration
PRIVATE libfastfetch
)
enable_testing()
add_test(NAME test-strbuf COMMAND fastfetch-test-strbuf)
add_test(NAME test-list COMMAND fastfetch-test-list)
add_test(NAME test-format COMMAND fastfetch-test-format)
add_test(NAME test-color COMMAND fastfetch-test-color)
add_test(NAME test-duration COMMAND fastfetch-test-duration)
endif()
##################
@@ -1650,10 +1863,17 @@ endif()
include(GNUInstallDirs)
install(
TARGETS fastfetch flashfetch
TARGETS fastfetch
DESTINATION "${CMAKE_INSTALL_BINDIR}"
)
if (TARGET flashfetch)
install(
TARGETS flashfetch
DESTINATION "${CMAKE_INSTALL_BINDIR}"
)
endif()
if (TARGET ffwinrt)
install(
TARGETS ffwinrt
@@ -1701,17 +1921,17 @@ install(
##################
set(CPACK_GENERATOR "TGZ;ZIP")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(CMAKE_SYSTEM_PROCESSOR "amd64")
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
set(CMAKE_SYSTEM_PROCESSOR "aarch64")
endif()
if(APPLE)
string(TOLOWER "${CMAKE_PROJECT_NAME}-macos-universal" CPACK_PACKAGE_FILE_NAME)
else() # We don't use this in Windows
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(CMAKE_SYSTEM_PROCESSOR "amd64")
endif()
if(IS_MUSL)
string(TOLOWER "${CMAKE_PROJECT_NAME}-musl-${CMAKE_SYSTEM_PROCESSOR}" CPACK_PACKAGE_FILE_NAME)
else()
string(TOLOWER "${CMAKE_PROJECT_NAME}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}" CPACK_PACKAGE_FILE_NAME)
endif()
string(TOLOWER "${CMAKE_PROJECT_NAME}-macos-${CMAKE_SYSTEM_PROCESSOR}" CPACK_PACKAGE_FILE_NAME) # use macos instead of darwin
elseif(IS_MUSL)
string(TOLOWER "${CMAKE_PROJECT_NAME}-musl-${CMAKE_SYSTEM_PROCESSOR}" CPACK_PACKAGE_FILE_NAME)
else()
string(TOLOWER "${CMAKE_PROJECT_NAME}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}" CPACK_PACKAGE_FILE_NAME)
endif()
if(LINUX)
@@ -1737,12 +1957,17 @@ if(LINUX)
endif()
endif()
find_program(HAVE_RPMBUILD "rpmbuild")
if(HAVE_RPMBUILD)
set(CPACK_GENERATOR "${CPACK_GENERATOR};RPM")
if(NOT IS_MUSL)
find_program(HAVE_RPMBUILD "rpmbuild")
if(HAVE_RPMBUILD)
set(CPACK_GENERATOR "${CPACK_GENERATOR};RPM")
set(CPACK_RPM_PACKAGE_LICENSE "MIT")
set(CPACK_RPM_PACKAGE_LICENSE "MIT")
endif()
endif()
elseif(FreeBSD)
set(CPACK_FREEBSD_PACKAGE_LICENSE "MIT")
set(CPACK_GENERATOR "${CPACK_GENERATOR};FREEBSD")
endif()
set(CPACK_SET_DESTDIR ON)
+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
+142 -60
View File
@@ -10,8 +10,9 @@
[![GitHub release (with filter)](https://img.shields.io/github/v/release/fastfetch-cli/fastfetch?logo=github)](https://github.com/fastfetch-cli/fastfetch/releases)
[![latest packaged version(s)](https://repology.org/badge/latest-versions/fastfetch.svg)](https://repology.org/project/fastfetch/versions)
[![Packaging status](https://repology.org/badge/tiny-repos/fastfetch.svg)](https://repology.org/project/fastfetch/versions)
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/fastfetch-cli/fastfetch)
Fastfetch is a [neofetch](https://github.com/dylanaraps/neofetch)-like tool for fetching system information and displaying it prettily. It is written mainly in C, with performance and customizability in mind. Currently, Linux, Android, FreeBSD, macOS, SunOS and Windows 7+ are supported.
Fastfetch is a [neofetch](https://github.com/dylanaraps/neofetch)-like tool for fetching system information and displaying it in a visually appealing way. It is written mainly in C, with a focus on performance and customizability. Currently, it supports Linux, macOS, Windows 7+, Android, FreeBSD, OpenBSD, NetBSD, DragonFly, Haiku, and SunOS.
<img src="screenshots/example1.png" width="49%" align="left" />
<img src="https://upload.wikimedia.org/wikipedia/commons/2/24/Transparent_Square_Tiles_Texture.png" width="49%" height="16px" align="left" />
@@ -21,13 +22,19 @@ Fastfetch is a [neofetch](https://github.com/dylanaraps/neofetch)-like tool for
<img src="screenshots/example3.png" width="48%" align="top" />
<img src="screenshots/example5.png" height="15%" align="top" />
According configuration files for examples are located [here](https://github.com/fastfetch-cli/fastfetch/tree/dev/presets/examples).
There are [screenshots on different platforms](https://github.com/fastfetch-cli/fastfetch/wiki).
## Installation
### Linux
Some distros package an outdated fastfetch version. Older versions receive no support, so please try always to use the latest version.
Some distributions package outdated versions of fastfetch. Older versions receive no support, so please always try 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)
@@ -40,17 +47,14 @@ Some distros package an outdated fastfetch version. Older versions receive no su
* openSUSE: `zypper install fastfetch`
* ALT Linux: `apt-get install fastfetch`
* Exherbo: `cave resolve --execute app-misc/fastfetch`
* GNU Guix: `guix install fastfetch`
* Solus: `eopkg install fastfetch`
* Slackware: `sbopkg -i fastfetch`
* Void Linux: `xbps-install fastfetch`
* Venom Linux: `scratch install fastfetch`
You may need `sudo`, `doas` or `sup` to run these commands.
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`
If fastfetch is not packaged for your distribution or an outdated version is packaged, [linuxbrew](https://brew.sh/) is a good alternative: `brew install fastfetch`
### macOS
@@ -66,72 +70,67 @@ If fastfetch is not packaged for your distro or an outdated version is packaged,
You may also download the program directly from [the GitHub releases page](https://github.com/fastfetch-cli/fastfetch/releases/latest) in the form of an archive file.
### FreeBSD
### BSD systems
* `pkg install fastfetch`
* FreeBSD: `pkg install fastfetch`
* NetBSD: `pkgin in fastfetch`
* OpenBSD: `pkg_add fastfetch` (Snapshots only)
* DragonFly BSD: `pkg install fastfetch` (Snapshots only)
### Android (Termux)
* `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
See the Wiki: https://github.com/fastfetch-cli/fastfetch/wiki/Building
## Usage
* Run it with default configuration: `fastfetch`
* Run it with [all supported modules](https://github.com/fastfetch-cli/fastfetch/wiki/Support+Status#available-modules) and find what interests you: `fastfetch -c all.jsonc`
* Find all data that fastfetch detects: `fastfetch -s <module> --format json`
* Run with default configuration: `fastfetch`
* Run with [all supported modules](https://github.com/fastfetch-cli/fastfetch/wiki/Support+Status#available-modules) to find what interests you: `fastfetch -c all.jsonc`
* View all data that fastfetch detects: `fastfetch -s <module1>[:<module2>][:<module3>] --format json`
* Display help messages: `fastfetch --help`
* Generate config file based on command line arguments: `fastfetch --arg1 --arg2 --gen-config`
* Generate a config file based on command line arguments: `fastfetch --arg1 --arg2 --gen-config`
## Customization
Fastfetch uses the JSONC (or JSON with comments) for configuration. [See Wiki for detail](https://github.com/fastfetch-cli/fastfetch/wiki/Configuration). There are some premade config files in [`presets`](presets), including the ones used for the screenshots above. You can load them using `-c <filename>`. Those files can serve as examples of the configuration syntax.
Fastfetch uses JSONC (JSON with comments) for configuration. [See the Wiki for details](https://github.com/fastfetch-cli/fastfetch/wiki/Configuration). There are some premade config files in the [`presets`](presets) directory, including those used for the screenshots above. You can load them using `-c <filename>`. These files can serve as examples of the configuration syntax.
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?
1. Fastfetch is actively maintained.
2. Fastfetch is faster. As the name suggests.
3. Fastfetch has a greater number of features, though by default fastfetch only has a few modules enabled; use `fastfetch -c all` to find what you want.
2. Fastfetch is faster, as the name suggests.
3. Fastfetch has a greater number of features, though by default it only has a few modules enabled; use `fastfetch -c all` to discover what you want.
4. Fastfetch is more configurable. You can find more information in the Wiki: <https://github.com/fastfetch-cli/fastfetch/wiki/Configuration>.
5. Fastfetch is more polished. For example, neofetch prints `555 MiB` in the Memory module and `23 G` in the Disk module, whereas fastfetch prints `555.00 MiB` and `22.97 GiB` respectively.
6. Fastfetch is more accurate. For example, [neofetch never actually supports the Wayland protocol](https://github.com/dylanaraps/neofetch/pull/2395).
### Q: Fastfetch shows my local IP address. It leaks my privacy!
### Q: Fastfetch shows my local IP address. Does it leak my privacy?
A local IP (10.x.x.x, 172.x.x.x, 192.168.x.x) has nothing to do with privacy. It only makes sense if you are on the same network, for example, if you connect to the same Wi-Fi network.
A local IP address (10.x.x.x, 172.x.x.x, 192.168.x.x) has nothing to do with privacy. It only has meaning if you are on the same network, for example, if you connect to the same Wi-Fi network.
Actually the `Local IP` module is the most useful module for me personally. I (@CarterLi) have several VMs installed to test fastfetch and often need to SSH into them. I have fastfetch running on shell startup and I never need to type `ip addr` manually.
Actually, the `Local IP` module is the most useful module for me personally. I (@CarterLi) have several VMs installed to test fastfetch and often need to SSH into them. With fastfetch running on shell startup, I never need to type `ip addr` manually.
If you really don't like it, you can disable the `Local IP` module in `config.jsonc`.
### Q: Where is the config file? I can't find it.
`Fastfetch` does not generate config file automatically. You can use `fastfetch --gen-config` to generate one. The config file will be saved in `~/.config/fastfetch/config.jsonc` by default. See [Wiki for detail](https://github.com/fastfetch-cli/fastfetch/wiki/Configuration).
Fastfetch does not generate a config file automatically. You can use `fastfetch --gen-config` to generate one. The config file will be saved in `~/.config/fastfetch/config.jsonc` by default. See the [Wiki for details](https://github.com/fastfetch-cli/fastfetch/wiki/Configuration).
### Q: The configuration is so complex. Where is the documentation?
Fastfetch uses JSON (with comments) for configuration. I suggest you use an IDE with JSON schema support (like VSCode) to edit it.
Fastfetch uses JSON (with comments) for configuration. I suggest using an IDE with JSON schema support (like VSCode) to edit it.
Alternatively, you can refer to the presets in [`presets` directory](https://github.com/fastfetch-cli/fastfetch/tree/dev/presets).
Alternatively, you can refer to the presets in the [`presets` directory](https://github.com/fastfetch-cli/fastfetch/tree/dev/presets).
The **correct** way to edit the configuration:
@@ -141,32 +140,32 @@ This is an example that [changes size prefix from MiB / GiB to MB / GB](https://
### Q: I WANT THE DOCUMENTATION!
[Here is the documentation](https://github.com/fastfetch-cli/fastfetch/wiki/Json-Schema). It is generated from [JSON schema](https://github.com/fastfetch-cli/fastfetch/blob/dev/doc/json_schema.json) but you won't like it.
[Here is the documentation](https://github.com/fastfetch-cli/fastfetch/wiki/Json-Schema). It is generated from the [JSON schema](https://github.com/fastfetch-cli/fastfetch/blob/dev/doc/json_schema.json), but you might not find it very user-friendly.
### Q: How can I customize the module output?
Fastfetch uses `format` to generate output. For example, to make the `GPU` module show only the GPU name (leaving other information undisplayed), you can use
Fastfetch uses `format` to generate output. For example, to make the `GPU` module show only the GPU name (leaving other information undisplayed), you can use:
```jsonc
{
"modules": [
{
"type": "gpu",
"format": "{name}" // See `fastfetch -h gpu-format` for detail
"format": "{name}" // See `fastfetch -h gpu-format` for details
}
]
}
```
. . which is equivalent to `fastfetch -s gpu --gpu-format '{name}'`
...which is equivalent to `fastfetch -s gpu --gpu-format '{name}'`
See `fastfetch -h format` for information on basic usage. For module specific formattion, see `fastfetch -h <module>-format`
See `fastfetch -h format` for information on basic usage. For module-specific formatting, see `fastfetch -h <module>-format`
### Q: I have my own ascii-art / image file. How can I show it with fastfetch?
### Q: I have my own ASCII art / image file. How can I show it with fastfetch?
Try `fastfetch -l /path/to/logo`. See [logo documentation](https://github.com/fastfetch-cli/fastfetch/wiki/Logo-options) for detail.
Try `fastfetch -l /path/to/logo`. See the [logo documentation](https://github.com/fastfetch-cli/fastfetch/wiki/Logo-options) for details.
If you just want to display distro name in [FIGlet text](https://github.com/pwaller/pyfiglet):
If you just want to display the distro name in [FIGlet text](https://github.com/pwaller/pyfiglet):
```bash
# install pyfiglet and jq first
@@ -175,38 +174,121 @@ pyfiglet -s -f small_slant $(fastfetch -s os --format json | jq -r '.[0].result.
![image](https://github.com/fastfetch-cli/fastfetch/assets/6134068/6466524e-ab8c-484f-848d-eec7ddeb7df2)
### Q: My image logo behaves weird. How can I fix it?
### Q: My image logo behaves strangely. How can I fix it?
See troubleshooting section: <https://github.com/fastfetch-cli/fastfetch/wiki/Logo-options#troubleshooting>
See the troubleshooting section: <https://github.com/fastfetch-cli/fastfetch/wiki/Logo-options#troubleshooting>
### Q: Fastfetch runs in white and black on shell startup. Why?
### Q: Fastfetch runs in black and white on shell startup. Why?
This issue usually happens when using fastfetch with `p10k`. There are known incompatibility between fastfetch and p10k instant prompt.
The p10k doc clearly states that you should NOT print anything to stdout after `p10k-instant-prompt` is initialized. You should either put `fastfetch` before initialization of `p10k-instant-prompt` (recommended)
This issue usually occurs when using fastfetch with `p10k`. There are known incompatibilities between fastfetch and p10k instant prompt.
The p10k documentation clearly states that you should NOT print anything to stdout after `p10k-instant-prompt` is initialized. You should put `fastfetch` before the initialization of `p10k-instant-prompt` (recommended).
You can always use `fastfetch --pipe false` to force fastfetch running in colorful mode.
You can always use `fastfetch --pipe false` to force fastfetch to run in colorful mode.
### Q: Why do fastfetch and neofetch show different memory usage result?
### Q: Why do fastfetch and neofetch show different memory usage results?
See [#1096](https://github.com/fastfetch-cli/fastfetch/issues/1096).
### Q: Fastfetch shows less dpkg packages than neofetch, is it a bug?
### Q: Fastfetch shows fewer dpkg packages than neofetch. Is it a bug?
Neofetch incorrectly counts `rc` packages ( the package has been removed, but that the configuration files remain ). Bug https://github.com/dylanaraps/neofetch/issues/2278
Neofetch incorrectly counts `rc` packages (packages that have been removed but still have configuration files remaining). See bug: https://github.com/dylanaraps/neofetch/issues/2278
### Q: I use Debian / Ubuntu / Debian deserved distro. My GPU is detected as `XXXX Device XXXX (VGA compatible)`. Is it a bug?
### Q: I use Debian / Ubuntu / Debian-derived distro. My GPU is detected as `XXXX Device XXXX (VGA compatible)`. Is this a bug?
Try upgrading `pci.ids`: Download <https://pci-ids.ucw.cz/v2.2/pci.ids> and overwrite file `/usr/share/hwdata/pci.ids`. For AMD GPUs, you should also upgrade `amdgpu.ids`: Download <https://gitlab.freedesktop.org/mesa/drm/-/raw/main/data/amdgpu.ids> and overwrite file `/usr/share/libdrm/amdgpu.ids`
Try upgrading `pci.ids`: Download <https://pci-ids.ucw.cz/v2.2/pci.ids> and overwrite the file `/usr/share/hwdata/pci.ids`. For AMD GPUs, you should also upgrade `amdgpu.ids`: Download <https://gitlab.freedesktop.org/mesa/drm/-/raw/main/data/amdgpu.ids> and overwrite the file `/usr/share/libdrm/amdgpu.ids`
Alternatively, you may try to use `fastfetch --gpu-driver-specific`, so that `fastfetch` will try to ask the driver for GPU name if supported.
Alternatively, you may try using `fastfetch --gpu-driver-specific`, which will make fastfetch attempt to ask the driver for the GPU name if supported.
### Q: I get the error `Authorization required, but no authorization protocol specified` when running fastfetch as root
Try `export XAUTHORITY=$HOME/.Xauthority`
### Q: Fastfetch cannot detect my awesome 3rd-party macOS window manager!
Try `fastfetch --wm-detect-plugin`. See also [#984](https://github.com/fastfetch-cli/fastfetch/issues/984)
### Q: How can I change the colors of my ASCII logo?
Try `fastfetch --logo-color-[1-9] <color>`, where `[1-9]` is the index of color placeholders.
For example: `fastfetch --logo-color-1 red --logo-color-2 green`.
In JSONC, you can use:
```jsonc
{
"logo": {
"color": {
"1": "red",
"2": "green"
}
}
}
```
### Q: How do I hide a key?
Set the key to a white space.
```jsonc
{
"key": " "
}
```
### Q: How can I display images on Windows?
As of April 2025:
#### mintty and Wezterm
mintty (used by Bash on Windows and MSYS2) and Wezterm (nightly build only) support the iTerm image protocol on Windows.
In `config.jsonc`:
```json
{
"logo": {
"type": "iterm",
"source": "C:/path/to/image.png",
"width": <num-in-chars>
}
}
```
#### Windows Terminal
Windows Terminal supports the sixel image protocol only.
* If you installed fastfetch through MSYS2:
1. Install imagemagick: `pacman -S mingw-w64-<subsystem>-x86_64-imagemagick`
2. In `config.jsonc`:
```jsonc
{
"logo": {
"type": "sixel", // DO NOT USE "auto"
"source": "C:/path/to/image.png", // Do NOT use `~` as fastfetch is a native Windows program and doesn't apply cygwin path conversion
"width": <image-width-in-chars>, // Optional
"height": <image-height-in-chars> // Optional
}
}
```
* If you installed fastfetch via scoop or downloaded the binary directly from the GitHub Releases page:
1. Convert your image manually to sixel format using [any online image conversion service](https://www.google.com/search?q=convert+image+to+sixel)
2. In `config.jsonc`:
```jsonc
{
"logo": {
"type": "raw", // DO NOT USE "auto"
"source": "C:/path/to/image.sixel",
"width": <image-width-in-chars>, // Required
"height": <image-height-in-chars> // Required
}
}
```
### Q: I want feature A / B / C. Will fastfetch support it?
Fastfetch is a system information tool. We only accept hardware or system level software feature requests. For most personal uses, I recommend using `Command` module to detect it yourself, which can be used to grab output from a custom shell script:
Fastfetch is a system information tool. We only accept hardware or system-level software feature requests. For most personal uses, I recommend using the `Command` module to implement custom functionality, which can be used to grab output from a custom shell script:
```jsonc
// This module shows the default editor
@@ -221,23 +303,23 @@ Fastfetch is a system information tool. We only accept hardware or system level
}
```
Otherwise, open a feature request in [GitHub Issues](https://github.com/fastfetch-cli/fastfetch/issues).
Otherwise, please open a feature request in [GitHub Issues](https://github.com/fastfetch-cli/fastfetch/issues).
### Q: I have questions. Where can I get help?
* For usage questions, please start a discussion in [GitHub Discussions](https://github.com/fastfetch-cli/fastfetch/discussions).
* For possible bugs, please open an issue in [GitHub Issues](https://github.com/fastfetch-cli/fastfetch/issues). Be sure to fill the bug-report template carefully for developers to investigate.
* For possible bugs, please open an issue in [GitHub Issues](https://github.com/fastfetch-cli/fastfetch/issues). Be sure to fill out the bug report template carefully to help developers investigate.
## Donate
If you find Fastfetch to be useful, please consider donating.
If you find Fastfetch useful, please consider donating.
* Current maintainer: [@CarterLi](https://paypal.me/zhangsongcui)
* Original author: [@LinusDierheimer](https://github.com/sponsors/LinusDierheimer)
## Star History
Give it a star to support us!
Give us a star to show your support!
<a href="https://star-history.com/#fastfetch-cli/fastfetch&Date">
<picture>
+119 -428
View File
@@ -1,430 +1,121 @@
__fastfetch_complete_help()
{
local __ff_helps=(
"color"
"format"
"config"
"os-format"
"host-format"
"kernel-format"
"uptime-format"
"processes-format"
"packages-format"
"shell-format"
"display-format"
"de-format"
"wm-format"
"wmtheme-format"
"theme-format"
"icons-format"
"font-format"
"cursor-format"
"terminal-format"
"terminalfont-format"
"cpu-format"
"cpuusage-format"
"gpu-format"
"memory-format"
"swap-format"
"disk-format"
"battery-format"
"poweradapter-format"
"locale-format"
"localip-format"
"publicip-format"
"player-format"
"media-format"
"datetime-format"
"date-format"
"time-format"
"vulkan-format"
"opengl-format"
"opencl-format"
"bluetooth-format"
)
COMPREPLY=($(compgen -W "${__ff_helps[*]}" -- "$CURRENT_WORD"))
#!/usr/bin/env bash
_fastfetch() {
# Use Bash built-in variables directly
local cur="${COMP_WORDS[COMP_CWORD]}"
local prev="${COMP_WORDS[COMP_CWORD-1]}"
# Check if Python is available
if ! command -v python3 &>/dev/null; then
return
fi
# Handle standard completion cases
case "$prev" in
--color|--color-keys|--color-title|--color-output|--color-separator|--*-color|--*-key-color|--*-output-color|--logo-color-[1-9]|--percent-color-*|--temp-color-*)
local -a colors=("black" "red" "green" "yellow" "blue" "magenta" "cyan" "white" "default")
COMPREPLY=($(compgen -W "${colors[*]}" -- "$cur"))
return
;;
--logo|-l)
local -a logos
readarray -t logos < <(fastfetch --list-logos autocompletion 2>/dev/null)
logos+=("none" "small")
COMPREPLY=($(compgen -W "${logos[*]}" -- "$cur"))
return
;;
--config|-c)
local -a presets
readarray -t presets < <(fastfetch --list-presets autocompletion 2>/dev/null)
presets+=("none")
COMPREPLY=($(compgen -W "${presets[*]}" -- "$cur"))
# Also allow file path completion
if type _filedir &>/dev/null; then
_filedir
elif type compgen &>/dev/null; then
COMPREPLY+=($(compgen -f -- "$cur"))
fi
return
;;
--structure|-s)
# Get all module names in lowercase only
local -a structures
readarray -t structures < <(fastfetch --list-modules autocompletion 2>/dev/null | cut -d':' -f1 | tr '[:upper:]' '[:lower:]')
COMPREPLY=($(compgen -W "${structures[*]}" -- "$cur"))
return
;;
--help|-h)
local -a modules
readarray -t modules < <(fastfetch --list-modules autocompletion 2>/dev/null)
# Convert to lowercase and keep only module names
local -a module_names=()
for module in "${modules[@]}"; do
module_names+=($(echo "$module" | cut -d':' -f1 | tr '[:upper:]' '[:lower:]')-format)
done
module_names+=("format" "color")
COMPREPLY=($(compgen -W "${module_names[*]}" -- "$cur"))
return
;;
--format)
COMPREPLY=($(compgen -W "json default" -- "$cur"))
return
;;
--*-format)
# Format string completion, handle spaces
return
;;
--*path*|--*file*|--gen-config*|--*data*)
# File path completion
if type _filedir &>/dev/null; then
_filedir
elif type compgen &>/dev/null; then
COMPREPLY=($(compgen -f -- "$cur"))
fi
return
;;
esac
# If not a special option, generate all possible options
if [[ "$cur" == -* ]]; then
local -a opts
readarray -t opts < <(python3 - "$cur" <<'EOF'
import json
import sys
import subprocess
def main(current):
try:
# Use fastfetch --help-raw to get option data
output = subprocess.check_output(['fastfetch', '--help-raw'], stderr=subprocess.DEVNULL)
data = json.loads(output)
for category in data.values():
for flag in category:
if flag.get("pseudo", False):
continue
if "short" in flag:
print(f"-{flag['short']}")
if "long" in flag:
if flag["long"] == "logo-color-[1-9]":
for i in range(1, 10):
print(f"--logo-color-{i}")
else:
print(f"--{flag['long']}")
except Exception:
# If error occurs, return no options
pass
if __name__ == "__main__":
main(sys.argv[1])
EOF
)
COMPREPLY=($(compgen -W "${opts[*]}" -- "$cur"))
fi
return 0
}
__fastfetch_complete_bool()
{
COMPREPLY=($(compgen -W "true false" -- "$CURRENT_WORD"))
}
__fastfetch_complete_string()
{
if [[ $CURRENT_WORD != "" ]]; then
COMPREPLY=("$CURRENT_WORD")
fi
}
__fastfetch_complete_path()
{
COMPREPLY=($(compgen -A file -- "$CURRENT_WORD"))
}
__fastfetch_complete_logo()
{
COMPREPLY=($(compgen -W "$(fastfetch --list-logos autocompletion)" -- "$CURRENT_WORD"))
}
__fastfetch_complete_logo_type()
{
local __ff_logo_types=(
"auto"
"builtin"
"file"
"raw"
"sixel"
"kitty"
"chafa"
)
COMPREPLY=($(compgen -W "${__ff_logo_types[*]}" -- "$CURRENT_WORD"))
}
__fastfetch_complete_binary_prefix()
{
local __ff_size_binary_prefixes=(
"iec"
"si"
"jedec"
)
COMPREPLY=($(compgen -W "${__ff_size_binary_prefixes[*]}" -- "$CURRENT_WORD"))
}
__fastfetch_complete_gl()
{
local __ff_gl_types=(
"auto"
"egl"
"glx"
"osmesa"
)
COMPREPLY=($(compgen -W "${__ff_gl_types[*]}" -- "$CURRENT_WORD"))
}
__fastfetch_complete_option()
{
local FF_OPTIONS_ALL=(
"${FF_OPTIONS_BOOL[@]}"
"${FF_OPTIONS_STRING[@]}"
"${FF_OPTIONS_PATH[@]}"
"${FF_OPTIONS_LOGO[@]}"
"${FF_OPTIONS_LOGO_TYPE[@]}"
"${FF_OPTIONS_BINARY_PREFIX[@]}"
"${FF_OPTIONS_OPENGL[@]}"
)
if [[ $WORD_COUND -lt 3 ]]; then
FF_OPTIONS_ALL+=(
"${FF_OPTIONS_SINGLE[@]}"
"${FF_OPTIONS_HELP[@]}"
)
fi
for ff_word in ${COMP_WORDS[@]}; do
if [[ $ff_word == $CURRENT_WORD ]]; then
break
fi
FF_OPTIONS_ALL=("${FF_OPTIONS_ALL[@]/$ff_word}")
done
COMPREPLY=($(compgen -W "${FF_OPTIONS_ALL[*]}" -- "$CURRENT_WORD"))
}
__fastfetch_previous_matches()
{
for ff_option in "$@"; do
if [[ $ff_option == "$PREVIOUS_WORD" ]]; then
return 0
fi
done
return 1
}
__fastfetch_completion()
{
local CURRENT_WORD="${COMP_WORDS[$COMP_CWORD]}"
local PREVIOUS_WORD="${COMP_WORDS[$COMP_CWORD - 1]}"
local WORD_COUND="${#COMP_WORDS[@]}"
local FF_OPTIONS_SINGLE=(
"-v"
"--version"
"--list-logos"
"--list-modules"
"--list-presets"
"--list-features"
"--print-logos"
"--print-config-system"
"--print-config-user"
"--print-structure"
"--gen-config"
"--gen-config-force"
)
local FF_OPTIONS_HELP=(
"-h"
"--help"
)
local FF_OPTIONS_BOOL=(
"-r"
"--show-errors"
"--logo-print-remaining"
"--multithreading"
"--stat"
"--allow-slow-operations"
"--disable-linewrap"
"--hide-cursor"
"--cpu-temp"
"--gpu-temp"
"--battery-temp"
"--display-precise-refresh-rate"
"--localip-show-ipv4"
"--localip-show-ipv6"
"--localip-show-flags"
"--localip-show-loop"
"--localip-show-mtu"
"--localip-show-speed"
"--localip-name-prefix"
"--localip-compact-type"
"--escape-bedrock"
"--pipe"
"--title-fqdn"
"--disk-folders"
"--disk-show-external"
"--disk-show-hidden"
"--disk-show-subvolumes"
"--gpu-hide-integrated"
"--gpu-hide-discrete"
"--gpu-force-method"
"--disk-show-unknown"
"--bluetooth-show-disconnected"
)
local FF_OPTIONS_STRING=(
"--logo-type"
"--logo-padding"
"--logo-padding-left"
"--logo-padding-right"
"--logo-padding-top"
"--logo-color-1"
"--logo-color-2"
"--logo-color-3"
"--logo-color-4"
"--logo-color-5"
"--logo-color-6"
"--logo-color-7"
"--logo-color-8"
"--logo-color-9"
"--logo-width"
"--logo-height"
"--color"
"--color-keys"
"--color-title"
"--display-compact-type"
"--separator"
"-s"
"--structure"
"--player-name"
"--percent-type"
"--publicip-url"
"--publicip-timeout"
"--weather-output-format"
"--weather-timeout"
"--os-key"
"--os-format"
"--os-key-color"
"--host-key"
"--host-format"
"--host-key-color"
"--kernel-key"
"--kernel-format"
"--kernel-key-color"
"--uptime-key"
"--uptime-format"
"--uptime-key-color"
"--processes-key"
"--processes-format"
"--processes-key-color"
"--packages-key"
"--packages-format"
"--packages-key-color"
"--shell-key"
"--shell-format"
"--shell-key-color"
"--display-key"
"--display-format"
"--display-key-color"
"--de-key"
"--de-format"
"--de-key-color"
"--wm-key"
"--wm-format"
"--wm-key-color"
"--wmtheme-key"
"--wmtheme-format"
"--wmtheme-key-color"
"--theme-key"
"--theme-format"
"--theme-key-color"
"--icons-key"
"--icons-format"
"--icons-key-color"
"--font-key"
"--font-format"
"--font-key-color"
"--cursor-key"
"--cursor-format"
"--cursor-key-color"
"--terminal-key"
"--terminal-format"
"--terminal-key-color"
"--terminalfont-key"
"--terminalfont-format"
"--terminalfont-key-color"
"--cpu-key"
"--cpu-format"
"--cpu-key-color"
"--cpu-useage-key"
"--cpu-useage-format"
"--cpu-useage-key-color"
"--gpu-key"
"--gpu-format"
"--gpu-key-color"
"--memory-key"
"--memory-format"
"--memory-key-color"
"--swap-key"
"--swap-format"
"--swap-key-color"
"--disk-key"
"--disk-format"
"--disk-key-color"
"--battery-key"
"--battery-format"
"--battery-key-color"
"--poweradapter-key"
"--poweradapter-format"
"--poweradapter-key-color"
"--locale-key"
"--locale-format"
"--locale-key-color"
"--localip-key"
"--localip-format"
"--localip-key-color"
"--publicip-key"
"--publicip-format"
"--publicip-key-color"
"--wifi-key"
"--wifi-format"
"--wifi-key-color"
"--weather-key"
"--weather-format"
"--weather-key-color"
"--player-key"
"--player-format"
"--player-key-color"
"--media-key"
"--media-format"
"--media-key-color"
"--datetime-key"
"--datetime-format"
"--datetime-key-color"
"--date-key"
"--date-format"
"--date-key-color"
"--time-key"
"--time-format"
"--time-key-color"
"--vulkan-key"
"--vulkan-format"
"--vulkan-key-color"
"--opengl-key"
"--opengl-format"
"--opengl-key-color"
"--opencl-key"
"--opencl-format"
"--opencl-key-color"
"--users-key"
"--users-format"
"--users-key-color"
"--users-myself-only"
"--bluetooth-key"
"--bluetooth-format"
"--bluetooth-key-color"
)
local FF_OPTIONS_PATH=(
"-c"
"--config"
"--lib-vulkan"
"--lib-wayland"
"--lib-xcb-randr"
"--lib-xcb"
"--lib-xrandr"
"--lib-X11"
"--lib-gio"
"--lib-dconf"
"--lib-dbus"
"--lib-xfconf"
"--lib-sqlite3"
"--lib-rpm"
"--lib-imagemagick"
"--lib-z"
"--lib-chafa"
"--lib-egl"
"--lib-glx"
"--lib-osmesa"
"--lib-opencl"
"--lib-pulse"
"--lib-ddcutil"
"--lib-nm"
)
local FF_OPTIONS_LOGO=(
"-l"
"--logo"
)
local FF_OPTIONS_LOGO_TYPE=(
"--logo-type"
)
local FF_OPTIONS_BINARY_PREFIX=(
"--binary-prefix"
)
local FF_OPTIONS_OPENGL=(
"--opengl-type"
)
if __fastfetch_previous_matches "${FF_OPTIONS_SINGLE[@]}"; then
return
elif [[ $WORD_COUND -gt 3 && ( ${COMP_WORDS[$COMP_CWORD - 2]} == "--help" || ${COMP_WORDS[$COMP_CWORD - 2]} == "-h" ) ]]; then
return
elif [[ $CURRENT_WORD == "-"* ]]; then
__fastfetch_complete_option
elif __fastfetch_previous_matches "${FF_OPTIONS_HELP[@]}"; then
__fastfetch_complete_help
elif __fastfetch_previous_matches "${FF_OPTIONS_BOOL[@]}"; then
__fastfetch_complete_bool
elif __fastfetch_previous_matches "${FF_OPTIONS_STRING[@]}"; then
__fastfetch_complete_string
elif __fastfetch_previous_matches "${FF_OPTIONS_PATH[@]}"; then
__fastfetch_complete_path
elif __fastfetch_previous_matches "${FF_OPTIONS_LOGO[@]}"; then
__fastfetch_complete_logo
elif __fastfetch_previous_matches "${FF_OPTIONS_LOGO_TYPE[@]}"; then
__fastfetch_complete_logo_type
elif __fastfetch_previous_matches "${FF_OPTIONS_BINARY_PREFIX[@]}"; then
__fastfetch_complete_binary_prefix
elif __fastfetch_previous_matches "${FF_OPTIONS_OPENGL[@]}"; then
__fastfetch_complete_gl
else
__fastfetch_complete_option
fi
}
complete -F __fastfetch_completion fastfetch
# Register completion
complete -F _fastfetch fastfetch
+8 -1
View File
@@ -62,11 +62,17 @@ end
echo '
import json, subprocess, sys
def main():
data: dict[str, list[dict]] = json.loads(subprocess.check_output(["fastfetch", "--help-raw"]))
for key in data:
for flag in data[key]:
if flag["long"] == "logo-color-[1-9]":
for i in range(1, 10):
print(f"""complete -c fastfetch -d "{flag["desc"]}" -l "logo-color-{i}" -x -a "(__fastfetch_complete_color)" """)
continue
if flag.get("pseudo", False):
continue
@@ -75,7 +81,7 @@ def main():
command_prefix += f""" -o {flag["short"]}"""
if "arg" in flag:
type: str = flag["arg"]["type"];
type: str = flag["arg"]["type"]
if type == "bool":
print(f"{command_prefix} -x -a \"(__fastfetch_complete_bool)\"")
elif type == "color":
@@ -98,6 +104,7 @@ def main():
else:
print(f"{command_prefix} -f")
if __name__ == "__main__":
try:
main()
+3 -3
View File
@@ -26,7 +26,7 @@ def main():
for flag in data[key]:
if flag["long"] == "logo-color-[1-9]":
for i in range(1, 10):
command_prefix = f"--logo-color-{i}[{flag["desc"]} ({i})]"
command_prefix = f"--logo-color-{i}[{flag['desc']} ({i})]"
print_command(command_prefix, flag)
continue
@@ -34,11 +34,11 @@ def main():
continue
if "short" in flag:
command_prefix = f"-{flag["short"]}[{flag["desc"]}]"
command_prefix = f"-{flag['short']}[{flag['desc']}]"
print_command(command_prefix, flag)
if "long" in flag:
command_prefix = f"--{flag["long"]}[{flag["desc"]}]"
command_prefix = f"--{flag['long']}[{flag['desc']}]"
print_command(command_prefix, flag)
+162
View File
@@ -1,3 +1,165 @@
fastfetch (2.48.0) jammy; urgency=medium
* Update to 2.48.0
-- Carter Li <zhangsongcui@live.cn> Thu, 17 Jul 2025 16:16:52 +0800
fastfetch (2.47.0) jammy; urgency=medium
* Update to 2.47.0
-- Carter Li <zhangsongcui@live.cn> Thu, 03 Jul 2025 14:51:45 +0800
fastfetch (2.46.0) jammy; urgency=medium
* Update to 2.46.0
-- Carter Li <zhangsongcui@live.cn> Fri, 20 Jun 2025 15:01:21 +0800
fastfetch (2.45.0) jammy; urgency=medium
* Update to 2.45.0
-- Carter Li <zhangsongcui@live.cn> Thu, 05 Jun 2025 10:56:38 +0800
fastfetch (2.44.0) jammy; urgency=medium
* Update to 2.44.0
-- Carter Li <zhangsongcui@live.cn> Mon, 26 May 2025 14:59:01 +0800
fastfetch (2.43.0) jammy; urgency=medium
* Update to 2.43.0
-- Carter Li <zhangsongcui@live.cn> Wed, 14 May 2025 09:49:50 +0800
fastfetch (2.42.0) jammy; urgency=medium
* Update to 2.42.0
-- Carter Li <zhangsongcui@live.cn> Wed, 30 Apr 2025 14:08:57 +0800
fastfetch (2.41.0) jammy; urgency=medium
* Update to 2.41.0
-- Carter Li <zhangsongcui@live.cn> Wed, 16 Apr 2025 13:42:58 +0800
fastfetch (2.40.4) jammy; urgency=medium
* Update to 2.40.4
-- Carter Li <zhangsongcui@live.cn> Thu, 10 Apr 2025 15:38:21 +0800
fastfetch (2.40.3) jammy; urgency=medium
* Update to 2.40.3
-- Carter Li <zhangsongcui@live.cn> Mon, 07 Apr 2025 09:29:27 +0800
fastfetch (2.40.0) jammy; urgency=medium
* Update to 2.40.0
-- Carter Li <zhangsongcui@live.cn> Thu, 03 Apr 2025 08:46:54 +0800
fastfetch (2.39.1) jammy; urgency=medium
* Update to 2.39.1
-- Carter Li <zhangsongcui@live.cn> Fri, 21 Mar 2025 11:02:19 +0800
fastfetch (2.39.0ubuntu1) jammy; urgency=medium
* Remove unwanted debugging code
-- Carter Li <zhangsongcui@live.cn> Thu, 20 Mar 2025 10:39:22 +0800
fastfetch (2.39.0) jammy; urgency=medium
* Update to 2.39.0
-- Carter Li <zhangsongcui@live.cn> Thu, 20 Mar 2025 10:35:18 +0800
fastfetch (2.38.0) jammy; urgency=medium
* Update to 2.38.0
-- Carter Li <zhangsongcui@live.cn> Wed, 05 Mar 2025 14:56:24 +0800
fastfetch (2.37.0) jammy; urgency=medium
* Update to 2.37.0
-- Carter Li <zhangsongcui@live.cn> Wed, 19 Feb 2025 15:43:42 +0800
fastfetch (2.36.1) jammy; urgency=medium
* Update to 2.36.1
-- 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
-- Carter Li <zhangsongcui@live.cn> Mon, 13 Jan 2025 16:06:22 +0800
fastfetch (2.34.0) jammy; urgency=medium
* Update to 2.34.0
-- Carter Li <zhangsongcui@live.cn> Thu, 09 Jan 2025 09:03:17 +0800
fastfetch (2.33.0) jammy; urgency=medium
* Update to 2.33.0
-- Carter Li <zhangsongcui@live.cn> Thu, 26 Dec 2024 09:42:27 +0800
fastfetch (2.32.0) jammy; urgency=medium
* Update to 2.32.0
-- Carter Li <zhangsongcui@live.cn> Wed, 18 Dec 2024 10:39:06 +0800
fastfetch (2.31.0) jammy; urgency=medium
* Update to 2.31.0
-- Carter Li <zhangsongcui@live.cn> Wed, 04 Dec 2024 08:41:40 +0800
fastfetch (2.30.1) jammy; urgency=medium
* Update to 2.30.1
-- Carter Li <zhangsongcui@live.cn> Mon, 18 Nov 2024 15:40:48 +0800
fastfetch (2.30.0) jammy; urgency=medium
* Update to 2.30.0
-- Carter Li <zhangsongcui@live.cn> Mon, 18 Nov 2024 09:30:58 +0800
fastfetch (2.29.0) jammy; urgency=medium
* Update to 2.29.0
-- Carter Li <zhangsongcui@live.cn> Mon, 04 Nov 2024 15:05:02 +0800
fastfetch (2.28.0) jammy; urgency=medium
* Update to 2.28.0
+1 -1
View File
@@ -2,7 +2,7 @@ Source: fastfetch
Section: universe/utils
Priority: optional
Maintainer: Carter Li <zhangsongcui@live.cn>
Build-Depends: libvulkan-dev, libwayland-dev, libxrandr-dev, libxcb-randr0-dev, libdconf-dev, libdbus-1-dev, libmagickcore-dev, libxfconf-0-dev, libsqlite3-dev, librpm-dev, libegl-dev, libglx-dev, libosmesa6-dev, ocl-icd-opencl-dev, libpulse-dev, libdrm-dev, libddcutil-dev, libchafa-dev, directx-headers-dev, pkgconf, cmake (>= 3.12), debhelper (>= 11.2), dh-cmake, dh-cmake-compat (= 1), dh-sequence-cmake, dh-sequence-ctest, ninja-build
Build-Depends: libvulkan-dev, libwayland-dev, libxrandr-dev, libxcb-randr0-dev, libdconf-dev, libdbus-1-dev, libmagickcore-dev, libxfconf-0-dev, libsqlite3-dev, librpm-dev, libegl-dev, libglx-dev, ocl-icd-opencl-dev, libpulse-dev, libdrm-dev, libddcutil-dev, libchafa-dev, directx-headers-dev, pkgconf, cmake (>= 3.12), debhelper (>= 11.2), dh-cmake, dh-cmake-compat (= 1), dh-sequence-cmake, dh-sequence-ctest, ninja-build
Standards-Version: 4.0.0
Homepage: https://github.com/fastfetch-cli/fastfetch
+1 -1
View File
@@ -1 +1 @@
fastfetch_2.28.0_source.buildinfo universe/utils optional
fastfetch_2.48.0_source.buildinfo universe/utils optional
+140 -59
View File
@@ -1,8 +1,7 @@
.TH FASTFETCH 1 "@FASTFETCH_BUILD_DATE@" "@CMAKE_PROJECT_NAME@ @CMAKE_PROJECT_VERSION@"
.SH NAME
fastfetch \- a neofetch\-like tool for fetching system information and
displaying them in a pretty way
fastfetch \- a fast and customizable system information tool similar to neofetch
.SH SYNOPSIS
@@ -11,15 +10,12 @@ displaying them in a pretty way
.SH DESCRIPTION
Fastfetch is a neofetch\-like tool for fetching system information and
displaying them in a pretty way. It is written mainly in C, with performance
and customizability in mind.
Currently, Linux, Android, FreeBSD, MacOS and Windows 7+ are supported.
Fastfetch is a tool for displaying system information in a visually appealing way. Written primarily in C, it focuses on performance and customizability while providing functionality similar to neofetch.
It supports Linux, Android, *BSD, macOS, Haiku, and Windows 7 or newer.
.SH "EXIT STATUS"
On successful execution, fastfetch returns zero. If any error happened,
the exit code will be non\-zero.
Fastfetch returns zero on successful execution. Any errors result in a non-zero exit code.
.SH OPTIONS
@@ -27,115 +23,200 @@ the exit code will be non\-zero.
.TP
.B \-h, \-\-help \fI[command]
Show help output, displaying all available options or help for given command
Display help information for all available options or for a specific command
.TP
.B \-v, \-\-version
Show version of fastfetch
Display the version of fastfetch
.TP
.B \-\-version\-raw
Display the raw version string (major.minor.patch)
.TP
.B \-\-list\-config\-paths
List search paths of config files
List search paths for configuration files
.TP
.B \-\-list\-data\-paths
List search paths of presets and logos
List search paths for presets and logos
.TP
.B \-\-list\-logos
List available logos, they can be loaded with \fI\-\-logo
List available logos that can be loaded with \fI\-\-logo
.TP
.B \-\-list\-modules
List available modules
List all available modules
.TP
.B \-\-list\-presets
List available presets, they can be loaded with \fI\-\-config
List available presets that can be loaded with \fI\-\-config
.TP
.B \-\-list\-features
List the supported features fastfetch was compiled with
List the features that fastfetch was compiled with (mainly for development)
.TP
.B \-\-print\-logos
Print available logos
Display all available logos
.TP
.B \-\-print\-structure
Print the default structure
Display the default structure
.TP
.B \-\-format \fI<type>
Set the output format. Besides the
.I default
format, only
.I json
is supported currently.
.SS "Display Options"
.TP
.B \-l, \-\-logo \fI<logo>
Set the logo to display
.TP
.B \-s, \-\-structure \fI<structure>
Set the structure of the fetch. For details about the structure,
see the CONFIGURATION section.
Set the output format. Available options are:
.RS
.IP \(bu 2
\fIdefault\fR: Default human-readable format
.IP \(bu 2
\fIjson\fR: JSON format for machine processing
.RE
.SS "Config Options"
.TP
.B \-c, \-\-config \fI<config>
Use the specified config file or preset. If
.I none
is specified, disable further config loading. For details about
config files, see the CONFIGURATION section
Use the specified config file or preset. Specify \fInone\fR to disable further config loading. See the CONFIGURATION section for details on config files.
.TP
.B \-\-gen\-config \fI[file]
Generate a config file with options specified on the command line.
If \fIfile\fR is specified, the configuration will be written to the
file, otherwise it will be written to stdout.
.B \-\-gen\-config \fI[path]
Generate a config file with options specified on the command line. If \fIpath\fR is not specified, it defaults to \fB~/.config/fastfetch/config.jsonc\fR. If \fIpath\fR is "\-", the configuration will be written to stdout.
.TP
.B \-\-gen\-config\-force \fI[file]
Same as \fB\-\-gen\-config\fR, but overwrites existing config
.B \-\-gen\-config\-force \fI[path]
Same as \fB\-\-gen\-config\fR, but overwrites any existing file at the destination path.
.TP
.SS "Logo Options"
.TP
To list all options, use \fB\-\-help\fR. It will also print all available module options.
.B \-l, \-\-logo \fI<logo>
Set the logo to display. Can be the name of a built-in logo or a path to an image file. Use \fInone\fR to disable the logo.
.TP
.B \-\-logo\-type \fI<type>
Set the type of the logo specified with \fI\-\-logo\fR. Available types include \fIauto\fR, \fIbuiltin\fR, \fIfile\fR, \fIsixel\fR, \fIkitty\fR, and others. See \fB\-\-help logo\-type\fR for details.
.TP
.B \-\-logo\-width \fI<width>
Set the width of the logo in characters (for image logos)
.TP
.B \-\-logo\-height \fI<height>
Set the height of the logo in characters (for image logos)
.TP
.B \-\-logo\-color\-[1\-9] \fI<color>
Override specific colors in the logo
.SS "Display Options"
.TP
.B \-s, \-\-structure \fI<structure>
Set the structure of the fetch (a colon-separated list of module names)
.TP
.B \-\-color \fI<color>
Set the color of keys and title. See \fB\-\-help color\fR for available colors.
.TP
.B \-\-color\-keys \fI<color>
Set the color of keys only
.TP
.B \-\-color\-title \fI<color>
Set the color of the title only
.TP
.B \-\-separator \fI<string>
Set the separator between key and value (default: ": ")
.TP
.B \-\-key\-width \fI<num>
Align the width of keys to \fI<num>\fR characters
.TP
.B \-\-show\-errors
Display errors when they occur (default: false)
.TP
.B \-\-pipe
Disable colors (automatically detected based on whether stdout is a terminal)
To list all available options including module-specific options, use \fB\-\-help\fR.
.SH CONFIGURATION
.SS "Fetch Structure"
The structure of a fetch describes the modules that should be included in
the output. It consists of a string of modules, separated by a colon (:).
The structure defines which modules to display and in what order. It consists of module names separated by colons (:).
For example: \fBtitle:separator:os:kernel:uptime\fR
To list all available modules, use \fB\-\-list\-modules\fR
.SS "Config Files"
Fastfetch uses JSONC based format for configuration. Fastfetch doesn't generate
config file automatically; it should be generated manually by \fB\-\-gen\-config\fR.
The config file will be saved in \fB~/.config/fastfetch/config.jsonc\fR by default.
Fastfetch uses JSONC for configuration files. JSONC is JSON with support for comments (// and /* */). Configuration files must have the .jsonc extension.
A JSONC config file is a JSON file that also supports comments with (// and /* */).
Those files must have the extension '.jsonc'.
You can generate a default config file using \fB\-\-gen\-config\fR. By default, the config file is saved at \fB~/.config/fastfetch/config.jsonc\fR.
The specified configuration/preset files are searched in the following order:
The configuration/preset files are searched in the following locations (in order):
1. relative to the current working directory
.RS
.IP 1. 4
Relative to the current working directory
.IP 2. 4
Relative to ~/.local/share/fastfetch/presets/
.IP 3. 4
Relative to /usr/share/fastfetch/presets/
.RE
2. relative to ~/.local/share/fastfetch/presets/
For detailed information on logo options, module configuration, and formatting, visit:
.RS
\fIhttps://github.com/fastfetch-cli/fastfetch/wiki/Configuration\fR
.RE
3. relative to /usr/share/fastfetch/presets/
Fastfetch provides several built-in presets. List them with \fB\-\-list\-presets\fR.
Fastfetch provides some default presets. List them with \fB\-\-list\-presets\fR.
.SS "JSON Schema"
A JSON schema is available for editor intelligence when editing the configuration file. Add the following line at the beginning of your config file:
.PP
\fB"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json"\fR
.SH EXAMPLES
.TP
Basic usage:
.RS
\fBfastfetch\fR
.RE
.TP
Use a specific logo:
.RS
\fBfastfetch \-\-logo arch\fR
.RE
.TP
Custom structure:
.RS
\fBfastfetch \-\-structure title:os:kernel:uptime:memory\fR
.RE
.TP
Generate a config file:
.RS
\fBfastfetch \-\-gen\-config\fR
.RE
.TP
Use a preset:
.RS
\fBfastfetch \-\-config neofetch\fR
.RE
.SH "SEE ALSO"
.BR neofetch (1)
.SH BUGS
Please report bugs to: \fIhttps://github.com/fastfetch\-cli/fastfetch/issues\fR
.SH AUTHORS
Fastfetch is developed by a team of contributors on GitHub.
Visit \fIhttps://github.com/fastfetch-cli/fastfetch\fR for more information.
+1928 -296
View File
File diff suppressed because it is too large Load Diff
+6 -1
View File
@@ -52,7 +52,10 @@
},
"memory",
"physicalmemory",
"swap",
{
"type": "swap",
"separate": true
},
"disk",
"btrfs",
"zpool",
@@ -90,6 +93,8 @@
"sound",
"camera",
"gamepad",
"mouse",
"keyboard",
{
"type": "weather",
"timeout": 1000
+8 -3
View File
@@ -54,7 +54,10 @@
},
"memory",
"physicalmemory",
"swap",
{
"type": "swap",
"separate": true
},
"disk",
"btrfs",
"zpool",
@@ -87,11 +90,13 @@
"opengl",
"opencl",
"users",
"bluetooth",
"bluetoothradio",
// "bluetooth", // doesn't work on macOS because it requires bluetooth permissions
// "bluetoothradio",
"sound",
"camera",
"gamepad",
"mouse",
"keyboard",
{
"type": "weather",
"timeout": 1000
+18 -6
View File
@@ -9,7 +9,7 @@
},
"separator": "│ ",
"percent": {
"type": 6
"type": ["bar", "hide-others"]
},
"bar": {
"borderLeft": "",
@@ -70,7 +70,7 @@
"type": "localip",
"key": "│ MAC ADDR │{$1}",
"format": "{mac} ({ifname})",
"showIPv4": false,
"showIpv4": false,
"showMac": true
},
{
@@ -120,12 +120,18 @@
{
"type": "memory",
"key": "│ MEMORY │{$1}",
"format": "{used} / {total} [{percentage}]"
"format": "{used} / {total} [{percentage}]",
"percent": {
"type": ["num"]
}
},
{
"type": "memory",
"key": "│ USAGE │{$1}",
"format": ""
"format": "",
"percent": {
"type": ["bar", "hide-others"]
}
},
{
"type": "custom",
@@ -135,12 +141,18 @@
"type": "disk",
"key": "│ VOLUME │{$1}",
"format": "{size-used} / {size-total} [{size-percentage}]",
"folders": "/"
"folders": "/",
"percent": {
"type": ["num"]
}
},
{
"type": "disk",
"key": "│ DISK USAGE │{$1}",
"format": ""
"format": "",
"percent": {
"type": ["bar", "hide-others"]
}
},
{
"type": "custom",
+11 -11
View File
@@ -28,38 +28,38 @@
{
"type": "title",
"key": "{#90}{$1}│ {#92}User {#90}│",
"format": "{$2}{$3}{user-name} {#2}[{home-dir}]"
"format": "{$2}{$3}{user-name} {#2}[{home-dir}]"
},
{
"type": "users",
"key": "{#90}{$1}│ {#92}Users {#90}│",
"myselfOnly": false,
"format": "{$2}{$3}{1}@{host-name}{/host-name}localhost{/}{?client-ip} {#2}[IP:{client-ip}]{?} {#2}[Login time: {login-time}]",
"format": "{$2}{$3}{1}@{host-name}{/host-name}localhost{/}{?client-ip} {#2}[IP:{client-ip}]{?} [Login time: {login-time}]"
},
{
"type": "datetime",
"key": "{#90}{$1}│ {#92}Datetime {#90}│",
"format": "{$2}{$3}{year}-{month-pretty}-{day-in-month} {hour-pretty}:{minute-pretty}:{second-pretty} {#2}{weekday} {#2}[W{week}] {#2}[UTC{offset-from-utc}]"
"format": "{$2}{$3}{year}-{month-pretty}-{day-in-month} {hour-pretty}:{minute-pretty}:{second-pretty} [{weekday}] [W{week}] [UTC{offset-from-utc}]"
},
{
"type": "title",
"key": "{#90}{$1}│ {#93}Host: {#90}│",
"format": "{$2}{$3}{#1}{#36}{host-name}"
"key": "{#90}{$1}│ {#93}Host {#90}│",
"format": "{$2}{$3}{host-name}"
},
{
"type": "host",
"key": "{#90}{$1}│ {#93}Machine {#90}│",
"format": "{$2}{$3}{name} {#2}{version}"
"format": "{$2}{$3}{name} {#2}{version}"
},
{
"type": "os",
"key": "{#90}{$1}│ {#93}OS {#90}│",
"format": "{$2}{$3}{pretty-name} {codename} {#2}[v{version}] {#2}[{arch}]"
"format": "{$2}{$3}{?pretty-name}{pretty-name}{?}{/pretty-name}{name}{/} {codename} {#2}[v{version}] [{arch}]"
},
{
"type": "kernel",
"key": "{#90}{$1}│ {#93}Kernel {#90}│",
"format": "{$2}{$3}{sysname} {#2}[v{release}]"
"format": "{$2}{$3}{sysname} {#2}[v{release}]"
},
{
"type": "uptime",
@@ -71,14 +71,14 @@
"key": "{#90}{$1}│ {#91}CPU {#90}│",
"showPeCoreCount": true,
"temp": true,
"format": "{$2}{$3}{name} {#2}[C:{core-types}] {#2}[{freq-max}]"
"format": "{$2}{$3}{name} {#2}[C:{core-types}] [{freq-max}]"
},
{
"type": "gpu",
"key": "{#90}{$1}│ {#91}GPU {#90}│",
"detectionMethod": "auto",
"driverSpecific": true,
"format": "{$2}{$3}{name} {#2}[C:{core-count}] {#2}[{type}]"
"format": "{$2}{$3}{name} {#2}[C:{core-count}]{?frequency} [{frequency}]{?} [{type}]"
},
{
"type": "memory",
@@ -98,7 +98,7 @@
{
"type": "terminal",
"key": "{#90}{$1}│ {#95}Terminal {#90}│",
"format": "{$2}{$3}{pretty-name} {#2}[{version}] [PID:{pid}]"
"format": "{$2}{$3}{pretty-name} {#2}[{version}] [PID:{pid}]"
},
{
"type": "terminalfont",
+254
View File
@@ -0,0 +1,254 @@
// Based on #1576
{
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
"display": {
"color": {
"keys": "blue"
},
"separator": "",
"constants": [
"──────────────────────────────────────────────",
"\u001b[47D",
"\u001b[47C",
"\u001b[46C"
],
"brightColor": false
},
"modules": [
{
"type": "version",
"key": "┌───────────────┬─{$1}┐\u001b[41D",
"format": "\u001b[1m{#keys} {1} - {2} "
},
{
"type": "os",
"key": "│ {icon} \u001b[s{sysname}\u001b[u\u001b[10C│{$3}│{$2}"
},
{
"type": "datetime",
"key": "│ {icon} Fetched │{$3}│{$2}",
"format": "{year}-{month-pretty}-{day-pretty} {hour-pretty}:{minute-pretty}:{second-pretty} {timezone-name}"
},
{
"type": "locale",
"key": "│ {icon} Locale │{$3}│{$2}"
},
// Hardware
{
"type": "custom",
"key": "│{#cyan}┌──────────────┬{$1}┐{#keys}│\u001b[37D",
"format": "{#bright_cyan} Hardware "
},
{
"type": "chassis",
"key": "│{#cyan}│ {icon} Chassis │{$4}│{#keys}│{$2}"
},
{
"type": "memory",
"key": "│{#cyan}│ {icon} RAM │{$4}│{#keys}│{$2}"
},
{
"type": "swap",
"key": "│{#cyan}│ {icon} SWAP │{$4}│{#keys}│{$2}"
},
{
"type": "cpu",
"key": "│{#cyan}│ {icon} CPU │{$4}│{#keys}│{$2}",
"showPeCoreCount": true
},
{
"type": "gpu",
"key": "│{#cyan}│ {icon} GPU │{$4}│{#keys}│{$2}"
},
{
"type": "disk",
"key": "│{#cyan}│ {icon} Disk │{$4}│{#keys}│{$2}",
"format": "{size-used} \/ {size-total} ({size-percentage}) - {filesystem}",
},
{
"type": "battery",
"key": "│{#cyan}│ {icon} Battery │{$4}│{#keys}│{$2}"
},
{
"type": "custom",
"key": "│{#cyan}└──────────────┴{$1}┘{#keys}│",
"format": ""
},
// Desktop
{
"type": "custom",
"key": "│{#green}┌──────────────┬{$1}┐{#keys}│\u001b[37D",
"format": "{#bright_green} Desktop "
},
{
"type": "de",
"key": "│{#green}│ {icon} Desktop │{$4}│{#keys}│{$2}"
},
{
"type": "wm",
"key": "│{#green}│ {icon} Session │{$4}│{#keys}│{$2}"
},
{
"type": "display",
"key": "│{#green}│ {icon} Display │{$4}│{#keys}│{$2}",
"compactType": "original-with-refresh-rate"
},
{
"type": "gpu",
"key": "│{#green}│ {icon} G-Driver │{$4}│{#keys}│{$2}",
"format": "{driver}"
},
{
"type": "custom",
"key": "│{#green}└──────────────┴{$1}┘{#keys}│",
"format": ""
},
// Terminal
{
"type": "custom",
"key": "│{#yellow}┌──────────────┬{$1}┐{#keys}│\u001b[37D",
"format": "{#bright_yellow} Terminal "
},
{
"type": "shell",
"key": "│{#yellow}│ {icon} Shell │{$4}│{#keys}│{$2}"
},
{
"type": "terminal",
"key": "│{#yellow}│ {icon} Terminal │{$4}│{#keys}│{$2}"
},
{
"type": "terminalfont",
"key": "│{#yellow}│ {icon} Term Font │{$4}│{#keys}│{$2}"
},
{
"type": "terminaltheme",
"key": "│{#yellow}│ {icon} Colors │{$4}│{#keys}│{$2}"
},
{
"type": "packages",
"key": "│{#yellow}│ {icon} Packages │{$4}│{#keys}│{$2}"
},
{
"type": "custom",
"key": "│{#yellow}└──────────────┴{$1}┘{#keys}│",
"format": ""
},
// Development
{
"type": "custom",
"key": "│{#red}┌──────────────┬{$1}┐{#keys}│\u001b[39D",
"format": "{#bright_red} Development "
},
{
"type": "command",
"keyIcon": "",
"key": "│{#red}│ {icon} Rust │{$4}│{#keys}│{$2}",
"text": "rustc --version | cut -d' ' -f2",
"format": "rustc {}"
},
{
"type": "command",
"keyIcon": "",
"key": "│{#red}│ {icon} Clang │{$4}│{#keys}│{$2}",
"text": "clang --version | head -1 | awk '{print $NF}'",
"format": "clang {}"
},
{
"type": "command",
"keyIcon": "",
"key": "│{#red}│ {icon} NodeJS │{$4}│{#keys}│{$2}",
"text": "node --version",
"format": "node {~1}"
},
{
"type": "command",
"keyIcon": "",
"key": "│{#red}│ {icon} Go │{$4}│{#keys}│{$2}",
"text": "go version | cut -d' ' -f3",
"format": "go {~2}"
},
{
"type": "command",
"keyIcon": "",
"key": "│{#red}│ {icon} Zig │{$4}│{#keys}│{$2}",
"text": "zig version",
"format": "zig {}"
},
{
"type": "editor",
"key": "│{#red}│ {icon} Editor │{$4}│{#keys}│{$2}"
},
{
"type": "command",
"keyIcon": "󰊢",
"key": "│{#red}│ {icon} Git │{$4}│{#keys}│{$2}",
"text": "git version",
"format": "git {~12}"
},
{
"type": "font",
"key": "│{#red}│ {icon} Interface │{$4}│{#keys}│{$2}"
},
{
"type": "custom",
"key": "│{#red}└──────────────┴{$1}┘{#keys}│",
"format": ""
},
// Uptime
{
"type": "custom",
"key": "│{#magenta}┌──────────────┬{$1}┐{#keys}│\u001b[36D",
"format": "{#bright_magenta} Uptime "
},
{
"type": "uptime",
"key": "│{#magenta}│ {icon} Uptime │{$4}│{#keys}│{$2}"
},
{
"type": "users",
"myselfOnly": true,
"keyIcon": "",
"key": "│{#magenta}│ {icon} Login │{$4}│{#keys}│{$2}"
},
{
"condition": {
"!system": "macOS"
},
"type": "disk",
"keyIcon": "",
"key": "│{#magenta}│ {icon} OS Age │{$4}│{#keys}│{$2}",
"folders": "/",
"format": "{create-time:10} [{days} days]"
},
{
"condition": {
"system": "macOS"
},
"type": "disk",
"keyIcon": "",
"key": "│{#magenta}│ {icon} OS Age │{$4}│{#keys}│{$2}",
"folders": "/System/Volumes/VM",
"format": "{create-time:10} [{days} days]"
},
{
"type": "custom",
"key": "│{#magenta}└──────────────┴{$1}┘{#keys}│",
"format": ""
},
{
"type": "custom",
"key": "└─────────────────{$1}┘",
"format": ""
},
// End
"break",
"colors"
]
}
+165
View File
@@ -0,0 +1,165 @@
// Modified from: 24.jsonc
{
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
"logo": {
"padding": {
"top": 2
}
},
"display": {
"separator": "",
"constants": [
// CONSTANT {$1} - VERTICAL BARS AT START AND 75th CHARACTERS FORWARD AND BACKWARD
"\u001b[90m│ │\u001b[60D\u001b[39m"
]
},
"modules": [
// CUSTOM - Top UI bar
{
"type": "custom",
"key": "{#90}╭ Keys ───────╮",
"format": "{#90}╭ Values ────────────────────────────────────────────────────╮",
},
{
"type": "title",
"key": "{#90}│ {#92}User {#90}│",
"format": "{$1}{user-name} {#2}[{home-dir}]"
},
{
"type": "users",
"key": "{#90}│ {#92}Users {#90}│",
"myselfOnly": false,
"format": "{$1}{1}@{host-name}{/host-name}localhost{/}{?client-ip} {#2}[IP:{client-ip}]{?} [Login time: {login-time}]"
},
{
"type": "datetime",
"key": "{#90}│ {#92}Datetime {#90}│",
"format": "{$1}{year}-{month-pretty}-{day-in-month} {hour-pretty}:{minute-pretty}:{second-pretty} {#2}[{weekday}] [W{week}] [UTC{offset-from-utc}]"
},
{
"type": "title",
"key": "{#90}│ {#93}Host {#90}│",
"format": "{$1}{host-name}"
},
{
"type": "host",
"key": "{#90}│ {#93}Machine {#90}│",
"format": "{$1}{name} {#2}{version}"
},
{
"type": "os",
"key": "{#90}│ {#93}OS {#90}│",
"format": "{$1}{?pretty-name}{pretty-name}{?}{/pretty-name}{name}{/} {codename} {#2}[v{version}] [{arch}]"
},
{
"type": "kernel",
"key": "{#90}│ {#93}Kernel {#90}│",
"format": "{$1}{sysname} {#2}[v{release}]"
},
{
"type": "uptime",
"key": "{#90}│ {#93}Uptime {#90}│",
"format": "{$1}{?days}{days} Days + {?}{hours}:{minutes}:{seconds}"
},
{
"type": "cpu",
"key": "{#90}│ {#91}CPU {#90}│",
"showPeCoreCount": true,
"temp": true,
"format": "{$1}{name} {#2}[C:{core-types}] [{freq-max}]"
},
{
"type": "gpu",
"key": "{#90}│ {#91}GPU {#90}│",
"detectionMethod": "auto",
"driverSpecific": true,
"format": "{$1}{name} {#2}[C:{core-count}]{?frequency} [{frequency}]{?} {#2}[{type}]"
},
{
"type": "memory",
"key": "{#90}│ {#91}Memory {#90}│",
"format": "{$1}{used} / {total} ({percentage})"
},
{
"type": "disk",
"key": "{#90}│ {#91}Disk {#90}│",
"format": "{$1}{size-used} / {size-total} ({size-percentage})"
},
{
"type": "poweradapter",
"key": "{#90}│ {#91}Power {#90}│",
"format": "{$1}{name}"
},
{
"type": "terminal",
"key": "{#90}│ {#95}Terminal {#90}│",
"format": "{$1}{pretty-name} {#2}[{version}] [PID:{pid}]"
},
{
"type": "terminalfont",
"key": "{#90}│ {#95}Font {#90}│",
"format": "{$1}{name} {#2}[{size}]"
},
{
"type": "shell",
"key": "{#90}│ {#95}Shell {#90}│",
"format": "{$1}{pretty-name} {#2}[v{version}] [PID:{pid}]"
},
{
// localip IPv4
"type": "localip",
"key": "{#90}│ {#94}Local IPv4 {#90}│",
"showPrefixLen": true,
"showIpv4": true,
"showIpv6": false,
"showMtu": true,
"format": "{$1}{ifname}: {ipv4} {#2}[MTU:{mtu}]"
},
{
// localip IPv6
"type": "localip",
"key": "{#90}│ {#94}Local IPv6 {#90}│",
"showPrefixLen": true,
"showIpv4": false,
"showIpv6": true,
"showMtu": true,
"format": "{$1}{ifname}: {ipv6} {#2}[MTU:{mtu}]"
},
{
"type": "publicip",
"key": "{#90}│ {#94}Public IPv4 {#90}│",
"ipv6": false,
"format": "{$1}{ip} {#2}[{location}]"
},
{
"type": "publicip",
"key": "{#90}│ {#94}Public IPv6 {#90}│",
"ipv6": true,
"format": "{$1}{ip} {#2}[{location}]"
},
// CUSTOM - Button UI bar
{
"type": "custom",
"key": "{#90}╰─────────────╯",
"format": "{#90}╰────────────────────────────────────────────────────────────╯",
},
"break",
{
"type": "custom",
"key": " ",
"format": "{#90}╭ Colors ───────────────────────────────────────────────────────────────────╮",
},
{
"type": "custom",
"format": "{#90}│ {#40} {#41} {#42} {#43} {#44} {#45} {#46} {#47} {#} {#90}│",
},
{
"type": "custom",
"format": "{#90}│ {#100} {#101} {#102} {#103} {#104} {#105} {#106} {#107} {#} {#90}│",
},
{
"type": "custom",
"format": "{#90}╰───────────────────────────────────────────────────────────────────────────╯",
},
]
}
+49
View File
@@ -0,0 +1,49 @@
{
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
"logo": {
"type": "small",
"padding": {
"top": 1
}
},
"display": {
"separator": " "
},
"modules": [
"break",
"title",
{
"type": "os",
"key": "os ",
"keyColor": "red"
},
{
"type": "kernel",
"key": "kernel",
"keyColor": "green"
},
{
"type": "host",
"format": "{vendor} {family}",
"key": "host ",
"keyColor": "yellow"
},
{
"type": "packages",
"key": "pkgs ",
"keyColor": "blue"
},
{
"type": "uptime",
"format": "{?days}{days}d {?}{hours}h {minutes}m",
"key": "uptime",
"keyColor": "magenta"
},
{
"type": "memory",
"key": "memory",
"keyColor": "cyan"
},
"break"
]
}
+4 -1
View File
@@ -16,7 +16,10 @@
"format": "{release}"
},
"uptime",
"packages",
{
"type": "packages",
"combined": true
},
"shell",
{
"type": "display",
+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])
+327
View File
@@ -0,0 +1,327 @@
#!/usr/bin/env python3
"""
Python script to generate a comprehensive man page for the command `fastfetch`.
The generated man page content will be printed to stdout,
so you will need to pipe it to a file if you want to save it.
Example: python3 gen-man.py > fastfetch.1
The command options are generated using a JSON file.
For the JSON file format, see:
https://github.com/fastfetch-cli/fastfetch/blob/dev/src/data/help.json
"""
from json import load
from datetime import datetime, timezone
from time import time
from re import search
from os import environ, path
###### Text Decorations Tags ######
startUnderline = r"\fI" # start underline text tag
endUnderline = r"\fR" # end underline text tag
startBold = r"\fB" # start bold text tag
endBold = r"\fR" # end bold text tag
###### Parameters ######
# path to the current directory
pathToCurrentDir = path.dirname(__file__)
# path to the JSON option file
pathToHelpFile = path.join(pathToCurrentDir, "../src/data/help.json")
# man page section
manSection = 1
# title (center header)
titlePage = "FASTFETCH"
# date (center footer)
# format : "Month (abbreviation) Day Year"
todayDate = datetime.fromtimestamp(
int(environ.get("SOURCE_DATE_EPOCH", time())),
tz=timezone.utc,
).strftime("%b %d %Y")
# file to fastfetch version (left footer)
pathToVersionFile = path.join(pathToCurrentDir, "../CMakeLists.txt")
###### Sections Text ######
# text displayed in the "NAME" section
nameSection = r"fastfetch \- A fast and feature-rich system information tool similar to neofetch"
# text displayed in the "DESCRIPTION" section
descriptionSection = r"""
Fastfetch is a tool for displaying system information in a visually appealing way. Written primarily in C, it focuses on performance and customizability while providing functionality similar to neofetch.
It supports Linux, Android, FreeBSD, macOS, and Windows 7 or newer.
"""
# text displayed at the beginning of the "OPTIONS" section
optionSection = r"""
Options are parsed in a case-insensitive manner. For example, \fB--logo-type\fR and \fB--LOGO-TYPE\fR are treated identically.
Arguments in square brackets are optional. Optional boolean arguments default to 'true' when specified without a value.
For more detailed information about a specific option, use:
\fBfastfetch -h <option_name_without_dashes>\fR
Any combination of options can be made permanent by generating a configuration file:
\fBfastfetch <options> --gen-config\fR
"""
# text displayed in the "CONFIGURATION"
configurationSection = f"""
.SS Fetch Structure
The structure defines which modules to display and in what order. It consists of module names separated by colons (:).
For example: {startBold}title:separator:os:kernel:uptime{endBold}
To list all available modules, use {startBold}--list-modules{endBold}
.SS Config Files
Fastfetch uses JSONC (JSON with Comments) for configuration files. These files must have the .jsonc extension.
You can generate a default config file using {startBold}--gen-config{endBold}. By default, the config file is saved at {startBold}~/.config/fastfetch/config.jsonc{endBold}.
The configuration/preset files are searched in the following locations (in order):
{startBold}1.{endBold} Relative to the current working directory
{startBold}2.{endBold} Relative to ~/.local/share/fastfetch/presets/
{startBold}3.{endBold} Relative to /usr/share/fastfetch/presets/
For detailed information on logo options, module configuration, and formatting, visit:
{startBold}https://github.com/fastfetch-cli/fastfetch/wiki/Configuration{endBold}
Fastfetch provides several built-in presets. List them with {startBold}--list-presets{endBold}.
.SS JSON Schema
A JSON schema is available for editor intelligence when editing the configuration file. Add the following line at the beginning of your config file:
{startBold}"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json"{endBold}
"""
# text displayed in the "EXAMPLE" section
exampleSection = f"""
.SS Basic Usage
{startBold}fastfetch{endBold}
.SS Use a specific logo
{startBold}fastfetch --logo arch{endBold}
.SS Custom structure
{startBold}fastfetch --structure title:os:kernel:uptime:memory{endBold}
.SS Generate a config file
{startBold}fastfetch --gen-config{endBold}
.SS Use a preset
{startBold}fastfetch --config neofetch{endBold}
.SS Config File Example
.nf
// ~/.config/fastfetch/config.jsonc
{{
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
"logo": {{
"type": "auto",
"source": "arch"
}},
"display": {{
"separator": ": ",
"color": {{
"keys": "blue",
"title": "red"
}},
"key": {{
"width": 12
}}
}},
"modules": [
"title",
"separator",
"os",
"kernel",
"uptime",
{{
"type": "memory",
"format": "{{used}}/{{total}} ({{used_percent}}%)"
}}
]
}}
.fi
"""
# text displayed in the "BUGS" section
bugSection = "Please report bugs to: https://github.com/fastfetch-cli/fastfetch/issues"
# text displayed in the "AUTHORS" section
authorsSection = "Fastfetch is developed by a team of contributors on GitHub.\nVisit https://github.com/fastfetch-cli/fastfetch for more information."
###### Argument decoration ######
### optional arguments tags ###
# if an optional argument is displayed as [?optArg] (with "optArg" underlined)
# this value should be f"[?{startUnderline}"
startOptionalArgument = f"[{startUnderline}"
# if an optional argument is displayed as [?optArg] (with "optArg underlined")
# this value should be f"{endUnderline}]"
endOptionalArgument = f"{endUnderline}]"
### mandatory arguments tags ###
startMandatoryArgument = f"{startUnderline}"
endMandatoryArgument = f"{endUnderline}"
def main():
# importing the JSON file
with open(pathToHelpFile, 'r') as jsonFile:
helpFileData = load(jsonFile) # json.load
######## Start printing the generated .1 file ########
###### header, footer & config #####
print(f".TH FASTFETCH {manSection} ", end=" ")
print(f"\"{todayDate}\"", end=" ")
# version number
with open(pathToVersionFile, 'r') as versionFile:
# research version number in file with regex
for line in versionFile:
researchVersion = search(r"^\s*VERSION (\d+\.\d+\.\d+)$", line)
if (researchVersion):
print(f"\"Fastfetch {researchVersion.group(1)}\"", end=" ")
break
print(f"\"{titlePage}\"")
###### Name ######
print(".SH NAME")
print(nameSection)
##### Synopsis ######
print(".SH SYNOPSIS")
print(".B fastfetch")
print(f"[{startUnderline}OPTIONS{endUnderline}...]")
###### Description ######
print(".SH DESCRIPTION")
print(descriptionSection)
###### Configuration ######
print(".SH CONFIGURATION")
print(configurationSection)
###### Options ######
print(".SH OPTIONS")
print(optionSection)
print()
# loop through every options sections
for key, value in helpFileData.items():
# print new subsection
print(f".SS {key}")
# loop through every option in a section
for option in value:
# list of existing keys for this option
keyList = option.keys()
# start a new "option" entry
print(".TP")
print(startBold, end="")
# short option (-opt)
if "short" in keyList:
print(fr"\-{ option['short'] }", end="")
# if also have a long option, print a comma
if "long" in keyList:
print(", ", end="")
# long option (--option)
if "long" in keyList:
print(fr"\-\-{ option['long'] }", end="")
print(endBold, end=" ")
# arguments
if "arg" in keyList:
# if argument is optional, print "[arg]"
if "optional" in option["arg"].keys() and option["arg"]["optional"]:
print(startOptionalArgument + option['arg']['type'] + endOptionalArgument, end="")
# if argument is mandatory, print "arg"
else:
print(startMandatoryArgument + option['arg']['type'] + endMandatoryArgument, end="")
# description
print()
# If desc is a list, join with newlines and proper spacing
if isinstance(option['desc'], list):
desc_text = "\n ".join(option['desc'])
print(f" {desc_text}")
else:
print(f" {option['desc']}")
# Add remarks if available
if "remark" in keyList:
print()
if isinstance(option['remark'], list):
for remark in option['remark']:
print(f" {remark}")
else:
print(f" {option['remark']}")
print()
###### Examples ######
print(".SH EXAMPLES")
print(exampleSection)
###### See Also ######
print(".SH \"SEE ALSO\"")
print(".BR neofetch (1)")
###### Bugs ######
print(".SH BUGS")
print(bugSection)
###### Authors ######
print(".SH AUTHORS")
print(authorsSection)
if __name__ == "__main__":
main()
Regular → Executable
+9 -9
View File
@@ -1,4 +1,6 @@
from requests import get as http_get
#!/usr/bin/env python3
import sys
class PciDeviceModel:
def __init__(self, id: int, name: str):
@@ -11,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'):
@@ -78,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
@@ -92,4 +92,4 @@ if __name__ == '__main__':
0x1ab8, # Parallel
0x1414, # Microsoft
0x108e, # Oracle
})
}, sys.argv[1])
-383
View File
@@ -1,383 +0,0 @@
//
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
/// \file
/// \mainpage
/// AGS Library Overview
/// --------------------
/// This document provides an overview of the AGS (AMD GPU Services) library. The AGS library provides software developers with the ability to query
/// AMD GPU software and hardware state information that is not normally available through standard operating systems or graphic APIs.
///
/// The latest version of the API is publicly hosted here: https://github.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/.
/// It is also worth checking http://gpuopen.com/gaming-product/amd-gpu-services-ags-library/ for any updates and articles on AGS.
/// \internal
/// Online documentation is publicly hosted here: http://gpuopen-librariesandsdks.github.io/ags/
/// \endinternal
///
/// ---------------------------------------
/// What's new in AGS 6.2 since version 6.1
/// ---------------------------------------
/// AGS 6.2 includes the following updates:
/// * Shader clock intrinsics
/// * Minor improvements and fixes
///
/// ---------------------------------------
/// What's new in AGS 6.1 since version 6.0
/// ---------------------------------------
/// AGS 6.1 includes the following updates:
/// * RDNA3 detection
///
/// ---------------------------------------
/// What's new in AGS 6.0 since version 5.4.2
/// ---------------------------------------
/// AGS 6.0 includes the following updates:
/// * DX12 ray tracing hit token for RDNA2 hardware.
/// * Shader intrinsic that exposes ReadLaneAt in DX12.
/// * Shader intrinsics that expose explicit float conversions in DX12.
/// * Refactored and revised API to minimize user error.
/// * Added agsGetVersionNumber.
/// * Detection for external GPUs.
/// * Detection of RDNA2 architecture.
/// * Grouped the more established intrinsics together into per year support.
/// * Function pointer typedefs for the API
///
/// ---------------------------------------
/// What's new in AGS 5.4.2 since version 5.4.1
/// ---------------------------------------
/// AGS 5.4.2 includes the following updates:
/// * sharedMemoryInBytes has been reinstated.
/// * Clock speed returned for APUs.
///
/// ---------------------------------------
/// What's new in AGS 5.4.1 since version 5.4.0
/// ---------------------------------------
/// AGS 5.4.1 includes the following updates:
/// * AsicFamily_Count to help with code maintenance.
/// * Visual Studio 2019 support.
/// * x86 support
/// * BaseInstance and BaseVertex intrinsics along with corresponding caps bits.
/// * GetWaveSize intrinsic along with corresponding caps bits.
///
/// ---------------------------------------
/// What's new in AGS 5.4 since version 5.3
/// ---------------------------------------
/// AGS 5.4 includes the following updates:
/// * A more detailed description of the GPU architecture, now including RDNA GPUs.
/// * Radeon 7 core and memory speeds returned.
/// * Draw index and Atomic U64 intrinsics for both DX11 and DX12.
///
/// ---------------------------------------
/// What's new in AGS 5.3 since version 5.2
/// ---------------------------------------
/// AGS 5.3 includes the following updates:
/// * DX11 deferred context support for Multi Draw Indirect and UAV Overlap extensions.
/// * A Radeon Software Version helper to determine whether the installed driver meets your game's minimum driver version requirements.
/// * Freesync HDR Gamma 2.2 mode which uses a 1010102 swapchain and can be considered as an alternative to using the 64 bit swapchain required for Freesync HDR scRGB.
///
/// Using the AGS library
/// ---------------------
/// It is recommended to take a look at the source code for the samples that come with the AGS SDK:
/// * AGSSample
/// * CrossfireSample
/// * EyefinitySample
/// The AGSSample application is the simplest of the three examples and demonstrates the code required to initialize AGS and use it to query the GPU and Eyefinity state.
/// The CrossfireSample application demonstrates the use of the new API to transfer resources on GPUs in Crossfire mode. Lastly, the EyefinitySample application provides a more
/// extensive example of Eyefinity setup than the basic example provided in AGSSample.
/// There are other samples on Github that demonstrate the DirectX shader extensions, such as the Barycentrics11 and Barycentrics12 samples.
///
/// To add AGS support to an existing project, follow these steps:
/// * Link your project against the correct import library. Choose from either the 32 bit or 64 bit version.
/// * Copy the AGS dll into the same directory as your game executable.
/// * Include the amd_ags.h header file from your source code.
/// * Include the AGS hlsl files if you are using the shader intrinsics.
/// * Declare a pointer to an AGSContext and make this available for all subsequent calls to AGS.
/// * On game initialization, call \ref agsInitialize passing in the address of the context. On success, this function will return a valid context pointer.
///
/// Don't forget to cleanup AGS by calling \ref agsDeInitialize when the app exits, after the device has been destroyed.
#ifndef AMD_AGS_H
#define AMD_AGS_H
#define AMD_AGS_VERSION_MAJOR 6 ///< AGS major version
#define AMD_AGS_VERSION_MINOR 2 ///< AGS minor version
#define AMD_AGS_VERSION_PATCH 0 ///< AGS patch version
#ifdef __cplusplus
extern "C" {
#endif
/// \defgroup Defines AGS defines
/// @{
#if defined (AGS_GCC)
#define AMD_AGS_API
#else
#define AMD_AGS_API __declspec(dllexport) ///< AGS exported functions
#endif
#define AGS_MAKE_VERSION( major, minor, patch ) ( ( major << 22 ) | ( minor << 12 ) | patch ) ///< Macro to create the app and engine versions for the fields in \ref AGSDX12ExtensionParams and \ref AGSDX11ExtensionParams and the Radeon Software Version
#define AGS_UNSPECIFIED_VERSION 0xFFFFAD00 ///< Use this to specify no version
#define AGS_CURRENT_VERSION AGS_MAKE_VERSION( AMD_AGS_VERSION_MAJOR, AMD_AGS_VERSION_MINOR, AMD_AGS_VERSION_PATCH ) ///< Macro to return the current AGS version as defined by the AGS header file
/// @}
/// \defgroup enums General enumerations
/// @{
/// The return codes
typedef enum AGSReturnCode
{
AGS_SUCCESS, ///< Successful function call
AGS_FAILURE, ///< Failed to complete call for some unspecified reason
AGS_INVALID_ARGS, ///< Invalid arguments into the function
AGS_OUT_OF_MEMORY, ///< Out of memory when allocating space internally
AGS_MISSING_D3D_DLL, ///< Returned when a D3D dll fails to load
AGS_LEGACY_DRIVER, ///< Returned if a feature is not present in the installed driver
AGS_NO_AMD_DRIVER_INSTALLED, ///< Returned if the AMD GPU driver does not appear to be installed
AGS_EXTENSION_NOT_SUPPORTED, ///< Returned if the driver does not support the requested driver extension
AGS_ADL_FAILURE, ///< Failure in ADL (the AMD Display Library)
AGS_DX_FAILURE, ///< Failure from DirectX runtime
AGS_D3DDEVICE_NOT_CREATED ///< Failure due to not creating the D3D device successfully via AGS.
} AGSReturnCode;
/// @}
typedef struct AGSContext AGSContext; ///< All function calls in AGS require a pointer to a context. This is generated via \ref agsInitialize
/// The rectangle struct used by AGS.
typedef struct AGSRect
{
int offsetX; ///< Offset on X axis
int offsetY; ///< Offset on Y axis
int width; ///< Width of rectangle
int height; ///< Height of rectangle
} AGSRect;
/// The display info struct used to describe a display enumerated by AGS
typedef struct AGSDisplayInfo
{
char name[ 256 ]; ///< The name of the display
char displayDeviceName[ 32 ]; ///< The display device name, i.e. DISPLAY_DEVICE::DeviceName
unsigned int isPrimaryDisplay : 1; ///< Whether this display is marked as the primary display
unsigned int HDR10 : 1; ///< HDR10 is supported on this display
unsigned int dolbyVision : 1; ///< Dolby Vision is supported on this display
unsigned int freesync : 1; ///< Freesync is supported on this display
unsigned int freesyncHDR : 1; ///< Freesync HDR is supported on this display
unsigned int eyefinityInGroup : 1; ///< The display is part of the Eyefinity group
unsigned int eyefinityPreferredDisplay : 1; ///< The display is the preferred display in the Eyefinity group for displaying the UI
unsigned int eyefinityInPortraitMode : 1; ///< The display is in the Eyefinity group but in portrait mode
unsigned int reservedPadding : 24; ///< Reserved for future use
int maxResolutionX; ///< The maximum supported resolution of the unrotated display
int maxResolutionY; ///< The maximum supported resolution of the unrotated display
float maxRefreshRate; ///< The maximum supported refresh rate of the display
AGSRect currentResolution; ///< The current resolution and position in the desktop, ignoring Eyefinity bezel compensation
AGSRect visibleResolution; ///< The visible resolution and position. When Eyefinity bezel compensation is enabled this will
///< be the sub region in the Eyefinity single large surface (SLS)
float currentRefreshRate; ///< The current refresh rate
int eyefinityGridCoordX; ///< The X coordinate in the Eyefinity grid. -1 if not in an Eyefinity group
int eyefinityGridCoordY; ///< The Y coordinate in the Eyefinity grid. -1 if not in an Eyefinity group
double chromaticityRedX; ///< Red display primary X coord
double chromaticityRedY; ///< Red display primary Y coord
double chromaticityGreenX; ///< Green display primary X coord
double chromaticityGreenY; ///< Green display primary Y coord
double chromaticityBlueX; ///< Blue display primary X coord
double chromaticityBlueY; ///< Blue display primary Y coord
double chromaticityWhitePointX; ///< White point X coord
double chromaticityWhitePointY; ///< White point Y coord
double screenDiffuseReflectance; ///< Percentage expressed between 0 - 1
double screenSpecularReflectance; ///< Percentage expressed between 0 - 1
double minLuminance; ///< The minimum luminance of the display in nits
double maxLuminance; ///< The maximum luminance of the display in nits
double avgLuminance; ///< The average luminance of the display in nits
int logicalDisplayIndex; ///< The internally used index of this display
int adlAdapterIndex; ///< The internally used ADL adapter index
int reserved; ///< reserved field
} AGSDisplayInfo;
/// The ASIC family
typedef enum AsicFamily
{
AsicFamily_Unknown, ///< Unknown architecture, potentially from another IHV. Check \ref AGSDeviceInfo::vendorId
AsicFamily_PreGCN, ///< Pre GCN architecture.
AsicFamily_GCN1, ///< AMD GCN 1 architecture: Oland, Cape Verde, Pitcairn & Tahiti.
AsicFamily_GCN2, ///< AMD GCN 2 architecture: Hawaii & Bonaire. This also includes APUs Kaveri and Carrizo.
AsicFamily_GCN3, ///< AMD GCN 3 architecture: Tonga & Fiji.
AsicFamily_GCN4, ///< AMD GCN 4 architecture: Polaris.
AsicFamily_Vega, ///< AMD Vega architecture, including Raven Ridge (ie AMD Ryzen CPU + AMD Vega GPU).
AsicFamily_RDNA, ///< AMD RDNA architecture
AsicFamily_RDNA2, ///< AMD RDNA2 architecture
AsicFamily_RDNA3, ///< AMD RDNA3 architecture
AsicFamily_Count ///< Number of enumerated ASIC families
} AsicFamily;
/// The device info struct used to describe a physical GPU enumerated by AGS
typedef struct AGSDeviceInfo
{
const char* adapterString; ///< The adapter name string
AsicFamily asicFamily; ///< Set to Unknown if not AMD hardware
unsigned int isAPU : 1; ///< Whether this device is an APU
unsigned int isPrimaryDevice : 1; ///< Whether this device is marked as the primary device
unsigned int isExternal :1; ///< Whether this device is a detachable, external device
unsigned int reservedPadding : 29; ///< Reserved for future use
int vendorId; ///< The vendor id
int deviceId; ///< The device id
int revisionId; ///< The revision id
int numCUs; ///< Number of compute units
int numWGPs; ///< Number of RDNA Work Group Processors. Only valid if ASIC is RDNA onwards.
int numROPs; ///< Number of ROPs
int coreClock; ///< Core clock speed at 100% power in MHz
int memoryClock; ///< Memory clock speed at 100% power in MHz
int memoryBandwidth; ///< Memory bandwidth in MB/s
float teraFlops; ///< Teraflops of GPU. Zero if not GCN onwards. Calculated from iCoreClock * iNumCUs * 64 Pixels/clk * 2 instructions/MAD
unsigned long long localMemoryInBytes; ///< The size of local memory in bytes. 0 for non AMD hardware.
unsigned long long sharedMemoryInBytes; ///< The size of system memory available to the GPU in bytes. It is important to factor this into your VRAM budget for APUs
///< as the reported local memory will only be a small fraction of the total memory available to the GPU.
int numDisplays; ///< The number of active displays found to be attached to this adapter.
AGSDisplayInfo* displays; ///< List of displays allocated by AGS to be numDisplays in length.
int eyefinityEnabled; ///< Indicates if Eyefinity is active
int eyefinityGridWidth; ///< Contains width of the multi-monitor grid that makes up the Eyefinity Single Large Surface.
int eyefinityGridHeight; ///< Contains height of the multi-monitor grid that makes up the Eyefinity Single Large Surface.
int eyefinityResolutionX; ///< Contains width in pixels of the multi-monitor Single Large Surface.
int eyefinityResolutionY; ///< Contains height in pixels of the multi-monitor Single Large Surface.
int eyefinityBezelCompensated; ///< Indicates if bezel compensation is used for the current SLS display area. 1 if enabled, and 0 if disabled.
int adlAdapterIndex; ///< Internally used index into the ADL list of adapters
int reserved; ///< reserved field
} AGSDeviceInfo;
/// \defgroup general General API functions
/// API for initialization, cleanup, HDR display modes and Crossfire GPU count
/// @{
typedef void* (__stdcall *AGS_ALLOC_CALLBACK)( size_t allocationSize ); ///< AGS user defined allocation prototype
typedef void (__stdcall *AGS_FREE_CALLBACK)( void* allocationPtr ); ///< AGS user defined free prototype
/// The configuration options that can be passed in to \ref agsInitialize
typedef struct AGSConfiguration
{
AGS_ALLOC_CALLBACK allocCallback; ///< Optional memory allocation callback. If not supplied, malloc() is used
AGS_FREE_CALLBACK freeCallback; ///< Optional memory freeing callback. If not supplied, free() is used
} AGSConfiguration;
/// The top level GPU information returned from \ref agsInitialize
typedef struct AGSGPUInfo
{
const char* driverVersion; ///< The AMD driver package version
const char* radeonSoftwareVersion; ///< The Radeon Software Version
int numDevices; ///< Number of GPUs in the system
AGSDeviceInfo* devices; ///< List of GPUs in the system
} AGSGPUInfo;
/// The struct to specify the display settings to the driver.
typedef struct AGSDisplaySettings AGSDisplaySettings;
/// The result returned from \ref agsCheckDriverVersion
typedef enum AGSDriverVersionResult
{
AGS_SOFTWAREVERSIONCHECK_OK, ///< The reported Radeon Software Version is newer or the same as the required version
AGS_SOFTWAREVERSIONCHECK_OLDER, ///< The reported Radeon Software Version is older than the required version
AGS_SOFTWAREVERSIONCHECK_UNDEFINED ///< The check could not determine as result. This could be because it is a private or custom driver or just invalid arguments.
} AGSDriverVersionResult;
///
/// Helper function to check the installed software version against the required software version.
///
/// \param [in] radeonSoftwareVersionReported The Radeon Software Version returned from \ref AGSGPUInfo::radeonSoftwareVersion.
/// \param [in] radeonSoftwareVersionRequired The Radeon Software Version to check against. This is specificed using \ref AGS_MAKE_VERSION.
/// \return The result of the check.
///
AMD_AGS_API AGSDriverVersionResult agsCheckDriverVersion( const char* radeonSoftwareVersionReported, unsigned int radeonSoftwareVersionRequired );
///
/// Function to return the AGS version number.
///
/// \return The version number made using AGS_MAKE_VERSION( AMD_AGS_VERSION_MAJOR, AMD_AGS_VERSION_MINOR, AMD_AGS_VERSION_PATCH ).
///
AMD_AGS_API int agsGetVersionNumber();
///
/// Function used to initialize the AGS library.
/// agsVersion must be specified as AGS_CURRENT_VERSION or the call will return \ref AGS_INVALID_ARGS.
/// Must be called prior to any of the subsequent AGS API calls.
/// Must be called prior to ID3D11Device or ID3D12Device creation.
/// \note The caller of this function should handle the possibility of the call failing in the cases below. One option is to do a vendor id check and only call \ref agsInitialize if there is an AMD GPU present.
/// \note This function will fail with \ref AGS_NO_AMD_DRIVER_INSTALLED if there is no AMD driver found on the system.
/// \note This function will fail with \ref AGS_LEGACY_DRIVER in Catalyst versions before 12.20.
///
/// \param [in] agsVersion The API version specified using the \ref AGS_CURRENT_VERSION macro. If this does not match the version in the binary this initialization call will fail.
/// \param [in] config Optional pointer to a AGSConfiguration struct to override the default library configuration.
/// \param [out] context Address of a pointer to a context. This function allocates a context on the heap which is then required for all subsequent API calls.
/// \param [out] gpuInfo Optional pointer to a AGSGPUInfo struct which will get filled in for all the GPUs in the system.
///
AMD_AGS_API AGSReturnCode agsInitialize( int agsVersion, const AGSConfiguration* config, AGSContext** context, AGSGPUInfo* gpuInfo );
///
/// Function used to clean up the AGS library.
///
/// \param [in] context Pointer to a context. This function will deallocate the context from the heap.
///
AMD_AGS_API AGSReturnCode agsDeInitialize( AGSContext* context );
///
/// Function used to set a specific display into HDR mode
/// \note Setting all of the values apart from color space and transfer function to zero will cause the display to use defaults.
/// \note Call this function after each mode change (switch to fullscreen, any change in swapchain etc).
/// \note HDR10 PQ mode requires a 1010102 swapchain.
/// \note HDR10 scRGB mode requires an FP16 swapchain.
/// \note Freesync HDR scRGB mode requires an FP16 swapchain.
/// \note Freesync HDR Gamma 2.2 mode requires a 1010102 swapchain.
/// \note Dolby Vision requires a 8888 UNORM swapchain.
///
/// \param [in] context Pointer to a context. This is generated by \ref agsInitialize
/// \param [in] deviceIndex The index of the device listed in \ref AGSGPUInfo::devices.
/// \param [in] displayIndex The index of the display listed in \ref AGSDeviceInfo::displays.
/// \param [in] settings Pointer to the display settings to use.
///
AMD_AGS_API AGSReturnCode agsSetDisplayMode( AGSContext* context, int deviceIndex, int displayIndex, const AGSDisplaySettings* settings );
/// @}
/// @}
#ifdef __cplusplus
} // extern "C"
#endif
#endif // AMD_AGS_H
-7
View File
@@ -1,7 +0,0 @@
{
"home": "https://github.com/GPUOpen-LibrariesAndSDKs/AGS_SDK",
"license": "MIT (embeded in source)",
"version": "AGS v6.2.0",
"author": "Advanced Micro Devices, Inc",
"modified": "CarterLi"
}
File diff suppressed because it is too large Load Diff
+46
View File
@@ -0,0 +1,46 @@
//
// Copyright (c) 2016 - 2022 Advanced Micro Devices, Inc. All rights reserved.
//
// MIT LICENSE:
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
/// \file adl_sdk.h
/// \brief Contains the definition of the Memory Allocation Callback.\n <b>Included in ADL SDK</b>
///
/// \n\n
/// This file contains the definition of the Memory Allocation Callback.\n
/// It also includes definitions of the respective structures and constants.\n
/// <b> This is the only header file to be included in a C/C++ project using ADL </b>
#ifndef ADL_SDK_H_
#define ADL_SDK_H_
#include "adl_structures.h"
#if defined (LINUX)
#define __stdcall
#endif /* (LINUX) */
/// Memory Allocation Call back
typedef void* ( __stdcall *ADL_MAIN_MALLOC_CALLBACK )( int );
#define ADL_SDK_MAJOR_VERSION 17
#define ADL_SDK_MINOR_VERSION 1
#endif /* ADL_SDK_H_ */
File diff suppressed because it is too large Load Diff
+6
View File
@@ -0,0 +1,6 @@
{
"home": "https://github.com/GPUOpen-LibrariesAndSDKs/display-library",
"license": "MIT (embeded in source)",
"version": "ADL SDK 17.1",
"author": "Advanced Micro Devices, Inc"
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"home": "https://github.com/ibireme/yyjson",
"license": "MIT ( embed in source )",
"version": "0.10.0",
"version": "0.11.1",
"author": "ibireme"
}
+2508 -1264
View File
File diff suppressed because it is too large Load Diff
+800 -570
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -134,7 +134,7 @@ void ffPrintCommandOption(FFdata* data, yyjson_mut_doc* jsonDoc)
int len = snprintf(str, sizeof str, "%.3fms", ms);
if (thres > 0)
snprintf(str, sizeof str, "\e[%sm%.3fms\e[m", (ms <= thres ? FF_COLOR_FG_GREEN : ms <= 2 * thres ? FF_COLOR_FG_YELLOW : FF_COLOR_FG_RED), ms);
printf("\e[s\e[1A\e[9999999C\e[%dD%s\e[u", len, str); // Save; Up 1; Right 9999999; Left <len>; Print <str>; Load
printf("\e7\e[1A\e[9999999C\e[%dD%s\e8", len, str); // Save; Up 1; Right 9999999; Left <len>; Print <str>; Load
}
}
+2 -2
View File
@@ -171,7 +171,7 @@ DBusMessage* ffDBusGetMethodReply(FFDBusData* dbus, const char* busName, const c
if (arg)
dbus->lib->ffdbus_message_append_args(message, DBUS_TYPE_STRING, &arg, DBUS_TYPE_INVALID);
DBusMessage* reply = dbus->lib->ffdbus_connection_send_with_reply_and_block(dbus->connection, message, FF_DBUS_TIMEOUT_MILLISECONDS, NULL);
DBusMessage* reply = dbus->lib->ffdbus_connection_send_with_reply_and_block(dbus->connection, message, instance.config.general.processingTimeout, NULL);
dbus->lib->ffdbus_message_unref(message);
@@ -189,7 +189,7 @@ DBusMessage* ffDBusGetProperty(FFDBusData* dbus, const char* busName, const char
DBUS_TYPE_STRING, &property,
DBUS_TYPE_INVALID);
DBusMessage* reply = dbus->lib->ffdbus_connection_send_with_reply_and_block(dbus->connection, message, FF_DBUS_TIMEOUT_MILLISECONDS, NULL);
DBusMessage* reply = dbus->lib->ffdbus_connection_send_with_reply_and_block(dbus->connection, message, instance.config.general.processingTimeout, NULL);
dbus->lib->ffdbus_message_unref(message);
+5 -2
View File
@@ -6,8 +6,6 @@
#include "util/FFstrbuf.h"
#include "common/library.h"
#define FF_DBUS_TIMEOUT_MILLISECONDS 100
typedef struct FFDBusLibrary
{
FF_LIBRARY_SYMBOL(dbus_bus_get)
@@ -38,4 +36,9 @@ DBusMessage* ffDBusGetProperty(FFDBusData* dbus, const char* busName, const char
bool ffDBusGetPropertyString(FFDBusData* dbus, const char* busName, const char* objectPath, const char* interface, const char* property, FFstrbuf* result);
bool ffDBusGetPropertyUint(FFDBusData* dbus, const char* busName, const char* objectPath, const char* interface, const char* property, uint32_t* result);
static inline DBusMessage* ffDBusGetAllProperties(FFDBusData* dbus, const char* busName, const char* objectPath, const char* interface)
{
return ffDBusGetMethodReply(dbus, busName, objectPath, "org.freedesktop.DBus.Properties", "GetAll", interface);
}
#endif // FF_HAVE_DBUS
+29 -13
View File
@@ -32,10 +32,16 @@ void ffFormatAppendFormatArg(FFstrbuf* buffer, const FFformatarg* formatarg)
ffStrbufAppend(buffer, (FFstrbuf*)formatarg->value);
break;
case FF_FORMAT_ARG_TYPE_FLOAT:
ffStrbufAppendF(buffer, "%f", *(float*)formatarg->value);
if (instance.config.display.fractionNdigits >= 0)
ffStrbufAppendF(buffer, "%.*f", instance.config.display.fractionNdigits, *(float*)formatarg->value);
else
ffStrbufAppendF(buffer, "%g", *(float*)formatarg->value);
break;
case FF_FORMAT_ARG_TYPE_DOUBLE:
ffStrbufAppendF(buffer, "%g", *(double*)formatarg->value);
if (instance.config.display.fractionNdigits >= 0)
ffStrbufAppendF(buffer, "%.*f", instance.config.display.fractionNdigits, *(double*)formatarg->value);
else
ffStrbufAppendF(buffer, "%g", *(double*)formatarg->value);
break;
case FF_FORMAT_ARG_TYPE_BOOL:
ffStrbufAppendS(buffer, *(bool*)formatarg->value ? "true" : "false");
@@ -108,6 +114,7 @@ static inline bool formatArgSet(const FFformatarg* arg)
{
return arg->value != NULL && (
(arg->type == FF_FORMAT_ARG_TYPE_DOUBLE && *(double*)arg->value > 0.0) || //Also is false for NaN
(arg->type == FF_FORMAT_ARG_TYPE_FLOAT && *(float*)arg->value > 0.0) || //Also is false for NaN
(arg->type == FF_FORMAT_ARG_TYPE_INT && *(int*)arg->value > 0) ||
(arg->type == FF_FORMAT_ARG_TYPE_STRBUF && ((FFstrbuf*)arg->value)->length > 0) ||
(arg->type == FF_FORMAT_ARG_TYPE_STRING && ffStrSet((char*)arg->value)) ||
@@ -259,24 +266,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 -5
View File
@@ -2,7 +2,7 @@
#include "util/FFstrbuf.h"
typedef enum FFformatArgType
typedef enum __attribute__((__packed__)) FFformatArgType
{
FF_FORMAT_ARG_TYPE_NULL = 0,
FF_FORMAT_ARG_TYPE_UINT,
@@ -42,7 +42,5 @@ typedef struct FFformatarg
void ffFormatAppendFormatArg(FFstrbuf* buffer, const FFformatarg* formatarg);
void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t numArgs, const FFformatarg* arguments);
#define FF_PARSE_FORMAT_STRING_CHECKED(buffer, formatstr, numArgs, arguments) do {\
static_assert(sizeof(arguments) / sizeof(*arguments) == (numArgs), "Invalid number of format arguments");\
ffParseFormatString((buffer), (formatstr), (numArgs), (arguments));\
} while (0)
#define FF_PARSE_FORMAT_STRING_CHECKED(buffer, formatstr, arguments) \
ffParseFormatString((buffer), (formatstr), sizeof(arguments) / sizeof(*arguments), (arguments));
+12 -13
View File
@@ -1,4 +1,5 @@
#include "fastfetch.h"
#include "common/init.h"
#include "common/parsing.h"
#include "common/thread.h"
#include "detection/displayserver/displayserver.h"
@@ -76,19 +77,21 @@ static void resetConsole(void)
}
#ifdef _WIN32
BOOL WINAPI consoleHandler(DWORD signal)
BOOL WINAPI consoleHandler(FF_MAYBE_UNUSED DWORD signal)
{
FF_UNUSED(signal);
resetConsole();
exit(0);
}
#else
static void exitSignalHandler(int signal)
static void exitSignalHandler(FF_MAYBE_UNUSED int signal)
{
FF_UNUSED(signal);
resetConsole();
exit(0);
}
static void chldSignalHandler(FF_MAYBE_UNUSED int signal)
{
// empty; used to interrupt the poll and read syscalls
}
#endif
void ffStart(void)
@@ -102,6 +105,7 @@ void ffStart(void)
ffHideCursor = instance.config.display.hideCursor && !instance.config.display.pipe && !instance.state.resultDoc;
#ifdef _WIN32
SetErrorMode(SEM_FAILCRITICALERRORS);
if (instance.config.display.noBuffer)
setvbuf(stdout, NULL, _IONBF, 0);
else
@@ -118,6 +122,7 @@ void ffStart(void)
sigaction(SIGINT, &action, NULL);
sigaction(SIGTERM, &action, NULL);
sigaction(SIGQUIT, &action, NULL);
sigaction(SIGCHLD, &(struct sigaction) { .sa_handler = chldSignalHandler }, NULL);
#endif
//reset everything to default before we start printing
@@ -179,15 +184,9 @@ void ffListFeatures(void)
#if FF_HAVE_XCB_RANDR
"xcb-randr\n"
#endif
#if FF_HAVE_XCB
"xcb\n"
#endif
#if FF_HAVE_XRANDR
"xrandr\n"
#endif
#if FF_HAVE_X11
"x11\n"
#endif
#if FF_HAVE_DRM
"drm\n"
#endif
@@ -230,15 +229,15 @@ void ffListFeatures(void)
#if FF_HAVE_GLX
"glx\n"
#endif
#if FF_HAVE_OSMESA
"osmesa\n"
#endif
#if FF_HAVE_OPENCL
"opencl\n"
#endif
#if FF_HAVE_FREETYPE
"freetype\n"
#endif
#if FF_HAVE_PCIACCESS
"libpciaccess\n"
#endif
#if FF_HAVE_PULSE
"libpulse\n"
#endif
+7
View File
@@ -0,0 +1,7 @@
#pragma once
void ffInitInstance(void);
void ffStart(void);
void ffFinish(void);
void ffDestroyInstance(void);
void ffListFeatures(void);
+15 -18
View File
@@ -19,8 +19,7 @@
#define FF_INVALID_FD (-1)
// procfs's file can be changed between read calls such as /proc/meminfo and /proc/uptime.
// one safe way to read correct data is reading the whole file in a single read syscall
// 8192 comes from procps-ng: https://gitlab.com/procps-ng/procps/-/blob/master/library/meminfo.c?ref_type=heads#L39
#define PROC_FILE_BUFFSIZ 8192
#define PROC_FILE_BUFFSIZ (32 * 1024)
#endif
static inline FFNativeFD FFUnixFD2NativeFD(int unixfd)
@@ -87,11 +86,12 @@ static inline bool ffReadFileBufferRelative(FFNativeFD dfd, const char* fileName
}
//Bit flags, combine with |
typedef enum FFPathType
typedef enum __attribute__((__packed__)) FFPathType
{
FF_PATHTYPE_FILE = 1 << 0,
FF_PATHTYPE_DIRECTORY = 1 << 1,
FF_PATHTYPE_ANY = FF_PATHTYPE_FILE | FF_PATHTYPE_DIRECTORY,
FF_PATHTYPE_FORCE_UNSIGNED = UINT8_MAX,
} FFPathType;
static inline bool ffPathExists(const char* path, FFPathType pathType)
@@ -118,22 +118,17 @@ static inline bool ffPathExists(const char* path, FFPathType pathType)
}
else
{
size_t len = strlen(path);
assert(len < PATH_MAX);
if (len == 0) return false;
struct stat fileStat;
if(stat(path, &fileStat) != 0)
return false;
int ret;
if (path[len - 1] != '/')
{
char buf[PATH_MAX + 1];
memcpy(buf, path, len);
buf[len] = '/';
buf[len + 1] = 0;
ret = access(buf, F_OK);
}
else
ret = access(path, F_OK);
return pathType == FF_PATHTYPE_DIRECTORY ? ret == 0 : ret == -1 && errno == ENOTDIR;
unsigned int mode = fileStat.st_mode & S_IFMT;
if(pathType & FF_PATHTYPE_FILE && mode != S_IFDIR)
return true;
if(pathType & FF_PATHTYPE_DIRECTORY && mode == S_IFDIR)
return true;
}
#endif
@@ -227,6 +222,8 @@ static inline bool ffSearchUserConfigFile(const FFlist* configDirs, const char*
return false;
}
FFNativeFD ffGetNullFD(void);
#ifdef _WIN32
// Only O_RDONLY is supported
HANDLE openat(HANDLE dfd, const char* fileName, bool directory);
+21 -6
View File
@@ -1,6 +1,7 @@
#include "io.h"
#include "fastfetch.h"
#include "util/stringUtils.h"
#include "common/time.h"
#include <fcntl.h>
#include <termios.h>
@@ -145,10 +146,10 @@ bool ffPathExpandEnv(FF_MAYBE_UNUSED const char* in, FF_MAYBE_UNUSED FFstrbuf* o
if (wordexp(in, &exp, 0) != 0)
return false;
if (exp.we_wordc == 1)
if (exp.we_wordc >= 1)
{
result = true;
ffStrbufSetS(out, exp.we_wordv[0]);
ffStrbufSetS(out, exp.we_wordv[exp.we_wordc > 1 ? ffTimeGetNow() % exp.we_wordc : 0]);
}
wordfree(&exp);
@@ -159,10 +160,10 @@ bool ffPathExpandEnv(FF_MAYBE_UNUSED const char* in, FF_MAYBE_UNUSED FFstrbuf* o
if (glob(in, GLOB_NOSORT | GLOB_TILDE, NULL, &gb) != 0)
return false;
if (gb.gl_matchc == 1)
if (gb.gl_matchc >= 1)
{
result = true;
ffStrbufSetS(out, gb.gl_pathv[0]);
ffStrbufSetS(out, gb.gl_pathv[gb.gl_matchc > 1 ? ffTimeGetNow() % gb.gl_matchc : 0]);
}
globfree(&gb);
@@ -255,6 +256,11 @@ const char* ffGetTerminalResponse(const char* request, int nParams, const char*
bool ffSuppressIO(bool suppress)
{
#ifndef NDEBUG
if (instance.config.display.debugMode)
return false;
#endif
static bool init = false;
static int origOut = -1;
static int origErr = -1;
@@ -284,7 +290,7 @@ bool ffSuppressIO(bool suppress)
void listFilesRecursively(uint32_t baseLength, FFstrbuf* folder, uint8_t indentation, const char* folderName, bool pretty)
{
FF_AUTO_CLOSE_FD int dfd = open(folder->chars, O_RDONLY);
FF_AUTO_CLOSE_FD int dfd = open(folder->chars, O_RDONLY | O_CLOEXEC);
if (dfd < 0)
return;
@@ -309,7 +315,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
@@ -352,3 +358,12 @@ void ffListFilesRecursively(const char* path, bool pretty)
ffStrbufEnsureEndsWithC(&folder, '/');
listFilesRecursively(folder.length, &folder, 0, NULL, pretty);
}
FFNativeFD ffGetNullFD(void)
{
static FFNativeFD hNullFile = -1;
if (hNullFile != -1)
return hNullFile;
hNullFile = open("/dev/null", O_WRONLY | O_CLOEXEC);
return hNullFile;
}
+34 -2
View File
@@ -147,6 +147,14 @@ ssize_t ffReadFileDataRelative(HANDLE dfd, const char* fileName, size_t dataSize
bool ffPathExpandEnv(const char* in, FFstrbuf* out)
{
if (in[0] == '~') {
if ((in[1] == '/' || in[1] == '\\' || in[1] == '\0') && !ffStrContainsC(in, '%')) {
ffStrbufSet(out, &instance.state.platform.homeDir);
ffStrbufAppendS(out, in + 1);
return true;
}
}
DWORD length = ExpandEnvironmentStringsA(in, NULL, 0);
if (length <= 1) return false;
@@ -159,10 +167,15 @@ bool ffPathExpandEnv(const char* in, FFstrbuf* out)
bool ffSuppressIO(bool suppress)
{
#ifndef NDEBUG
if (instance.config.display.debugMode)
return false;
#endif
static bool init = false;
static HANDLE hOrigOut = INVALID_HANDLE_VALUE;
static HANDLE hOrigErr = INVALID_HANDLE_VALUE;
static HANDLE hNullFile = INVALID_HANDLE_VALUE;
HANDLE hNullFile = ffGetNullFD();
static int fOrigOut = -1;
static int fOrigErr = -1;
static int fNullFile = -1;
@@ -174,7 +187,6 @@ bool ffSuppressIO(bool suppress)
hOrigOut = GetStdHandle(STD_OUTPUT_HANDLE);
hOrigErr = GetStdHandle(STD_ERROR_HANDLE);
hNullFile = CreateFileW(L"NUL", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, NULL);
fOrigOut = _dup(STDOUT_FILENO);
fOrigErr = _dup(STDERR_FILENO);
fNullFile = _open_osfhandle((intptr_t) hNullFile, 0);
@@ -339,3 +351,23 @@ const char* ffGetTerminalResponse(const char* request, int nParams, const char*
return NULL;
}
FFNativeFD ffGetNullFD(void)
{
static FFNativeFD hNullFile = INVALID_HANDLE_VALUE;
if (hNullFile != INVALID_HANDLE_VALUE)
return hNullFile;
hNullFile = CreateFileW(
L"NUL",
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_WRITE,
0,
OPEN_EXISTING,
0,
&(SECURITY_ATTRIBUTES){
.nLength = sizeof(SECURITY_ATTRIBUTES),
.lpSecurityDescriptor = NULL,
.bInheritHandle = TRUE,
});
return hNullFile;
}
+44 -1
View File
@@ -4,6 +4,7 @@
#include "common/printing.h"
#include "common/io/io.h"
#include "common/time.h"
#include "detection/version/version.h"
#include "modules/modules.h"
#include "util/stringUtils.h"
@@ -170,6 +171,25 @@ static void prepareModuleJsonObject(const char* type, yyjson_val* module)
}
}
static bool matchesJsonArray(const char* str, yyjson_val* val)
{
assert(val);
if (unsafe_yyjson_is_str(val))
return ffStrEqualsIgnCase(str, unsafe_yyjson_get_str(val));
if (!unsafe_yyjson_is_arr(val)) return false;
size_t idx, max;
yyjson_val* item;
yyjson_arr_foreach(val, idx, max, item)
{
if (yyjson_is_str(item) && ffStrEqualsIgnCase(str, unsafe_yyjson_get_str(item)))
return true;
}
return false;
}
static const char* printJsonConfig(bool prepare, yyjson_mut_doc* jsonDoc)
{
yyjson_val* const root = yyjson_doc_get_root(instance.state.configDoc);
@@ -197,6 +217,29 @@ static const char* printJsonConfig(bool prepare, yyjson_mut_doc* jsonDoc)
module = NULL;
else if (yyjson_is_obj(module))
{
yyjson_val* conditions = yyjson_obj_get(module, "condition");
if (conditions)
{
if (!yyjson_is_obj(conditions))
return "Property 'conditions' must be an object";
yyjson_val* system = yyjson_obj_get(conditions, "system");
if (system && !matchesJsonArray(ffVersionResult.sysName, system))
continue;
system = yyjson_obj_get(conditions, "!system");
if (system && matchesJsonArray(ffVersionResult.sysName, system))
continue;
yyjson_val* arch = yyjson_obj_get(conditions, "arch");
if (arch && !matchesJsonArray(ffVersionResult.architecture, arch))
continue;
arch = yyjson_obj_get(conditions, "!arch");
if (arch && matchesJsonArray(ffVersionResult.architecture, arch))
continue;
}
type = yyjson_get_str(yyjson_obj_get(module, "type"));
if (!type) return "module object must contain a \"type\" key ( case sensitive )";
if (yyjson_obj_size(module) == 1) // contains only Property type
@@ -224,7 +267,7 @@ static const char* printJsonConfig(bool prepare, yyjson_mut_doc* jsonDoc)
int len = snprintf(str, sizeof str, "%.3fms", ms);
if (thres > 0)
snprintf(str, sizeof str, "\e[%sm%.3fms\e[m", (ms <= thres ? FF_COLOR_FG_GREEN : ms <= 2 * thres ? FF_COLOR_FG_YELLOW : FF_COLOR_FG_RED), ms);
printf("\e[s\e[1A\e[9999999C\e[%dD%s\e[u", len, str); // Save; Up 1; Right 9999999; Left <len>; Print <str>; Load
printf("\e7\e[1A\e[9999999C\e[%dD%s\e8", len, str); // Save; Up 1; Right 9999999; Left <len>; Print <str>; Load
}
}
+1 -1
View File
@@ -74,7 +74,7 @@ void* ffLibraryLoad(const char* path, int maxVersion, ...);
FF_MAYBE_UNUSED void* libraryObjectName = NULL; // Placeholder
#define FF_LIBRARY_LOAD_SYMBOL_ADDRESS(library, symbolMapping, symbolName, returnValue) \
symbolMapping = (__typeof__(&symbolName)) &symbolName
symbolMapping = (__typeof__(&symbolName)) &symbolName;
#define FF_LIBRARY_LOAD_SYMBOL(library, symbolName, returnValue) \
FF_MAYBE_UNUSED __typeof__(&symbolName) FF_LIBRARY_LOAD_SYMBOL_ADDRESS(library, ff ## symbolName, symbolName, returnValue);
+1 -1
View File
@@ -3,7 +3,7 @@
#ifndef _WIN32
#include <net/if.h>
#else
#define IF_NAMESIZE 16
#define IF_NAMESIZE 0
#endif
bool ffNetifGetDefaultRouteImpl(char iface[IF_NAMESIZE + 1], uint32_t* ifIndex);
+41 -1
View File
@@ -1,6 +1,7 @@
#include "netif.h"
#include "common/io/io.h"
#include "util/mallocHelper.h"
#include <net/if.h>
#include <net/if_dl.h>
@@ -8,13 +9,17 @@
#include <netinet/in.h>
#include <sys/socket.h>
#if defined(__OpenBSD__) || defined(__DragonFly__)
#include <sys/sysctl.h>
#endif
#define ROUNDUP2(a, n) ((a) > 0 ? (1 + (((a) - 1U) | ((n) - 1))) : (n))
#if defined(__APPLE__)
# define ROUNDUP(a) ROUNDUP2((a), sizeof(int))
#elif defined(__NetBSD__)
# define ROUNDUP(a) ROUNDUP2((a), sizeof(uint64_t))
#elif defined(__FreeBSD__)
#elif defined(__FreeBSD__) || defined(__DragonFly__)
# define ROUNDUP(a) ROUNDUP2((a), sizeof(int))
#elif defined(__OpenBSD__)
# define ROUNDUP(a) ROUNDUP2((a), sizeof(int))
@@ -47,6 +52,39 @@ get_rt_address(struct rt_msghdr *rtm, int desired)
bool ffNetifGetDefaultRouteImpl(char iface[IF_NAMESIZE + 1], uint32_t* ifIndex)
{
#if defined(__OpenBSD__) || defined(__DragonFly__)
int mib[6] = {CTL_NET, PF_ROUTE, 0, AF_INET, NET_RT_FLAGS, RTF_GATEWAY};
size_t needed;
if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0)
return false;
FF_AUTO_FREE char* buf = malloc(needed);
if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0)
return false;
char* lim = buf + needed;
struct rt_msghdr* rtm;
for (char* next = buf; next < lim; next += rtm->rtm_msglen)
{
rtm = (struct rt_msghdr *)next;
struct sockaddr* sa = (struct sockaddr *)(rtm + 1);
if ((rtm->rtm_flags & RTF_GATEWAY) && (sa->sa_family == AF_INET))
{
struct sockaddr_dl* sdl = (struct sockaddr_dl *)get_rt_address(rtm, RTA_IFP);
if (sdl->sdl_family == AF_LINK)
{
assert(sdl->sdl_nlen <= IF_NAMESIZE);
memcpy(iface, sdl->sdl_data, sdl->sdl_nlen);
iface[sdl->sdl_nlen] = '\0';
*ifIndex = sdl->sdl_index;
return true;
}
}
}
#else
//https://github.com/hashPirate/copenheimer-masscan-fork/blob/36f1ed9f7b751a7dccd5ed27874e2e703db7d481/src/rawsock-getif.c#L104
FF_AUTO_CLOSE_FD int pfRoute = socket(PF_ROUTE, SOCK_RAW, AF_INET);
@@ -106,5 +144,7 @@ bool ffNetifGetDefaultRouteImpl(char iface[IF_NAMESIZE + 1], uint32_t* ifIndex)
return false;
}
}
#endif
return false;
}
+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;
}
+28 -2
View File
@@ -7,7 +7,7 @@
#define FF_STR_INDIR(x) #x
#define FF_STR(x) FF_STR_INDIR(x)
bool ffNetifGetDefaultRouteImpl(char iface[IF_NAMESIZE + 1], uint32_t* ifIndex)
static bool getDefaultRouteIPv4(char iface[IF_NAMESIZE + 1], uint32_t* ifIndex)
{
FILE* FF_AUTO_CLOSE_FILE netRoute = fopen("/proc/net/route", "r");
if (!netRoute) return false;
@@ -15,12 +15,38 @@ bool ffNetifGetDefaultRouteImpl(char iface[IF_NAMESIZE + 1], uint32_t* ifIndex)
// skip first line
FF_UNUSED(fscanf(netRoute, "%*[^\n]\n"));
unsigned long long destination; //, gateway, flags, refCount, use, metric, mask, mtu,
unsigned long long destination; //, gateway, flags, refCount, use, metric, mask, mtu, ...
while (fscanf(netRoute, "%" FF_STR(IF_NAMESIZE) "s%llx%*[^\n]", iface, &destination) == 2)
{
if (destination != 0) continue;
*ifIndex = if_nametoindex(iface);
return true;
}
iface[0] = '\0';
return false;
}
static bool getDefaultRouteIPv6(char iface[IF_NAMESIZE + 1], uint32_t* ifIndex)
{
FILE* FF_AUTO_CLOSE_FILE netRoute = fopen("/proc/net/ipv6_route", "r");
if (!netRoute) return false;
uint32_t prefixLen;
//destination, dest_prefix_len, source, src_prefix_len, next hop, metric, ref counter, use counter, flags, iface
while (fscanf(netRoute, "%*s %x %*s %*s %*s %*s %*s %*s %*s %" FF_STR(IF_NAMESIZE) "s", &prefixLen, iface) == 2)
{
if (prefixLen != 0) continue;
*ifIndex = if_nametoindex(iface);
return true;
}
iface[0] = '\0';
return false;
}
bool ffNetifGetDefaultRouteImpl(char iface[IF_NAMESIZE + 1], uint32_t* ifIndex)
{
if (getDefaultRouteIPv4(iface, ifIndex))
return true;
return getDefaultRouteIPv6(iface, ifIndex);
}
+20 -11
View File
@@ -1,27 +1,36 @@
#include "netif.h"
#include "util/mallocHelper.h"
#include <ws2tcpip.h> // AF_INET6, IN6_IS_ADDR_UNSPECIFIED
#include <iphlpapi.h>
bool ffNetifGetDefaultRouteImpl(FF_MAYBE_UNUSED char* iface/* unsupported */, uint32_t* ifIndex)
bool ffNetifGetDefaultRouteImpl(FF_MAYBE_UNUSED char iface[IF_NAMESIZE + 1], uint32_t* ifIndex)
{
ULONG size = 0;
if (GetIpForwardTable(NULL, &size, TRUE) != ERROR_INSUFFICIENT_BUFFER)
PMIB_IPFORWARD_TABLE2 pIpForwardTable = NULL;
DWORD result = GetIpForwardTable2(AF_UNSPEC, &pIpForwardTable);
if (result != NO_ERROR)
return false;
FF_AUTO_FREE MIB_IPFORWARDTABLE* pIpForwardTable = (MIB_IPFORWARDTABLE*) malloc(size);
if (GetIpForwardTable(pIpForwardTable, &size, TRUE) != ERROR_SUCCESS)
return false;
bool foundDefault = false;
for (uint32_t i = 0; i < pIpForwardTable->dwNumEntries; ++i)
for (ULONG i = 0; i < pIpForwardTable->NumEntries; ++i)
{
MIB_IPFORWARDROW* ipForwardRow = &pIpForwardTable->table[i];
if (ipForwardRow->dwForwardDest == 0 && ipForwardRow->dwForwardMask == 0)
MIB_IPFORWARD_ROW2* row = &pIpForwardTable->Table[i];
if ((row->DestinationPrefix.PrefixLength == 0) &&
((row->DestinationPrefix.Prefix.Ipv4.sin_family == AF_INET &&
row->DestinationPrefix.Prefix.Ipv4.sin_addr.S_un.S_addr == 0) ||
(row->DestinationPrefix.Prefix.Ipv6.sin6_family == AF_INET6 &&
IN6_IS_ADDR_UNSPECIFIED(&row->DestinationPrefix.Prefix.Ipv6.sin6_addr))))
{
*ifIndex = ipForwardRow->dwForwardIfIndex;
*ifIndex = row->InterfaceIndex;
foundDefault = true;
break;
}
}
return true;
FreeMibTable(pIpForwardTable);
return foundDefault;
}
@@ -7,14 +7,16 @@
#include <minwindef.h>
#endif
struct addrinfo;
typedef struct FFNetworkingState {
#ifdef _WIN32
uintptr_t sockfd;
OVERLAPPED overlapped;
#else
int sockfd;
FFstrbuf host;
FFstrbuf command;
struct addrinfo* addr;
#ifdef FF_HAVE_THREADS
FFThreadType thread;
@@ -23,7 +25,14 @@ typedef struct FFNetworkingState {
uint32_t timeout;
bool ipv6;
bool compression; // if true, HTTP content compression will be enabled if supported
bool tfo; // if true, TCP Fast Open will be attempted first, and fallback to traditional connection if it fails
} FFNetworkingState;
const char* ffNetworkingSendHttpRequest(FFNetworkingState* state, const char* host, const char* path, const char* headers);
const char* ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buffer);
#ifdef FF_HAVE_ZLIB
const char* ffNetworkingLoadZlibLibrary(void);
bool ffNetworkingDecompressGzip(FFstrbuf* buffer, char* headerEnd);
#endif
+194
View File
@@ -0,0 +1,194 @@
#include "fastfetch.h"
#include "common/library.h"
#include "common/networking/networking.h"
#include "util/stringUtils.h"
#include "util/debug.h"
#ifdef FF_HAVE_ZLIB
#include <zlib.h>
struct FFZlibLibrary
{
FF_LIBRARY_SYMBOL(inflateInit2_)
FF_LIBRARY_SYMBOL(inflate)
FF_LIBRARY_SYMBOL(inflateEnd)
FF_LIBRARY_SYMBOL(inflateGetHeader)
bool inited;
} zlibData;
const char* ffNetworkingLoadZlibLibrary(void)
{
if (!zlibData.inited)
{
zlibData.inited = true;
FF_LIBRARY_LOAD(zlib, "dlopen libz failed",
#ifdef _WIN32
"zlib1"
#else
"libz"
#endif
FF_LIBRARY_EXTENSION, 2)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(zlib, zlibData, inflateInit2_)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(zlib, zlibData, inflate)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(zlib, zlibData, inflateEnd)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(zlib, zlibData, inflateGetHeader)
zlib = NULL; // don't auto dlclose
}
return zlibData.ffinflateEnd == NULL ? "Failed to load libz" : NULL;
}
// Try to pre-read gzip header to determine uncompressed size
static uint32_t guessGzipOutputSize(const void* data, uint32_t dataSize)
{
// gzip file format: http://www.zlib.org/rfc-gzip.html
if (dataSize < 10 || ((const uint8_t*)data)[0] != 0x1f || ((const uint8_t*)data)[1] != 0x8b)
return 0;
// Uncompressed size in gzip format is stored in the last 4 bytes, but only valid if data is less than 4GB
if (dataSize > 18) {
// Get ISIZE value from the end of file (little endian)
const uint8_t* tail = (const uint8_t*)data + dataSize - 4;
uint32_t uncompressedSize = (uint32_t) tail[0] | ((uint32_t) tail[1] << 8u) | ((uint32_t) tail[2] << 16u) | ((uint32_t) tail[3] << 24u);
// For valid gzip files, this value is the length of the uncompressed data modulo 2^32
if (uncompressedSize > 0) {
FF_DEBUG("Read uncompressed size from GZIP trailer: %u bytes", uncompressedSize);
// Add some margin to the estimated size for safety
return uncompressedSize + 64;
}
}
// If unable to get size from trailer or size is 0, use estimated value
// Typically, text data compression ratio is between 3-5x, we use the larger value
uint32_t estimatedSize = dataSize * 5;
FF_DEBUG("Unable to read exact uncompressed size, estimated as 5x of compressed data: %u bytes", estimatedSize);
return estimatedSize;
}
// Decompress gzip content
bool ffNetworkingDecompressGzip(FFstrbuf* buffer, char* headerEnd)
{
// Calculate header size
uint32_t headerSize = (uint32_t) (headerEnd - buffer->chars);
*headerEnd = '\0'; // Replace delimiter with null character for easier processing
// Ensure Content-Encoding is in response headers, not in response body
bool hasGzip = strcasestr(buffer->chars, "\nContent-Encoding: gzip") != NULL;
*headerEnd = '\r'; // Restore delimiter
if (!hasGzip) {
FF_DEBUG("No gzip compressed content detected, skipping decompression");
return true;
}
FF_DEBUG("Gzip compressed content detected, preparing for decompression");
const char* bodyStart = headerEnd + 4; // Skip delimiter
// Calculate compressed content size
uint32_t compressedSize = buffer->length - headerSize - 4;
if (compressedSize <= 0) {
// No content to decompress
FF_DEBUG("Compressed content size is 0, skipping decompression");
return true;
}
// Check if content is actually in gzip format (gzip header magic is 0x1f 0x8b)
if (compressedSize < 2 || (uint8_t)bodyStart[0] != 0x1f || (uint8_t)bodyStart[1] != 0x8b) {
FF_DEBUG("Content is not valid gzip format, skipping decompression");
return false;
}
// Predict uncompressed size
uint32_t estimatedSize = guessGzipOutputSize(bodyStart, compressedSize);
// Create decompression buffer with estimated size
FF_STRBUF_AUTO_DESTROY decompressedBuffer = ffStrbufCreateA(estimatedSize > 0 ? estimatedSize : compressedSize * 5);
FF_DEBUG("Created decompression buffer: %u bytes", decompressedBuffer.allocated);
// Initialize decompression
z_stream zs = {
.zalloc = Z_NULL,
.zfree = Z_NULL,
.opaque = Z_NULL,
.avail_in = (uInt)compressedSize,
.next_in = (Bytef*)bodyStart,
.avail_out = (uInt)ffStrbufGetFree(&decompressedBuffer),
.next_out = (Bytef*)decompressedBuffer.chars,
};
// Initialize decompression engine
if (zlibData.ffinflateInit2_(&zs, 16 + MAX_WBITS, ZLIB_VERSION, (int)sizeof(z_stream)) != Z_OK) {
FF_DEBUG("Failed to initialize decompression engine");
return false;
}
uInt availableOut = zs.avail_out;
// Perform decompression
int result = zlibData.ffinflate(&zs, Z_FINISH);
// If output buffer is insufficient, try to extend buffer
while (result == Z_BUF_ERROR || (result != Z_STREAM_END && zs.avail_out == 0))
{
FF_DEBUG("Output buffer insufficient, trying to extend");
// Save already decompressed data amount
uint32_t alreadyDecompressed = (uint32_t)(availableOut - zs.avail_out);
decompressedBuffer.length += alreadyDecompressed;
decompressedBuffer.chars[decompressedBuffer.length] = '\0'; // Ensure null-terminated string
ffStrbufEnsureFree(&decompressedBuffer, decompressedBuffer.length / 2);
// Set output parameters to point to new buffer
zs.avail_out = (uInt)ffStrbufGetFree(&decompressedBuffer);
zs.next_out = (Bytef*)(decompressedBuffer.chars + decompressedBuffer.length);
availableOut = zs.avail_out;
// Decompress again
result = zlibData.ffinflate(&zs, Z_FINISH);
}
zlibData.ffinflateEnd(&zs);
// Calculate decompressed size
uint32_t decompressedSize = (uint32_t)(availableOut - zs.avail_out);
decompressedBuffer.length += decompressedSize;
decompressedBuffer.chars[decompressedSize] = '\0'; // Ensure null-terminated string
FF_DEBUG("Successfully decompressed %u bytes compressed data to %u bytes", compressedSize, decompressedBuffer.length);
// Modify Content-Length header and remove Content-Encoding header
FF_STRBUF_AUTO_DESTROY newBuffer = ffStrbufCreateA(headerSize + decompressedSize + 64);
char* line = NULL;
size_t len = 0;
while (ffStrbufGetline(&line, &len, buffer))
{
if (ffStrStartsWithIgnCase(line, "Content-Encoding:"))
{
continue;
}
else if (ffStrStartsWithIgnCase(line, "Content-Length:"))
{
ffStrbufAppendF(&newBuffer, "Content-Length: %u\r\n", decompressedSize);
continue;
}
else if (line[0] == '\r')
{
ffStrbufAppendS(&newBuffer, "\r\n");
ffStrbufGetlineRestore(&line, &len, buffer);
break;
}
ffStrbufAppendS(&newBuffer, line);
ffStrbufAppendC(&newBuffer, '\n');
}
ffStrbufAppend(&newBuffer, &decompressedBuffer);
ffStrbufDestroy(buffer);
ffStrbufInitMove(buffer, &newBuffer);
return true;
}
#endif // FF_HAVE_ZLIB
+500
View File
@@ -0,0 +1,500 @@
#include "fastfetch.h"
#include "common/networking/networking.h"
#include "common/time.h"
#include "common/library.h"
#include "util/stringUtils.h"
#include "util/mallocHelper.h"
#include "util/debug.h"
#include <unistd.h>
#include <poll.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h> // For FreeBSD
#include <netinet/tcp.h>
#include <errno.h>
#include <fcntl.h>
static const char* tryNonThreadingFastPath(FFNetworkingState* state)
{
#if defined(TCP_FASTOPEN) || __APPLE__
if (!state->tfo)
{
#ifdef __linux__
// Linux doesn't support sendto() on unconnected sockets
FF_DEBUG("TCP Fast Open disabled, skipping");
return "TCP Fast Open disabled";
#endif
}
else
{
FF_DEBUG("Attempting to use TCP Fast Open to connect");
#ifndef __APPLE__ // On macOS, TCP_FASTOPEN doesn't seem to be needed
// Set TCP Fast Open
#ifdef __linux__
int flag = 5; // the queue length of pending packets
#else
int flag = 1; // enable TCP Fast Open
#endif
if (setsockopt(state->sockfd, IPPROTO_TCP,
#ifdef __APPLE__
// https://github.com/rust-lang/libc/pull/3135
0x218 // TCP_FASTOPEN_FORCE_ENABLE
#else
TCP_FASTOPEN
#endif
, &flag, sizeof(flag)) != 0) {
FF_DEBUG("Failed to set TCP_FASTOPEN option: %s", strerror(errno));
return "setsockopt(TCP_FASTOPEN) failed";
} else {
#ifdef __linux__
FF_DEBUG("Successfully set TCP_FASTOPEN option, queue length: %d", flag);
#elif defined(__APPLE__)
FF_DEBUG("Successfully set TCP_FASTOPEN_FORCE_ENABLE option");
#else
FF_DEBUG("Successfully set TCP_FASTOPEN option");
#endif
}
#endif
}
#ifndef __APPLE__
FF_DEBUG("Using sendto() + MSG_DONTWAIT to send %u bytes of data", state->command.length);
ssize_t sent = sendto(state->sockfd,
state->command.chars,
state->command.length,
#ifdef MSG_FASTOPEN
MSG_FASTOPEN |
#endif
#ifdef MSG_NOSIGNAL
MSG_NOSIGNAL |
#endif
MSG_DONTWAIT,
state->addr->ai_addr,
state->addr->ai_addrlen);
#else
if (fcntl(state->sockfd, F_SETFL, O_NONBLOCK) == -1) {
FF_DEBUG("fcntl(F_SETFL) failed: %s", strerror(errno));
return "fcntl(F_SETFL) failed";
}
FF_DEBUG("Using connectx() to send %u bytes of data", state->command.length);
// Use connectx to establish connection and send data in one call
size_t sent;
if (connectx(state->sockfd,
&(sa_endpoints_t) {
.sae_dstaddr = state->addr->ai_addr,
.sae_dstaddrlen = state->addr->ai_addrlen,
},
SAE_ASSOCID_ANY, state->tfo ? CONNECT_DATA_IDEMPOTENT : 0,
&(struct iovec) {
.iov_base = state->command.chars,
.iov_len = state->command.length,
}, 1, &sent, NULL) != 0) sent = 0;
if (fcntl(state->sockfd, F_SETFL, 0) == -1) {
FF_DEBUG("fcntl(F_SETFL) failed: %s", strerror(errno));
return "fcntl(F_SETFL) failed";
}
#endif
if (sent > 0 || (errno == EAGAIN || errno == EWOULDBLOCK
#ifdef __APPLE__
// On macOS EINPROGRESS means the connection cannot be completed immediately
// On Linux, it means the TFO cookie is not available locally
|| errno == EINPROGRESS
#endif
))
{
FF_DEBUG(
#ifdef __APPLE__
"connectx()"
#else
"sendto()"
#endif
" %s (sent=%zd, errno=%d: %s)", errno == 0 ? "succeeded" : "was in progress",
sent, errno, strerror(errno));
freeaddrinfo(state->addr);
state->addr = NULL;
ffStrbufDestroy(&state->command);
return NULL;
}
FF_DEBUG(
#ifdef __APPLE__
"connectx()"
#else
"sendto()"
#endif
" failed: %s (errno=%d)", strerror(errno), errno);
#ifdef __APPLE__
return "connectx() failed";
#else
return "sendto() failed";
#endif
#else
FF_UNUSED(state);
return "TFO support is not available";
#endif
}
// Traditional connect and send function
static const char* connectAndSend(FFNetworkingState* state)
{
const char* ret = NULL;
FF_DEBUG("Using traditional connection method to connect");
FF_DEBUG("Attempting connect() to server...");
if(connect(state->sockfd, state->addr->ai_addr, state->addr->ai_addrlen) == -1)
{
FF_DEBUG("connect() failed: %s (errno=%d)", strerror(errno), errno);
ret = "connect() failed";
goto error;
}
FF_DEBUG("connect() succeeded");
FF_DEBUG("Attempting to send %u bytes of data...", state->command.length);
if(send(state->sockfd, state->command.chars, state->command.length, 0) < 0)
{
FF_DEBUG("send() failed: %s (errno=%d)", strerror(errno), errno);
ret = "send() failed";
goto error;
}
FF_DEBUG("Data sent successfully");
goto exit;
error:
FF_DEBUG("Error occurred, closing socket");
close(state->sockfd);
state->sockfd = -1;
exit:
FF_DEBUG("Releasing address info and other resources");
freeaddrinfo(state->addr);
state->addr = NULL;
ffStrbufDestroy(&state->command);
return ret;
}
FF_THREAD_ENTRY_DECL_WRAPPER(connectAndSend, FFNetworkingState*);
// Parallel DNS resolution and socket creation
static const char* initNetworkingState(FFNetworkingState* state, const char* host, const char* path, const char* headers)
{
FF_DEBUG("Initializing network connection state: host=%s, path=%s", host, path);
// Initialize command and host information
ffStrbufInitA(&state->command, 64);
ffStrbufAppendS(&state->command, "GET ");
ffStrbufAppendS(&state->command, path);
ffStrbufAppendS(&state->command, " HTTP/1.0\nHost: ");
ffStrbufAppendS(&state->command, host);
ffStrbufAppendS(&state->command, "\r\n");
// Add extra optimized HTTP headers
ffStrbufAppendS(&state->command, "Connection: close\r\n"); // Explicitly tell the server we don't need to keep the connection
// If compression needs to be enabled
if (state->compression) {
FF_DEBUG("Enabling HTTP content compression");
ffStrbufAppendS(&state->command, "Accept-Encoding: gzip\r\n");
}
ffStrbufAppendS(&state->command, headers);
ffStrbufAppendS(&state->command, "\r\n");
#ifdef FF_HAVE_THREADS
state->thread = 0;
FF_DEBUG("Thread ID initialized to 0");
#endif
const char* ret = NULL;
struct addrinfo hints = {
.ai_family = state->ipv6 ? AF_INET6 : AF_INET,
.ai_socktype = SOCK_STREAM,
.ai_flags = AI_NUMERICSERV
};
FF_DEBUG("Resolving address: %s (%s)", host, state->ipv6 ? "IPv6" : "IPv4");
// Use AI_NUMERICSERV flag to indicate the service is a numeric port, reducing parsing time
if(getaddrinfo(host, "80", &hints, &state->addr) != 0)
{
FF_DEBUG("getaddrinfo() failed: %s", gai_strerror(errno));
ret = "getaddrinfo() failed";
goto error;
}
FF_DEBUG("Address resolution successful");
FF_DEBUG("Creating socket");
state->sockfd = socket(state->addr->ai_family, state->addr->ai_socktype, state->addr->ai_protocol);
if(state->sockfd == -1)
{
FF_DEBUG("socket() failed: %s (errno=%d)", strerror(errno), errno);
ret = "socket() failed";
goto error;
}
FF_DEBUG("Socket creation successful: fd=%d", state->sockfd);
int flag = 1;
#ifdef TCP_NODELAY
// Disable Nagle's algorithm to reduce small packet transmission delay
if (setsockopt(state->sockfd, IPPROTO_TCP, TCP_NODELAY, &flag, sizeof(flag)) != 0) {
FF_DEBUG("Failed to set TCP_NODELAY: %s", strerror(errno));
} else {
FF_DEBUG("Successfully disabled Nagle's algorithm");
}
#endif
#ifdef TCP_QUICKACK
// Set TCP_QUICKACK option to avoid delayed acknowledgments
if (setsockopt(state->sockfd, IPPROTO_TCP, TCP_QUICKACK, &flag, sizeof(flag)) != 0) {
FF_DEBUG("Failed to set TCP_QUICKACK: %s", strerror(errno));
} else {
FF_DEBUG("Successfully enabled TCP quick acknowledgment");
}
#endif
if (state->timeout > 0)
{
FF_DEBUG("Setting connection timeout: %u ms", state->timeout);
FF_MAYBE_UNUSED uint32_t sec = state->timeout / 1000;
if (sec == 0) sec = 1;
#ifdef TCP_CONNECTIONTIMEOUT
FF_DEBUG("Using TCP_CONNECTIONTIMEOUT: %u seconds", sec);
setsockopt(state->sockfd, IPPROTO_TCP, TCP_CONNECTIONTIMEOUT, &sec, sizeof(sec));
#elif defined(TCP_KEEPINIT)
FF_DEBUG("Using TCP_KEEPINIT: %u seconds", sec);
setsockopt(state->sockfd, IPPROTO_TCP, TCP_KEEPINIT, &sec, sizeof(sec));
#elif defined(TCP_USER_TIMEOUT)
FF_DEBUG("Using TCP_USER_TIMEOUT: %u milliseconds", state->timeout);
setsockopt(state->sockfd, IPPROTO_TCP, TCP_USER_TIMEOUT, &state->timeout, sizeof(state->timeout));
#else
FF_DEBUG("Current platform does not support TCP connection timeout");
#endif
}
return NULL;
error:
FF_DEBUG("Error occurred during initialization");
if (state->addr != NULL)
{
FF_DEBUG("Releasing address information");
freeaddrinfo(state->addr);
state->addr = NULL;
}
if (state->sockfd > 0)
{
FF_DEBUG("Closing socket: fd=%d", state->sockfd);
close(state->sockfd);
state->sockfd = -1;
}
return ret;
}
const char* ffNetworkingSendHttpRequest(FFNetworkingState* state, const char* host, const char* path, const char* headers)
{
FF_DEBUG("Preparing to send HTTP request: host=%s, path=%s", host, path);
if (state->compression)
{
FF_DEBUG("Compression enabled, checking if zlib is available");
#ifdef FF_HAVE_ZLIB
const char* zlibError = ffNetworkingLoadZlibLibrary();
// Only enable compression if zlib library is successfully loaded
if (zlibError == NULL)
{
FF_DEBUG("Successfully loaded zlib library, compression enabled");
} else {
FF_DEBUG("Failed to load zlib library, compression disabled: %s", zlibError);
state->compression = false;
}
#else
FF_DEBUG("zlib not supported at build time, compression disabled");
state->compression = false;
#endif
}
else
{
FF_DEBUG("Compression disabled");
}
const char* initResult = initNetworkingState(state, host, path, headers);
if (initResult != NULL) {
FF_DEBUG("Initialization failed: %s", initResult);
return initResult;
}
FF_DEBUG("Network state initialization successful");
const char* tfoResult = tryNonThreadingFastPath(state);
if (tfoResult == NULL) {
FF_DEBUG("TryNonThreadingFastPath() succeeded or in progress");
return NULL;
}
FF_DEBUG("TryNonThreadingFastPath() failed: %s, trying traditional connection", tfoResult);
#ifdef FF_HAVE_THREADS
if (instance.config.general.multithreading)
{
FF_DEBUG("Multithreading mode enabled, creating connection thread");
state->thread = ffThreadCreate(connectAndSendThreadMain, state);
if (state->thread) {
FF_DEBUG("Thread creation successful: thread=%p", (void*)state->thread);
return NULL;
}
FF_DEBUG("Thread creation failed");
} else {
FF_DEBUG("Multithreading mode disabled, connecting in main thread");
}
#endif
return connectAndSend(state);
}
const char* ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buffer)
{
FF_DEBUG("Preparing to receive HTTP response");
uint32_t timeout = state->timeout;
#ifdef FF_HAVE_THREADS
if (state->thread)
{
FF_DEBUG("Connection thread is running, waiting for it to complete (timeout=%u ms)", timeout);
if (!ffThreadJoin(state->thread, timeout)) {
FF_DEBUG("Thread join failed or timed out");
return "ffThreadJoin() failed or timeout";
}
FF_DEBUG("Thread completed successfully");
state->thread = 0;
}
#endif
if(state->sockfd == -1)
{
FF_DEBUG("Invalid socket, HTTP request might have failed");
return "ffNetworkingSendHttpRequest() failed";
}
// Set larger initial receive buffer instead of small repeated receives
int rcvbuf = 65536; // 64KB
setsockopt(state->sockfd, SOL_SOCKET, SO_RCVBUF, &rcvbuf, sizeof(rcvbuf));
#ifdef __APPLE__
// poll for the socket to be readable.
// Because of the non-blocking connectx() call, the connection might not be established yet
FF_DEBUG("Using poll() to check if socket is readable");
if (poll(&(struct pollfd) {
.fd = state->sockfd,
.events = POLLIN
}, 1, timeout > 0 ? (int) timeout : -1) == -1)
{
FF_DEBUG("poll() failed: %s (errno=%d)", strerror(errno), errno);
close(state->sockfd);
state->sockfd = -1;
return "poll() failed";
}
FF_DEBUG("Socket is readable, proceeding to receive data");
#else
if(timeout > 0)
{
FF_DEBUG("Setting receive timeout: %u ms", timeout);
struct timeval timev;
timev.tv_sec = timeout / 1000;
timev.tv_usec = (__typeof__(timev.tv_usec)) ((timeout % 1000) * 1000); //milliseconds to microseconds
setsockopt(state->sockfd, SOL_SOCKET, SO_RCVTIMEO, &timev, sizeof(timev));
}
#endif
FF_DEBUG("Starting data reception");
FF_MAYBE_UNUSED int recvCount = 0;
uint32_t contentLength = 0;
char* headerEnd = NULL;
do {
FF_DEBUG("Data reception loop #%d, current buffer size: %u, available space: %u",
++recvCount, buffer->length, ffStrbufGetFree(buffer));
ssize_t received = recv(state->sockfd, buffer->chars + buffer->length, ffStrbufGetFree(buffer), MSG_WAITALL);
if (received <= 0) {
if (received == 0) {
FF_DEBUG("Connection closed (received=0)");
} else {
FF_DEBUG("Reception failed: %s (errno=%d)", strerror(errno), errno);
}
break;
}
buffer->length += (uint32_t) received;
buffer->chars[buffer->length] = '\0';
FF_DEBUG("Successfully received %zd bytes of data, total: %u bytes", received, buffer->length);
// Check if HTTP header end marker is found
if (headerEnd == NULL) {
headerEnd = memmem(buffer->chars, buffer->length, "\r\n\r\n", 4);
if (headerEnd != NULL) {
FF_DEBUG("Found HTTP header end marker, position: %ld", (long)(headerEnd - buffer->chars));
// Check for Content-Length header to pre-allocate enough memory
const char* clHeader = strcasestr(buffer->chars, "Content-Length:");
if (clHeader) {
contentLength = (uint32_t) strtoul(clHeader + 16, NULL, 10);
if (contentLength > 0) {
FF_DEBUG("Detected Content-Length: %u, pre-allocating buffer", contentLength);
// Ensure buffer is large enough, adding header size and some margin
ffStrbufEnsureFree(buffer, contentLength + 16);
FF_DEBUG("Extended receive buffer to %u bytes", buffer->length);
}
}
}
}
} while (ffStrbufGetFree(buffer) > 0);
FF_DEBUG("Closing socket: fd=%d", state->sockfd);
close(state->sockfd);
state->sockfd = -1;
if (buffer->length == 0) {
FF_DEBUG("Server response is empty");
return "Empty server response received";
}
if (headerEnd == NULL) {
FF_DEBUG("No HTTP header end marker found");
return "No HTTP header end found";
}
if (contentLength > 0 && buffer->length != contentLength + (uint32_t)(headerEnd - buffer->chars) + 4) {
FF_DEBUG("Received content length mismatches: %u != %u", buffer->length, contentLength + (uint32_t)(headerEnd - buffer->chars) + 4);
return "Content length mismatch";
}
if (ffStrbufStartsWithS(buffer, "HTTP/1.0 200 OK\r\n")) {
FF_DEBUG("Received valid HTTP 200 response, content %u bytes, total %u bytes", contentLength, buffer->length);
} else {
FF_DEBUG("Invalid response: %.40s...", buffer->chars);
return "Invalid response";
}
// If compression was used, try to decompress
#ifdef FF_HAVE_ZLIB
if (state->compression) {
FF_DEBUG("Content received, checking if compressed");
if (!ffNetworkingDecompressGzip(buffer, headerEnd)) {
FF_DEBUG("Decompression failed or invalid compression format");
return "Failed to decompress or invalid format";
} else {
FF_DEBUG("Decompression successful or no decompression needed, total length after decompression: %u bytes", buffer->length);
}
}
#endif
return NULL;
}
+339
View File
@@ -0,0 +1,339 @@
#include <mswsock.h>
#include <ws2tcpip.h>
//Must be included after <mswsock.h>
#include "fastfetch.h"
#include "common/networking/networking.h"
#include "util/stringUtils.h"
#include "util/debug.h"
static LPFN_CONNECTEX ConnectEx;
static const char* initWsaData(WSADATA* wsaData)
{
FF_DEBUG("Initializing WinSock");
if(WSAStartup(MAKEWORD(2, 2), wsaData) != 0) {
FF_DEBUG("WSAStartup() failed");
return "WSAStartup() failed";
}
if(LOBYTE(wsaData->wVersion) != 2 || HIBYTE(wsaData->wVersion) != 2) {
FF_DEBUG("Invalid wsaData version found: %d.%d", LOBYTE(wsaData->wVersion), HIBYTE(wsaData->wVersion));
return "Invalid wsaData version found";
}
//Dummy socket needed for WSAIoctl
SOCKET sockfd = socket(AF_INET, SOCK_STREAM, 0);
if(sockfd == INVALID_SOCKET) {
FF_DEBUG("socket(AF_INET, SOCK_STREAM) failed");
return "socket(AF_INET, SOCK_STREAM) failed";
}
DWORD dwBytes;
GUID guid = WSAID_CONNECTEX;
if(WSAIoctl(sockfd, SIO_GET_EXTENSION_FUNCTION_POINTER,
&guid, sizeof(guid),
&ConnectEx, sizeof(ConnectEx),
&dwBytes, NULL, NULL) != 0) {
FF_DEBUG("WSAIoctl(sockfd, SIO_GET_EXTENSION_FUNCTION_POINTER) failed");
return "WSAIoctl(sockfd, SIO_GET_EXTENSION_FUNCTION_POINTER) failed";
}
closesocket(sockfd);
FF_DEBUG("WinSock initialized successfully");
return NULL;
}
const char* ffNetworkingSendHttpRequest(FFNetworkingState* state, const char* host, const char* path, const char* headers)
{
FF_DEBUG("Preparing to send HTTP request: host=%s, path=%s", host, path);
if (state->compression)
{
#ifdef FF_HAVE_ZLIB
const char* zlibError = ffNetworkingLoadZlibLibrary();
// Only enable compression if zlib library is successfully loaded
if (zlibError == NULL)
{
FF_DEBUG("Successfully loaded zlib library, compression enabled");
} else {
FF_DEBUG("Failed to load zlib library, compression disabled: %s", zlibError);
state->compression = false;
}
#else
FF_DEBUG("zlib not supported at build time, compression disabled");
state->compression = false;
#endif
}
else
{
FF_DEBUG("Compression disabled");
}
static WSADATA wsaData;
if (wsaData.wVersion == 0)
{
const char* error = initWsaData(&wsaData);
if (error != NULL)
{
wsaData.wVersion = (WORD) -1;
FF_DEBUG("WinSock initialization failed: %s", error);
return error;
}
}
else if (wsaData.wVersion == (WORD) -1)
{
FF_DEBUG("WinSock initialization previously failed");
return "initWsaData() failed before";
}
struct addrinfo* addr;
struct addrinfo hints = {
.ai_family = state->ipv6 ? AF_INET6 : AF_INET,
.ai_socktype = SOCK_STREAM,
.ai_flags = AI_NUMERICSERV,
};
FF_DEBUG("Resolving address: %s (%s)", host, state->ipv6 ? "IPv6" : "IPv4");
if(getaddrinfo(host, "80", &hints, &addr) != 0)
{
FF_DEBUG("getaddrinfo() failed");
return "getaddrinfo() failed";
}
state->sockfd = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol);
if(state->sockfd == INVALID_SOCKET)
{
FF_DEBUG("socket() failed");
freeaddrinfo(addr);
return "socket() failed";
}
DWORD flag = 1;
#ifdef TCP_NODELAY
// Enable TCP_NODELAY to disable Nagle's algorithm
if (setsockopt(state->sockfd, IPPROTO_TCP, TCP_NODELAY, (char*)&flag, sizeof(flag)) != 0) {
FF_DEBUG("Failed to set TCP_NODELAY: %s", ffDebugWin32Error((DWORD) WSAGetLastError()));
} else {
FF_DEBUG("Successfully disabled Nagle's algorithm");
}
#endif
// Set timeout if needed
if (state->timeout > 0) {
FF_DEBUG("Setting connection timeout: %u ms", state->timeout);
setsockopt(state->sockfd, SOL_SOCKET, SO_SNDTIMEO, (const char*)&state->timeout, sizeof(state->timeout));
}
//ConnectEx requires the socket to be initially bound
if((state->ipv6
? bind(state->sockfd, (SOCKADDR *) &(struct sockaddr_in6) {
.sin6_family = AF_INET6,
.sin6_addr = in6addr_any,
}, sizeof(struct sockaddr_in6))
: bind(state->sockfd, (SOCKADDR *) &(struct sockaddr_in) {
.sin_family = AF_INET,
.sin_addr.s_addr = INADDR_ANY,
}, sizeof(struct sockaddr_in))) != 0)
{
FF_DEBUG("bind() failed: %s", ffDebugWin32Error((DWORD) WSAGetLastError()));
closesocket(state->sockfd);
freeaddrinfo(addr);
state->sockfd = INVALID_SOCKET;
return "bind() failed";
}
// Initialize overlapped structure for asynchronous I/O
memset(&state->overlapped, 0, sizeof(OVERLAPPED));
// Build HTTP command
FF_STRBUF_AUTO_DESTROY command = ffStrbufCreateA(64);
ffStrbufAppendS(&command, "GET ");
ffStrbufAppendS(&command, path);
ffStrbufAppendS(&command, " HTTP/1.0\nHost: ");
ffStrbufAppendS(&command, host);
ffStrbufAppendS(&command, "\r\n");
ffStrbufAppendS(&command, "Connection: close\r\n"); // Explicitly request connection closure
// Add compression support if enabled
if (state->compression) {
FF_DEBUG("Enabling HTTP content compression");
ffStrbufAppendS(&command, "Accept-Encoding: gzip\r\n");
}
ffStrbufAppendS(&command, headers);
ffStrbufAppendS(&command, "\r\n");
#ifdef TCP_FASTOPEN
if (state->tfo)
{
// Set TCP Fast Open
flag = 1;
if (setsockopt(state->sockfd, IPPROTO_TCP, TCP_FASTOPEN, (char*)&flag, sizeof(flag)) != 0) {
FF_DEBUG("Failed to set TCP_FASTOPEN option: %s", ffDebugWin32Error((DWORD) WSAGetLastError()));
} else {
FF_DEBUG("Successfully set TCP_FASTOPEN option");
}
}
else
{
FF_DEBUG("TCP Fast Open disabled");
}
#endif
FF_DEBUG("Using ConnectEx to send %u bytes of data", command.length);
DWORD sent = 0;
BOOL result = ConnectEx(state->sockfd, addr->ai_addr, (int)addr->ai_addrlen,
command.chars, command.length, &sent, &state->overlapped);
freeaddrinfo(addr);
addr = NULL;
if(!result)
{
if (WSAGetLastError() != WSA_IO_PENDING)
{
FF_DEBUG("ConnectEx() failed: %s", ffDebugWin32Error((DWORD) WSAGetLastError()));
closesocket(state->sockfd);
state->sockfd = INVALID_SOCKET;
return "ConnectEx() failed";
}
else
{
FF_DEBUG("ConnectEx() pending");
}
}
else
{
FF_DEBUG("ConnectEx() succeeded, sent %u bytes of data", (unsigned) sent);
}
// No need to cleanup state fields here since we need them in the receive function
return NULL;
}
const char* ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buffer)
{
FF_DEBUG("Preparing to receive HTTP response");
if (state->sockfd == INVALID_SOCKET)
{
FF_DEBUG("Invalid socket, HTTP request might have failed");
return "ffNetworkingSendHttpRequest() failed";
}
uint32_t timeout = state->timeout;
if (timeout > 0)
{
FF_DEBUG("WaitForSingleObject with timeout: %u ms", timeout);
if (WaitForSingleObject((HANDLE)state->sockfd, timeout) != WAIT_OBJECT_0)
{
FF_DEBUG("WaitForSingleObject failed or timed out");
CancelIo((HANDLE) state->sockfd);
closesocket(state->sockfd);
return "WaitForSingleObject(state->sockfd) failed or timeout";
}
}
DWORD transfer, flags;
if (!WSAGetOverlappedResult(state->sockfd, &state->overlapped, &transfer, TRUE, &flags))
{
FF_DEBUG("WSAGetOverlappedResult failed: %s", ffDebugWin32Error((DWORD) WSAGetLastError()));
closesocket(state->sockfd);
return "WSAGetOverlappedResult() failed";
}
if(timeout > 0)
{
FF_DEBUG("Setting receive timeout: %u ms", timeout);
setsockopt(state->sockfd, SOL_SOCKET, SO_RCVTIMEO, (const char*)&timeout, sizeof(timeout));
}
// Set larger receive buffer for better performance
int rcvbuf = 65536; // 64KB
setsockopt(state->sockfd, SOL_SOCKET, SO_RCVBUF, (const char*)&rcvbuf, sizeof(rcvbuf));
FF_DEBUG("Starting data reception");
FF_MAYBE_UNUSED int recvCount = 0;
uint32_t contentLength = 0;
char* headerEnd = NULL;
do {
FF_DEBUG("Data reception loop #%d, current buffer size: %u, available space: %u",
++recvCount, buffer->length, ffStrbufGetFree(buffer));
ssize_t received = recv(state->sockfd, buffer->chars + buffer->length, (int)ffStrbufGetFree(buffer), 0);
if (received <= 0) {
if (received == 0) {
FF_DEBUG("Connection closed (received=0)");
} else {
FF_DEBUG("Reception failed: %s", ffDebugWin32Error((DWORD) WSAGetLastError()));
}
break;
}
buffer->length += (uint32_t) received;
buffer->chars[buffer->length] = '\0';
FF_DEBUG("Successfully received %zd bytes of data, total: %u bytes", received, buffer->length);
// Check if HTTP header end marker is found
if (headerEnd == NULL) {
headerEnd = strstr(buffer->chars, "\r\n\r\n");
if (headerEnd != NULL) {
FF_DEBUG("Found HTTP header end marker, position: %ld", (long)(headerEnd - buffer->chars));
// Check for Content-Length header to pre-allocate enough memory
const char* clHeader = strcasestr(buffer->chars, "Content-Length:");
if (clHeader) {
contentLength = (uint32_t) strtoul(clHeader + 16, NULL, 10);
if (contentLength > 0) {
FF_DEBUG("Detected Content-Length: %u, pre-allocating buffer", contentLength);
// Ensure buffer is large enough, adding header size and some margin
ffStrbufEnsureFree(buffer, contentLength + 16);
FF_DEBUG("Extended receive buffer to %u bytes", buffer->allocated);
}
}
}
}
} while (ffStrbufGetFree(buffer) > 0);
FF_DEBUG("Closing socket: fd=%u", (unsigned)state->sockfd);
closesocket(state->sockfd);
state->sockfd = INVALID_SOCKET;
if (buffer->length == 0) {
FF_DEBUG("Server response is empty");
return "Empty server response received";
}
if (headerEnd == NULL) {
FF_DEBUG("No HTTP header end marker found");
return "No HTTP header end found";
}
if (ffStrbufStartsWithS(buffer, "HTTP/1.0 200 OK\r\n")) {
FF_DEBUG("Received valid HTTP 200 response, content length: %u bytes, total length: %u bytes",
contentLength, buffer->length);
} else {
FF_DEBUG("Invalid response: %.40s...", buffer->chars);
return "Invalid response";
}
// If compression was used, try to decompress
#ifdef FF_HAVE_ZLIB
if (state->compression) {
FF_DEBUG("Content received, checking if compressed");
if (!ffNetworkingDecompressGzip(buffer, headerEnd)) {
FF_DEBUG("Decompression failed or invalid compression format");
return "Failed to decompress or invalid format";
} else {
FF_DEBUG("Decompression successful or no decompression needed, total length after decompression: %u bytes", buffer->length);
}
}
#endif
return NULL;
}
-137
View File
@@ -1,137 +0,0 @@
#include "fastfetch.h"
#include "common/networking.h"
#include <unistd.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h> // For FreeBSD
#include <netinet/tcp.h>
static const char* connectAndSend(FFNetworkingState* state)
{
const char* ret = NULL;
struct addrinfo* addr;
if(getaddrinfo(state->host.chars, "80", &(struct addrinfo) {
.ai_family = state->ipv6 ? AF_INET6 : AF_INET,
.ai_socktype = SOCK_STREAM,
}, &addr) != 0)
{
ret = "getaddrinfo() failed";
goto error;
}
state->sockfd = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol);
if(state->sockfd == -1)
{
freeaddrinfo(addr);
ret = "socket() failed";
goto error;
}
if (state->timeout > 0)
{
FF_MAYBE_UNUSED uint32_t sec = state->timeout / 1000;
if (sec == 0) sec = 1;
#ifdef TCP_CONNECTIONTIMEOUT
setsockopt(state->sockfd, IPPROTO_TCP, TCP_CONNECTIONTIMEOUT, &sec, sizeof(sec));
#elif defined(TCP_KEEPINIT)
setsockopt(state->sockfd, IPPROTO_TCP, TCP_KEEPINIT, &sec, sizeof(sec));
#elif defined(TCP_USER_TIMEOUT)
setsockopt(state->sockfd, IPPROTO_TCP, TCP_USER_TIMEOUT, &state->timeout, sizeof(state->timeout));
#endif
}
if(connect(state->sockfd, addr->ai_addr, addr->ai_addrlen) == -1)
{
close(state->sockfd);
freeaddrinfo(addr);
ret = "connect() failed";
goto error;
}
freeaddrinfo(addr);
if(send(state->sockfd, state->command.chars, state->command.length, 0) < 0)
{
close(state->sockfd);
ret = "send() failed";
goto error;
}
goto exit;
error:
state->sockfd = -1;
exit:
ffStrbufDestroy(&state->host);
ffStrbufDestroy(&state->command);
return ret;
}
FF_THREAD_ENTRY_DECL_WRAPPER(connectAndSend, FFNetworkingState*);
const char* ffNetworkingSendHttpRequest(FFNetworkingState* state, const char* host, const char* path, const char* headers)
{
ffStrbufInitS(&state->host, host);
ffStrbufInitA(&state->command, 64);
ffStrbufAppendS(&state->command, "GET ");
ffStrbufAppendS(&state->command, path);
ffStrbufAppendS(&state->command, " HTTP/1.1\nHost: ");
ffStrbufAppendS(&state->command, host);
ffStrbufAppendS(&state->command, "\r\n");
ffStrbufAppendS(&state->command, headers);
ffStrbufAppendS(&state->command, "\r\n");
#ifdef FF_HAVE_THREADS
if (instance.config.general.multithreading)
{
state->thread = ffThreadCreate(connectAndSendThreadMain, state);
return state->thread ? NULL : "ffThreadCreate(connectAndSend) failed";
}
#endif
return connectAndSend(state);
}
const char* ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buffer)
{
uint32_t timeout = state->timeout;
#ifdef FF_HAVE_THREADS
if (instance.config.general.multithreading)
{
if (!ffThreadJoin(state->thread, timeout))
return "ffThreadJoin() failed or timeout";
}
#endif
if(state->sockfd == -1)
return "ffNetworkingSendHttpRequest() failed";
if(timeout > 0)
{
struct timeval timev;
timev.tv_sec = timeout / 1000;
timev.tv_usec = (__typeof__(timev.tv_usec)) ((timeout % 1000) * 1000); //milliseconds to microseconds
setsockopt(state->sockfd, SOL_SOCKET, SO_RCVTIMEO, &timev, sizeof(timev));
}
uint32_t recvStart;
do {
recvStart = buffer->length;
ssize_t received = recv(state->sockfd, buffer->chars + buffer->length, ffStrbufGetFree(buffer), 0);
if (received <= 0) break;
buffer->length += (uint32_t) received;
buffer->chars[buffer->length] = '\0';
} while (ffStrbufGetFree(buffer) > 0 && strstr(buffer->chars + recvStart, "\r\n\r\n") == NULL);
close(state->sockfd);
if (buffer->length == 0) return "Empty server response received";
return ffStrbufStartsWithS(buffer, "HTTP/1.1 200 OK\r\n") ? NULL : "Invalid response";
}
-146
View File
@@ -1,146 +0,0 @@
#include <mswsock.h>
#include <ws2tcpip.h>
//Must be included after <mswsock.h>
#include "fastfetch.h"
#include "common/networking.h"
static LPFN_CONNECTEX ConnectEx;
static const char* initWsaData(WSADATA* wsaData)
{
if(WSAStartup(MAKEWORD(2, 2), wsaData) != 0)
return "WSAStartup() failed";
if(LOBYTE(wsaData->wVersion) != 2 || HIBYTE(wsaData->wVersion) != 2)
return "Invalid wsaData version found";
//Dummy socket needed for WSAIoctl
SOCKET sockfd = socket(AF_INET, SOCK_STREAM, 0);
if(sockfd == INVALID_SOCKET)
return "socket(AF_INET, SOCK_STREAM) failed";
DWORD dwBytes;
GUID guid = WSAID_CONNECTEX;
if(WSAIoctl(sockfd, SIO_GET_EXTENSION_FUNCTION_POINTER,
&guid, sizeof(guid),
&ConnectEx, sizeof(ConnectEx),
&dwBytes, NULL, NULL) != 0)
return "WSAIoctl(sockfd, SIO_GET_EXTENSION_FUNCTION_POINTER) failed";
closesocket(sockfd);
return NULL;
}
const char* ffNetworkingSendHttpRequest(FFNetworkingState* state, const char* host, const char* path, const char* headers)
{
static WSADATA wsaData;
if (wsaData.wVersion == 0)
{
const char* error = initWsaData(&wsaData);
if (error != NULL)
{
wsaData.wVersion = (WORD) -1;
return error;
}
}
else if (wsaData.wVersion == (WORD) -1)
return "initWsaData() failed before";
struct addrinfo* addr;
if(getaddrinfo(host, "80", &(struct addrinfo) {
.ai_family = state->ipv6 ? AF_INET6 : AF_INET,
.ai_socktype = SOCK_STREAM,
}, &addr) != 0)
return "getaddrinfo() failed";
state->sockfd = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol);
if(state->sockfd == INVALID_SOCKET)
{
freeaddrinfo(addr);
return "socket() failed";
}
//ConnectEx requires the socket to be initially bound
if((state->ipv6
? bind(state->sockfd, (SOCKADDR *) &(struct sockaddr_in6) {
.sin6_family = AF_INET6,
.sin6_addr = in6addr_any,
}, sizeof(struct sockaddr_in6))
: bind(state->sockfd, (SOCKADDR *) &(struct sockaddr_in) {
.sin_family = AF_INET,
.sin_addr.s_addr = INADDR_ANY,
}, sizeof(struct sockaddr_in))) != 0)
{
closesocket(state->sockfd);
freeaddrinfo(addr);
state->sockfd = INVALID_SOCKET;
return "bind() failed";
}
FF_STRBUF_AUTO_DESTROY command = ffStrbufCreateA(64);
ffStrbufAppendS(&command, "GET ");
ffStrbufAppendS(&command, path);
ffStrbufAppendS(&command, " HTTP/1.1\nHost: ");
ffStrbufAppendS(&command, host);
ffStrbufAppendS(&command, "\r\n");
ffStrbufAppendS(&command, headers);
ffStrbufAppendS(&command, "\r\n");
BOOL result = ConnectEx(state->sockfd, addr->ai_addr, (int)addr->ai_addrlen, command.chars, command.length, NULL, &state->overlapped);
freeaddrinfo(addr);
if(!result && WSAGetLastError() != WSA_IO_PENDING)
{
closesocket(state->sockfd);
state->sockfd = INVALID_SOCKET;
return "ConnectEx() failed";
}
return NULL;
}
const char* ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buffer)
{
if (state->sockfd == INVALID_SOCKET)
return "ffNetworkingSendHttpRequest() failed";
uint32_t timeout = state->timeout;
if (timeout > 0)
{
if (WaitForSingleObject((HANDLE) state->sockfd, timeout) != WAIT_OBJECT_0)
{
CancelIo((HANDLE) state->sockfd);
closesocket(state->sockfd);
return "WaitForSingleObject(state->sockfd) failed or timeout";
}
}
DWORD transfer, flags;
if (!WSAGetOverlappedResult(state->sockfd, &state->overlapped, &transfer, TRUE, &flags))
{
closesocket(state->sockfd);
return "WSAGetOverlappedResult() failed";
}
if(timeout > 0)
{
//https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt
setsockopt(state->sockfd, SOL_SOCKET, SO_RCVTIMEO, (const char*) &timeout, sizeof(timeout));
}
uint32_t recvStart;
do {
recvStart = buffer->length;
ssize_t received = recv(state->sockfd, buffer->chars + buffer->length, (int) ffStrbufGetFree(buffer), 0);
if (received <= 0) break;
buffer->length = recvStart + (uint32_t) received;
buffer->chars[buffer->length] = '\0';
} while (ffStrbufGetFree(buffer) > 0 && strstr(buffer->chars + recvStart, "\r\n\r\n") == NULL);
closesocket(state->sockfd);
if (buffer->length == 0) return "Empty server response received";
return ffStrbufStartsWithS(buffer, "HTTP/1.1 200 OK\r\n") ? NULL : "Invalid response";
}
+30
View File
@@ -177,6 +177,7 @@ void ffOptionParseColorNoClear(const char* value, FFstrbuf* buffer)
if (ffCharIsEnglishAlphabet(value[0]))
{
FF_APPEND_COLOR_CODE_COND(reset_, FF_COLOR_MODE_RESET)
else FF_APPEND_COLOR_CODE_COND(bold_, FF_COLOR_MODE_BOLD)
else FF_APPEND_COLOR_CODE_COND(bright_, FF_COLOR_MODE_BOLD)
else FF_APPEND_COLOR_CODE_COND(dim_, FF_COLOR_MODE_DIM)
else FF_APPEND_COLOR_CODE_COND(italic_, FF_COLOR_MODE_ITALIC)
@@ -212,6 +213,35 @@ void ffOptionParseColorNoClear(const char* value, FFstrbuf* buffer)
exit(479);
}
}
else if (value[0] == '#')
{
// RGB color
++value;
char* pend = NULL;
uint32_t rgb = (uint32_t) strtoul(value, &pend, 16);
if (pend == value) {
fprintf(stderr, "Error: invalid RGB color code found: %s\n", value);
exit(479);
}
if (pend - value > 6) {
fprintf(stderr, "Error: RGB color code too long: %s\n", value);
exit(479);
}
else if (pend - value == 3) {
rgb = ((rgb & 0xF00) >> 8) * 0x110000 +
((rgb & 0x0F0) >> 4) * 0x001100 +
((rgb & 0x00F) >> 0) * 0x000011;
}
else if (pend - value != 6) {
fprintf(stderr, "Error: invalid RGB color code length: %s\n", value);
exit(479);
}
uint32_t r = rgb >> 16, g = (rgb >> 8) & 0xFF, b = rgb & 0xFF;
ffStrbufAppendF(buffer, FF_COLOR_FG_RGB "%u;%u;%u", r, g, b);
value = pend;
continue;
}
ffStrbufAppendC(buffer, *value);
++value;
+17 -24
View File
@@ -6,6 +6,20 @@ struct yyjson_val;
struct yyjson_mut_doc;
struct yyjson_mut_val;
typedef struct FFModuleFormatArg
{
const char* desc;
const char* name;
} FFModuleFormatArg;
typedef struct FFModuleFormatArgList
{
FFModuleFormatArg* args;
uint32_t count;
} FFModuleFormatArgList;
#define FF_FORMAT_ARG_LIST(list) { .args = list, .count = sizeof(list) / sizeof(FFModuleFormatArg) }
// Must be the first field of FFModuleOptions
typedef struct FFModuleBaseInfo
{
@@ -19,38 +33,17 @@ typedef struct FFModuleBaseInfo
void (*parseJsonObject)(void* options, struct yyjson_val *module);
void (*printModule)(void* options);
void (*generateJsonResult)(void* options, struct yyjson_mut_doc* doc, struct yyjson_mut_val* module);
void (*printHelpFormat)(void);
void (*generateJsonConfig)(void* options, struct yyjson_mut_doc* doc, struct yyjson_mut_val* obj);
FFModuleFormatArgList formatArgs;
} FFModuleBaseInfo;
static inline void ffOptionInitModuleBaseInfo(
FFModuleBaseInfo* baseInfo,
const char* name,
const char* description,
void* parseCommandOptions, // bool (*const parseCommandOptions)(void* options, const char* key, const char* value)
void* parseJsonObject, // void (*const parseJsonObject)(void* options, yyjson_val *module)
void* printModule, // void (*const printModule)(void* options)
void* generateJsonResult, // void (*const generateJsonResult)(void* options, yyjson_mut_doc* doc, yyjson_mut_val* obj)
void (*printHelpFormat)(void),
void* generateJsonConfig // void (*const generateJsonConfig)(void* options, yyjson_mut_doc* doc, yyjson_mut_val* obj)
)
{
baseInfo->name = name;
baseInfo->description = description;
baseInfo->parseCommandOptions = (__typeof__(baseInfo->parseCommandOptions)) parseCommandOptions;
baseInfo->parseJsonObject = (__typeof__(baseInfo->parseJsonObject)) parseJsonObject;
baseInfo->printModule = (__typeof__(baseInfo->printModule)) printModule;
baseInfo->generateJsonResult = (__typeof__(baseInfo->generateJsonResult)) generateJsonResult;
baseInfo->printHelpFormat = printHelpFormat;
baseInfo->generateJsonConfig = (__typeof__(baseInfo->generateJsonConfig)) generateJsonConfig;
}
typedef enum FFModuleKeyType
typedef enum __attribute__((__packed__)) FFModuleKeyType
{
FF_MODULE_KEY_TYPE_NONE = 0,
FF_MODULE_KEY_TYPE_STRING = 1 << 0,
FF_MODULE_KEY_TYPE_ICON = 1 << 1,
FF_MODULE_KEY_TYPE_BOTH = FF_MODULE_KEY_TYPE_STRING | FF_MODULE_KEY_TYPE_ICON,
FF_MODULE_KEY_TYPE_FORCE_UNSIGNED = UINT8_MAX,
} FFModuleKeyType;
typedef struct FFModuleArgs
+16 -3
View File
@@ -190,14 +190,27 @@ void ffParseGTK(FFstrbuf* buffer, const FFstrbuf* gtk2, const FFstrbuf* gtk3, co
}
}
void ffParseDuration(uint32_t days, uint32_t hours, uint32_t minutes, uint32_t seconds, FFstrbuf* result)
void ffParseDuration(uint64_t totalSeconds, FFstrbuf* result)
{
if(days == 0 && hours == 0 && minutes == 0)
if(totalSeconds < 60)
{
ffStrbufAppendF(result, "%u seconds", seconds);
ffStrbufAppendF(result, "%u second", (unsigned) totalSeconds);
if (totalSeconds != 1)
ffStrbufAppendC(result, 's');
return;
}
uint32_t seconds = (uint32_t) (totalSeconds % 60);
totalSeconds /= 60;
if (seconds >= 30)
totalSeconds++;
uint32_t minutes = (uint32_t) (totalSeconds % 60);
totalSeconds /= 60;
uint32_t hours = (uint32_t) (totalSeconds % 24);
totalSeconds /= 24;
uint32_t days = (uint32_t) totalSeconds;
if(days > 0)
{
ffStrbufAppendF(result, "%u day", days);
+1 -1
View File
@@ -27,4 +27,4 @@ int8_t ffVersionCompare(const FFVersion* version1, const FFVersion* version2);
void ffParseSize(uint64_t bytes, FFstrbuf* result);
bool ffParseFrequency(uint32_t mhz, FFstrbuf* result);
void ffParseDuration(uint32_t days, uint32_t hours, uint32_t minutes, uint32_t seconds, FFstrbuf* result);
void ffParseDuration(uint64_t totalSeconds, FFstrbuf* result);
+72 -10
View File
@@ -14,7 +14,46 @@ static void appendOutputColor(FFstrbuf* buffer, const FFModuleArgs* module)
ffStrbufAppendF(buffer, "\e[%sm", instance.config.display.colorOutput.chars);
}
void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFColorRangeConfig config, const FFModuleArgs* module)
const char* ffPercentParseTypeJsonConfig(yyjson_val* jsonVal, FFPercentageTypeFlags* result)
{
if (yyjson_is_uint(jsonVal))
{
*result = (FFPercentageTypeFlags) yyjson_get_uint(jsonVal);
return NULL;
}
if (yyjson_is_arr(jsonVal))
{
FFPercentageTypeFlags flags = 0;
yyjson_val* item;
size_t idx, max;
yyjson_arr_foreach(jsonVal, idx, max, item)
{
const char* flag = yyjson_get_str(item);
if (!flag)
return "Error: percent.type: invalid flag string";
if (ffStrEqualsIgnCase(flag, "num"))
flags |= FF_PERCENTAGE_TYPE_NUM_BIT;
else if (ffStrEqualsIgnCase(flag, "bar"))
flags |= FF_PERCENTAGE_TYPE_BAR_BIT;
else if (ffStrEqualsIgnCase(flag, "hide-others"))
flags |= FF_PERCENTAGE_TYPE_HIDE_OTHERS_BIT;
else if (ffStrEqualsIgnCase(flag, "num-color"))
flags |= FF_PERCENTAGE_TYPE_NUM_COLOR_BIT;
else if (ffStrEqualsIgnCase(flag, "bar-monochrome"))
flags |= FF_PERCENTAGE_TYPE_BAR_MONOCHROME_BIT;
else
return "Error: percent.type: unknown flag string";
}
*result = flags;
return NULL;
}
return "Error: usage: percent.type must be a number or an array of strings";
}
void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFPercentageModuleConfig config, const FFModuleArgs* module)
{
uint8_t green = config.green, yellow = config.yellow;
assert(green <= 100 && yellow <= 100);
@@ -41,15 +80,18 @@ void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFColorRangeConfig con
}
else
{
const char* colorGreen = instance.config.display.percentColorGreen.chars;
const char* colorYellow = instance.config.display.percentColorYellow.chars;
const char* colorRed = instance.config.display.percentColorRed.chars;
const char* colorGreen = options->percentColorGreen.chars;
const char* colorYellow = options->percentColorYellow.chars;
const char* colorRed = options->percentColorRed.chars;
FFPercentageTypeFlags percentType = config.type == 0 ? options->percentType : config.type;
bool monochrome = !!(percentType & FF_PERCENTAGE_TYPE_BAR_MONOCHROME_BIT);
for (uint32_t i = 0; i < blocksPercent; ++i)
{
if(!options->pipe)
{
if (options->percentType & FF_PERCENTAGE_TYPE_BAR_MONOCHROME_BIT)
if (monochrome)
{
const char* color = NULL;
if (green <= yellow)
@@ -104,14 +146,15 @@ void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFColorRangeConfig con
}
}
void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFColorRangeConfig config, bool parentheses, const FFModuleArgs* module)
void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFPercentageModuleConfig config, bool parentheses, const FFModuleArgs* module)
{
uint8_t green = config.green, yellow = config.yellow;
assert(green <= 100 && yellow <= 100);
const FFOptionsDisplay* options = &instance.config.display;
FFPercentageTypeFlags percentType = config.type == 0 ? options->percentType : config.type;
bool colored = !!(options->percentType & FF_PERCENTAGE_TYPE_NUM_COLOR_BIT);
bool colored = !!(percentType & FF_PERCENTAGE_TYPE_NUM_COLOR_BIT);
if (parentheses)
ffStrbufAppendC(buffer, '(');
@@ -156,7 +199,7 @@ void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFColorRangeConfig con
ffStrbufAppendC(buffer, ')');
}
bool ffPercentParseCommandOptions(const char* key, const char* subkey, const char* value, FFColorRangeConfig* config)
bool ffPercentParseCommandOptions(const char* key, const char* subkey, const char* value, FFPercentageModuleConfig* config)
{
if (!ffStrStartsWithIgnCase(subkey, "percent-"))
return false;
@@ -187,10 +230,16 @@ bool ffPercentParseCommandOptions(const char* key, const char* subkey, const cha
return true;
}
if (ffStrEqualsIgnCase(subkey, "type"))
{
config->type = (FFPercentageTypeFlags) ffOptionParseUInt32(key, value);
return true;
}
return false;
}
bool ffPercentParseJsonObject(const char* key, yyjson_val* value, FFColorRangeConfig* config)
bool ffPercentParseJsonObject(const char* key, yyjson_val* value, FFPercentageModuleConfig* config)
{
if (!ffStrEqualsIgnCase(key, "percent"))
return false;
@@ -225,10 +274,21 @@ bool ffPercentParseJsonObject(const char* key, yyjson_val* value, FFColorRangeCo
config->yellow = (uint8_t) num;
}
yyjson_val* typeVal = yyjson_obj_get(value, "type");
if (typeVal)
{
const char* error = ffPercentParseTypeJsonConfig(typeVal, &config->type);
if (error)
{
fputs(error, stderr);
exit(480);
}
}
return true;
}
void ffPercentGenerateJsonConfig(yyjson_mut_doc* doc, yyjson_mut_val* module, FFColorRangeConfig defaultConfig, FFColorRangeConfig config)
void ffPercentGenerateJsonConfig(yyjson_mut_doc* doc, yyjson_mut_val* module, FFPercentageModuleConfig defaultConfig, FFPercentageModuleConfig config)
{
if (config.green == defaultConfig.green && config.yellow == defaultConfig.yellow)
return;
@@ -238,4 +298,6 @@ void ffPercentGenerateJsonConfig(yyjson_mut_doc* doc, yyjson_mut_val* module, FF
yyjson_mut_obj_add_uint(doc, percent, "green", config.green);
if (config.yellow != defaultConfig.yellow)
yyjson_mut_obj_add_uint(doc, percent, "yellow", config.yellow);
if (config.type != defaultConfig.type)
yyjson_mut_obj_add_uint(doc, percent, "type", config.type);
}
+18 -7
View File
@@ -4,14 +4,24 @@
#include "common/parsing.h"
#include "common/option.h"
enum FFPercentageTypeFlags
typedef enum __attribute__((__packed__)) FFPercentageTypeFlags
{
FF_PERCENTAGE_TYPE_NONE = 0,
FF_PERCENTAGE_TYPE_NUM_BIT = 1 << 0,
FF_PERCENTAGE_TYPE_BAR_BIT = 1 << 1,
FF_PERCENTAGE_TYPE_HIDE_OTHERS_BIT = 1 << 2,
FF_PERCENTAGE_TYPE_NUM_COLOR_BIT = 1 << 3,
FF_PERCENTAGE_TYPE_BAR_MONOCHROME_BIT = FF_PERCENTAGE_TYPE_NUM_COLOR_BIT,
};
FF_PERCENTAGE_TYPE_FORCE_UNSIGNED_ = UINT8_MAX,
} FFPercentageTypeFlags;
static_assert(sizeof(FFPercentageTypeFlags) == 1, "");
typedef struct FFPercentageModuleConfig
{
uint8_t green;
uint8_t yellow;
FFPercentageTypeFlags type;
} FFPercentageModuleConfig;
// if (green <= yellow)
// [0, green]: print green
@@ -23,12 +33,13 @@ enum FFPercentageTypeFlags
// [yellow, green): print yellow
// [0, yellow): print red
void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFColorRangeConfig config, const FFModuleArgs* module);
void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFColorRangeConfig config, bool parentheses, const FFModuleArgs* module);
void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFPercentageModuleConfig config, const FFModuleArgs* module);
void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFPercentageModuleConfig config, bool parentheses, const FFModuleArgs* module);
typedef struct yyjson_val yyjson_val;
typedef struct yyjson_mut_doc yyjson_mut_doc;
typedef struct yyjson_mut_val yyjson_mut_val;
bool ffPercentParseCommandOptions(const char* key, const char* subkey, const char* value, FFColorRangeConfig* config);
bool ffPercentParseJsonObject(const char* key, yyjson_val* value, FFColorRangeConfig* config);
void ffPercentGenerateJsonConfig(yyjson_mut_doc* doc, yyjson_mut_val* module, FFColorRangeConfig defaultConfig, FFColorRangeConfig config);
bool ffPercentParseCommandOptions(const char* key, const char* subkey, const char* value, FFPercentageModuleConfig* config);
bool ffPercentParseJsonObject(const char* key, yyjson_val* value, FFPercentageModuleConfig* config);
void ffPercentGenerateJsonConfig(yyjson_mut_doc* doc, yyjson_mut_val* module, FFPercentageModuleConfig defaultConfig, FFPercentageModuleConfig config);
const char* ffPercentParseTypeJsonConfig(yyjson_val* value, FFPercentageTypeFlags* result);
+6 -25
View File
@@ -1,5 +1,6 @@
#include "fastfetch.h"
#include "common/printing.h"
#include "logo/logo.h"
#include "util/textModifier.h"
void ffPrintLogoAndKey(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType)
@@ -50,7 +51,7 @@ void ffPrintLogoAndKey(const char* moduleName, uint8_t moduleIndex, const FFModu
else
{
FF_STRBUF_AUTO_DESTROY key = ffStrbufCreate();
FF_PARSE_FORMAT_STRING_CHECKED(&key, &moduleArgs->key, 2, ((FFformatarg[]){
FF_PARSE_FORMAT_STRING_CHECKED(&key, &moduleArgs->key, ((FFformatarg[]) {
FF_FORMAT_ARG(moduleIndex, "index"),
FF_FORMAT_ARG(moduleArgs->keyIcon, "icon"),
}));
@@ -99,7 +100,7 @@ void ffPrintFormat(const char* moduleName, uint8_t moduleIndex, const FFModuleAr
ffStrbufPutTo(&buffer, stdout);
}
static void printError(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, const char* message, va_list arguments)
void ffPrintError(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, const char* message, ...)
{
if(!instance.config.display.showErrors)
return;
@@ -109,7 +110,10 @@ static void printError(const char* moduleName, uint8_t moduleIndex, const FFModu
if(!instance.config.display.pipe)
fputs(FASTFETCH_TEXT_MODIFIER_ERROR, stdout);
va_list arguments;
va_start(arguments, message);
vprintf(message, arguments);
va_end(arguments);
if(!instance.config.display.pipe)
fputs(FASTFETCH_TEXT_MODIFIER_RESET, stdout);
@@ -117,14 +121,6 @@ static void printError(const char* moduleName, uint8_t moduleIndex, const FFModu
putchar('\n');
}
void ffPrintError(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, const char* message, ...)
{
va_list arguments;
va_start(arguments, message);
printError(moduleName, moduleIndex, moduleArgs, printType, message, arguments);
va_end(arguments);
}
void ffPrintColor(const FFstrbuf* colorValue)
{
//If the color is not set, this would reset in \033[m, which resets everything.
@@ -148,18 +144,3 @@ void ffPrintCharTimes(char c, uint32_t times)
if(remaining > 0)
fwrite(str, 1, remaining, stdout);
}
void ffPrintModuleFormatHelp(const char* name, const char* def, uint32_t numArgs, const char* args[])
{
FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreateS(name);
ffStrbufLowerCase(&buffer);
printf("--%s-format:\n", buffer.chars);
printf("Sets the format string for %s output.\n", name);
puts("To see how a format string is constructed, take a look at \"fastfetch --help format\".");
puts("The following values are passed:");
for(unsigned i = 0; i < numArgs; i++)
printf(" {%u}: %s\n", i + 1, args[i]);
printf("The default is something similar to \"%s\".\n", def);
}
+4 -11
View File
@@ -3,26 +3,19 @@
#include "fastfetch.h"
#include "common/format.h"
typedef enum FFPrintType {
typedef enum __attribute__((__packed__)) FFPrintType {
FF_PRINT_TYPE_DEFAULT = 0,
FF_PRINT_TYPE_NO_CUSTOM_KEY = 1 << 0, // key has been formatted outside
FF_PRINT_TYPE_NO_CUSTOM_KEY_COLOR = 1 << 1,
FF_PRINT_TYPE_NO_CUSTOM_KEY_WIDTH = 1 << 2,
FF_PRINT_TYPE_NO_CUSTOM_OUTPUT_FORMAT = 1 << 3, // reserved
FF_PRINT_TYPE_FORCE_UNSIGNED = UINT8_MAX,
} FFPrintType;
void ffPrintLogoAndKey(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType);
void ffPrintFormat(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, uint32_t numArgs, const FFformatarg* arguments);
#define FF_PRINT_FORMAT_CHECKED(moduleName, moduleIndex, moduleArgs, printType, numArgs, arguments) do {\
static_assert(sizeof(arguments) / sizeof(*arguments) == (numArgs), "Invalid number of format arguments");\
ffPrintFormat((moduleName), (moduleIndex), (moduleArgs), (printType), (numArgs), (arguments));\
} while (0)
#define FF_PRINT_FORMAT_CHECKED(moduleName, moduleIndex, moduleArgs, printType, arguments) \
ffPrintFormat((moduleName), (moduleIndex), (moduleArgs), (printType), (sizeof(arguments) / sizeof(*arguments)), (arguments));
FF_C_PRINTF(5, 6) void ffPrintError(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, const char* message, ...);
void ffPrintColor(const FFstrbuf* colorValue);
void ffPrintCharTimes(char c, uint32_t times);
void ffPrintModuleFormatHelp(const char* name, const char* def, uint32_t numArgs, const char* args[]);
#define FF_PRINT_MODULE_FORMAT_HELP_CHECKED(moduleName, def, numArgs, args) do {\
static_assert(sizeof(args) / sizeof(*args) == (numArgs), "Invalid number of format arguments");\
ffPrintModuleFormatHelp((moduleName), (def), (numArgs), (args));\
} while (0)
+162 -22
View File
@@ -1,7 +1,6 @@
#include "fastfetch.h"
#include "common/processing.h"
#include "common/io/io.h"
#include "common/time.h"
#include "util/stringUtils.h"
#include "util/mallocHelper.h"
@@ -13,6 +12,10 @@
#include <errno.h>
#include <sys/wait.h>
#if !(__ANDROID__ || __OpenBSD__)
#include <spawn.h>
#endif
#if defined(__FreeBSD__) || defined(__APPLE__)
#include <sys/types.h>
#include <sys/user.h>
@@ -29,13 +32,20 @@
#elif defined(__NetBSD__)
#include <sys/types.h>
#include <sys/sysctl.h>
#elif defined(__HAIKU__)
#include <OS.h>
#include <image.h>
#endif
#ifndef environ
extern char** environ;
#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);
@@ -46,6 +56,8 @@ static inline int ffPipe2(int *fds, int flags)
#endif
}
// Not thread-safe
const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool useStdErr)
{
int pipes[2];
@@ -54,7 +66,77 @@ const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool use
if(ffPipe2(pipes, O_CLOEXEC) == -1)
return "pipe() failed";
pid_t childPid = fork();
pid_t childPid = -1;
int nullFile = ffGetNullFD();
#if !(__ANDROID__ || __OpenBSD__)
// NetBSD / Darwin: native syscall
// Linux (glibc): clone3-execve
// FreeBSD: vfork-execve
// illumos: vforkx-execve
// OpenBSD / Android (bionic): fork-execve
posix_spawn_file_actions_t file_actions;
posix_spawn_file_actions_init(&file_actions);
posix_spawn_file_actions_adddup2(&file_actions, pipes[1], useStdErr ? STDERR_FILENO : STDOUT_FILENO);
posix_spawn_file_actions_adddup2(&file_actions, nullFile, useStdErr ? STDOUT_FILENO : STDERR_FILENO);
static char* oldLang = NULL;
static int langIndex = -1;
if (langIndex >= 0)
{
// Found before
if (oldLang) // oldLang was set only if it needed to be changed
{
if (environ[langIndex] != oldLang)
{
// environ is changed outside of this function
langIndex = -1;
}
else
environ[langIndex] = (char*) "LANG=C.UTF-8";
}
}
if (langIndex < 0)
{
for (int i = 0; environ[i] != NULL; i++)
{
if (ffStrStartsWith(environ[i], "LANG="))
{
langIndex = i;
const char* langValue = environ[i] + 5; // Skip "LANG="
if (ffStrEqualsIgnCase(langValue, "C") ||
ffStrStartsWithIgnCase(environ[i], "C.") ||
ffStrEqualsIgnCase(langValue, "en_US") ||
ffStrStartsWithIgnCase(langValue, "en_US."))
break; // No need to change LANG
oldLang = environ[i];
environ[i] = (char*) "LANG=C.UTF-8"; // Set LANG to C.UTF-8 for consistent output
break;
}
}
}
int ret = posix_spawnp(&childPid, argv[0], &file_actions, NULL, argv, environ);
if (oldLang)
environ[langIndex] = oldLang;
posix_spawn_file_actions_destroy(&file_actions);
if (ret != 0)
{
close(pipes[0]);
close(pipes[1]);
return "posix_spawnp() failed";
}
#else
// https://github.com/termux/termux-packages/issues/25369
childPid = fork();
if(childPid == -1)
{
close(pipes[0]);
@@ -62,18 +144,18 @@ const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool use
return "fork() failed";
}
//Child
if(childPid == 0)
{
int nullFile = open("/dev/null", O_WRONLY | O_CLOEXEC);
//Child
dup2(pipes[1], useStdErr ? STDERR_FILENO : STDOUT_FILENO);
dup2(nullFile, useStdErr ? STDOUT_FILENO : STDERR_FILENO);
setenv("LANG", "C", 1);
putenv("LANG=C.UTF-8");
execvp(argv[0], argv);
_exit(127);
}
//Parent
#endif
close(pipes[1]);
int FF_AUTO_CLOSE_FD childPipeFd = pipes[0];
@@ -84,12 +166,32 @@ const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool use
if (timeout >= 0)
{
struct pollfd pollfd = { childPipeFd, POLLIN, 0 };
if (poll(&pollfd, 1, timeout) == 0)
int pollret = poll(&pollfd, 1, timeout);
if (pollret == 0)
{
kill(childPid, SIGTERM);
waitpid(childPid, NULL, 0);
return "poll(&pollfd, 1, timeout) timeout (try increasing --processing-timeout)";
}
else if (pollret < 0)
{
if (errno == EINTR)
{
// The child process has been terminated. See `chldSignalHandler` in `common/init.c`
if (waitpid(childPid, NULL, WNOHANG) == childPid)
{
// Read remaining data from the pipe
fcntl(childPipeFd, F_SETFL, O_CLOEXEC | O_NONBLOCK);
childPid = -1;
}
}
else
{
kill(childPid, SIGTERM);
waitpid(childPid, NULL, 0);
return "poll(&pollfd, 1, timeout) error";
}
}
else if (pollfd.revents & POLLERR)
{
kill(childPid, SIGTERM);
@@ -104,7 +206,7 @@ const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool use
else if (nRead == 0)
{
int stat_loc = 0;
if (waitpid(childPid, &stat_loc, 0) == childPid)
if (childPid > 0 && waitpid(childPid, &stat_loc, 0) == childPid)
{
if (!WIFEXITED(stat_loc))
return "child process exited abnormally";
@@ -113,10 +215,15 @@ const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool use
// We only handle 127 as an error. See `getTerminalVersionUrxvt` in `terminalshell.c`
return NULL;
}
return "waitpid() failed";
return NULL;
}
else if (nRead < 0)
break;
{
if (errno == EAGAIN)
return NULL;
else
break;
}
};
return "read(childPipeFd, str, FF_PIPE_BUFSIZ) failed";
@@ -147,7 +254,7 @@ void ffProcessGetInfoLinux(pid_t pid, FFstrbuf* processName, FFstrbuf* exe, cons
if (length > 0) // doesn't contain trailing NUL
{
buf[length] = '\0';
ffStrbufEnsureFixedLengthFree(exePath, (uint32_t)length + 1); // +1 for the NUL
ffStrbufEnsureFixedLengthFree(exePath, (uint32_t)length);
ffStrbufAppendNS(exePath, (uint32_t)length, buf);
}
}
@@ -158,10 +265,8 @@ void ffProcessGetInfoLinux(pid_t pid, FFstrbuf* processName, FFstrbuf* exe, cons
int mibs[] = { CTL_KERN, KERN_PROCARGS2, pid };
if (sysctl(mibs, ARRAY_SIZE(mibs), NULL, &len, NULL, 0) == 0)
{// try get arg0
#ifndef MAC_OS_X_VERSION_10_15
//don't know why if don't let len longer, proArgs2 and len will change during the following sysctl() in old MacOS version.
len++;
#endif
FF_AUTO_FREE char* const procArgs2 = malloc(len);
if (sysctl(mibs, ARRAY_SIZE(mibs), procArgs2, &len, NULL, 0) == 0)
{
@@ -195,11 +300,12 @@ void ffProcessGetInfoLinux(pid_t pid, FFstrbuf* processName, FFstrbuf* exe, cons
}
else
{
ffStrbufEnsureFixedLengthFree(exe, PATH_MAX);
int length = proc_pidpath(pid, exe->chars, exe->allocated);
char buf[PROC_PIDPATHINFO_MAXSIZE];
int length = proc_pidpath(pid, buf, ARRAY_SIZE(buf));
if (length > 0)
{
exe->length = (uint32_t) length;
ffStrbufEnsureFixedLengthFree(exe, (uint32_t) length);
ffStrbufAppendNS(exe, (uint32_t) length, buf);
if (exePath)
ffStrbufSet(exePath, exe);
}
@@ -263,8 +369,10 @@ void ffProcessGetInfoLinux(pid_t pid, FFstrbuf* processName, FFstrbuf* exe, cons
psinfo_t proc;
if (ffReadFileData(filePath, sizeof(proc), &proc) == sizeof(proc))
{
ffStrbufSetS(exe, proc.pr_psargs);
ffStrbufSubstrBeforeFirstC(exe, ' ');
const char* args = proc.pr_psargs;
if (args[0] == '-') ++args;
const char* end = strchr(args, ' ');
ffStrbufSetNS(exe, end ? (uint32_t) (end - args) : (uint32_t) strlen(args), args);
}
if (exePath)
@@ -275,7 +383,7 @@ void ffProcessGetInfoLinux(pid_t pid, FFstrbuf* processName, FFstrbuf* exe, cons
if (length > 0) // doesn't contain trailing NUL
{
buf[length] = '\0';
ffStrbufEnsureFixedLengthFree(exePath, (uint32_t)length + 1); // +1 for the NUL
ffStrbufEnsureFixedLengthFree(exePath, (uint32_t)length);
ffStrbufAppendNS(exePath, (uint32_t)length, buf);
}
}
@@ -288,10 +396,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)
@@ -458,6 +586,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";
+21 -3
View File
@@ -81,7 +81,7 @@ const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool use
if (hChildPipeWrite == INVALID_HANDLE_VALUE)
return "CreateFileW(L\"\\\\.\\pipe\\FASTFETCH-$(PID)\") failed";
PROCESS_INFORMATION piProcInfo = {0};
PROCESS_INFORMATION piProcInfo = {};
BOOL success;
@@ -91,9 +91,15 @@ const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool use
.dwFlags = STARTF_USESTDHANDLES,
};
if (useStdErr)
{
siStartInfo.hStdOutput = ffGetNullFD();
siStartInfo.hStdError = hChildPipeWrite;
}
else
{
siStartInfo.hStdOutput = hChildPipeWrite;
siStartInfo.hStdError = ffGetNullFD();
}
FF_STRBUF_AUTO_DESTROY cmdline = ffStrbufCreate();
argvToCmdline(argv, &cmdline);
@@ -130,7 +136,11 @@ const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool use
switch (GetLastError())
{
case ERROR_IO_PENDING:
if (!timeout || WaitForSingleObject(hChildPipeRead, (DWORD) timeout) != WAIT_OBJECT_0)
#if __aarch64__
if (!GetOverlappedResultEx(hChildPipeRead, &overlapped, &nRead, timeout < 0 ? INFINITE : (DWORD) timeout, FALSE))
#else
// To support Windows 7
if (timeout >= 0 && WaitForSingleObject(hChildPipeRead, (DWORD) timeout) != WAIT_OBJECT_0)
{
CancelIo(hChildPipeRead);
TerminateProcess(hProcess, 1);
@@ -138,13 +148,18 @@ const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool use
}
if (!GetOverlappedResult(hChildPipeRead, &overlapped, &nRead, FALSE))
#endif
{
if (GetLastError() == ERROR_BROKEN_PIPE)
return NULL;
CancelIo(hChildPipeRead);
TerminateProcess(hProcess, 1);
return "GetOverlappedResult(hChildPipeRead) failed";
return "GetOverlappedResult"
#if __aarch64__
"Ex"
#endif
"(hChildPipeRead) failed";
}
break;
@@ -169,6 +184,9 @@ bool ffProcessGetInfoWindows(uint32_t pid, uint32_t* ppid, FFstrbuf* pname, FFst
? GetCurrentProcess()
: OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, pid);
if (hProcess == NULL)
return false;
if (gui)
*gui = GetGuiResources(hProcess, GR_GDIOBJECTS) > 0;
+1 -1
View File
@@ -2,7 +2,7 @@
#include "fastfetch.h"
typedef enum FFvarianttype
typedef enum __attribute__((__packed__)) FFvarianttype
{
FF_VARIANT_TYPE_STRING,
FF_VARIANT_TYPE_BOOL,
+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;
+14 -6
View File
@@ -36,11 +36,19 @@
#if FF_HAVE_PTHREAD_NP
#include <pthread_np.h>
#endif
#define FF_THREAD_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
typedef pthread_mutex_t FFThreadMutex;
typedef pthread_t FFThreadType;
static inline void ffThreadMutexLock(FFThreadMutex* mutex) { pthread_mutex_lock(mutex); }
static inline void ffThreadMutexUnlock(FFThreadMutex* mutex) { pthread_mutex_unlock(mutex); }
#if __APPLE__
#include <os/lock.h>
#define FF_THREAD_MUTEX_INITIALIZER OS_UNFAIR_LOCK_INIT
typedef os_unfair_lock FFThreadMutex;
static inline void ffThreadMutexLock(os_unfair_lock* mutex) { os_unfair_lock_lock(mutex); }
static inline void ffThreadMutexUnlock(os_unfair_lock* mutex) { os_unfair_lock_unlock(mutex); }
#else
#define FF_THREAD_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
typedef pthread_mutex_t FFThreadMutex;
static inline void ffThreadMutexLock(FFThreadMutex* mutex) { pthread_mutex_lock(mutex); }
static inline void ffThreadMutexUnlock(FFThreadMutex* mutex) { pthread_mutex_unlock(mutex); }
#endif
static inline FFThreadType ffThreadCreate(void* (* func)(void*), void* data) {
FFThreadType newThread = 0;
pthread_create(&newThread, NULL, func, data);
@@ -57,8 +65,8 @@
struct timespec ts;
if (clock_gettime(CLOCK_REALTIME, &ts) == 0)
{
ts.tv_sec += ts.tv_sec / 1000;
ts.tv_nsec += (ts.tv_nsec % 1000) * 1000000;
ts.tv_sec += timeout / 1000;
ts.tv_nsec += (timeout % 1000) * 1000000;
if (pthread_timedjoin_np(thread, NULL, &ts) != 0)
{
pthread_kill(thread, SIGTERM);
+62
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);
@@ -76,6 +82,62 @@ static inline const char* ffTimeToShortStr(uint64_t msec)
return buf;
}
// Not thread-safe
static inline const char* ffTimeToTimeStr(uint64_t msec)
{
if (msec == 0) return "";
time_t tsec = (time_t) (msec / 1000);
static char buf[32];
strftime(buf, sizeof(buf), "%T", localtime(&tsec));
sprintf(buf + __builtin_strlen("00:00:00"), ".%03u", (unsigned) (msec % 1000));
return buf;
}
#ifdef _WIN32
#pragma GCC diagnostic pop
#endif
typedef struct FFTimeGetAgeResult
{
uint32_t years;
uint32_t daysOfYear;
double yearsFraction;
} FFTimeGetAgeResult;
static inline FFTimeGetAgeResult ffTimeGetAge(uint64_t birthMs, uint64_t nowMs)
{
FFTimeGetAgeResult result = {};
if (__builtin_expect(birthMs == 0 || nowMs < birthMs, 0))
return result;
time_t birth_s = (time_t) (birthMs / 1000);
struct tm birth_tm;
#ifdef _WIN32
localtime_s(&birth_tm, &birth_s);
#else
localtime_r(&birth_s, &birth_tm);
#endif
time_t now_s = (time_t) (nowMs / 1000);
struct tm now_tm;
#ifdef _WIN32
localtime_s(&now_tm, &now_s);
#else
localtime_r(&now_s, &now_tm);
#endif
result.years = (uint32_t) (now_tm.tm_year - birth_tm.tm_year);
if (now_tm.tm_yday < birth_tm.tm_yday)
result.years--;
birth_tm.tm_year += (int) result.years;
birth_s = mktime(&birth_tm);
uint32_t diff_s = (uint32_t) (now_s - birth_s);
result.daysOfYear = diff_s / (24 * 60 * 60);
birth_tm.tm_year += 1;
result.yearsFraction = (double) diff_s / (double) (mktime(&birth_tm) - birth_s) + result.years;
return result;
}
+231 -178
View File
File diff suppressed because it is too large Load Diff
-24
View File
@@ -1,24 +0,0 @@
Usage: fastfetch --color <color>
Shortcut of `fastfetch --color-keys <color> --color-title <color>`.
If no color is set, the main color of the logo will be used.
Following information applies to all settings
<color> must be a color encoding as ANSI escape sequences. It is inserted between "ESC[" and "m".
Infos about them can be found here: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters.
Examples:
35: sets the color to magenta
38;5;38: sets the color to 38th color of ANSI 256 colors
4;92: sets the color to bright green with underline
5;104: blinking text on a blue background
ANSI named colors are also supported:
magenta: equivalent to `35`
underline_bright_green: equivalent to `4;92`
After v2.15.0, some special keys can be used:
keys: use the color set by `--color-keys`
title: use the color set by `--color-title`
output: use the color set by `--color-output`
separator: use the color set by `--color-separator`
-4
View File
@@ -1,4 +0,0 @@
Parsing is not case sensitive. E.g. "--lib-PCI" is equal to "--Lib-Pci"
If a value starts with a ?, it is optional. An optional boolean value defaults to true if not specified.
More detailed help messages for each options can be printed with "-h <option_without_dash_prefix>"
All options can be made permanent with command "fastfetch <options> --gen-config"
-53
View File
@@ -1,53 +0,0 @@
A format string is a string that contains placeholders for values.
These placeholders begin with a '{', containing the index of the value, and end with a '}'.
For example the format string "Values: {1} ({2})", with the values "First" and "My second val", will produce "Values: First (My second val)".
The format string can contain placeholders in any order and have multiple occurrences.
To include spaces when setting from the command line, surround the whole string with double quotes (").
In 2.14.0 or newer, the value indices can be meaningful named tags.
For example: "--title-format '{user-name-colored}{at-symbol-colored}{host-name-colored}'" is equivalent to "--title-format '{6}{7}{8}'"
See "fastfetch -h title-format" for all supported tags.
In 2.17.0 or newer, a truncation length can be specified using syntax '<arg>:<trunc-length>`
For example: "--title-format '{user-name:5}'" will truncate user name into 5-length string.
If '<trunc-length>' is negative, an ellipsis … will be appended at the end when the original string is truncated.
Note: The string length is counted in raw bytes. Multi-byte unicode characters and ANSI escape codes are not taken into account.
In 2.23.0 or newer, `<` or `>` can be specified instead of `:` to set a left or right padding.
For example: "--title-format '{user-name<20}'" will generate `<user-name> `;
"--title-format '{user-name>20}'" will generate ` <user-name>`
In 2.24.0 or newer, `{~startIndex,endIndex}` can be specified to slice a string. Negative index counts back from the end of the 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.
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.
To make formatting easier, a double open curly brace ("{{") will be printed as a single open curly brace and not counted as the beginning of a placeholder.
If a value index is misformatted or wants a non-existing value, it will be printed as is, with the curly braces around it.
If the last placeholder isn't closed, it will be treated like it was at the end of the format string.
To only print something if a variable is set, use "{?<index>} ... {?}".
For example, to only print a second value if it is set, use "{?2} Second value: {2}{?}".
If a "{?}" is found without an opener, it is printed as is.
To only print something if a variable is not set, do the same as with if, just replace every '?' with a '/'.
For example to print a fallback for a second value if it is not set, use "{?2}{2}{?}{/2}Second value fallback{/}".
To stop formatting at any point in the format string, use "{-}".
To print something with color, start a placeholder with a '#' and then the linux terminal color encoding.
"\033[" at the start, and an 'm' at the end is automatically added, so don't do that.
A "{#}" is equivalent to a "{#0}" and resets everything to normal.
For example to print something pink and underline, use "{#4;35}...{#}". "{#underline_magenta}" is also supported. See `fastfetch -h color` for detail.
Information about what the numbers mean can be found here: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters.
Which escape codes are supported and how they look is defined by your terminal.
If a format string evaluates to an empty value, the whole line in the output will be discarded.
You can therefore use --host-format " " to disable host output.
Note that --host-format "" would evaluate as not set, and therefore use the built-in host format
Format string is also the way to go to set a fixed value - just use one without placeholders.
For example when running in headless mode, you could use "--display-format Preferred".
+1 -1
View File
@@ -98,7 +98,7 @@ const char* ffDetectBattery(FFBatteryOptions* options, FFlist* results)
// https://github.com/AsahiLinux/linux/blob/b5c05cbffb0488c7618106926d522cc3b43d93d5/drivers/power/supply/macsmc_power.c#L410-L419
int year = (manufactureDate[0] - '0') * 10 + (manufactureDate[1] - '0') + 2000 - 8;
int month = (manufactureDate[2] - '0') * 10 + (manufactureDate[3] - '0');
int day = (manufactureDate[4] - '0') * 10 + (manufactureDate[3] - '5');
int day = (manufactureDate[4] - '0') * 10 + (manufactureDate[3] - '0');
ffStrbufSetF(&battery->manufactureDate, "%.4d-%.2d-%.2d", year, month, day);
}
}
+63
View File
@@ -0,0 +1,63 @@
#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";
if (extended.last_full_charge == (uint32)-1)
return "Skipped";
FFBatteryResult* battery = (FFBatteryResult*)ffListAdd(results);
ffStrbufInitS(&battery->modelName, extended.model_number);
ffStrbufInitS(&battery->manufacturer, extended.oem_info);
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;
}
+1 -1
View File
@@ -108,7 +108,7 @@ static void parseBattery(int dfd, const char* id, FFBatteryOptions* options, FFl
if (ffReadFileBufferRelative(dfd, "capacity_level", &tmpBuffer))
{
ffStrbufTrimRightSpace(&result->manufacturer);
ffStrbufTrimRightSpace(&tmpBuffer);
if (ffStrbufEqualS(&tmpBuffer, "Critical"))
{
if (result->status.length)
+111
View File
@@ -0,0 +1,111 @@
#include "battery.h"
#include "common/io/io.h"
#include "util/FFstrbuf.h"
#include "util/stringUtils.h"
#include <prop/prop_array.h>
#include <prop/prop_bool.h>
#include <prop/prop_dictionary.h>
#include <prop/prop_object.h>
#include <sys/envsys.h>
#include <prop/proplib.h>
#include <paths.h>
#include <time.h>
#include <unistd.h>
#include <fcntl.h>
const char* ffDetectBattery(FF_MAYBE_UNUSED FFBatteryOptions* options, FFlist* results)
{
FF_AUTO_CLOSE_FD int fd = open(_PATH_SYSMON, O_RDONLY | O_CLOEXEC);
if (fd < 0) return "open(_PATH_SYSMON, O_RDONLY | O_CLOEXEC) failed";
prop_dictionary_t root = NULL;
if (prop_dictionary_recv_ioctl(fd, ENVSYS_GETDICTIONARY, &root) < 0)
return "prop_dictionary_recv_ioctl(ENVSYS_GETDICTIONARY) failed";
bool acConnected = false;
{
prop_array_t acad = prop_dictionary_get(root, "acpiacad0");
if (acad)
{
prop_dictionary_t dict = prop_array_get(acad, 0);
prop_dictionary_get_uint8(dict, "cur-value", (uint8_t*) &acConnected);
}
}
prop_object_iterator_t itKey = prop_dictionary_iterator(root);
for (prop_dictionary_keysym_t key; (key = prop_object_iterator_next(itKey)) != NULL; )
{
if (!ffStrStartsWith(prop_dictionary_keysym_value(key), "acpibat")) continue;
prop_array_t bat = prop_dictionary_get_keysym(root, key);
uint32_t max = 0, curr = 0, dischargeRate = 0;
bool charging = false, critical = false;
prop_object_iterator_t iter = prop_array_iterator(bat);
for (prop_dictionary_t dict; (dict = prop_object_iterator_next(iter)) != NULL;)
{
if (prop_object_type(dict) != PROP_TYPE_DICTIONARY)
continue;
const char* desc = NULL;
if (!prop_dictionary_get_string(dict, "description", &desc))
continue;
if (ffStrEquals(desc, "present"))
{
int value = 0;
if (prop_dictionary_get_int(dict, "cur-value", &value) && value == 0)
continue;
}
else if (ffStrEquals(desc, "charging"))
{
prop_dictionary_get_uint8(dict, "cur-value", (uint8_t*) &charging);
}
else if (ffStrEquals(desc, "charge"))
{
prop_dictionary_get_uint32(dict, "max-value", &max);
prop_dictionary_get_uint32(dict, "cur-value", &curr);
const char* state = NULL;
if (prop_dictionary_get_string(dict, "state", &state) && ffStrEquals(state, "critical"))
critical = true;
}
else if (ffStrEquals(desc, "discharge rate"))
prop_dictionary_get_uint(dict, "cur-value", &dischargeRate);
}
if (max > 0)
{
FFBatteryResult* battery = ffListAdd(results);
battery->temperature = FF_BATTERY_TEMP_UNSET;
battery->cycleCount = 0;
ffStrbufInit(&battery->manufacturer);
ffStrbufInit(&battery->modelName);
ffStrbufInit(&battery->status);
ffStrbufInit(&battery->technology);
ffStrbufInit(&battery->serial);
ffStrbufInit(&battery->manufactureDate);
battery->timeRemaining = -1;
battery->capacity = (double) curr / (double) max * 100.;
if (charging)
ffStrbufAppendS(&battery->status, "Charging, ");
else if (dischargeRate)
{
ffStrbufAppendS(&battery->status, "Discharging, ");
battery->timeRemaining = (int32_t)((double)curr / dischargeRate * 3600);
}
if (critical)
ffStrbufAppendS(&battery->status, "Critical, ");
if (acConnected)
ffStrbufAppendS(&battery->status, "AC Connected");
ffStrbufTrimRight(&battery->status, ' ');
ffStrbufTrimRight(&battery->status, ',');
}
prop_object_iterator_release(iter);
}
prop_object_iterator_release(itKey);
prop_object_release(root);
return NULL;
}
+52
View File
@@ -0,0 +1,52 @@
#include "battery.h"
#include "common/io/io.h"
#include <machine/apmvar.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <fcntl.h>
const char* ffDetectBattery(FF_MAYBE_UNUSED FFBatteryOptions* options, FFlist* result)
{
FF_AUTO_CLOSE_FD int devfd = open("/dev/apm", O_RDONLY | O_CLOEXEC);
if (devfd < 0) return "open(dev/apm, O_RDONLY | O_CLOEXEC) failed";
struct apm_power_info info = {};
if (ioctl(devfd, APM_IOC_GETPOWER, &info) < 0)
return "ioctl(APM_IOC_GETPOWER) failed";
if (info.battery_state == APM_BATTERY_ABSENT)
return NULL;
FFBatteryResult* battery = (FFBatteryResult*) ffListAdd(result);
battery->temperature = FF_BATTERY_TEMP_UNSET;
battery->cycleCount = 0;
battery->timeRemaining = -1;
battery->capacity = info.battery_life;
ffStrbufInit(&battery->manufacturer);
ffStrbufInit(&battery->modelName);
ffStrbufInit(&battery->status);
ffStrbufInit(&battery->technology);
ffStrbufInit(&battery->serial);
ffStrbufInit(&battery->manufactureDate);
if (info.ac_state == APM_AC_ON)
ffStrbufAppendS(&battery->status, "AC Connected");
else if (info.ac_state == APM_AC_BACKUP)
ffStrbufAppendS(&battery->status, "Backup In Use");
else if (info.ac_state == APM_AC_OFF)
{
battery->timeRemaining = (int) info.minutes_left * 60;
ffStrbufAppendS(&battery->status, "Discharging");
}
if (info.battery_state == APM_BATT_CRITICAL || info.battery_state == APM_BATT_CHARGING)
{
if (battery->status.length) ffStrbufAppendS(&battery->status, ", ");
ffStrbufAppendS(&battery->status, info.battery_state == APM_BATT_CRITICAL ? "Critical" : "Charging");
}
return NULL;
}
+19 -28
View File
@@ -8,40 +8,31 @@
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <setupapi.h>
#include <batclass.h>
#include <devguid.h>
#include <cfgmgr32.h>
#include <winternl.h>
static inline void wrapSetupDiDestroyDeviceInfoList(HDEVINFO* hdev)
static const char* detectWithCmApi(FFBatteryOptions* options, FFlist* results)
{
if(*hdev)
SetupDiDestroyDeviceInfoList(*hdev);
}
//https://learn.microsoft.com/en-us/windows-hardware/drivers/install/using-device-interfaces
ULONG cchDeviceInterfaces = 0;
CONFIGRET cr = CM_Get_Device_Interface_List_SizeW(&cchDeviceInterfaces, (LPGUID)&GUID_DEVCLASS_BATTERY, NULL, CM_GET_DEVICE_INTERFACE_LIST_PRESENT);
if (cr != CR_SUCCESS)
return "CM_Get_Device_Interface_List_SizeW() failed";
static const char* detectWithSetupApi(FFBatteryOptions* options, FFlist* results)
{
//https://learn.microsoft.com/en-us/windows/win32/power/enumerating-battery-devices
HDEVINFO hdev __attribute__((__cleanup__(wrapSetupDiDestroyDeviceInfoList))) =
SetupDiGetClassDevsW(&GUID_DEVCLASS_BATTERY, 0, 0, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
if(hdev == INVALID_HANDLE_VALUE)
return "SetupDiGetClassDevsW(&GUID_DEVCLASS_BATTERY) failed";
if (cchDeviceInterfaces <= 1)
return NULL; // Not found
SP_DEVICE_INTERFACE_DATA did = { .cbSize = sizeof(did) };
for(DWORD idev = 0; SetupDiEnumDeviceInterfaces(hdev, NULL, &GUID_DEVCLASS_BATTERY, idev, &did); idev++)
wchar_t* FF_AUTO_FREE mszDeviceInterfaces = (wchar_t*)malloc(cchDeviceInterfaces * sizeof(wchar_t));
cr = CM_Get_Device_Interface_ListW((LPGUID)&GUID_DEVCLASS_BATTERY, NULL, mszDeviceInterfaces, cchDeviceInterfaces, CM_GET_DEVICE_INTERFACE_LIST_PRESENT);
if (cr != CR_SUCCESS)
return "CM_Get_Device_Interface_ListW() failed";
for (const wchar_t* pDeviceInterface = mszDeviceInterfaces; *pDeviceInterface; pDeviceInterface += wcslen(pDeviceInterface) + 1)
{
DWORD cbRequired = 0;
SetupDiGetDeviceInterfaceDetailW(hdev, &did, NULL, 0, &cbRequired, NULL); //Fail with not enough buffer
SP_DEVICE_INTERFACE_DETAIL_DATA_W* FF_AUTO_FREE pdidd = (SP_DEVICE_INTERFACE_DETAIL_DATA_W*)malloc(cbRequired);
if(!pdidd)
break; //Out of memory
pdidd->cbSize = sizeof(*pdidd);
if(!SetupDiGetDeviceInterfaceDetailW(hdev, &did, pdidd, cbRequired, &cbRequired, NULL))
continue;
HANDLE FF_AUTO_CLOSE_FD hBattery =
CreateFileW(pdidd->DevicePath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
CreateFileW(pDeviceInterface, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if(hBattery == INVALID_HANDLE_VALUE)
continue;
@@ -99,7 +90,7 @@ static const char* detectWithSetupApi(FFBatteryOptions* options, FFlist* results
bqi.InformationLevel = BatteryManufactureDate;
BATTERY_MANUFACTURE_DATE date;
if(DeviceIoControl(hBattery, IOCTL_BATTERY_QUERY_INFORMATION, &bqi, sizeof(bqi), &date, sizeof(date), &dwOut, NULL))
ffStrbufSetF(&battery->manufactureDate, "%.4d-%.2d-%.2d", date.Year + 1900, date.Month, date.Day);
ffStrbufSetF(&battery->manufactureDate, "%.4d-%.2d-%.2d", date.Year < 1000 ? date.Year + 1900 : date.Year, date.Month, date.Day);
}
{
@@ -131,7 +122,7 @@ static const char* detectWithSetupApi(FFBatteryOptions* options, FFlist* results
{
BATTERY_STATUS bs;
BATTERY_WAIT_STATUS bws = { .BatteryTag = bqi.BatteryTag };
if(DeviceIoControl(hBattery, IOCTL_BATTERY_QUERY_STATUS, &bws, sizeof(bws), &bs, sizeof(bs), &dwOut, NULL) && bs.Capacity != BATTERY_UNKNOWN_CAPACITY)
if(DeviceIoControl(hBattery, IOCTL_BATTERY_QUERY_STATUS, &bws, sizeof(bws), &bs, sizeof(bs), &dwOut, NULL) && bs.Capacity != BATTERY_UNKNOWN_CAPACITY && bi.FullChargedCapacity != 0)
battery->capacity = bs.Capacity * 100.0 / bi.FullChargedCapacity;
else
battery->capacity = 0;
@@ -271,6 +262,6 @@ static const char* detectWithNtApi(FF_MAYBE_UNUSED FFBatteryOptions* options, FF
const char* ffDetectBattery(FFBatteryOptions* options, FFlist* results)
{
return options->useSetupApi
? detectWithSetupApi(options, results)
? detectWithCmApi(options, results)
: detectWithNtApi(options, results);
}
+1 -1
View File
@@ -25,7 +25,7 @@ const char* ffDetectBios(FFBiosResult* result)
{
ffStrbufSetStatic(&result->type,
ffPathExists("/dev/efi" /*efidev*/, FF_PATHTYPE_FILE) ||
ffPathExists("/boot/efi/efi/" /*efi partition*/, FF_PATHTYPE_DIRECTORY)
ffPathExists("/boot/efi/efi/" /*efi partition. Note /boot/efi exists on BIOS system*/, FF_PATHTYPE_DIRECTORY)
? "UEFI" : "BIOS");
}
}
+1 -1
View File
@@ -4,7 +4,7 @@
#include <stdlib.h>
const char *ffDetectBios(FFBiosResult *bios)
const char* ffDetectBios(FFBiosResult* bios)
{
ffGetSmbiosValue("/sys/devices/virtual/dmi/id/bios_date", "/sys/class/dmi/id/bios_date", &bios->date);
ffGetSmbiosValue("/sys/devices/virtual/dmi/id/bios_release", "/sys/class/dmi/id/bios_release", &bios->release);
+24
View File
@@ -27,6 +27,15 @@ typedef struct _SYSTEM_BOOT_ENVIRONMENT_INFORMATION
};
};
} SYSTEM_BOOT_ENVIRONMENT_INFORMATION;
#elif __OpenBSD__
#include "common/io/io.h"
#include <fcntl.h>
#include <unistd.h>
#elif __sun
#include <libdevinfo.h>
#include <sys/sunddi.h>
#endif
typedef struct FFSmbiosBios
@@ -54,6 +63,7 @@ typedef struct FFSmbiosBios
static_assert(offsetof(FFSmbiosBios, ExtendedBiosRomSize) == 0x18,
"FFSmbiosBios: Wrong struct alignment");
const char* ffDetectBios(FFBiosResult* bios)
{
const FFSmbiosHeaderTable* smbiosTable = ffGetSmbiosHeaderTable();
@@ -89,6 +99,20 @@ const char* ffDetectBios(FFBiosResult* bios)
default: break;
}
}
#elif __sun
di_node_t rootNode = di_init("/", DINFOPROP);
if (rootNode != DI_NODE_NIL)
{
char* efiVersion = NULL;
if (di_prop_lookup_strings(DDI_DEV_T_ANY, rootNode, "efi-version", &efiVersion) > 0)
ffStrbufSetStatic(&bios->type, "UEFI");
else
ffStrbufSetStatic(&bios->type, "BIOS");
}
di_fini(rootNode);
#elif __HAIKU__ || __OpenBSD__
// Currently SMBIOS detection is supported in legancy BIOS only
ffStrbufSetStatic(&bios->type, "BIOS");
#endif
return NULL;
+1 -1
View File
@@ -11,4 +11,4 @@ typedef struct FFBluetoothResult
bool connected;
} FFBluetoothResult;
const char* ffDetectBluetooth(FFlist* devices /* FFBluetoothResult */);
const char* ffDetectBluetooth(FFBluetoothOptions* options, FFlist* devices /* FFBluetoothResult */);
+22 -2
View File
@@ -2,7 +2,15 @@
#import <IOBluetooth/IOBluetooth.h>
const char* ffDetectBluetooth(FFlist* devices /* FFBluetoothResult */)
@interface IOBluetoothDevice()
@property (nonatomic) uint8_t batteryPercentCase;
@property (nonatomic) uint8_t batteryPercentCombined;
@property (nonatomic) uint8_t batteryPercentLeft;
@property (nonatomic) uint8_t batteryPercentRight;
@property (nonatomic) uint8_t batteryPercentSingle;
@end
const char* ffDetectBluetooth(FFBluetoothOptions* options, FFlist* devices /* FFBluetoothResult */)
{
NSArray<IOBluetoothDevice*>* ioDevices = IOBluetoothDevice.pairedDevices;
if(!ioDevices)
@@ -10,11 +18,23 @@ const char* ffDetectBluetooth(FFlist* devices /* FFBluetoothResult */)
for(IOBluetoothDevice* ioDevice in ioDevices)
{
if (!options->showDisconnected && !ioDevice.isConnected)
continue;
FFBluetoothResult* device = ffListAdd(devices);
ffStrbufInitS(&device->name, ioDevice.name.UTF8String);
ffStrbufInitS(&device->address, ioDevice.addressString.UTF8String);
ffStrbufReplaceAllC(&device->address, '-', ':');
ffStrbufUpperCase(&device->address);
ffStrbufInit(&device->type);
device->battery = 0;
if (ioDevice.batteryPercentSingle)
device->battery = ioDevice.batteryPercentSingle;
else if (ioDevice.batteryPercentCombined)
device->battery = ioDevice.batteryPercentCombined;
else if (ioDevice.batteryPercentCase)
device->battery = ioDevice.batteryPercentCase;
device->connected = !!ioDevice.isConnected;
if(ioDevice.serviceClassMajor & kBluetoothServiceClassMajorLimitedDiscoverableMode)
ffStrbufAppendS(&device->type, "Limited Discoverable Mode, ");
+31
View File
@@ -0,0 +1,31 @@
#include "bluetooth.h"
#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
static int enumDev(FF_MAYBE_UNUSED int sockfd, struct bt_devinfo const* dev, FFlist* devices)
{
FFBluetoothResult* device = ffListAdd(devices);
ffStrbufInitS(&device->name,
#if __FreeBSD__
bt_devremote_name_gen(dev->devname, &dev->bdaddr)
#else
dev->devname
#endif
);
ffStrbufInitS(&device->address, bt_ntoa(&dev->bdaddr, NULL));
ffStrbufUpperCase(&device->address);
ffStrbufInit(&device->type);
device->battery = 0;
device->connected = true;
return 0;
}
const char* ffDetectBluetooth(FF_MAYBE_UNUSED FFBluetoothOptions* options, FF_MAYBE_UNUSED FFlist* devices /* FFBluetoothResult */)
{
// struct hostent* ent = bt_gethostent();
if (bt_devenum((void*) enumDev, devices) < 0)
return "bt_devenum() failed";
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;
}
+68 -22
View File
@@ -3,6 +3,7 @@
#ifdef FF_HAVE_DBUS
#include "common/dbus.h"
#include "common/io/io.h"
/* Example dbus reply, striped to only the relevant parts:
array [ //root
@@ -44,16 +45,16 @@ array [ //root
]
*/
static void detectBluetoothValue(FFDBusData* dbus, DBusMessageIter* iter, FFBluetoothResult* device)
static bool detectBluetoothValue(FFDBusData* dbus, DBusMessageIter* iter, FFBluetoothResult* device)
{
if(dbus->lib->ffdbus_message_iter_get_arg_type(iter) != DBUS_TYPE_DICT_ENTRY)
return;
return true;
DBusMessageIter dictIter;
dbus->lib->ffdbus_message_iter_recurse(iter, &dictIter);
if(dbus->lib->ffdbus_message_iter_get_arg_type(&dictIter) != DBUS_TYPE_STRING)
return;
return true;
const char* deviceProperty;
dbus->lib->ffdbus_message_iter_get_basic(&dictIter, &deviceProperty);
@@ -74,6 +75,13 @@ static void detectBluetoothValue(FFDBusData* dbus, DBusMessageIter* iter, FFBlue
}
else if(ffStrEquals(deviceProperty, "Connected"))
ffDBusGetBool(dbus, &dictIter, &device->connected);
else if(ffStrEquals(deviceProperty, "Paired"))
{
bool paired = true;
ffDBusGetBool(dbus, &dictIter, &paired);
if (!paired) return false;
}
return true;
}
static void detectBluetoothProperty(FFDBusData* dbus, DBusMessageIter* iter, FFBluetoothResult* device)
@@ -103,32 +111,37 @@ static void detectBluetoothProperty(FFDBusData* dbus, DBusMessageIter* iter, FFB
do
{
detectBluetoothValue(dbus, &arrayIter, device);
bool shouldContinue = detectBluetoothValue(dbus, &arrayIter, device);
if (!shouldContinue)
{
ffStrbufClear(&device->name);
break;
}
} while (dbus->lib->ffdbus_message_iter_next(&arrayIter));
}
static void detectBluetoothObject(FFlist* devices, FFDBusData* dbus, DBusMessageIter* iter)
static FFBluetoothResult* detectBluetoothObject(FFlist* devices, FFDBusData* dbus, DBusMessageIter* iter)
{
if(dbus->lib->ffdbus_message_iter_get_arg_type(iter) != DBUS_TYPE_DICT_ENTRY)
return;
return NULL;
DBusMessageIter dictIter;
dbus->lib->ffdbus_message_iter_recurse(iter, &dictIter);
if(dbus->lib->ffdbus_message_iter_get_arg_type(&dictIter) != DBUS_TYPE_OBJECT_PATH)
return;
return NULL;
const char* objectPath;
dbus->lib->ffdbus_message_iter_get_basic(&dictIter, &objectPath);
// We don't want adapter objects
if(!ffStrContains(objectPath, "/dev_"))
return;
return NULL;
dbus->lib->ffdbus_message_iter_next(&dictIter);
if(dbus->lib->ffdbus_message_iter_get_arg_type(&dictIter) != DBUS_TYPE_ARRAY)
return;
return NULL;
DBusMessageIter arrayIter;
dbus->lib->ffdbus_message_iter_recurse(&dictIter, &arrayIter);
@@ -145,16 +158,10 @@ static void detectBluetoothObject(FFlist* devices, FFDBusData* dbus, DBusMessage
detectBluetoothProperty(dbus, &arrayIter, device);
} while (dbus->lib->ffdbus_message_iter_next(&arrayIter));
if(device->name.length == 0)
{
ffStrbufDestroy(&device->name);
ffStrbufDestroy(&device->address);
ffStrbufDestroy(&device->type);
--devices->length;
}
return device;
}
static void detectBluetoothRoot(FFlist* devices, FFDBusData* dbus, DBusMessageIter* iter)
static void detectBluetoothRoot(FFlist* devices, FFDBusData* dbus, DBusMessageIter* iter, int32_t connectedCount)
{
if(dbus->lib->ffdbus_message_iter_get_arg_type(iter) != DBUS_TYPE_ARRAY)
return;
@@ -164,11 +171,25 @@ static void detectBluetoothRoot(FFlist* devices, FFDBusData* dbus, DBusMessageIt
do
{
detectBluetoothObject(devices, dbus, &arrayIter);
FFBluetoothResult* device = detectBluetoothObject(devices, dbus, &arrayIter);
if (device)
{
if(device->name.length == 0 || (connectedCount > 0 && !device->connected))
{
ffStrbufDestroy(&device->name);
ffStrbufDestroy(&device->address);
ffStrbufDestroy(&device->type);
--devices->length;
}
if (device->connected && --connectedCount == 0)
break;
}
} while (dbus->lib->ffdbus_message_iter_next(&arrayIter));
}
static const char* detectBluetooth(FFlist* devices)
static const char* detectBluetooth(FFlist* devices, int32_t connectedCount)
{
FFDBusData dbus;
const char* error = ffDBusLoadData(DBUS_BUS_SYSTEM, &dbus);
@@ -186,18 +207,43 @@ static const char* detectBluetooth(FFlist* devices)
return "Failed to get root iterator of GetManagedObjects";
}
detectBluetoothRoot(devices, &dbus, &rootIter);
detectBluetoothRoot(devices, &dbus, &rootIter, connectedCount);
dbus.lib->ffdbus_message_unref(managedObjects);
return NULL;
}
static uint32_t connectedDevices(void)
{
FF_AUTO_CLOSE_DIR DIR* dirp = opendir("/sys/class/bluetooth");
if(dirp == NULL)
return 0;
uint32_t result = 0;
struct dirent* entry;
while ((entry = readdir(dirp)) != NULL)
{
if (strchr(entry->d_name, ':') != NULL)
++result;
}
return result;
}
#endif
const char* ffDetectBluetooth(FF_MAYBE_UNUSED FFlist* devices /* FFBluetoothResult */)
const char* ffDetectBluetooth(FF_MAYBE_UNUSED FFBluetoothOptions* options, FF_MAYBE_UNUSED FFlist* devices /* FFBluetoothResult */)
{
#ifdef FF_HAVE_DBUS
return detectBluetooth(devices);
int32_t connectedCount = -1;
if (!options->showDisconnected)
{
connectedCount = (int32_t) connectedDevices();
if (connectedCount == 0)
return NULL;
}
return detectBluetooth(devices, connectedCount);
#else
return "Fastfetch was compiled without DBus support";
#endif
@@ -1,6 +1,6 @@
#include "bluetooth.h"
const char* ffDetectBluetooth(FF_MAYBE_UNUSED FFlist* devices /* FFBluetoothResult */)
const char* ffDetectBluetooth(FF_MAYBE_UNUSED FFBluetoothOptions* options, FF_MAYBE_UNUSED FFlist* devices /* FFBluetoothResult */)
{
return "Not supported on this platform";
}
+14 -10
View File
@@ -7,7 +7,7 @@
#pragma GCC diagnostic ignored "-Wpointer-sign"
const char* ffDetectBluetooth(FFlist* devices /* FFBluetoothResult */)
const char* ffDetectBluetooth(FFBluetoothOptions* options, FFlist* devices /* FFBluetoothResult */)
{
// Actually bluetoothapis.dll, but it's missing on Windows 7
FF_LIBRARY_LOAD(bluetoothapis, "dlopen bthprops.cpl failed", "bthprops.cpl", 1)
@@ -20,26 +20,27 @@ const char* ffDetectBluetooth(FFlist* devices /* FFBluetoothResult */)
};
HBLUETOOTH_DEVICE_FIND hFind = ffBluetoothFindFirstDevice(&(BLUETOOTH_DEVICE_SEARCH_PARAMS) {
.fReturnConnected = TRUE,
.fReturnRemembered = TRUE,
.fReturnAuthenticated = TRUE,
.fReturnUnknown = TRUE,
.fReturnRemembered = options->showDisconnected,
.fReturnAuthenticated = options->showDisconnected,
.dwSize = sizeof(BLUETOOTH_DEVICE_SEARCH_PARAMS)
}, &btdi);
if(!hFind)
{
if (GetLastError() == ERROR_NO_MORE_ITEMS)
return NULL;
return "BluetoothFindFirstDevice() failed";
}
do {
FFBluetoothResult* device = ffListAdd(devices);
ffStrbufInitWS(&device->name, btdi.szName);
ffStrbufInitF(&device->address, "%02x:%02x:%02x:%02x:%02x:%02x",
btdi.Address.rgBytes[0],
btdi.Address.rgBytes[1],
btdi.Address.rgBytes[2],
btdi.Address.rgBytes[3],
ffStrbufInitF(&device->address, "%02X:%02X:%02X:%02X:%02X:%02X",
btdi.Address.rgBytes[5],
btdi.Address.rgBytes[4],
btdi.Address.rgBytes[5]);
btdi.Address.rgBytes[3],
btdi.Address.rgBytes[2],
btdi.Address.rgBytes[1],
btdi.Address.rgBytes[0]);
ffStrbufInit(&device->type);
device->battery = 0;
device->connected = !!btdi.fConnected;
@@ -121,5 +122,8 @@ const char* ffDetectBluetooth(FFlist* devices /* FFBluetoothResult */)
ffBluetoothFindDeviceClose(hFind);
const char* ffBluetoothDetectBattery(FFlist* result);
ffBluetoothDetectBattery(devices);
return NULL;
}
@@ -0,0 +1,122 @@
extern "C"
{
#include "bluetooth.h"
}
#include "util/windows/wmi.hpp"
#include "util/windows/unicode.hpp"
STDAPI InitVariantFromStringArray(_In_reads_(cElems) PCWSTR *prgsz, _In_ ULONG cElems, _Out_ VARIANT *pvar);
template <typename Fn>
struct on_scope_exit {
on_scope_exit(Fn &&fn): _fn(std::move(fn)) {}
~on_scope_exit() { this->_fn(); }
private:
Fn _fn;
};
extern "C"
const char* ffBluetoothDetectBattery(FFlist* devices)
{
FFWmiQuery query(L"SELECT __PATH FROM Win32_PnPEntity WHERE Service = 'BthHFEnum'", nullptr, FFWmiNamespace::CIMV2);
if(!query)
return "Query WMI service failed";
IWbemClassObject* pInParams = nullptr;
on_scope_exit releaseInParams([&] { pInParams && pInParams->Release(); });
{
IWbemClassObject* pnpEntityClass = nullptr;
if (FAILED(query.pService->GetObjectW(bstr_t(L"Win32_PnPEntity"), 0, nullptr, &pnpEntityClass, nullptr)))
return "Failed to get PnP entity class";
on_scope_exit releasePnpEntityClass([&] { pnpEntityClass && pnpEntityClass->Release(); });
if (FAILED(pnpEntityClass->GetMethod(bstr_t(L"GetDeviceProperties"), 0, &pInParams, NULL)))
return "Failed to get GetDeviceProperties method";
VARIANT devicePropertyKeys;
PCWSTR props[] = { L"{104EA319-6EE2-4701-BD47-8DDBF425BBE5} 2", L"DEVPKEY_Bluetooth_DeviceAddress" };
if (FAILED(InitVariantFromStringArray(props, ARRAY_SIZE(props), &devicePropertyKeys)))
return "Failed to init variant from string array";
on_scope_exit releaseDevicePropertyKeys([&] { VariantClear(&devicePropertyKeys); });
if (FAILED(pInParams->Put(L"devicePropertyKeys", 0, &devicePropertyKeys, CIM_FLAG_ARRAY | CIM_STRING)))
return "Failed to put devicePropertyKeys";
}
while (FFWmiRecord record = query.next())
{
IWbemCallResult* pCallResult = nullptr;
if (FAILED(query.pService->ExecMethod(record.get(L"__PATH").bstrVal, bstr_t(L"GetDeviceProperties"), 0, nullptr, pInParams, nullptr, &pCallResult)))
continue;
on_scope_exit releaseCallResult([&] { pCallResult && pCallResult->Release(); });
IWbemClassObject* pResultObject = nullptr;
if (FAILED(pCallResult->GetResultObject((LONG) WBEM_INFINITE, &pResultObject)))
continue;
on_scope_exit releaseResultObject([&] { pResultObject && pResultObject->Release(); });
VARIANT propArray;
if (FAILED(pResultObject->Get(L"deviceProperties", 0, &propArray, nullptr, nullptr)))
continue;
on_scope_exit releasePropArray([&] { VariantClear(&propArray); });
if (propArray.vt != (VT_ARRAY | VT_UNKNOWN) ||
(propArray.parray->fFeatures & FADF_UNKNOWN) == 0 ||
propArray.parray->cDims != 1 ||
propArray.parray->rgsabound[0].cElements != 2
)
continue;
uint8_t batt = 0;
for (LONG i = 0; i < 2; i++)
{
IWbemClassObject* object = nullptr;
if (FAILED(SafeArrayGetElement(propArray.parray, &i, &object)))
continue;
FFWmiRecord rec(object);
auto data = rec.get(L"Data");
if (data.vt == VT_EMPTY)
break;
if (i == 0)
batt = data.get<uint8_t>();
else
{
FF_STRBUF_AUTO_DESTROY addr; // MAC address without colon
ffStrbufInitWSV(&addr, data.get<std::wstring_view>());
if (__builtin_expect(addr.length != 12, 0))
continue;
FF_LIST_FOR_EACH(FFBluetoothResult, bt, *devices)
{
if (bt->address.length != 12 + 5)
continue;
if (addr.chars[0] == bt->address.chars[0] &&
addr.chars[1] == bt->address.chars[1] &&
addr.chars[2] == bt->address.chars[3] &&
addr.chars[3] == bt->address.chars[4] &&
addr.chars[4] == bt->address.chars[6] &&
addr.chars[5] == bt->address.chars[7] &&
addr.chars[6] == bt->address.chars[9] &&
addr.chars[7] == bt->address.chars[10] &&
addr.chars[8] == bt->address.chars[12] &&
addr.chars[9] == bt->address.chars[13] &&
addr.chars[10] == bt->address.chars[15] &&
addr.chars[11] == bt->address.chars[16])
{
bt->battery = batt;
break;
}
}
}
}
}
return NULL;
}

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