Compare commits

...

565 Commits

Author SHA1 Message Date
Carter Li d317997396 Merge pull request #735 from fastfetch-cli/dev
Release: v2.8.5
2024-02-23 20:36:52 +08:00
李通洲 91dac1563b Release: v2.8.5 2024-02-23 20:34:39 +08:00
李通洲 73cfae97d2 DiskIO / NetIO: fix uninitialized variables 2024-02-23 20:30:54 +08:00
李通洲 78a606c1e1 Doc: update ubuntu ppa 2024-02-23 16:34:23 +08:00
Carter Li f258e484d9 Packaging: update debian stuff 2024-02-23 16:17:57 +08:00
Carter Li ea162fd452 Merge pull request #734 from fastfetch-cli/dev
Release: v2.8.4
2024-02-23 16:09:51 +08:00
李通洲 b80391b183 Release: v2.8.4 2024-02-23 15:56:12 +08:00
李通洲 4c7a9e4394 Doc: update changelog 2024-02-23 10:01:05 +08:00
李通洲 4b747f70a4 Disk (Linux): ensure only physical devices are detected
Ref: https://github.com/fastfetch-cli/fastfetch/issues/731#issuecomment-1955814211
2024-02-23 09:29:39 +08:00
李通洲 5fb4b6dc04 Display: --display-compact-type support *-with-refresh-rate
Ref: https://github.com/fastfetch-cli/fastfetch/discussions/732
2024-02-22 18:45:57 +08:00
李通洲 5e7cfe2976 Display: add option --display-order 2024-02-22 10:47:13 +08:00
李通洲 77db2d84a3 FFstrbuf: remove ffStrbufCompAlphabetically 2024-02-22 10:38:33 +08:00
李通洲 15bb5bfb24 Packages: add ability to disable specified package manager
Fix #729
2024-02-22 10:03:38 +08:00
李通洲 4e9ee9aa03 Package: code cleanup 2024-02-21 15:40:04 +08:00
李通洲 6a0c7ca788 Disk (Linux): try fixing multidevice bcachefs filesystem compatibility
Ref: #731
2024-02-21 09:05:26 +08:00
李通洲 90e99bcf69 Doc: fix invalid commands 2024-02-21 09:05:26 +08:00
Lenny0939 5b20a86d53 Fix mistake in README.md (#730)
Sudo is not necessary to use nix-shell, and puts you in a shell as root which is not ideal
2024-02-20 18:42:59 -06:00
李通洲 6ad1262f4a NetIO: add option --netio-detect-total 2024-02-20 14:44:55 +08:00
李通洲 e0297e1dd1 DiskIO: add option --diskio-detect-total 2024-02-20 14:43:50 +08:00
李通洲 937611aa29 Colors: support JSON config generation 2024-02-15 22:05:34 +08:00
李通洲 eda38e16db Colors: don't print extra empty lines 2024-02-15 21:55:33 +08:00
李通洲 2731756c39 Platform (Windows): small optimization 2024-02-15 20:29:57 +08:00
李通洲 853ca0f608 Platform (Windows): don't assume x86 as i686 2024-02-15 20:29:34 +08:00
李通洲 17f4a6e055 Colors: support block related settings
Fix #721
2024-02-14 22:09:12 +08:00
李通洲 925dc6f681 TerminalFont (Windows): support portable Windows Terminal settings
Fix #720
2024-02-13 19:49:49 +08:00
李通洲 706527eab4 Github: update ISSUE_TEMPLATE 2024-02-13 19:19:29 +08:00
李通洲 3a96ade423 CPU (Linux): don't segfault if we fail to find Vendor ID in lscpu
Fix #718
2024-02-13 19:08:44 +08:00
李通洲 da9c928286 CMake: make artifact file names consistant
Fix #719
2024-02-13 19:02:03 +08:00
Carter Li 30d3d00900 Merge pull request #717 from fastfetch-cli/dev
Release v2.8.3
2024-02-12 10:59:30 +08:00
李通洲 99fce80d0d CI: fix windows artifacts generation 2024-02-12 10:46:57 +08:00
Herby Gillot a5a28e30a0 README: add MacPorts install info (#716)
Add info on installing `fastfetch` on macOS via MacPorts: https://ports.macports.org/port/fastfetch/
2024-02-12 10:43:23 +08:00
李通洲 7fe39353df Release: v2.8.3 2024-02-12 10:28:29 +08:00
李通洲 a3576b3154 CI: release file name without version
Fix #714
2024-02-12 10:28:29 +08:00
AlbydS c5d0d84001 Add installation instructions for even more Linux distributions (#715)
Added Alpine (now with the right command), ALT Linux and Arch AUR to the installation instructions.
2024-02-12 10:20:10 +08:00
李通洲 467ed54a3b GPU (Linux): lazy load pci.ids 2024-02-12 10:12:34 +08:00
Carter 7ea8882843 GPU (FreeBSD): detect correct AMD card names 2024-02-12 18:09:11 +08:00
李通洲 f4cb3bb33f GPU (Linux): use amdgpu.ids 2024-02-12 00:43:06 +08:00
李通洲 330eb9fa21 GPU: show sub-device if available
Try fixing #713
2024-02-11 23:01:14 +08:00
李通洲 1006f513f5 Release: v2.8.2 2024-02-10 14:38:47 +08:00
李通洲 652c4b2e82 CI: don't upload old artifacts 2024-02-10 14:37:27 +08:00
李通洲 3c618a8cd0 Merge remote-tracking branch 'upstream/master' into dev 2024-02-10 14:14:09 +08:00
李通洲 b5821de793 Release: v2.8.1 2024-02-10 14:02:22 +08:00
李通洲 dec604691c CMake: try fixing packaging name conflicting 2024-02-10 13:59:34 +08:00
Carter Li 72baa6cca9 Merge pull request #712 from fastfetch-cli/dev
Release v2.8.0
2024-02-10 12:02:58 +08:00
李通洲 34b023a74f Release: 2.8.0 (ci skip)
For Luna New Year!
2024-02-10 10:32:14 +08:00
李通洲 8249a8ed6a Doc: update changelog 2024-02-09 00:10:29 +08:00
李通洲 7e1ac5e24a Terminal (Windows): code cleanup 2024-02-08 23:15:58 +08:00
李通洲 55c72a8bb3 Camera (Windows): fix Windows Server Core compatibility 2024-02-08 19:14:09 +08:00
Carter Li b602bb20c2 Battery (Linux): print the same format of battery status as other platforms 2024-02-08 14:10:51 +08:00
Carter Li 46ed24275f Battery (FreeBSD): fix typos 2024-02-08 13:59:02 +08:00
Carter Li 71db83f806 PowerAdapter (Linux): don't print not connected either
To align result to macOS
2024-02-08 13:51:30 +08:00
李通洲 0746afa0c2 PowerAdapter (macOS): don't show not connected if no power adapter is detected 2024-02-08 10:53:58 +08:00
李通洲 805c384819 Battery (macOS): don't show an empty battery if no battery is detected 2024-02-08 10:37:06 +08:00
Carter Li 9e4c0e318c Chore: add dpkg related stuff 2024-02-07 14:39:19 +08:00
李通洲 51eaac2fd7 Doc: update changelog 2024-02-06 09:54:33 +08:00
李通洲 92c3df82e6 Logo (Builtin): add PikaOS
Ref: https://github.com/hykilpikonna/hyfetch/pull/231
2024-02-06 09:30:24 +08:00
李通洲 7f238a701e Logo (Builtin): add tatra
Ref: https://github.com/dylanaraps/neofetch/pull/2439
2024-02-06 09:25:44 +08:00
李通洲 72236f62ad Logo (Builtin): add z/OS
Ref: https://github.com/dylanaraps/neofetch/pull/2436
2024-02-06 09:03:01 +08:00
李通洲 51b0c43d76 Platform (Windows): use %USERNAME% if available 2024-02-05 20:01:19 +08:00
李通洲 79e2007d30 Revert "Platform (Linux): use $HOSTNAME if available"
$HOSTNAME doesn't seem to be a standard variable

This reverts commit 02eb604ceb.
2024-02-05 20:01:18 +08:00
李通洲 02eb604ceb Platform (Linux): use $HOSTNAME if available
Ref: #710
2024-02-05 18:23:21 +08:00
李通洲 ce6b2b85f7 Locale (Linux): use environment variable if available
In some machine `setlocale(LC_MESSAGES, NULL)` returns `C` for some reason.
2024-02-05 16:25:12 +08:00
李通洲 48d1980061 CI: build linux old 2024-02-05 14:32:17 +08:00
李通洲 40fae5c5f1 Camera (Android): add empty color space result 2024-02-04 19:07:47 +08:00
李通洲 e296ee1040 CI (Linux): bump version of linux runners
Drop support of Debian 11
2024-02-04 15:48:58 +08:00
李通洲 199e71553d CI: run camera module 2024-02-04 15:14:18 +08:00
李通洲 13fa218e5a Camera: adjust output format 2024-02-04 14:17:18 +08:00
李通洲 eed5efabea Camera (Windows): detect color space 2024-02-04 14:17:18 +08:00
李通洲 d2315e967e Camera (macOS): detect color space 2024-02-04 14:17:18 +08:00
Carter Li cbe3c70480 Camera (Linux): add property colorspace 2024-02-04 14:17:18 +08:00
李通洲 c918226909 Fastfetch: print videodev2 in --list-features 2024-02-04 09:56:22 +08:00
李通洲 18472660ae CI (FreeBSD): remove unused depenencies 2024-02-04 09:27:04 +08:00
李通洲 458c2ccd01 Camera (FreeBSD): enable support
Requires build dependency `v4l_compat`
2024-02-04 09:26:19 +08:00
李通洲 7bb9efcebb Camera (Android): init support 2024-02-02 23:22:40 +08:00
李通洲 8a42dfd68d Camera: tidy; add module to all.jsonc 2024-02-02 22:43:01 +08:00
李通洲 3edd8a6740 Camera (Linux): init support 2024-02-02 22:14:25 +08:00
李通洲 cba22b7155 Camera (Windows): init support 2024-02-02 20:36:22 +08:00
李通洲 246ad6d288 Sound (Windows): tidy 2024-02-02 20:36:22 +08:00
李通洲 295e119810 Camera (macOS): new module 2024-02-02 20:36:22 +08:00
李通洲 cfe22f9524 Terminal (Linux): try fixing #707 (v2) 2024-02-01 17:56:40 +08:00
李通洲 de2c1d7786 CI: unify artifacts name (v2) 2024-02-01 16:00:33 +08:00
李通洲 7d74339aa0 CI: build in parallel 2024-02-01 15:43:56 +08:00
李通洲 7589e962c2 CI: unify artifact names 2024-02-01 15:25:05 +08:00
李通洲 9a189694f9 CI: silence more warnings 2024-02-01 15:24:07 +08:00
李通洲 4069fbfe7b CI: upgrade codeql-action 2024-02-01 15:02:37 +08:00
李通洲 7ccd886909 CI: build aarch64 binaries 2024-02-01 14:29:28 +08:00
李通洲 42957356b2 GPU: remove libpci related stuff 2024-02-01 13:38:15 +08:00
李通洲 9038cd32b2 Terminal (Linux): don't assume blackbox is build for flatpak 2024-02-01 09:14:06 +08:00
李通洲 128c3bfea6 TerminalShell (Linux): try supporting blackbox
Fix #707
2024-02-01 09:02:49 +08:00
李通洲 60ed822f6a GPU (Linux): fix detection in some cases 2024-01-31 18:58:48 +08:00
Carter Li 527ec1bc61 Logo (Builtin): add asahi2; make asahi logo actually work 2024-01-31 16:47:22 +08:00
Carter Li cbf203901b CPU (Linux): code refactor 2024-01-31 14:36:00 +08:00
Carter Li cf6f3dbe0c CI (Windows): fix build 2024-01-31 13:35:57 +08:00
Carter Li ab625497ce CPU (Linux): code refactor 2024-01-31 13:28:18 +08:00
Yussef Dalton 83532b68dd CPU (Linux): use marketing name on Asahi Linux 2024-01-31 11:02:41 +08:00
Carter Li cd2a1495b8 GPU (FreeBSD): use ffGPUParsePciIds 2024-01-31 10:39:09 +08:00
Carter Li b01d2bdd8c GPU (Linux): rewrite; drop libpci dependency 2024-01-31 10:20:49 +08:00
Carter Li 736d5316cc Merge pull request #705 from fastfetch-cli/dev
Release v2.7.1
2024-01-30 19:25:55 +08:00
李通洲 efe42a2c7d GPU: fix a copy-paste error 2024-01-30 18:54:26 +08:00
李通洲 ee07755139 Release: v2.7.1 2024-01-30 18:45:56 +08:00
李通洲 3d924eeadd Merge remote-tracking branch 'upstream/master' into dev 2024-01-30 18:27:24 +08:00
李通洲 aaa091f23b Terminal (Linux): fix segfault 2024-01-30 15:22:26 +08:00
李通洲 53cd1e5378 DateTime: print timezone info; simplify code 2024-01-29 22:01:54 +08:00
李通洲 3747683f0d GPU: add vendor code of QTI & MTK 2024-01-29 21:49:42 +08:00
李通洲 59c1e3d8c5 Platform: detect real path of exe path 2024-01-28 10:45:21 +08:00
Carter Li 1206f6d2ba Merge pull request #701 from fastfetch-cli/dev
Release v2.7.0
2024-01-26 11:06:32 +08:00
李通洲 9aad3e339a CMake: remove unused deps 2024-01-26 10:44:20 +08:00
李通洲 ef9221f305 CI: generate sha512sums [no ci] 2024-01-26 10:41:31 +08:00
李通洲 391a3a0430 Release: v2.7.0
Bump minor version because of rewriting the FreeBSD GPU detection code
2024-01-26 10:23:44 +08:00
李通洲 6b0314f14b Platform: fix exe path detection 2024-01-26 10:19:21 +08:00
李通洲 8e316eb080 Release: v2.6.4 2024-01-26 10:10:11 +08:00
李通洲 999f2170fe Terminal: ignore sshd 2024-01-26 09:53:12 +08:00
李通洲 0282b884cc OpenCL: fix possible segfaults
Found in Alpine Linux
2024-01-26 09:38:08 +08:00
李通洲 ef7e6d0a6a GPU (WSL): fix uninitialized variables 2024-01-26 09:20:58 +08:00
李通洲 77253a8d81 GPU (FreeBSD): better name detection 2024-01-26 09:20:58 +08:00
Carter Li 2041272f5f GPU (Linux): simpify code 2024-01-25 18:32:40 +08:00
Carter Li d2a41bdfe1 GPU (FreeBSD): drop pciutils dep 2024-01-25 10:33:06 +08:00
Carter Li 025a708ecb Shell: remove trailing \0 in JSON output 2024-01-25 10:33:06 +08:00
John Mertz 4e2c124442 ASCII logos for fedora immutable variants (#700)
Container Linux is also deprecated and continued as Fedora CoreOS
2024-01-23 23:38:41 -06:00
李通洲 79ba9d7a68 TerminalShell (Linux): fix segfault 2024-01-23 18:51:00 +08:00
李通洲 ee60ec3530 TerminalShell: don't detect sh as a terminal 2024-01-23 16:38:43 +08:00
李通洲 9d7cbb0fe3 Revert "3rdparty: use a newer wcwidch implementation"
Unwanted change

This reverts commit 28ea765f19.
2024-01-23 14:42:00 +08:00
李通洲 0b98a14977 Fastfetch: don't expand envs in --config
Since it can only be used in command line
2024-01-23 13:14:53 +08:00
李通洲 8f51763374 Linux: allow command substitution when expanding paths
Ref: https://github.com/fastfetch-cli/fastfetch/discussions/698
2024-01-23 13:13:30 +08:00
李通洲 28ea765f19 3rdparty: use a newer wcwidch implementation 2024-01-23 10:19:02 +08:00
李通洲 5378d05bfb Doc: update changelog 2024-01-22 19:33:27 +08:00
李通洲 bbf04f0d40 Doc: add TerminalTheme 2024-01-22 18:50:11 +08:00
李通洲 ec6195133b TerminalTheme: add new module 2024-01-22 16:40:27 +08:00
李通洲 fa8c99601c TerminalSize: tidy 2024-01-22 14:34:19 +08:00
李通洲 a5d5de90f8 Terminal (Linux): support screen version detection 2024-01-22 14:33:55 +08:00
李通洲 994fd359a5 Terminal (Linux): fix kgx version detection 2024-01-22 11:10:40 +08:00
李通洲 a9a5790cba TerminalShell (Linux): improve terminal detection by env 2024-01-22 11:10:40 +08:00
李通洲 31b3fe403a Wifi (Linux): remove trailing \n
Fix #697
2024-01-22 11:10:30 +08:00
李通洲 14b74fe51d Doc: update issue template 2024-01-22 09:10:03 +08:00
Carter Li 35a5a03cd7 Merge pull request #696 from fastfetch-cli/dev
Release v2.6.3
2024-01-21 23:04:15 +08:00
李通洲 f927b8ea87 Release: v2.6.3 2024-01-21 23:01:49 +08:00
李通洲 ebefcec3e2 Bluetooth: fix result printing 2024-01-21 23:00:38 +08:00
Carter Li c151bf0b37 Merge pull request #695 from fastfetch-cli/dev
Release v2.6.2
2024-01-21 17:54:12 +08:00
李通洲 a767104b96 TerminalShell (Windows): more variable initialization fixes 2024-01-21 17:52:03 +08:00
Carter Li 18fced9b2e Merge pull request #694 from fastfetch-cli/dev
Release 2.6.2
2024-01-21 17:46:02 +08:00
李通洲 713ef0ce34 Release: v2.6.2 2024-01-21 17:41:34 +08:00
李通洲 5b2db02bc1 CI: Fix building for GCC in Windows 2024-01-21 17:39:31 +08:00
Carter Li 0f69dc5980 Merge pull request #692 from fastfetch-cli/dev
Release 2.6.1
2024-01-20 22:34:06 +08:00
李通洲 6af57ff5b6 Doc: update changelog 2024-01-20 22:20:28 +08:00
Carter Li 7d7789565b PowerAdapter (macOS): improve detection for Intel macbook 2024-01-20 21:46:57 +08:00
Carter Li 0eb76e9636 Battery (macOS): improve manufacture info detection 2024-01-20 21:38:24 +08:00
李通洲 8b1ee64a3e GPU (macOS): fix gpu type detection 2024-01-20 20:57:33 +08:00
李通洲 b0acf168bf Doc: update changelog 2024-01-20 20:14:56 +08:00
李通洲 7ddc207574 Percentage: add options --percent-color-* 2024-01-20 20:06:42 +08:00
李通洲 d1a791b333 Global: make threshold of percentage colors configurable
Fix #689
2024-01-20 18:40:12 +08:00
李通洲 62ca495155 Percentage: prepare to make threshold configurable 2024-01-20 14:10:56 +08:00
李通洲 e7974a7cea Percentage: refactor function names 2024-01-20 13:49:04 +08:00
李通洲 24cb83dd18 Bluetooth / Gamepad / Sound: support percentage number formatting 2024-01-20 13:48:42 +08:00
李通洲 da5c44b3d0 Percentage: simplify usage of ffAppendPercentBar 2024-01-20 13:27:55 +08:00
李通洲 bd71aa931f Global: rename common/bar to common/percent 2024-01-20 11:28:38 +08:00
李通洲 4d1f242e1d Terminal (Windows): tidy 2024-01-19 22:23:32 +08:00
李通洲 d810245d55 Doc: update changelog 2024-01-19 21:54:44 +08:00
李通洲 06181ec433 Terminal (Windows): default default terminal to conhost 2024-01-19 21:54:44 +08:00
李通洲 8404ae034f Locale: improve detection
Linux: always use `setlocale`, fix #688
Windows: don't append `UTF-8`
2024-01-19 21:15:05 +08:00
李通洲 8e7d465333 Fastfetch: create sub folders when writing config file
Fix #690
2024-01-19 21:01:02 +08:00
李通洲 87813b3306 Shell: detect associated TTY 2024-01-19 16:43:08 +08:00
李通洲 9610a1ab23 TerminalShell (Windows): simplify nested shell detection by looking up GUI objects 2024-01-19 15:00:10 +08:00
李通洲 5f14781970 TerminalShell (Windows): set exePath 2024-01-19 14:40:07 +08:00
Carter Li 356488be0c TerminalShell (FreeBSD): detect real exe path 2024-01-19 14:40:07 +08:00
Carter Li e013c87890 TerminalShell (Linux): detect real exe path 2024-01-19 14:40:07 +08:00
李通洲 7d78d92a92 TerminalShell (macOS): detect full exe path 2024-01-19 14:40:07 +08:00
李通洲 06af39835a Terminal: don't use login as terminal process; set ppid 2024-01-19 14:40:07 +08:00
Carter Li eee8fb78d2 Shell (FreeBSD): detect arg0 instead of exe path 2024-01-19 14:40:07 +08:00
Carter Li 413f91260d Processes (FreeBSD): don't count sub-threads as processes 2024-01-19 14:40:07 +08:00
李通洲 a44daa04d6 Shell (Windows): better support xonsh detection 2024-01-18 18:08:08 +08:00
李通洲 d6cb405afe Release: v2.6.1 2024-01-18 15:31:36 +08:00
李通洲 b2a853cb6e Doc: update changelog 2024-01-18 15:28:49 +08:00
李通洲 0168f2e9a8 Shell: improve xonsh version detection 2024-01-18 15:27:31 +08:00
李通洲 3992d85eb6 CPU (Linux): show vendor if no model name available 2024-01-18 15:16:46 +08:00
李通洲 5096180e92 CPU (Linux): don't access out-of-bound memory 2024-01-18 15:06:47 +08:00
李通洲 947d2ff0a9 Processing (Linux): return error when command is not found 2024-01-18 14:54:14 +08:00
李通洲 1e4f174415 Shell (macOS): improve handling of xonsh 2024-01-18 14:07:29 +08:00
李通洲 2808b1a653 TerminalShell: improve xonsh version detection 2024-01-17 23:45:39 +08:00
李通洲 c749f214e0 Global: silence warnings when building in 32bit environments 2024-01-17 23:12:55 +08:00
Carter Li d0d9831d41 Merge pull request #686 from fastfetch-cli/dev
Release v2.6.0
2024-01-17 15:20:56 +08:00
李通洲 b3945e277c Global: review code 2024-01-17 15:06:52 +08:00
李通洲 9f77851176 JsonSchema: make it a valid json document 2024-01-17 14:08:31 +08:00
李通洲 963eaa5395 Release: v2.6.0 2024-01-17 14:02:07 +08:00
李通洲 07dfe57386 Doc: update changelog 2024-01-17 14:00:55 +08:00
Carter Li a3c0085e2b Sound: tidy 2024-01-17 13:31:34 +08:00
Carter Li c8f28e4c79 Sound (FreeBSD): don't use mixer.h
It's only supported in FreeBSD 14 and later
2024-01-17 10:22:56 +08:00
Carter Li 861eea5899 Sound (FreeBSD): new impl; drop pulseaudio dep 2024-01-16 17:40:41 +08:00
李通洲 1227799a38 Vulkan: print platformApi in JSON format 2024-01-15 18:14:40 +08:00
李通洲 35d1497053 Doc: update changelog 2024-01-15 15:48:39 +08:00
李通洲 ea3734f004 Locale (Windows): fix typo 2024-01-15 15:48:32 +08:00
李通洲 5d35dade60 DisplayServer (Windows): don't detect unknown display type as external 2024-01-15 15:22:33 +08:00
李通洲 0c844fc342 FFstrbuf: don't crash with ffStrbufInitStatic(&buf, NULL) 2024-01-15 15:22:33 +08:00
李通洲 c1ed0a4e91 Locale (Windows): print standard format 2024-01-15 15:22:33 +08:00
李通洲 e1af6fc0fe Locale: display only LC_MESSAGES if available, which is used by gettext 2024-01-15 14:27:29 +08:00
李通洲 c1d41a36bb CMake: fix build in macOS with -DENABLE_SYSTEM_YYJSON 2024-01-15 14:21:23 +08:00
李通洲 958bde228b Doc: fix typo 2024-01-15 13:30:18 +08:00
李通洲 6655c446ba Revert "Image: silence compiler warnings"
This reverts commit afa0a7dac8.
2024-01-15 13:15:43 +08:00
李通洲 43657e8fd6 Doc: update changelog 2024-01-15 11:29:29 +08:00
李通洲 38f216291e CMake: use system <yyjson.h> in fastfetch.c and flashfetch.c too
Fix #684
2024-01-15 11:22:42 +08:00
Carter Li 01de158bba Vulkan: print instance version if no vulkan drivers found 2024-01-15 10:33:55 +08:00
李通洲 5a34b8d01f Vulkan: error out if no results detected 2024-01-15 09:39:03 +08:00
李通洲 afa0a7dac8 Image: silence compiler warnings 2024-01-15 09:13:14 +08:00
李通洲 974ee2ab0d TerminalShell: fix wezterm name pretty printing 2024-01-14 17:26:54 +08:00
李通洲 ab1e3db665 Shell (Linux): detect ash version 2024-01-13 23:39:17 +08:00
李通洲 95b64622c4 Terminal (Linux): fix detection 2024-01-13 23:39:17 +08:00
李通洲 d3c7529c45 Processing (Windows): don't use CreateEventW 2024-01-13 13:38:53 +08:00
李通洲 89db425a03 Gamepad (Windows): use nonblocking read to get battery information 2024-01-13 13:33:29 +08:00
apocelipes 269ad36df5 refactor(TerminalShell): changing recursion into loops 2024-01-12 23:56:04 +08:00
李通洲 22cdb1247f TerminalShell: tidy; use case senstive string comparation where meaningful 2024-01-12 21:21:42 +08:00
李通洲 905ed76ddd TerminalShell: split terminal and shell detection code further 2024-01-12 20:58:45 +08:00
李通洲 6da57d64c3 TerminalShell: split terminal detection and shell detection 2024-01-12 16:44:19 +08:00
李通洲 37e0a7b03f stringUtils: tidy 2024-01-11 16:27:53 +08:00
李通洲 0c65cdc1f5 GPU (macOS): detect memory usage 2024-01-11 10:11:50 +08:00
李通洲 653e689f18 GPU (macOS): tidy 2024-01-11 09:55:13 +08:00
李通洲 a8aaf605b1 Doc: update changelog 2024-01-10 19:04:47 +08:00
李通洲 5f638a67ed Battery: rename manufacturerDate to manufactureDate 2024-01-10 19:03:58 +08:00
李通洲 0645f559af Monitor: detect serial number and manufacture date 2024-01-10 19:01:54 +08:00
李通洲 f5a57ab747 Doc: update changelog 2024-01-10 14:48:47 +08:00
李通洲 92e05f7e38 Chassis: don't print useless version 2024-01-10 14:44:14 +08:00
李通洲 8ba031b761 Brightness (FreeBSD): don't print empty () 2024-01-10 14:22:56 +08:00
李通洲 fdb68669f4 Battery (macOS): support manufacture date detection 2024-01-10 13:26:54 +08:00
李通洲 12155e029b Battery (Linux): support manufacture date detection 2024-01-09 23:08:19 +08:00
李通洲 7926b74917 Battery: detect manufacturer date 2024-01-09 22:58:32 +08:00
Carter Li 61af59fc00 Battery (Linux): fix temperature detection 2024-01-09 16:34:04 +08:00
李通洲 bc52613410 Gamepad: rename identifier to serial number 2024-01-09 15:53:42 +08:00
李通洲 f84bb1ebe2 Smbios: silence compiler warnings 2024-01-09 15:46:19 +08:00
李通洲 a160bc8de5 Gamepad (macOS): detect manufacturer 2024-01-09 15:28:03 +08:00
Carter Li cb599c6f2a Display (FreeBSD): support resolution detection in console 2024-01-08 16:03:07 +08:00
Carter Li 5693700c16 Bios (FreeBSD): fix boot type detection on some weird platforms 2024-01-08 16:02:52 +08:00
Carter Li e8c067ff3d Wifi (Linux): don't print invalid information 2024-01-08 11:32:39 +08:00
Carter Li 80cc4e3f4a Host (Linux): detect serial number for Asahi Linux 2024-01-08 11:19:35 +08:00
李通洲 8e78fadbeb Gamepad: don't provide device names of XBox compatible controllers 2024-01-08 10:38:40 +08:00
李通洲 1215eb06ca Gamepad (Windows): support battery detection of NS Pro 2024-01-07 19:07:15 +08:00
李通洲 2aa899d83c Gamepad (Linux): support battery level detection of NS Pro controller 2024-01-07 17:59:50 +08:00
李通洲 cf096eb101 Gamepad (Windows): detect serial number and battery (PS4 controller) 2024-01-06 23:43:35 +08:00
李通洲 5b4a26393d Gamepad (Linux): detect battery capacity 2024-01-06 20:40:20 +08:00
李通洲 2ba878cbab Monitor (Linux): fix detection with Nvidia drivers
NVIDIA DRM driver reports `enabled` to be `disabled`
2024-01-06 19:12:36 +08:00
李通洲 0af40ab6a3 Settings (FreeBSD): don't append trailing \0 2024-01-06 18:47:16 +08:00
李通洲 b9777bec77 Chassis: detect serial number 2024-01-06 18:35:10 +08:00
李通洲 8801921d02 Smbios: trim spaces 2024-01-06 18:33:57 +08:00
李通洲 c0c32456e8 Board: detect serial number 2024-01-06 18:12:51 +08:00
李通洲 640fa146c1 CPU (Windows): only use smbios to detect maximum speed
Because some virtual machines report invalid information
2024-01-06 18:00:59 +08:00
李通洲 de91429e1a CI: fix build 2024-01-06 17:11:39 +08:00
李通洲 1621484c96 CPU (Windows): don't report 30GHz in VMware 2024-01-06 17:11:26 +08:00
李通洲 d8297d296e CPU (Windows): use ThreadCount if GetLogicalProcessorInformationEx() fails 2024-01-06 17:11:26 +08:00
李通洲 48bb82c8fb Board (Windows): use SMBIOS result 2024-01-06 17:11:26 +08:00
李通洲 c1c7f7b93f Bios (Windows): use SMBIOS result 2024-01-06 17:11:26 +08:00
李通洲 1d35811253 Windows: make SMBIOS data a singleton 2024-01-06 17:11:26 +08:00
李通洲 fe0b43d92d CPU (Windows): detect the actual maximum frequency 2024-01-06 17:11:26 +08:00
李通洲 446fe907d2 Smbios: add comments, tidy 2024-01-06 17:11:26 +08:00
李通洲 d578f1006c Host / Chassis (Windows): remove options --*-use-wmi 2024-01-06 17:11:26 +08:00
李通洲 33f3199383 Host / Chassis (Windows): parse SMBIOS data directly 2024-01-06 17:11:25 +08:00
李通洲 21f3875c4f Host (Windows): detect serial number and UUID 2024-01-06 17:11:25 +08:00
李通洲 6bcd75835e Host: rename properties 2024-01-05 20:38:29 +08:00
李通洲 24cec76251 Host (Linux): detect serial number and uuid 2024-01-05 16:33:52 +08:00
李通洲 f8ac56691f Host (FreeBSD): detect serial number and uuid 2024-01-05 16:32:34 +08:00
李通洲 810112cb26 Host (macOS): detect serial number and uuid 2024-01-05 16:29:38 +08:00
李通洲 2340c2afd7 Board (macOS): print internal name instead of model indentifier
and actually detect the vendor
2024-01-05 16:24:43 +08:00
李通洲 b6c8649cbf macOS: improve IO service related code generally 2024-01-05 15:00:50 +08:00
李通洲 92a6b01133 Brightness (Apple): code optimise and fix mem leaks 2024-01-05 13:20:47 +08:00
李通洲 396112e8ea PowerAdapter: simplify implementation and support serial number detection 2024-01-05 11:01:32 +08:00
李通洲 5eacd0bb8e Battery (Apple): use less hard coded strings 2024-01-05 11:01:32 +08:00
李通洲 ea3ea196aa Battery (Linux): simplify temp detection 2024-01-05 11:01:32 +08:00
李通洲 0e6be69eb8 GPU (Linux): try detect GPU type 2024-01-04 18:50:38 +08:00
李通洲 d69e19377e Doc: update changelog 2024-01-04 16:31:41 +08:00
李通洲 f4f466d4ba Battery: print serial number 2024-01-04 16:21:19 +08:00
李通洲 10b2fe13bd Battery (Windows): detect serial number 2024-01-04 16:20:48 +08:00
李通洲 b5dc4f59f1 Battery (macOS): detect serial number 2024-01-04 16:04:34 +08:00
李通洲 7c0b743c61 Merge remote-tracking branch 'origin/master' into dev 2024-01-04 15:33:16 +08:00
李通洲 6bd909c89d Doc: update changelog 2024-01-04 15:27:31 +08:00
李通洲 1fef41241a Presets: fix formatation 2024-01-04 15:27:31 +08:00
Carter Li 5c75e271ef PowerAdapter (Linux): add support 2024-01-04 15:16:51 +08:00
Carter Li b6b1993f62 Battery (Linux): code refactor, support serial number detection 2024-01-04 15:16:51 +08:00
Carter Li cd0109c382 Battery (Linux): remove option --battery-dir
It was added in c5c3cecb93 but there was no comment or issues linked to indicate why it was necessary.

`/sys/class/power_supply` is standardized in <https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-power>. I don't I want to support non-standard platform unless proper reason is given
2024-01-04 14:18:33 +08:00
Carter Li 6698283430 GPU: fix vendor detection for asahi 2024-01-04 10:29:02 +08:00
李通洲 83ce3e4554 Wallpaper (macOS): support Sonoma 2024-01-03 10:15:56 +08:00
李通洲 ff0f91dc3c macOS: fix mem leaks 2024-01-03 10:12:48 +08:00
李通洲 ab028964bf GPU (WSL): add missing FF_USE_PROPRIETARY_GPU_DRIVER_API macro guards 2024-01-02 18:47:06 +08:00
李通洲 21353b8256 CMake (GPU): change ENABLE_NVIDIA_GPU to ENABLE_PROPRIETARY_GPU_DRIVER_API 2024-01-02 10:49:03 +08:00
Viorel 0a1de91a29 Add option for NVIDIA GPU support 2024-01-01 22:18:03 +08:00
Carter Li b80da99fac Merge pull request #677 from fastfetch-cli/dev
Release: v2.5.0
2024-01-01 11:52:51 +08:00
李通洲 a95a80aa93 README: remove invalid info 2024-01-01 10:50:04 +08:00
AlbydS 553338b2bc Add more Linux distributions to installation guide
I added Alpine Linux, NixOS and openSUSE to the installation guide.
2024-01-01 10:29:57 +08:00
李通洲 a56c092a78 Release: v2.5.0
Happy new year!
2023-12-31 18:44:32 +08:00
李通洲 3f553b3266 Doc: update changelog 2023-12-31 18:43:44 +08:00
Souma cae4b1c657 chore(terminalshell_linux.c): Ignore cwterm as well as figterm
Since CodeWhisperer overrides the terminal environment.
2023-12-31 18:19:04 +08:00
李通洲 bb489f9af3 Common: get rid of detection/internal.h 2023-12-30 18:13:54 +08:00
李通洲 275b53c6c0 Vulkan: don't print software renderers 2023-12-30 18:12:21 +08:00
李通洲 adae31304d Media (macOS): tidy 2023-12-30 14:21:52 +08:00
李通洲 db6d5d7fd6 Windows: get rid of InitOnceExecuteOnce 2023-12-30 14:19:25 +08:00
Carter Li bce96cf3f0 Doc: update changelog 2023-12-29 23:35:47 +08:00
Carter Li 0707902532 PhysicalDisk (Apple): trim strings 2023-12-29 23:33:16 +08:00
李通洲 ef1d102e05 GPU (Windows): clean up vendor name 2023-12-29 23:13:44 +08:00
李通洲 c1f511c8f2 GPU: detect supported platform graphic API version 2023-12-29 23:13:44 +08:00
李通洲 0284f6bfd1 Font: tidy 2023-12-28 15:42:07 +08:00
李通洲 6d50f1efdd Doc: update changelog 2023-12-28 15:12:20 +08:00
李通洲 4066c0d9e8 PhysicalDisk (Windows): improve stability 2023-12-28 14:50:39 +08:00
李通洲 150e9fc650 PhysicalDisk: prettify interconnect type 2023-12-28 13:47:21 +08:00
李通洲 36bce8fb0e PhysicalDisk (macOS): fix a possible segfault 2023-12-28 13:41:40 +08:00
Carter Li e5e70c1d92 PhysicalDisk (Linux): prettify interconnect type 2023-12-28 10:31:28 +08:00
Carter Li 12065bcfb0 PhysicalDisk (Linux): display nvme namespace id if needed 2023-12-28 10:28:21 +08:00
Carter Li 73a30da7bc Disk (FreeBSD): detect partition name 2023-12-27 16:26:58 +08:00
Carter Li 01fb491289 PhysicalDisk (FreeBSD): detect NVMe connect type 2023-12-27 15:32:17 +08:00
李通洲 6c4a4bfe13 Disk (macOS): support name detection of iso volumes 2023-12-27 14:15:50 +08:00
Carter Li 62647c3cb9 PhysicalDisk (FreeBSD): add comments 2023-12-27 11:14:15 +08:00
Carter Li 42694042f5 PhysicalDisk (FreeBSD): fix read-only type detection 2023-12-27 11:03:01 +08:00
李通洲 d5997b9f29 Doc: document --physicaldisk-temp 2023-12-27 10:16:33 +08:00
李通洲 969a67ed0f PhysicalDisk (macOS): detect temp 2023-12-27 10:00:29 +08:00
李通洲 54bd4346ec Temps (macOS): rename functions 2023-12-27 08:46:49 +08:00
李通洲 17d6f84850 Temps (macOS): update sensors of M2X 2023-12-27 08:45:02 +08:00
李通洲 0972eb6986 PhysicalDisk: detect temp 2023-12-26 19:57:24 +08:00
李通洲 0ee892f2de Disk (Linux): simplify impl of detecting partition removable 2023-12-26 18:58:05 +08:00
Carter Li b1f54ab7a2 Battery (Linux): fix temp detection for asahi 2023-12-26 16:44:13 +08:00
Carter Li 5a372882fa Battery (Linux): tidy 2023-12-26 16:44:13 +08:00
李通洲 16d34b6933 Doc: update changelog 2023-12-26 15:50:48 +08:00
李通洲 f319a80dc5 CPU (Linux): if we failed to detect the number of physical cores, assume all logical cores are physical 2023-12-26 13:40:41 +08:00
李通洲 60f5cc9079 CPU (Linux): don't print - 2023-12-26 13:34:58 +08:00
Carter Li dd3b3f22ba CPU (Linux): detect multi cpu models by lscpu
Supports asahi linux
2023-12-26 11:20:40 +08:00
Carter Li e672e40f8b GPU: detect devices by OpenGL
which works for asahi linux
2023-12-26 11:19:33 +08:00
李通洲 91089a7fe9 PhysicalDisk (Windows): init variables 2023-12-25 20:02:41 +08:00
李通洲 677f39420b PhysicalDisk: print product revision 2023-12-25 18:33:39 +08:00
李通洲 f2da8305c7 PhysicalDisk (Windows): detect revision 2023-12-25 18:22:04 +08:00
李通洲 060082885b PhysicalDisk: rename firmwareRev to revision 2023-12-25 18:21:23 +08:00
李通洲 3134a04b5c PhysicalDisk (Linux): don't append diskseq 2023-12-25 18:12:02 +08:00
李通洲 d3bcef61da PhysicalDisk (macOS): detect firmware revision 2023-12-25 16:40:59 +08:00
Carter Li b2cabd2af7 PhysicalDisk (Linux): detect firmware revision 2023-12-25 16:32:34 +08:00
Carter Li 5e85864ab0 PhysicalDisk (FreeBSD): detect read-only 2023-12-25 14:49:49 +08:00
李通洲 cb68dccd0e GPU (AMD): fix a silly bug 2023-12-25 14:47:12 +08:00
李通洲 3b6d5468da PhysicalDisk (macOS): detect read-only 2023-12-25 14:47:12 +08:00
李通洲 350388295d Doc: fix --help messages 2023-12-25 14:47:12 +08:00
apocelipes e7aa6c3757 fix(Battery): fix overflow and uninitializations of battery cycle counts 2023-12-25 06:45:47 +00:00
李通洲 c100e0dff7 PhysicalDisk (Windows): detect CDROMs; detect read-only 2023-12-24 23:27:57 +08:00
李通洲 02999ae4bf PhysicalDisk (Linux): detect readonly 2023-12-24 22:34:45 +08:00
李通洲 b5a01400e9 PhysicalDisk (Linux): detect more interconnect type 2023-12-24 22:31:36 +08:00
李通洲 ef8bd63075 PhysicalDisk (Linux): remove trailing spaces 2023-12-24 21:33:57 +08:00
李通洲 58e8403e16 Disk (Linux): be more careful to detect external type 2023-12-24 20:53:11 +08:00
李通洲 34b0bbac26 PhysicalDisk (Linux): be more careful to detect connection type 2023-12-24 20:52:05 +08:00
李通洲 97c6966939 Disk (Linux): detect subvolume first
Fix #674
2023-12-24 20:32:43 +08:00
李通洲 be38182ab2 Disk (WSL): fix Windows volume detection 2023-12-24 19:42:10 +08:00
李通洲 d2d4ee89d8 GPU (WSL): fix gpu temp detection for nvidia cards 2023-12-24 19:41:20 +08:00
apocelipes 113b1b8fc2 fix: fix trailing space 2023-12-23 02:55:14 +00:00
Carter Li cf98e6f5a1 Global: remove unexpected trailing line endings
Ref: https://github.com/fastfetch-cli/fastfetch/pull/671#issuecomment-1867777472
2023-12-23 00:19:50 +08:00
apocelipes e85a4b9ff5 refactor(IO): clean up ffAppendFDBuffer
for 2 reasons:

- Simplify the Code.
- ffAppendFDBuffer can't make assumptions about how the read data will
  be processed, so the trim calls are inappropriate.
2023-12-22 11:49:57 +00:00
FilippoULIVO b7935aa238 Update README.md 2023-12-22 11:06:00 +00:00
李通洲 a13520c5ff 3rdparty: remove unused types in amd_ags and make it complies in C
Ref: https://github.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/issues/48
2023-12-21 19:20:35 +08:00
李通洲 dfb0eecf86 3rdparty: add amd_ags 2023-12-21 18:52:38 +08:00
李通洲 c5695542b2 CI: generate sha256sum for source tarballs
Ref: https://github.com/ncipollo/release-action/issues/400
2023-12-21 10:31:25 +08:00
李通洲 a1d81b4964 fastfetch: fix compiler warnings 2023-12-21 09:52:20 +08:00
李通洲 72ed11ec9e 3rdparty: oops 2023-12-20 22:23:02 +08:00
李通洲 1c5179d3b0 GPU (Intel): actually detect real time clock frequency 2023-12-20 22:19:15 +08:00
李通洲 adc506d2b3 GPU: fix clock frequency detection and overall tidy 2023-12-20 19:13:00 +08:00
apocelipes b2236cc046 refactor(TerminalFont): use ffSearchUserConfigFile 2023-12-20 10:28:51 +00:00
apocelipes 3040bc38cb refactor(WMTheme): use ffSearchUserConfigFile 2023-12-20 10:28:51 +00:00
apocelipes b9368ac20d feature(IO): support searching user's config file from configDirs 2023-12-20 10:28:51 +00:00
Carter Li a4f5a9af03 Brightness (Linux): show meaningfull name on asahi 2023-12-20 16:44:30 +08:00
李通洲 f8be6322df GPU: rename use-nvml to driver-specific
Because we are supporting drivers other than NVML
2023-12-20 15:32:55 +08:00
李通洲 4a1bbb6a03 GPU: huge improvement of driver specific detection code 2023-12-20 14:45:27 +08:00
李通洲 961e9a6a5f GPU (Windows): detection with intel driver (WIP) 2023-12-20 00:49:56 +08:00
李通洲 2f4b210f33 CI: generate sha256sum 2023-12-19 18:48:38 +08:00
李通洲 456a58c8f5 fastfetch: default preset names to .jsonc
Fix #666
2023-12-19 18:48:38 +08:00
李通洲 b8b15c5170 Wifi (macOS): support most auth types 2023-12-19 18:48:38 +08:00
apocelipes 61485cb133 refactor(WMTheme): clean up detectOpenbox
Simplify the code and implement stricter checking of xml contents.
2023-12-19 08:31:57 +00:00
Carter Li 5ede47fede Merge pull request #665 from fastfetch-cli/dev
Release v2.4.0
2023-12-18 23:02:03 +00:00
李通洲 d84ae91f59 Release: v2.4.0 2023-12-18 23:55:11 +08:00
apocelipes 70160d324f fix(DiskIO, PhysicalDisk): fix readlink 2023-12-18 14:31:05 +00:00
李通洲 600f6c7f24 Image: don't dlclose(imageMagick)
Fix: #552
2023-12-18 21:25:15 +08:00
李通洲 11b1b97567 IO: only retry when open() error is ENOENT / ERROR_PATH_NOT_FOUND
Close: #663
2023-12-18 21:08:29 +08:00
李通洲 4ae0c43c6f IO: remove support of FF_PATHTYPE_LINK 2023-12-18 20:49:32 +08:00
李通洲 e89d475a3b Presets: remove flag based config files 2023-12-18 16:13:45 +08:00
李通洲 4f3cd46f96 Presets: rename all flag based files to *.conf 2023-12-18 16:09:24 +08:00
李通洲 c076f5ae98 Github: update issue templates 2023-12-18 16:04:56 +08:00
李通洲 064d7d3c3a Doc: update changelog 2023-12-18 15:58:01 +08:00
李通洲 9937eeab1d Logo (Builtin): add EshanizedOS 2023-12-18 15:57:35 +08:00
李通洲 e8326306f8 Doc: add module physical disk 2023-12-18 15:53:15 +08:00
李通洲 89bc7eb015 DiskIO: move device info detected in PhysicalDisk module 2023-12-18 15:12:52 +08:00
李通洲 3cd81ec3ad PhysicalDisk: add new module 2023-12-18 15:12:52 +08:00
李通洲 0f497a53ad DiskIO (macOS): detect serial number and removable 2023-12-18 09:57:19 +08:00
Carter Li 569883a1a1 DiskIO (FreeBSD): detect disk serial number 2023-12-18 09:01:33 +08:00
李通洲 04a41cbd6b DiskIO (Windows): don't use registry 2023-12-17 21:49:54 +08:00
李通洲 4e4246a46a DiskIO (Windows): fix segfault and memleak 2023-12-17 19:40:24 +08:00
李通洲 c3a28064f6 DiskIO: tidy 2023-12-17 19:29:45 +08:00
李通洲 ce9f9ed7ed Windows: try fixing --no-buffer 2023-12-17 19:04:49 +08:00
李通洲 fb8c7d6e4a DiskIO: add property removable 2023-12-17 18:40:41 +08:00
李通洲 70f39e641c DiskIO (Windows): improve device name detection 2023-12-17 18:24:01 +08:00
李通洲 1dbd8474c2 DiskIO (Linux): fix serial number detection 2023-12-17 17:27:38 +08:00
李通洲 e7c787159a DiskIO: print serial number in json format
Always init serial property
2023-12-17 13:51:17 +08:00
李通洲 9339a0fb4e DiskIO (Windows): detect serial number 2023-12-17 13:43:52 +08:00
Carter Li b692b759c7 DiskIO (Linux): detect interconnect more aggressively 2023-12-17 12:52:34 +08:00
李通洲 529f94c64a DiskIO (Linux): better handling virtual devices 2023-12-17 12:21:12 +08:00
李通洲 e071a1eeb2 Disk (Linux): improve removable type detection 2023-12-17 12:13:28 +08:00
李通洲 3400e40e47 DiskIO (Linux): detect device serial number 2023-12-17 11:48:59 +08:00
李通洲 d32125e988 DiskIO (Linux): improve device name detection 2023-12-17 11:47:05 +08:00
李通洲 b3484088e9 FFPlatform (Linux): tidy 2023-12-17 11:46:28 +08:00
Carter Li f91a8aea4d DiskIO (Linux): improve detection
1. Ignore `dm-*`
2. Add devices that don't have disk ids
3. Fix  device size detection
2023-12-17 10:39:25 +08:00
Carter Li 335022e034 SMBIOS: ignore more meaningless values 2023-12-17 09:10:11 +08:00
Carter Li 8fa073b1e4 DisplayServer (Linux): test for status instead of enabled 2023-12-17 01:00:37 +08:00
李通洲 10e1753c03 DisplayServer (Linux): better handling abnormal situations
Try fix #660
2023-12-17 00:41:59 +08:00
李通洲 224a6a9881 TerminalShell: code cleanup 2023-12-15 14:29:51 +08:00
李通洲 e804dfc49e Memory (macOS): align algo of memory usage counting to stats
Which seems to print the same result of neofetch
2023-12-14 16:13:05 +08:00
李通洲 8048101eca Doc: fix documentation of --ds-force-drm 2023-12-14 16:13:05 +08:00
Horst G. Burkhardt 833727f333 remove unnecessary escaping for Adelie logo 2023-12-14 15:15:52 +08:00
李通洲 8ed5d30b3e Wifi (Windows): use less magic numbers 2023-12-13 19:33:20 +08:00
Carter Li f62cdff924 README: add start history 2023-12-13 02:56:13 -06:00
Carter Li 25a792743b WMDE: tidy 2023-12-12 18:22:20 +08:00
Carter Li b63e6a3053 DE (Linux): add support for CDE
Fix #658
2023-12-12 18:20:02 +08:00
李通洲 a565dcfb9e Doc: update changelog
Fix: #655
2023-12-12 10:12:12 +08:00
Carter Li 453f4757ed DE (FreeBSD): support detection with processes 2023-12-12 10:10:08 +08:00
李通洲 0555fb97e8 TerminalShell (Linux): tidy 2023-12-12 09:51:09 +08:00
李通洲 663d568927 DE (Linux): fix xfce4 version detection 2023-12-11 16:36:12 +08:00
李通洲 165c213ed0 FFstrbuf: don't crash with ffStrbufAppendNC(&str, 0, 'c') 2023-12-11 15:21:16 +08:00
李通洲 a28dc8a9bf DisplayServer (Linux): support --ds-force-drm sysfs-only 2023-12-11 13:25:58 +08:00
李通洲 f20b6d4387 Temps (macOS): support Apple M3 2023-12-08 16:10:10 +08:00
李通洲 4925222dab CI: run basic modules only in FreeBSD 2023-12-08 10:58:11 +08:00
李通洲 77cc0c61d7 Doc: update changelog 2023-12-08 10:28:03 +08:00
李通洲 a19888bb33 CI: don't run cpuusage in FreeBSD, which seems to have issues when running in VM 2023-12-08 10:28:03 +08:00
李通洲 40aa4a60d6 Packages: improve performance of pkg and rpm detection 2023-12-08 09:49:17 +08:00
Carter Li c4824b2b5d Merge pull request #654 from fastfetch-cli/dev
Release v2.3.4
2023-12-08 00:10:31 +08:00
李通洲 dcbda6c0d5 Release: v2.3.4 2023-12-08 00:04:38 +08:00
李通洲 91e4e94aaa CMake: fix --help doesn't work when building without python3 2023-12-07 23:51:56 +08:00
apocelipes 1504e26e38 optimize(Packages): optimize reading large files
Using less syscalls and processing data in memory
makes getNumStringsImpl ~300% faster.

The code is much simpler.
2023-12-07 20:32:14 +08:00
李通洲 a9c5c2892c Memory (Linux): Use MemAvailable if available 2023-12-07 16:30:10 +08:00
Carter Li 923997f0a2 Merge pull request #651 from fastfetch-cli/dev
Release v2.3.3
2023-12-07 09:39:07 +08:00
李通洲 0182e32f00 Release: v2.3.3 2023-12-07 09:33:26 +08:00
李通洲 bd40205427 Help: fix json text loading 2023-12-06 23:55:34 +08:00
Carter Li 30b9f95b49 Merge pull request #649 from fastfetch-cli/dev
Release v2.3.2
2023-12-06 11:20:24 +08:00
李通洲 74b9fd01ff CI (macOS): try fixing compiling 2023-12-06 11:06:52 +08:00
李通洲 03f4ffb9d7 Release: v2.3.2 2023-12-06 10:48:06 +08:00
李通洲 a00cb2aede CMake: install fish completion script 2023-12-06 10:38:55 +08:00
李通洲 6799076fa6 Logo (Builtin): fix compiling 2023-12-06 10:30:56 +08:00
李通洲 573a315d61 Help: tweaks 2023-12-06 10:29:28 +08:00
李通洲 0cd6cb841d Completion (Fish): fix fastfetch detection 2023-12-06 10:29:28 +08:00
xray_os af94cf4d0d fixing the name of my distro 2023-12-06 08:51:29 +08:00
Carter Li ac76107940 Merge pull request #647 from fastfetch-cli/dev
Release v2.3.1
2023-12-05 20:52:37 +08:00
李通洲 c25fe53251 Merge remote-tracking branch 'upstream/master' into dev 2023-12-05 20:50:10 +08:00
李通洲 4137b3829a Release v2.3.1 2023-12-05 20:48:09 +08:00
Viorel 0bb08049bf Fix man page install location 2023-12-05 20:41:20 +08:00
Carter Li 293576f6d6 Merge pull request #645 from fastfetch-cli/dev
Release 2.3.0
2023-12-05 18:45:02 +08:00
李通洲 0bc725c5f6 Release: v2.3.0 2023-12-05 15:56:10 +08:00
李通洲 c1c735001c Doc: update readme and changelog 2023-12-05 15:55:41 +08:00
李通洲 e350cce99e Logo: fix building on Windows 2023-12-04 20:32:46 +08:00
apocelipes 1c24cb3ebb refactor: simplify parsing 2023-12-04 19:47:34 +08:00
apocelipes 0662af17f4 fix(TerminalShell): fix reading procfs files 2023-12-04 19:47:34 +08:00
apocelipes 9fee532cb6 fix(CPUUsage): fix reading procfs files and simplify data parsing 2023-12-04 19:47:34 +08:00
apocelipes 57f88d2167 fix(Uptime): fix reading procfs files and simplify data parsing 2023-12-04 19:47:34 +08:00
apocelipes ed879ee53c fix(Swap): fix reading procfs files and simplify data parsing 2023-12-04 19:47:34 +08:00
apocelipes 6eae425679 fix(Memory): fix reading procfs files and simplify data parsing
Files in procfs are always changed by kernel.

It means if we read the data with more than one read syscall,
we could get an incorrect data which was broken by kernel.

A typical case about this problem was reported by psutil in
https://github.com/giampaolo/psutil/issues/2050

Using an big buffer let read reads the whole file can fix this.
psutil uses a 32K buffer while procps-ng uses a 8K buffer, i think a 8K buffer is enough.
2023-12-04 19:47:34 +08:00
李通洲 182c90b22c CI: fix macOS (2nd try) 2023-12-04 19:12:58 +08:00
李通洲 2c2e0582a9 CI: try fixing macOS 2023-12-04 16:31:38 +08:00
李通洲 4216d40696 Doc: update changelog 2023-12-04 16:08:22 +08:00
李通洲 af6f395ba3 DiskIO: increase number of format args for disk size 2023-12-04 16:08:04 +08:00
李通洲 3fda6e425a Global: never leak fd to child processes 2023-12-04 15:14:40 +08:00
李通洲 82581aa9e4 Processing: increase buffer size 2023-12-04 15:10:58 +08:00
李通洲 6bd515fed4 Packages (macOS): rename port to macports 2023-12-04 15:07:13 +08:00
李通洲 20970c6b71 CMake: silence compiler warnings 2023-12-04 15:00:25 +08:00
李通洲 532007267c Logo (Builtin): add Ironclad 2023-12-04 14:55:10 +08:00
李通洲 87a4758497 Logo (Builtin): update parch 2023-12-04 14:49:43 +08:00
李通洲 6a9cce62ab Logo (Builtin): add Adelie 2023-12-04 14:47:28 +08:00
李通洲 2816ea3797 Readme: update badge links (v2) 2023-12-04 14:40:35 +08:00
李通洲 5144081971 Readme: update badge links 2023-12-04 14:39:03 +08:00
李通洲 ccfe961a1f DiskIO (FreeBSD): support disk name, size and physical type detection 2023-12-04 13:54:26 +08:00
李通洲 97211df285 DiskIO (macOS): detect disk size 2023-12-04 08:59:41 +08:00
apocelipes 4868517d53 optimize(IO): reduce memory usage during reading data from files to FFstrbufs
Avoid unnecessary calls of ffStrbufEnsureFree and only allocate
necessary memory.

In most cases, this will save 30% ~ 50% of memory used by ffAppendFDBuffer.
2023-12-03 19:57:49 +08:00
李通洲 2979bfe4ca DiskIO: detect physical drive size 2023-12-03 19:02:29 +08:00
李通洲 42fd1a9cd7 DisplayServer (FreeBSD): enable libdrm support 2023-12-03 12:10:52 +08:00
李通洲 36298b8e93 Swap (FreeBSD): fix impl 2023-12-01 23:23:29 +08:00
李通洲 7168cc2ef2 Completions (Fish): reduce external dependencies 2023-12-01 16:01:14 +08:00
apocelipes c398dc6c07 fix(Cursor): fix a memory leak detected by valgrind 2023-12-01 15:49:48 +08:00
李通洲 390801aee7 DisplayServer: fix build on FreeBSD 2023-11-30 20:25:23 +08:00
李通洲 e3f5563f8d DisplayServer (Linux): fix build for Ubuntu 20.04 (v2) 2023-11-30 20:05:51 +08:00
李通洲 4a54b20c68 DisplayServer (Linux): fix compiling on Ubuntu 20.04 2023-11-30 16:42:56 +08:00
李通洲 ea3d904bfe DisplayServer (Linux): improve performance for X11
Try fixing #634
2023-11-30 16:31:35 +08:00
李通洲 67f4b991d7 DisplayServer (Linux): use libdrm
Which correctly detects current mode ( instead of preferred mode ) and
supports refresh rate
2023-11-30 10:47:03 +08:00
apocelipes 53922779ba fix(Common): fixes for ffProcessAppendOutput
- Use pipe2 on Linux and BSDs, which can set all flags through a single syscall.
- macOS/darwin does not support pipe2, add a wrapper for it.
- Close pipes when fork() failed. These fds should be closed when
  the function returns.
- Set O_CLOEXEC at pipes, the exec() family of functions will close
  this fds automatically.
- Use _exit instead of exit. Exit calls the callbacks registered by atexit
  and flushes the stdio's buffer, which can lead to some unexpected behavior,
  especially after an exec syscall failure.
- Fix timeout.
- Not use non-blocking IO. because we only wait for one file, and cannot
  do other things during waiting.
2023-11-30 10:10:40 +08:00
apocelipes 1431cdcc83 fix(Terminal): make fastfetch works under ltrace and perf
Fastfetch incorrectly displays the terminal name as
"ltrace" or "perf" when debugging itself with ltrace and perf.

minor fix: remove duplicated ffStrbufClear since getShellVersion
already called it.
2023-11-28 23:22:51 +08:00
李通洲 968a43cb29 Monitor (Linux): don't report disabled monitors 2023-11-28 16:11:32 +08:00
李通洲 0c522bdc10 Display (Linux): don't report disabled displays when using DRM
Ref: #634
2023-11-28 07:59:28 +00:00
李通洲 5db3c903e5 Host (macOS): fix build 2023-11-28 15:05:10 +08:00
李通洲 91c23c533a Host (macOS): add general method to query product name 2023-11-28 13:36:19 +08:00
李通洲 00721630ce Board (Apple): use machine model indentifier as motherboard name 2023-11-28 13:36:19 +08:00
李通洲 167b130011 Uptime (Linux): fix maybe uninitialized variable errors 2023-11-27 20:52:14 +08:00
Sunderland93 aca502e9a0 Add TileOS logo 2023-11-27 19:17:00 +08:00
apocelipes 36f18d0961 optimize(IO): speed up createSubfolders
Avoiding unnecessary ffStrbufAppendC calls to speed up createSubfolders.

Now it finds and adds a subdirectory at a time instead of just appending a char.
2023-11-27 19:16:05 +08:00
李通洲 e67a6856ce Completion (Fish): use fastfetch --help-raw 2023-11-27 15:37:01 +08:00
李通洲 3a0b132001 TerminalFont: support alacritty.toml
Fix #631
2023-11-27 10:12:22 +08:00
李通洲 f63f31db0a Memory (Linux): fix compiler warnings 2023-11-25 19:40:36 +08:00
李通洲 96d60184d5 Memory (Linux): try improving performance 2023-11-24 10:12:34 +08:00
李通洲 919bd8231e Swap (Linux): don't use syscall
Fix #620
2023-11-24 10:12:22 +08:00
李通洲 41fed1da5f Uptime (Linux): don't use syscall
Fix #620
2023-11-24 10:12:10 +08:00
李通洲 a846780382 py 2023-11-22 16:36:05 +08:00
李通洲 c10d7a8233 Help: small fixes 2023-11-22 15:36:48 +08:00
李通洲 cdcc976cd3 Help: small improvements 2023-11-22 09:32:38 +08:00
李通洲 b52e812c2c Help: support --help-raw 2023-11-22 09:14:27 +08:00
李通洲 aa45945b57 Logo (Builtin): add Peropesis 2023-11-22 09:10:44 +08:00
李通洲 eea6e81276 Logo (Builtin): add XrayOS
Ref: https://github.com/dylanaraps/neofetch/pull/2413
2023-11-22 09:07:00 +08:00
李通洲 0bac93093b Help: fix typo 2023-11-21 21:39:10 +08:00
李通洲 7bcb015a06 Help: print command specific help message 2023-11-21 16:39:38 +08:00
李通洲 02bdcd355c Help: minify JSON string 2023-11-21 15:11:49 +08:00
李通洲 fa90e01bc5 Helo: correctly display italic text 2023-11-20 22:51:01 +08:00
李通洲 1dec514129 Help: fix colors 2023-11-20 22:04:03 +08:00
李通洲 f81d09bddc Help: fix typo 2023-11-20 18:28:12 +08:00
李通洲 03916b6a1d Help: convert to parsable JSON format 2023-11-20 16:37:59 +08:00
李通洲 5338583c48 Logo (Chafa): accept enum strings instead of numbers 2023-11-20 14:27:48 +08:00
李通洲 6c492882a3 Doc: fix some bugs 2023-11-20 14:27:03 +08:00
李通洲 98c7c7ed4f Completions (Bash): remove unsupported flags 2023-11-20 14:26:15 +08:00
李通洲 a7a96a8954 Fastfetch: remove config-system & config-user 2023-11-19 11:15:06 +08:00
Carter Li 1a5044add9 Merge pull request #626 from mame98/spellcheck
Spellchecking
2023-11-19 00:13:36 +08:00
Marius Messerschmidt 7befd71069 Config: remove misspelled 'integrated' 2023-11-18 16:46:08 +01:00
Marius Messerschmidt 3d44a1befe Spelling: add new entries to .codespellrc 2023-11-18 15:52:28 +01:00
Marius Messerschmidt 57e734e628 Spelling: fix typo in Manpage 2023-11-18 15:48:02 +01:00
Marius Messerschmidt 3eadd332bb Workflows: add spellcheck job 2023-11-18 15:47:22 +01:00
Marius Messerschmidt 825db4fead Spelling: add .codespellrc 2023-11-18 15:47:22 +01:00
Marius Messerschmidt ad5be0f0c2 Spelling: fix spelling of files in remaining files 2023-11-18 15:47:22 +01:00
Marius Messerschmidt 6d22a76946 Spelling: fix spelling of files in src/modules/ 2023-11-18 15:47:22 +01:00
Marius Messerschmidt 40e977be31 Spelling: fix spelling of files in src/detection/ 2023-11-18 15:47:22 +01:00
Marius Messerschmidt 29d93d5c67 Spelling: fix spelling of files in src/common 2023-11-18 15:47:22 +01:00
Marius Messerschmidt 9b2c59936f Spelling: fix spelling of help files 2023-11-18 15:47:22 +01:00
Marius Messerschmidt bb02ba0b2e Spelling: fix spelling of CMakeLists.txt 2023-11-18 15:47:22 +01:00
Marius Messerschmidt 0987f68409 Spelling: fix spelling in top-level documentation files 2023-11-18 15:47:22 +01:00
Marius Messerschmidt 647403fc30 Add manpage (#625)
* Manpage: add initial manpage template

* CMake: integrate manpage installation to CMake

* Manpage: add details about JSONC based config files

* Manpage: minor cleanups

* Manpage: fix --print-structure

* Manpage: fix --structure

* help: change load-config -> config

* Manpage: remove legacy config file description

* Manpage: remove --print-config- commands

* help: remove --print-config- commands

* Manpage: change migrate-config to gen-config

* Manpage: add -h as shortcut for help

* Manpage: escaped all '-'
2023-11-18 22:18:08 +08:00
Carter Li 854a7cfeba Merge pull request #624 from mame98/cleanup
Minor cleanups reported by clang-tidy
2023-11-18 21:05:21 +08:00
Marius Messerschmidt f78f6ceb54 fixup! ClangTidy: avoid reserved identifier names 2023-11-18 12:31:57 +01:00
Marius Messerschmidt 975081aa27 ClangTidy: make pid pointer const 2023-11-18 12:31:57 +01:00
Marius Messerschmidt b0d3e7ef9e ClangTidy: avoid implicit widening of multiplication result 2023-11-18 12:31:57 +01:00
Marius Messerschmidt 6fe0eb5677 ClangTidy: avoid different parameter names for same function 2023-11-18 12:31:57 +01:00
Marius Messerschmidt 42c03b2383 ClangTidy: avoid reserved identifier names 2023-11-18 12:31:57 +01:00
Marius Messerschmidt b1319b34e7 ClangTidy: remove duplicated includes 2023-11-18 12:31:57 +01:00
Marius Messerschmidt 5162b4fdec ClangTidy: add missing unsigned specifier 2023-11-18 12:31:57 +01:00
Marius Messerschmidt 42f647378a ClangTidy: remove redundant expression 2023-11-18 12:31:57 +01:00
李通洲 97b3938dd5 Doc: update changelog
Fix: #623
2023-11-18 16:41:40 +08:00
李通洲 2e46b5932e Terminal (Windows): ignore the shell warpper servercoreshell 2023-11-18 16:38:01 +08:00
李通洲 4510ef7e1c Shell (Windows): tidy 2023-11-18 16:24:23 +08:00
李通洲 36bf978dc1 Bluetooth (Windows): remove hard dep of bthprops
Also fix resource leaks and better error message

Ref: https://github.com/fastfetch-cli/fastfetch/issues/623#issuecomment-1815682290
2023-11-18 16:09:54 +08:00
李通洲 7f999dfaaf OpenGL (Windows): remove hard dep of opengl32
Ref: https://github.com/fastfetch-cli/fastfetch/issues/623#issuecomment-1815682290
2023-11-18 15:40:09 +08:00
李通洲 6f6a68f7e5 Brightness (Windows): remove hard dep of dxva2
Ref: https://github.com/fastfetch-cli/fastfetch/issues/623#issuecomment-1815682290
2023-11-18 15:25:47 +08:00
Marius Messerschmidt 960bbfef59 ClangTidy: fix misplaced cast 2023-11-17 22:18:19 +01:00
李通洲 cabd5899f7 Doc: update help.txt 2023-11-17 15:39:25 +08:00
李通洲 730c0d1c92 Fastfetch: print module description for --list-modules 2023-11-17 14:12:57 +08:00
李通洲 ce6041938a CI: fix build 2023-11-16 18:49:27 +08:00
李通洲 998193b014 Fastfetch: support -c none; remove --load-user-config 2023-11-16 16:41:08 +08:00
李通洲 f8ba138b8d Completion: tidy 2023-11-16 14:21:24 +08:00
李通洲 3f9462d7c8 Package (macOS): try supporting nix 2023-11-16 10:04:17 +08:00
李通洲 413984963e TerminalShell: support oils and elvish 2023-11-15 16:30:46 +08:00
李通洲 5aab0e2dd9 Completion (Fish): built-in logos auto-completion 2023-11-15 16:21:07 +08:00
李通洲 1ba5e6e8f7 Doc: better document for logo types 2023-11-15 10:38:32 +08:00
李通洲 2a53b012ea Completion (Fish): clean up 2023-11-14 16:36:08 +08:00
李通洲 5d44efbf62 Colors: don't use background color
It causes some weird behavior on some old terminals.

Ref: https://www.reddit.com/r/HomeServer/comments/16ys32a/guess_the_power_consumption_of_ryzen57600x/
2023-11-14 10:01:29 +08:00
李通洲 6ad83af2b5 Host: clean up 2023-11-14 09:59:15 +08:00
李通洲 fceb19affe Fastfetch: change the order of loading config files 2023-11-14 09:58:42 +08:00
李通洲 ee7d3d471e Completions (Fish): inital support 2023-11-13 22:44:58 +08:00
李通洲 8e9c571293 Flashfetch: simplify implementation 2023-11-13 16:36:25 +08:00
李通洲 a44b8264af Fastfetch: remove the old function of --gen-config
The file `config_user.txt` has not been maintained for long. Let's remove it.
2023-11-13 10:32:45 +08:00
李通洲 84a5a4033e Fastfetch: parse some switches in advance 2023-11-13 10:32:45 +08:00
李通洲 f2fc92dbf7 Brightness (Linux): better ddcutil 2.x compatibility 2023-11-12 10:47:04 +08:00
李通洲 2af338f425 CI (Linux): build with ddcutil and remove unused deps 2023-11-09 14:24:49 +08:00
李通洲 41aaaa3429 Global: silence compiler warnings 2023-11-09 13:46:45 +08:00
李通洲 f9597eba39 Global: remove #ifndef FF_INCLUDED_* guards 2023-11-09 13:46:45 +08:00
Mohammed Keyvanzadeh b4cd47cbc4 src: end va_list before returning (#618)
Explicitly end the `va_list` before returning in the `ffStrbufSetF()`
function as `va_list`s are not ended implicitly.
2023-11-08 20:16:44 +08:00
Carter Li 22de71efeb Merge pull request #617 from fastfetch-cli/dev
Release v2.2.3
2023-11-08 12:33:16 +08:00
李通洲 ac654ff346 Host (macOS): update the latest models 2023-11-08 10:43:17 +08:00
李通洲 df2fdf05e6 Release v2.2.3 2023-11-08 10:14:31 +08:00
李通洲 788307e98d Doc: update changelog 2023-11-08 09:11:16 +08:00
李通洲 f93341ac61 TerminalShell: fix terminal name detection on NixOS
oops. No one report that...
2023-11-08 09:02:52 +08:00
李通洲 3e0d97db2e Platform: detect system page size 2023-11-08 00:10:16 +08:00
李通洲 864e707224 LocalIP (Android): don't set --default-route-only to true by default on Android
As we can't detect default route on that platform
2023-11-07 20:17:08 +08:00
李通洲 c42b68404f Logo (Image): try improving performace of base64 encoding 2023-11-07 19:04:16 +08:00
415 changed files with 20692 additions and 5478 deletions
+5
View File
@@ -0,0 +1,5 @@
[codespell]
check-filenames =
builtin = clear,rare,usage,informal
skip = */.git,*/cmake-build-*,*/.idea,*/completions,*/presets,*/screenshots,*/tests,*/3rdparty,*/logo/ascii
ignore-words-list = iterm,compiletime,unknwn,pengwin,siduction,master,sur,doas
+7 -9
View File
@@ -1,7 +1,7 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
title: '[BUG] '
labels: bug
assignees: ''
@@ -19,17 +19,17 @@ assignees: ''
# Often helpful information:
The content of the configuration file you use (if any)
Screenshot:
<!-- Paste the screenshot here -->
The content of the configuration file you use (if any):
```
//paste here
```
Output of `env NO_CONFIG=1 fastfetch --load-config all --show-errors --stat --multithreading false --disable-linewrap false --hide-cursor false`:
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.
If you get the following error: `Error: couldn't find config: [...]`, copy the files in [presets](../../presets/) to `/usr/share/fastfetch/presets/` or `~/.local/share/fastfetch/presets/`.
If this isn't possible (or too much work) for you, post the output of `env NO_CONFIG=1 fastfetch --show-errors --stat --multithreading false --disable-linewrap false --hide-cursor false && fastfetch --version`.
-->
```
@@ -46,9 +46,7 @@ Output of `fastfetch --list-features`:
Paste the stacktrace here. You may get it with:
```
$ gdb /path/to/fastfetch
$ run
$ bt
$ 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
+3 -1
View File
@@ -1,12 +1,14 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
title: '[FEAT] '
labels: enhancement
assignees: ''
---
<!-- Before requesting a new feature, please try `fastfetch -c all.jsonc` to see if it has been supported -->
# Current state:
# Wanted state:
+3 -3
View File
@@ -1,7 +1,7 @@
---
name: Logo request
about: Request a new logo
title: ''
title: '[LOGO] '
labels: logo request
assignees: ''
@@ -9,10 +9,10 @@ assignees: ''
# OS
```
paste content of /etc/os-release here. If this file doesn't exist, describe a way to identify the distro.
Paste content of /etc/os-release here. If this file doesn't exist, describe a way to identify the distro.
```
# Ascii
```
paste ascii art here. If you leave this empty, i will try to find the logo myself.
Paste ascii art here.
```
+211 -70
View File
@@ -5,6 +5,20 @@ on:
- pull_request
jobs:
spellcheck:
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: Install codespell
shell: bash
run: sudo apt update && sudo apt install -y codespell
- name: Run Spellchecker
run: codespell
linux-buildtest:
name: Linux build test
permissions:
@@ -12,7 +26,6 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-20.04]
compiler: [
{ cc: gcc, cxx: "g++" },
{ cc: clang, cxx: "clang++" },
@@ -23,7 +36,7 @@ jobs:
# The feature libraries are all build against glibc, so they can't be used with musl
- compiler: { cc: "musl-gcc", cxx: "musl-g++" }
enableFeatures: ON
runs-on: ${{ matrix.os }}
runs-on: ubuntu-22.04
steps:
- name: checkout repository
uses: actions/checkout@v4
@@ -32,16 +45,16 @@ jobs:
run: uname -a
- name: install required packages
run: sudo apt-get update && sudo apt-get install -y musl-dev musl-tools linux-headers-generic libpci-dev libvulkan-dev libwayland-dev libxrandr-dev libxcb-randr0-dev libdconf-dev libdbus-1-dev libmagickcore-dev libxfconf-0-dev libsqlite3-dev rpm librpm-dev libzstd-dev libegl-dev libglx-dev libosmesa6-dev ocl-icd-opencl-dev libnm-dev libpulse-dev directx-headers-dev
run: sudo apt-get update && sudo apt-get install -y musl-dev musl-tools linux-headers-generic libvulkan-dev libwayland-dev libxrandr-dev libxcb-randr0-dev libdconf-dev libdbus-1-dev libmagickcore-dev libxfconf-0-dev libsqlite3-dev librpm-dev libegl-dev libglx-dev libosmesa6-dev ocl-icd-opencl-dev libnm-dev libpulse-dev libddcutil-dev libchafa-dev libdrm-dev directx-headers-dev
- name: configure project
env:
CC: ${{ matrix.compiler.cc }}
CXX: ${{ matrix.compiler.cxx }}
run: cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_LIBPCI=${{ matrix.enableFeatures }} -DENABLE_VULKAN=${{ matrix.enableFeatures }} -DENABLE_WAYLAND=${{ matrix.enableFeatures }} -DENABLE_XCB_RANDR=${{ matrix.enableFeatures }} -DENABLE_XCB=${{ matrix.enableFeatures }} -DENABLE_XRANDR=${{ matrix.enableFeatures }} -DENABLE_X11=${{ matrix.enableFeatures }} -DENABLE_GIO=${{ matrix.enableFeatures }} -DENABLE_DCONF=${{ matrix.enableFeatures }} -DENABLE_DBUS=${{ matrix.enableFeatures }} -DENABLE_XFCONF=${{ matrix.enableFeatures }} -DENABLE_SQLITE3=${{ matrix.enableFeatures }} -DENABLE_RPM=${{ matrix.enableFeatures }} -DENABLE_IMAGEMAGICK7=${{ matrix.enableFeatures }} -DENABLE_IMAGEMAGICK6=${{ matrix.enableFeatures }} -DENABLE_CHAFA=${{ matrix.enableFeatures }} -DENABLE_ZLIB=${{ matrix.enableFeatures }} -DENABLE_EGL=${{ matrix.enableFeatures }} -DENABLE_GLX=${{ matrix.enableFeatures }} -DENABLE_OSMESA=${{ matrix.enableFeatures }} -DENABLE_OPENCL=${{ matrix.enableFeatures }} -DENABLE_LIBNM=${{ matrix.enableFeatures }} -DENABLE_PULSE=${{ matrix.enableFeatures }} -DENABLE_DIRECTX_HEADERS=${{ matrix.enableFeatures }} .
run: cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_VULKAN=${{ matrix.enableFeatures }} -DENABLE_WAYLAND=${{ matrix.enableFeatures }} -DENABLE_XCB_RANDR=${{ matrix.enableFeatures }} -DENABLE_XCB=${{ matrix.enableFeatures }} -DENABLE_XRANDR=${{ matrix.enableFeatures }} -DENABLE_X11=${{ matrix.enableFeatures }} -DENABLE_GIO=${{ matrix.enableFeatures }} -DENABLE_DCONF=${{ matrix.enableFeatures }} -DENABLE_DBUS=${{ matrix.enableFeatures }} -DENABLE_XFCONF=${{ matrix.enableFeatures }} -DENABLE_SQLITE3=${{ matrix.enableFeatures }} -DENABLE_RPM=${{ matrix.enableFeatures }} -DENABLE_IMAGEMAGICK7=${{ matrix.enableFeatures }} -DENABLE_IMAGEMAGICK6=${{ matrix.enableFeatures }} -DENABLE_CHAFA=${{ matrix.enableFeatures }} -DENABLE_ZLIB=${{ matrix.enableFeatures }} -DENABLE_EGL=${{ matrix.enableFeatures }} -DENABLE_GLX=${{ matrix.enableFeatures }} -DENABLE_OSMESA=${{ matrix.enableFeatures }} -DENABLE_OPENCL=${{ matrix.enableFeatures }} -DENABLE_LIBNM=${{ matrix.enableFeatures }} -DENABLE_PULSE=${{ matrix.enableFeatures }} -DENABLE_DIRECTX_HEADERS=${{ matrix.enableFeatures }} -DENABLE_DRM=${{ matrix.enableFeatures }} -DENABLE_DDCUTIL=${{ matrix.enableFeatures }} -DENABLE_CHAFA=${{ matrix.enableFeatures }} .
- name: build project
run: cmake --build .
run: cmake --build . --verbose -j4
- name: run tests
run: ctest
@@ -50,17 +63,76 @@ jobs:
run: ./fastfetch --list-features
- name: run fastfetch
run: time ./fastfetch -c presets/ci
run: time ./fastfetch -c presets/ci.jsonc
- name: run fastfetch --format json
run: time ./fastfetch -c presets/ci --format json
run: time ./fastfetch -c presets/ci.jsonc --format json
- name: run flashfetch
run: time ./flashfetch
linux:
name: Linux
runs-on: ubuntu-20.04 # 22.04 ships a newer version of glibc than debian stable, allow those people to use the debian package
Linux-old-amd64:
name: Linux-old-amd64
runs-on: ubuntu-20.04
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: 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 libnm-dev libpulse-dev libdrm-dev directx-headers-dev
- name: install linuxbrew packages
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
/home/linuxbrew/.linuxbrew/bin/brew install imagemagick chafa ddcutil --ignore-dependencies
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: c
- name: configure project
run: PKG_CONFIG_PATH=/home/linuxbrew/.linuxbrew/lib/pkgconfig:$PKG_CONFIG_PATH cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_INSTALL_PREFIX=/usr .
- 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
- name: run fastfetch
run: time ./fastfetch -c presets/ci.jsonc
- 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
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: fastfetch-linux-old-amd64
path: ./fastfetch-*.*
linux-amd64:
name: Linux-amd64
runs-on: ubuntu-22.04 # Ubuntu 22.04 uses Glibc 2.35. Should be fine with Debian 12, which uses Glibc 2.36 (https://packages.debian.org/source/bookworm/glibc)
permissions:
security-events: write
contents: read
@@ -74,7 +146,7 @@ jobs:
run: uname -a
- name: install required packages
run: sudo apt-get update && sudo apt-get install -y libpci-dev libvulkan-dev libwayland-dev libxrandr-dev libxcb-randr0-dev libdconf-dev libdbus-1-dev libmagickcore-dev libxfconf-0-dev libsqlite3-dev rpm librpm-dev libzstd-dev libegl-dev libglx-dev libosmesa6-dev ocl-icd-opencl-dev libnm-dev libpulse-dev directx-headers-dev
run: sudo apt-get update && sudo apt-get install -y libvulkan-dev libwayland-dev libxrandr-dev libxcb-randr0-dev libdconf-dev libdbus-1-dev libmagickcore-dev libxfconf-0-dev libsqlite3-dev librpm-dev libegl-dev libglx-dev libosmesa6-dev ocl-icd-opencl-dev libnm-dev libpulse-dev libdrm-dev libddcutil-dev libchafa-dev directx-headers-dev
- name: install linuxbrew packages
run: |
@@ -82,7 +154,7 @@ jobs:
/home/linuxbrew/.linuxbrew/bin/brew install imagemagick --ignore-dependencies
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: c
@@ -90,19 +162,19 @@ jobs:
run: PKG_CONFIG_PATH=/home/linuxbrew/.linuxbrew/lib/pkgconfig:$PKG_CONFIG_PATH cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_INSTALL_PREFIX=/usr .
- name: build project
run: cmake --build . --target package --verbose
run: cmake --build . --target package --verbose -j4
- name: perform CodeQL analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
- name: list features
run: ./fastfetch --list-features
- name: run fastfetch
run: time ./fastfetch -c presets/ci
run: time ./fastfetch -c presets/ci.jsonc
- name: run fastfetch --format json
run: time ./fastfetch -c presets/ci --format json
run: time ./fastfetch -c presets/ci.jsonc --format json
- name: run flashfetch
run: time ./flashfetch
@@ -118,13 +190,48 @@ jobs:
run: echo "ffversion=$(./fastfetch --version-raw)" >> $GITHUB_OUTPUT
- name: upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: fastfetch-linux
name: fastfetch-linux-amd64
path: ./fastfetch-*.*
macos:
name: MacOS
linux-aarch64:
name: Linux-aarch64
runs-on: ubuntu-22.04
permissions:
security-events: write
contents: read
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: run VM
uses: uraimo/run-on-arch-action@v2
id: runcmd
with:
arch: aarch64
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 libosmesa6-dev ocl-icd-opencl-dev libnm-dev libpulse-dev libdrm-dev libddcutil-dev libchafa-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
time ./fastfetch -c presets/ci.jsonc --format json
time ./flashfetch
ldd fastfetch
ctest
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: fastfetch-linux-aarch64
path: ./fastfetch-*.*
macos-universal:
name: macOS-universal
runs-on: macos-latest
permissions:
security-events: write
@@ -139,10 +246,10 @@ jobs:
- name: install required packages
run: |
brew update
brew install vulkan-loader vulkan-headers molten-vk imagemagick chafa
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install vulkan-loader vulkan-headers molten-vk imagemagick chafa
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: c
@@ -150,19 +257,19 @@ jobs:
run: cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_OSX_ARCHITECTURES='arm64;x86_64' .
- name: build project
run: cmake --build . --target package --verbose
run: cmake --build . --target package --verbose -j4
- name: perform CodeQL analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
- name: list features
run: ./fastfetch --list-features
- name: run fastfetch
run: time ./fastfetch -c presets/ci
run: time ./fastfetch -c presets/ci.jsonc
- name: run fastfetch --format json
run: time ./fastfetch -c presets/ci --format json
run: time ./fastfetch -c presets/ci.jsonc --format json
- name: run flashfetch
run: time ./flashfetch
@@ -174,13 +281,13 @@ jobs:
run: ctest
- name: upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: fastfetch-macos
name: fastfetch-macos-universal
path: ./fastfetch-*.*
freebsd:
name: FreeBSD
freebsd-amd64:
name: FreeBSD-amd64
runs-on: macos-12
permissions:
security-events: write
@@ -190,31 +297,31 @@ jobs:
uses: actions/checkout@v4
- name: run VM
uses: cross-platform-actions/action@v0.21.1
uses: cross-platform-actions/action@master
with:
operating_system: freebsd
version: '13.2'
run: |
uname -a
sudo pkg update
sudo pkg install -y cmake git pkgconf binutils pciutils wayland vulkan-headers vulkan-loader libxcb libXrandr libX11 glib dconf dbus sqlite3-tcl xfce4-conf ImageMagick6 ImageMagick7 chafa egl libosmesa opencl ocl-icd pulseaudio
sudo pkg install -y cmake git pkgconf binutils wayland vulkan-headers vulkan-loader libxcb libXrandr libX11 libdrm glib dconf dbus sqlite3-tcl xfce4-conf ImageMagick6 ImageMagick7 chafa egl libosmesa opencl ocl-icd v4l_compat
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On .
cmake --build . --target package --verbose
cmake --build . --target package --verbose -j4
./fastfetch --list-features
time ./fastfetch -c presets/ci
time ./fastfetch -c presets/ci --format json
time ./fastfetch
time ./fastfetch --format json
time ./flashfetch
ldd fastfetch
ctest
- name: upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: fastfetch-freebsd
name: fastfetch-freebsd-amd64
path: ./fastfetch-*.*
win64:
name: Win64
windows-amd64:
name: Windows-amd64
runs-on: windows-latest
permissions:
security-events: write
@@ -240,7 +347,7 @@ jobs:
run: env PKG_CONFIG_PATH=/clang64/lib/pkgconfig/:$PKG_CONFIG_PATH cmake -DSET_TWEAK=Off -DBUILD_TESTS=On .
- name: build project
run: cmake --build . --verbose
run: cmake --build . --verbose -j4
- name: copy necessary dlls
run: cp /clang64/bin/{OpenCL,vulkan-1}.dll .
@@ -249,10 +356,10 @@ jobs:
run: ./fastfetch --list-features
- name: run fastfetch
run: time ./fastfetch -c presets/ci
run: time ./fastfetch -c presets/ci.jsonc
- name: run fastfetch --format json
run: time ./fastfetch -c presets/ci --format json
run: time ./fastfetch -c presets/ci.jsonc --format json
- name: run flashfetch
run: time ./flashfetch
@@ -264,19 +371,19 @@ jobs:
run: ctest
- name: create zip archive
run: 7z a -tzip -mx9 -bd -y fastfetch-$(./fastfetch --version-raw)-Win64.zip *.dll fastfetch.exe flashfetch.exe presets
run: 7z a -tzip -mx9 -bd -y fastfetch-windows-amd64.zip *.dll fastfetch.exe flashfetch.exe presets
- name: create 7z archive
run: 7z a -t7z -mx9 -bd -y fastfetch-$(./fastfetch --version-raw)-Win64.7z *.dll fastfetch.exe flashfetch.exe presets
run: 7z a -t7z -mx9 -bd -y fastfetch-windows-amd64.7z *.dll fastfetch.exe flashfetch.exe presets
- name: upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: fastfetch-win64
path: ./fastfetch-*-Win64.*
name: fastfetch-windows-amd64
path: ./fastfetch-windows-amd64.*
win32:
name: Win32
windows-i686:
name: Windows-i686
runs-on: windows-latest
permissions:
security-events: write
@@ -299,7 +406,7 @@ jobs:
run: uname -a
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: c, cpp
@@ -307,19 +414,19 @@ jobs:
run: env PKG_CONFIG_PATH=/clang32/lib/pkgconfig/:$PKG_CONFIG_PATH cmake -DSET_TWEAK=Off -DBUILD_TESTS=On .
- name: build project
run: cmake --build . --verbose
run: cmake --build . --verbose -j4
- name: perform CodeQL analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
- name: copy necessary dlls
run: cp /clang32/bin/{OpenCL,vulkan-1}.dll .
- name: run fastfetch
run: time ./fastfetch -c presets/ci
run: time ./fastfetch -c presets/ci.jsonc
- name: run fastfetch --format json
run: time ./fastfetch -c presets/ci --format json
run: time ./fastfetch -c presets/ci.jsonc --format json
- name: run flashfetch
run: time ./flashfetch
@@ -331,44 +438,78 @@ jobs:
run: ctest
- name: create zip archive
run: 7z a -tzip -mx9 -bd -y fastfetch-$(./fastfetch --version-raw)-Win32.zip *.dll fastfetch.exe flashfetch.exe presets
run: 7z a -tzip -mx9 -bd -y fastfetch-windows-i686.zip *.dll fastfetch.exe flashfetch.exe presets
- name: create 7z archive
run: 7z a -t7z -mx9 -bd -y fastfetch-$(./fastfetch --version-raw)-Win32.7z *.dll fastfetch.exe flashfetch.exe presets
run: 7z a -t7z -mx9 -bd -y fastfetch-windows-i686.7z *.dll fastfetch.exe flashfetch.exe presets
- name: upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: fastfetch-win32
path: ./fastfetch-*-Win32.*
name: fastfetch-windows-i686
path: ./fastfetch-windows-i686.*
release:
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'fastfetch-cli/fastfetch'
name: Release
runs-on: ubuntu-latest
needs:
- linux
- macos
- freebsd
- win64
- win32
- linux-amd64
- linux-aarch64
- macos-universal
- freebsd-amd64
- windows-amd64
- windows-i686
permissions:
contents: write
steps:
- name: download artifacts
uses: actions/download-artifact@v3
- name: get latest release version
id: get_version_release
uses: pozetroninc/github-action-get-latest-release@master
with:
repository: ${{ github.repository }}
- name: download artifacts
if: needs.linux-amd64.outputs.ffversion != steps.get_version_release.outputs.release
uses: actions/download-artifact@v4
- name: rm old artifacts
if: needs.linux-amd64.outputs.ffversion != steps.get_version_release.outputs.release
run: |
rm -rf fastfetch-*-old-*
- name: create release
if: needs.linux.outputs.ffversion != steps.get_version_release.outputs.release
if: needs.linux-amd64.outputs.ffversion != steps.get_version_release.outputs.release
uses: ncipollo/release-action@v1
with:
tag: ${{ needs.linux.outputs.ffversion }}
tag: ${{ needs.linux-amd64.outputs.ffversion }}
commit: ${{ github.sha }}
artifactErrorsFailBuild: true
artifacts: fastfetch-linux/*,fastfetch-macos/*,fastfetch-freebsd/*,fastfetch-win64/*,fastfetch-win32/*
artifacts: fastfetch-*/fastfetch-*
body: "Please refer to [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/${{ needs.linux-amd64.outputs.ffversion }}/CHANGELOG.md) for details."
- name: download source tarballs
if: needs.linux-amd64.outputs.ffversion != steps.get_version_release.outputs.release
run: |
for i in 1 2 3 4 5; do curl -L --remote-name-all --output-dir fastfetch-source --create-dirs https://github.com/${{ github.repository }}/archive/refs/tags/${{ needs.linux-amd64.outputs.ffversion }}.{tar.gz,zip} && break || sleep 5; done
ls fastfetch-*/*
- name: generate release notes
if: needs.linux-amd64.outputs.ffversion != steps.get_version_release.outputs.release
run: |
echo "Please refer to [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/${{ needs.linux-amd64.outputs.ffversion }}/CHANGELOG.md) for details." > fastfetch-release-notes.md
echo -e "\n---\n\n<details><summary>SHA256SUMs</summary><br>\n\n\`\`\`" >> fastfetch-release-notes.md
sha256sum fastfetch-*/* >> fastfetch-release-notes.md
echo -e "\`\`\`\n</details>" >> fastfetch-release-notes.md
echo -e "\n<details><summary>SHA512SUMs</summary><br>\n\n\`\`\`" >> fastfetch-release-notes.md
sha512sum fastfetch-*/* >> fastfetch-release-notes.md
echo -e "\`\`\`\n</details>" >> fastfetch-release-notes.md
- name: update release body
if: needs.linux-amd64.outputs.ffversion != steps.get_version_release.outputs.release
uses: ncipollo/release-action@v1
with:
tag: ${{ needs.linux-amd64.outputs.ffversion }}
commit: ${{ github.sha }}
bodyFile: fastfetch-release-notes.md
allowUpdates: true
+1
View File
@@ -7,3 +7,4 @@
cscope.*
tags
fastfetch.kdev4
*.user
+269 -14
View File
@@ -1,3 +1,258 @@
# 2.8.5
Bugfixes:
* Fix uninitialized variables
# 2.8.4
Bugfixes:
* Fix segfault if we fail to find `Vendor ID` in `lscpu` (#718, CPU, Linux)
* Fix multi-device bcachefs filesystem compatibility (#731, Disk, Linux)
Features:
* Support portable Windows Terminal settings (#720, Terminal, Windows)
* Support `--color-block-width` and `--color-block-range` (#721, Colors)
* Support `--diskio-detect-total` to show total bytes read/written (DiskIO)
* Support `--netio-detect-total` to show total bytes received/sent (NetIO)
* Support `--packages-disabled` to disable specified package manager (#729, Packages)
* Support `--display-order` to sort multiple displays in a specific order (Display)
* Support `--display-compact-type original-with-refresh-rate` to show refresh rates in compact (oneline) mode (Display)
# 2.8.3
Bugfixes:
* Fix GPU name detection for AMD graphic cards (GPU, Linux / FreeBSD)
# 2.8.2
Changes:
* The linux binaries are now built with glibc 2.35, which means they no longer support Debian 11 and Ubuntu 20.04. Users using these distros may download the artifacts `fastfetch-linux-old` from GitHub Actions.
Features:
* Rewrite GPU module, drop libpci dependency (GPU, Linux)
* Detect marketing name of Apple Silicon CPUs for asahi linux (CPU, Linux)
* Add new module `Camera`, which prints the name and resolution of connected cameras
Bugfixes:
* Fix compatibility with packages installed by flatpak (Terminal, Linux)
* Don't show an empty battery if no battery is detected (macOS, Battery)
* Don't show `not connected` if no power adapter is found (macOS / Linux, PowerAdapter)
* Make format of battery status be consistent with other platforms (Linux, Battery)
Logo:
* Print Asahi logo in asahi linux (Logo, Linux)
* Add Asahi2, z/OS, Tatra, PikaOS
# 2.7.1
Features:
* Config presets in app folder now work with symlinks
Bugfixes:
* Fix a possible segfault when detecting terminal (Terminal, Linux)
# 2.7.0
Features:
* Add new module `TerminalTheme`, which prints the foreground and background color of the current terminal window. Currently doesn't work on Windows.
* Allow command substitution when expanding paths. For example, now it's possible to use `"source": "$(ls ~/path/to/images/*.png | shuf -n 1)"` in JSONC config file to randomly choose an image to display. (#698)
* Use native methods instead of pciutils to detect GPUs in FreeBSD. (GPU, FreeBSD)
Bugfixes:
* Fix text formatting (Wifi, Linux)
* Fix terminal detection in some cases (Terminal)
* Remove trailing `\0` in JSON results (FreeBSD)
* Fix uninitialized variables (GPU, Linux)
* Fix a possible segfault (OpenCL)
Logo:
* Add ASCII logos for fedora immutable variants (#700)
# 2.6.3
Bugfixes:
* Fix module not working (Bluetooth)
# 2.6.2
Bugfixes:
* Fix building for GCC in Windows (Windows)
# 2.6.1
Features:
* Improve xonsh shell detection (Shell)
* Support colored percentage values (Bluetooth / Gamepad / Sound)
* Add `--<module>-percent-[green|yellow]` options to specify threshold of percentage colors
* eg. `--disk-percent-green 20 --disk-percent-yellow 50` will show green if disk usage is less than 20%, yellow if disk usage is less then 50%, and red otherwise.
* Add `--percent-color-[green|yellow|red]` options to specify color of different percent value states.
* eg. `--percent-color-green blue` will show blue color if percent value falls in green state.
* Improve Intel macbook support (macOS)
Bugfixes:
* Fix segfault in CPU module when running in aarch64 machine without `lscpu` installed (CPU, Linux)
* Don't use `login` as terminal process (Terminal, Linux)
* Silence warnings when building in 32bit machines.
* Create sub folders when writing config file (#690)
* Improve user specific locale detection; fix locale detection in Windows 7 (Locale)
* Fix GPU type detection (GPU, macOS)
# 2.6.0
Changes:
* Remove support of option `--battery-dir`. We detect a lot of things in `/sys/class/*` and only module `Battery` supports specifying a custom directory for some reason, which is weird.
* Remove `--chassis-use-wmi` which is no longer used.
Features:
* Add `ENABLE_PROPRIETARY_GPU_DRIVER_API` cmake option to disable using of proprietary GPU driver APIs (GPU)
* Support wallpaper detection for macOS Sonoma (Wallpaper, macOS)
* Support power adapter detection for Asahi Linux (PowerAdapter, Linux)
* Support battery serial number and manufacturer date detection (Battery)
* Support host serial number and UUID detection (Host)
* Support battery level detection for gamepads where possible (Gamepad)
* Support maximum CPU clock detection. Previously base clock was printed (CPU, Windows)
* Support manufacture date and serial number detection for physical monitors (Monitor)
* Support ash (default shell of BusyBox) version detection (Shell, Linux)
* Sound module in FreeBSD now uses native `ioctl`s. Pulseaudio dependency is no longer used.
* Locale module in Windows now prints the same format as in Linux and other posix systems.
Bugfixes:
* Fix overall memory leaks (macOS)
* Remove trailing `\0` in JSON results (FreeBSD)
* Fix physical monitor detection with Nvidia drivers (Monitor, Linux)
* Don't print llvmpipe in vulkan module (Vulkan)
* Fix system yyjson usage in `fastfetch.c`. Previously embedded `3rdparty/yyjson/yyjson.h` was used in `fastfetch.c` even if `ENABLE_SYSTEM_YYJSON` was set (CMake)
* Fix locale module printing unexpected results in specific environments (Locale)
* Fix battery temperature detection in Windows. Note only smart batteries report temperatures but few laptops uses smart battery (Battery, Windows)
* Print device name if no backlight name is available, so we don't print empty parentheses (Brightness, FreeBSD)
# 2.5.0
Changes:
* `--gpu-use-nvml` has been renamed to `--gpu-driver-specific` due to using of `IGCL` and `AGS`
* We now detect external partitions more conservatively in Linux. USB partitions will not be detected as external always ( eg. The Linux kernel itself is installed in a USB drive )
Features:
* Support more authentication type detection for macOS Sonoma (Wifi, macOS)
* Default preset names to `.jsonc`. For example, `fastfetch -c all` will load `presets/all.jsonc` (#666)
* Use Intel Graphics Control Library (IGCL) to detect more GPU information. Windows only (GPU, Windows)
* Improve support of Asahi Linux (Brightness / CPU / GPU / Disk, Linux)
* Support more properties of physical disks (PhysicalDisk)
* Support SSD temperature detection with `--physicaldisk-temp` (PhysicalDisk)
* Support partition label detection (Disk, FreeBSD)
* Support platform specific graphic API version detection (GPU, macOS / Windows)
Bugfixes:
* Fix Windows partition detection for WSL2 (Linux, Disk)
* Fix Btrfs subvolumes being detected as external partitions some times (Linux, Disk)
* Fix battery cycle counts in some places (Battery)
* Fix CodeWhisperer compatibility (#676, Terminal, macOS)
# 2.4.0
**We are deprecating flags based config files (will be removed in v3.0.0). We suggest you migrate to json based config files.** One may use `-c /path/to/config.conf --gen-config` to migrate existing flag based config files.
Changes:
* All flag based presets are removed
Features:
* Improve performance of detecting rpm and pkg package count (Packages, Linux / FreeBSD)
* Support Apple M3X temperature detection (CPU / GPU, macOS)
* `--ds-force-drm` support a new option `sysfs-only`
* Improve xfce4 version detection
* Detect WM and DE by enumerating running processes (WM / DE, FreeBSD)
* Add a new module `Physical Disk`, which detects product name, full size, serial number and so on.
Bugfixes:
* Fix crashes sometimes when `--logo-padding-top` is not set (Logo)
* Fix memory usage counting algorithm (Memory, macOS)
* Fix the behavior of `--no-buffer` in Windows
* Fix possible segfault in some devices (Display, Linux)
* Fix segfaults on first use of new images with Sixel flag (Image)
Logo:
* Remove unnecessary escaping for Adelie logo
* Add EshanizedOS
# 2.3.4
Bugfixes:
* Fix `--help` doesn't work when built without python
Features:
* Use `MemAvailable` if available (Memory, Linux)
* Improve performance of detecting dpkg package count (Packages, Linux)
# 2.3.3
Bugfixes:
* Fix `--help` doesn't work in Windows and some other platforms
# 2.3.2
Bugfixes:
* Fix fish completion script, and install the script correctly
Logo:
* Fix Xray-OS logo name
# 2.3.1
Bugfixes:
* Fix man page install location
# 2.3.0
**We are deprecating flags based config files (will be removed in v3.0.0). We suggest you migrate to json based config files.**
Config related changes:
* The deprecated flag `--gen-config conf` is removed
* Flag `--gen-config` now does the same thing as `--migrate-config`, which can be used as config migration and default config file generation. Flag `--migrate-config` is removed
* Fastfetch now searches for config files in the order of `fastfetch --list-config-paths`, and won't load other config if one is found.
* The undocumented flag `--load-user-config` is removed. As an alternative, `--config none` can be used to disable loading config files.
* `--config` (previously named `--load-config`) is now supported for command line arguments only. If specified, other config files won't be loaded, which works like other programs.
* Config files will always be loaded before other command line flags being parsed. That is to say, command line flags will always override options defined in config files.
* the value of GPUType `integrated` contained a typo and was fixed. Existing config files may need to be updated.
Features:
* Support Oils and elvish shell version detection (Shell)
* Support Windows Server Core (Windows)
* Better ddcutil 2.x compatibility (Brightness, Linux)
* Add completion support for fish (natively) and nushell (via [carapace-bin](https://github.com/rsteube/carapace-bin))
* Support nix in macOS (Packages, macOS)
* Print module description for `--list-modules`
* Support `alacritty.toml` (TerminalFont)
* Support board detection on macOS. It simplily prints machine model identifier as for now (Board, macOS)
* Add general method to query product name (Host, macOS)
* Use `libdrm` as a better fall back for detecting displays, which correctly detects current mode; supports refresh rate detection and maybe also faster than using `/sys/class/drm` (Display, Linux)
* Support physical disk size detection (DiskIO)
* Support physical disk name and type detection (DiskIO, FreeBSD)
Bugfixes:
* End `va_list` before returning (@VoltrexKeyva)
* Don't use background color when printing blocks (Color)
* Fix lots of typos
* Fix compatibility with Linux containers (Linux)
* Don't report disabled monitors when using DRM (Linux)
* Fix bad performance in some cases when using X11 (Display, Linux)
* Fix some memory leaks
* Fix used swap space detection (Swap, FreeBSD)
* Don't leak fds to child processes (Linux)
* Fix possible issues when reading procfs (Linux, @apocelipes)
Logos:
* Add Adelie, Ironclad
* Update parch
# 2.2.3
Features:
* Update the latest mac models (Host, macOS)
Bugfixes:
* Fix local ips detection on Android. Regression from `2.0.0` (LocalIP, Android)
* Fix terminal detection on NixOS (Terminal)
# 2.2.2
Changes:
@@ -10,11 +265,11 @@ Features:
* Improve detection of `Battery`
* Detect cycle count on supported platforms
* Detect temperature on Linux when supported
* Status detection on macOS has been adjusted to be consistant with other platforms
* Status detection on macOS has been adjusted to be consistent with other platforms
* Linux binaries are built with imagemagick7 support
Bugfixes:
* Fix unitialized variables (#609)
* Fix uninitialized variables (#609)
* Fix spelling of `--preserve-aspect-ratio` (#614)
Logos:
@@ -40,7 +295,7 @@ Changes:
* Display keys `percent*` and `size*` in JSON config are restructured. e.g. `{ "sizeNdigits": 1 }` is now `{ "size": { "ndigits": 1 } }`
* With the introduction of `--migrate-config`, the old flag based config file is deprecated, and will be removed in 3.0.0 (next major version)
* Support of `--gen-config conf` is deprecated accordingly, and will be removed in 2.3.0 (next minor version)
* The global flag `--allow-slow-operations` is splitted into some explicit flags in differnet modules
* The global flag `--allow-slow-operations` is split into some explicit flags in different modules
* `--packages-winget`: control whether `winget` packages count should be detected. Note it's a very slow operation, please enable it with caution.
* `--chassis-use-wmi`: control whether `WMI` query should be used to detect chassis type, which detects more information, but slower. This flag only affects `--chassis-format` and `--format json`.
* `--battery-use-setup-api`: control whether `SetupAPI` should be used on Windows to detect battery info, which supports multi batteries, but slower.
@@ -113,9 +368,9 @@ This release introduces a new output format: JSON result
Changes:
* Users module detects and prints user login time by default. Specifying `--users-compact` to disable it
* Fastfetch now requires yyjson 0.8.0 or later, which is embeded in fastfetch source tree. If you build fastfetch with `-DENABLE_SYSTEM_YYJSON` cmake option, you must upgrade your yyjson package
* Fastfetch now requires yyjson 0.8.0 or later, which is embedded in fastfetch source tree. If you build fastfetch with `-DENABLE_SYSTEM_YYJSON` cmake option, you must upgrade your yyjson package
* Reduced information supported by `--terminal-format`, `--shell-format`
* Some config presets (`devinfo` and `verbose`) are obseleted and removed. They are barely maintained and can be replaced with `--format json` now.
* Some config presets (`devinfo` and `verbose`) are obsolete and removed. They are barely maintained and can be replaced with `--format json` now.
* Custom strings in `--module-key` and `--module-format` are no longer trimmed.
* `/boot` is hidden by default (FreeBSD, Disk)
@@ -195,7 +450,7 @@ Features:
# 2.0.2
Bugfixes:
* Workarund [a compiler bug of GCC](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85282) (Windows)
* Workaround [a compiler bug of GCC](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85282) (Windows)
* Fix presets not detected by file name (#529)
Logo:
@@ -207,7 +462,7 @@ First stable release of Fastfetch V2
Changes:
* Unescape strings only when parsing `.conf` files
* Previously: `$ NO_CONFIG=1 fastfetch --os-key \\\\ -s os -l none` prints `\: *`. Note the backslashs are unescaped twice (once by shell and once by fastfetch).
* Previously: `$ NO_CONFIG=1 fastfetch --os-key \\\\ -s os -l none` prints `\: *`. Note the backslashes are unescaped twice (once by shell and once by fastfetch).
* Now: `$ NO_CONFIG=1 fastfetch --os-key \\\\ -s os -l none` prints `\\: *`
* Remove option shortcut `-c` (alias of `--color`), which is more commonly used as alias of `--config`
* Rename `--recache` to `--logo-recache` (which is used for regenerate image logo cache). Remove option shortcut `-r` (alias of `--recache`).
@@ -263,7 +518,7 @@ Features:
* Better CPU and Host detection for Android (Android)
* Support yakuake terminal version & font detection (Terminal, Linux)
* Add new option `--bright-color` which can be used to disable the default bright color of keys, title and ASCII logo.
* Add module `Monitor` which prints physical parameters (native resolutions and demensions) of connected monitors
* Add module `Monitor` which prints physical parameters (native resolutions and dimensions) of connected monitors
* Support path with environment variables for `--logo-source` and `--load-config`.
Bugfixes:
@@ -351,7 +606,7 @@ Bugfixes:
* Fix Windows drives detection in WSL (Disk)
Changes:
* In order to make Icons module consistant between different platforms, `--icons-format` no longer supports individual GTK / QT icon params.
* In order to make Icons module consistent between different platforms, `--icons-format` no longer supports individual GTK / QT icon params.
* `--theme-format` no longer supports individual GTK / plasma theme params.
* `--local-ip-*` and `--public-ip-*` have been changed to `--localip-*` and `--publicip-*`
* `--localip-compact-type` is no longer supported. Fastfetch now display IPs as `--localip-compat-type multiline` by default, with `--local-compact true` can be set as an alias of `--localip-compact-type oneline`
@@ -374,7 +629,7 @@ Bugfixes:
* Fix iTerm being detected as iTermServer-* sometimes
* Fix sound device volume being incorrectly detected as muted sometimes (Sound)
* Fix memleaks reported by LeakSanitizer (Linux)
* Fix potential memory curruption bug in unicode.c (Windows)
* Fix potential memory corruption bug in unicode.c (Windows)
Logo:
* Update Windows 11 ASCII logo to look more visually consistent (#445)
@@ -410,7 +665,7 @@ Bugfixes:
* Fix compiling errors (Windows)
Improvements:
* Improve preformance (WmTheme amd Font, Windows and macOS)
* Improve performance (WmTheme amd Font, Windows and macOS)
* Enable nonblocking public-ip / weather detection (Android)
# 1.10.2
@@ -455,7 +710,7 @@ Other:
* Simplified wmtheme output format (Windows)
* Improved GPU detection performance on Windows 11
* Lastest Mac model identifier support (macOS)
* Latest Mac model identifier support (macOS)
# 1.9.1
@@ -537,7 +792,7 @@ Bugfixes:
This release introduces Windows support! Fastfetch now fully support all major desktop OSes (Linux, macOS, Windows and FreeBSD)
Notable Changes:
* Bios / Board / Chassis modules are splitted against Host module for performance reasons
* Bios / Board / Chassis modules are split against Host module for performance reasons
* Caching is removed. Option `--nocache` is removed accordingly
Features:
@@ -546,7 +801,7 @@ Features:
* Adds a new flag `--stat`, which prints time usage for individual modules
* Adds Wifi module which supports Windows and macOS
* Adds data source option for logo printing
* Detects Homebrew Cellar and Cask seperately
* Detects Homebrew Cellar and Cask separately
* Detects WSL version
* Detects disk based on mount point
* Exposes more chafa configs
+126 -53
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.2.2
VERSION 2.8.5
LANGUAGES C
DESCRIPTION "Fast neofetch-like system information tool"
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
@@ -42,13 +42,13 @@ include(CheckIncludeFile)
include(CMakeDependentOption)
cmake_dependent_option(ENABLE_LIBPCI "Enable libpci" ON "LINUX OR BSD" OFF)
cmake_dependent_option(ENABLE_VULKAN "Enable vulkan" ON "LINUX OR APPLE OR BSD OR WIN32 OR ANDROID" OFF)
cmake_dependent_option(ENABLE_WAYLAND "Enable wayland-client" ON "LINUX OR BSD" OFF)
cmake_dependent_option(ENABLE_XCB_RANDR "Enable xcb-randr" ON "LINUX OR BSD" OFF)
cmake_dependent_option(ENABLE_XCB "Enable xcb" ON "LINUX OR BSD" OFF)
cmake_dependent_option(ENABLE_XRANDR "Enable xrandr" ON "LINUX OR BSD" OFF)
cmake_dependent_option(ENABLE_X11 "Enable x11" ON "LINUX OR BSD" OFF)
cmake_dependent_option(ENABLE_DRM "Enable libdrm" ON "LINUX OR BSD" OFF)
cmake_dependent_option(ENABLE_GIO "Enable gio-2.0" ON "LINUX OR BSD" OFF)
cmake_dependent_option(ENABLE_DCONF "Enable dconf" ON "LINUX OR BSD" OFF)
cmake_dependent_option(ENABLE_DBUS "Enable dbus-1" ON "LINUX OR BSD" OFF)
@@ -65,14 +65,14 @@ cmake_dependent_option(ENABLE_OSMESA "Enable osmesa" ON "LINUX OR BSD" OFF)
cmake_dependent_option(ENABLE_OPENCL "Enable opencl" ON "LINUX OR BSD OR WIN32" OFF)
cmake_dependent_option(ENABLE_LIBNM "Enable libnm" ON "LINUX" OFF)
cmake_dependent_option(ENABLE_FREETYPE "Enable freetype" ON "ANDROID" OFF)
cmake_dependent_option(ENABLE_PULSE "Enable pulse" ON "LINUX OR BSD" 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_THREADS "Enable multithreading" ON "Threads_FOUND" OFF)
cmake_dependent_option(ENABLE_PCI_MEMORY "Enable detecting GPU memory size with libpci" OFF "LINUX OR BSD" OFF)
option(ENABLE_SYSTEM_YYJSON "Use system provided (instead of fastfetch embeded) yyjson library" OFF)
option(ENABLE_SYSTEM_YYJSON "Use system provided (instead of fastfetch embedded) yyjson library" OFF)
option(ENABLE_ASAN "Build fastfetch with ASAN (address sanitizer)" OFF)
option(ENABLE_PROPRIETARY_GPU_DRIVER_API "Enable proprietary GPU driver API (NVML, IGCL and AGS)" ON)
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
@@ -108,12 +108,8 @@ endif()
if(WIN32)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--tsaware -Wl,--build-id -Wl,--subsystem,console:6.1,--major-os-version,6,--minor-os-version,1")
endif()
# Used for dlopen finding dylibs installed by homebrew
# `/opt/homebrew/lib` is not on in dlopen search path by default
if(APPLE AND DEFINED ENV{HOMEBREW_PREFIX})
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,$ENV{HOMEBREW_PREFIX}/lib")
elseif(APPLE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fobjc-arc")
endif()
set(FASTFETCH_FLAGS_DEBUG "-fno-omit-frame-pointer")
@@ -204,19 +200,35 @@ endif()
# Text data #
#############
function(fastfetch_load_text FILENAME OUTVAR)
file(READ "${FILENAME}" TEMP)
string(REGEX REPLACE "\n$" "" TEMP "${TEMP}") # Remove trailing newline
function(fastfetch_encode_c_string STR OUTVAR)
string(REGEX REPLACE "\n$" "" TEMP "${STR}") # Remove trailing newline
string(REPLACE "\\" "\\\\" TEMP "${TEMP}") # Escape backslashes
string(REPLACE "\n" "\\n" TEMP "${TEMP}") # Replace newlines with \n
string(REPLACE "\"" "\\\"" TEMP "${TEMP}") # Replace quotes with \"
string(REPLACE "$\\" "" TEMP "${TEMP}") # Remove $\, so we can unescape some things
set("${OUTVAR}" "${TEMP}" PARENT_SCOPE)
set(${OUTVAR} "\"${TEMP}\"" PARENT_SCOPE)
endfunction(fastfetch_encode_c_string)
function(fastfetch_load_text FILENAME OUTVAR)
file(READ "${FILENAME}" TEMP)
fastfetch_encode_c_string("${TEMP}" TEMP)
set(${OUTVAR} "${TEMP}" PARENT_SCOPE)
endfunction(fastfetch_load_text)
find_package(Python)
if(Python_FOUND)
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)
if(DATATEXT_JSON_HELP STREQUAL "")
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")
file(READ "src/data/help.json" DATATEXT_JSON_HELP)
endif()
fastfetch_encode_c_string("${DATATEXT_JSON_HELP}" DATATEXT_JSON_HELP)
fastfetch_load_text(src/data/structure.txt DATATEXT_STRUCTURE)
fastfetch_load_text(src/data/config_system.txt DATATEXT_CONFIG_SYSTEM)
fastfetch_load_text(src/data/config_user.txt DATATEXT_CONFIG_USER)
fastfetch_load_text(src/data/config_user.jsonc DATATEXT_CONFIG_USER_JSONC)
fastfetch_load_text(src/data/help.txt DATATEXT_HELP)
fastfetch_load_text(src/data/help_color.txt DATATEXT_HELP_COLOR)
fastfetch_load_text(src/data/help_format.txt DATATEXT_HELP_FORMAT)
@@ -228,23 +240,17 @@ if(APPLE)
configure_file(src/util/apple/Info.plist.in Info.plist @ONLY)
endif()
string(TIMESTAMP FASTFETCH_BUILD_DATE "%d %B %Y")
configure_file(doc/fastfetch.1.in fastfetch.1 @ONLY)
####################
# Ascii image data #
####################
function(fastfetch_load_raw_text FILENAME OUTVAR)
file(READ "${FILENAME}" TEMP)
string(REGEX REPLACE "\n$" "" TEMP "${TEMP}") # Remove trailing newline
string(REPLACE "\\" "\\\\" TEMP "${TEMP}") # Escape backslashes
string(REPLACE "\n" "\\n" TEMP "${TEMP}") # Replace newlines with \n
string(REPLACE "\"" "\\\"" TEMP "${TEMP}") # Replace quotes with \"
set(${OUTVAR} "\"${TEMP}\"" PARENT_SCOPE)
endfunction(fastfetch_load_raw_text)
file(GLOB LOGO_FILES "src/logo/ascii/*.txt")
set(LOGO_BUILTIN_H "#pragma once\n\n")
set(LOGO_BUILTIN_H "#pragma once\n#pragma GCC diagnostic ignored \"-Wtrigraphs\"\n\n")
foreach(file ${LOGO_FILES})
fastfetch_load_raw_text("${file}" content)
fastfetch_load_text("${file}" content)
get_filename_component(file "${file}" NAME_WLE)
string(TOUPPER "${file}" file)
string(REGEX REPLACE "\\$\\{c([0-9]+)\\}" "$\\1" content "${content}")
@@ -257,7 +263,7 @@ file(GENERATE OUTPUT logo_builtin.h CONTENT "${LOGO_BUILTIN_H}")
#######################
set(LIBFASTFETCH_SRC
src/common/bar.c
src/common/percent.c
src/common/commandoption.c
src/common/font.c
src/common/format.c
@@ -279,13 +285,13 @@ set(LIBFASTFETCH_SRC
src/detection/displayserver/displayserver.c
src/detection/font/font.c
src/detection/gpu/gpu.c
src/detection/locale/locale.c
src/detection/media/media.c
src/detection/netio/netio.c
src/detection/opencl/opencl.c
src/detection/os/os.c
src/detection/packages/packages.c
src/detection/publicip/publicip.c
src/detection/terminaltheme/terminaltheme.c
src/detection/terminalfont/terminalfont.c
src/detection/terminalshell/terminalshell.c
src/detection/version/version.c
@@ -302,6 +308,7 @@ set(LIBFASTFETCH_SRC
src/modules/board/board.c
src/modules/brightness/brightness.c
src/modules/break/break.c
src/modules/camera/camera.c
src/modules/chassis/chassis.c
src/modules/colors/colors.c
src/modules/cpu/cpu.c
@@ -329,6 +336,7 @@ set(LIBFASTFETCH_SRC
src/modules/opengl/opengl.c
src/modules/os/os.c
src/modules/packages/packages.c
src/modules/physicaldisk/physicaldisk.c
src/modules/processes/processes.c
src/modules/player/player.c
src/modules/poweradapter/poweradapter.c
@@ -340,6 +348,7 @@ set(LIBFASTFETCH_SRC
src/modules/swap/swap.c
src/modules/media/media.c
src/modules/terminal/terminal.c
src/modules/terminaltheme/terminaltheme.c
src/modules/terminalfont/terminalfont.c
src/modules/terminalsize/terminalsize.c
src/modules/theme/theme.c
@@ -362,7 +371,6 @@ set(LIBFASTFETCH_SRC
src/util/FFlist.c
src/util/FFstrbuf.c
src/util/platform/FFPlatform.c
src/util/stringUtils.c
src/util/smbiosHelper.c
)
@@ -383,20 +391,23 @@ if(LINUX)
src/detection/cursor/cursor_linux.c
src/detection/bluetooth/bluetooth_linux.c
src/detection/disk/disk_linux.c
src/detection/physicaldisk/physicaldisk_linux.c
src/detection/diskio/diskio_linux.c
src/detection/displayserver/linux/displayserver_linux.c
src/detection/displayserver/linux/drm.c
src/detection/displayserver/linux/wayland.c
src/detection/displayserver/linux/wmde.c
src/detection/displayserver/linux/xcb.c
src/detection/displayserver/linux/xlib.c
src/detection/font/font_linux.c
src/detection/gpu/gpu_linux.c
src/detection/gpu/gpu_nvidia.c
src/detection/gpu/gpu_pci.c
src/detection/gtk_qt/gtk.c
src/detection/host/host_linux.c
src/detection/icons/icons_linux.c
src/detection/libc/libc_linux.c
src/detection/lm/lm_linux.c
src/detection/locale/locale_linux.c
src/detection/localip/localip_linux.c
src/detection/gamepad/gamepad_linux.c
src/detection/media/media_linux.c
@@ -406,7 +417,7 @@ if(LINUX)
src/detection/opengl/opengl_linux.c
src/detection/os/os_linux.c
src/detection/packages/packages_linux.c
src/detection/poweradapter/poweradapter_nosupport.c
src/detection/poweradapter/poweradapter_linux.c
src/detection/processes/processes_linux.c
src/detection/gtk_qt/qt.c
src/detection/sound/sound_linux.c
@@ -423,6 +434,7 @@ if(LINUX)
src/detection/wm/wm_nosupport.c
src/detection/de/de_linux.c
src/detection/wmtheme/wmtheme_linux.c
src/detection/camera/camera_linux.c
src/util/platform/FFPlatform_unix.c
)
elseif(ANDROID)
@@ -441,6 +453,7 @@ elseif(ANDROID)
src/detection/cursor/cursor_nosupport.c
src/detection/cpuusage/cpuusage_linux.c
src/detection/disk/disk_linux.c
src/detection/physicaldisk/physicaldisk_linux.c
src/detection/diskio/diskio_linux.c
src/detection/displayserver/displayserver_android.c
src/detection/font/font_nosupport.c
@@ -449,6 +462,7 @@ elseif(ANDROID)
src/detection/icons/icons_nosupport.c
src/detection/libc/libc_android.c
src/detection/lm/lm_nosupport.c
src/detection/locale/locale_linux.c
src/detection/localip/localip_linux.c
src/detection/gamepad/gamepad_nosupport.c
src/detection/media/media_nosupport.c
@@ -474,6 +488,7 @@ elseif(ANDROID)
src/detection/wm/wm_nosupport.c
src/detection/de/de_nosupport.c
src/detection/wmtheme/wmtheme_nosupport.c
src/detection/camera/camera_android.c
src/util/platform/FFPlatform_unix.c
)
elseif(BSD)
@@ -494,20 +509,23 @@ elseif(BSD)
src/detection/cpuusage/cpuusage_bsd.c
src/detection/cursor/cursor_linux.c
src/detection/disk/disk_bsd.c
src/detection/physicaldisk/physicaldisk_bsd.c
src/detection/diskio/diskio_bsd.c
src/detection/displayserver/linux/displayserver_linux.c
src/detection/displayserver/linux/drm.c
src/detection/displayserver/linux/wayland.c
src/detection/displayserver/linux/wmde.c
src/detection/displayserver/linux/xcb.c
src/detection/displayserver/linux/xlib.c
src/detection/font/font_linux.c
src/detection/gpu/gpu_linux.c
src/detection/gpu/gpu_nvidia.c
src/detection/gpu/gpu_bsd.c
src/detection/gpu/gpu_pci.c
src/detection/gtk_qt/gtk.c
src/detection/host/host_bsd.c
src/detection/lm/lm_linux.c
src/detection/icons/icons_linux.c
src/detection/libc/libc_bsd.c
src/detection/locale/locale_linux.c
src/detection/localip/localip_linux.c
src/detection/gamepad/gamepad_bsd.c
src/detection/media/media_linux.c
@@ -516,11 +534,11 @@ elseif(BSD)
src/detection/netio/netio_bsd.c
src/detection/opengl/opengl_linux.c
src/detection/os/os_linux.c
src/detection/packages/packages_linux.c
src/detection/packages/packages_bsd.c
src/detection/poweradapter/poweradapter_nosupport.c
src/detection/processes/processes_bsd.c
src/detection/gtk_qt/qt.c
src/detection/sound/sound_linux.c
src/detection/sound/sound_bsd.c
src/detection/swap/swap_bsd.c
src/detection/temps/temps_bsd.c
src/detection/terminalfont/terminalfont_linux.c
@@ -534,6 +552,7 @@ elseif(BSD)
src/detection/wm/wm_nosupport.c
src/detection/de/de_linux.c
src/detection/wmtheme/wmtheme_linux.c
src/detection/camera/camera_linux.c
src/util/platform/FFPlatform_unix.c
)
elseif(APPLE)
@@ -546,21 +565,24 @@ elseif(APPLE)
src/detection/battery/battery_apple.c
src/detection/bios/bios_apple.c
src/detection/bluetooth/bluetooth_apple.m
src/detection/board/board_nosupport.c
src/detection/board/board_apple.c
src/detection/brightness/brightness_apple.c
src/detection/chassis/chassis_nosupport.c
src/detection/cpu/cpu_apple.c
src/detection/cpuusage/cpuusage_apple.c
src/detection/cursor/cursor_apple.m
src/detection/disk/disk_bsd.c
src/detection/physicaldisk/physicaldisk_apple.c
src/detection/diskio/diskio_apple.c
src/detection/displayserver/displayserver_apple.c
src/detection/font/font_apple.m
src/detection/gpu/gpu_apple.c
src/detection/gpu/gpu_apple.m
src/detection/host/host_apple.c
src/detection/lm/lm_nosupport.c
src/detection/icons/icons_nosupport.c
src/detection/libc/libc_apple.c
src/detection/locale/locale_linux.c
src/detection/localip/localip_linux.c
src/detection/gamepad/gamepad_apple.c
src/detection/media/media_apple.m
@@ -581,11 +603,12 @@ elseif(APPLE)
src/detection/theme/theme_nosupport.c
src/detection/uptime/uptime_bsd.c
src/detection/users/users_linux.c
src/detection/wallpaper/wallpaper_apple.c
src/detection/wallpaper/wallpaper_apple.m
src/detection/wifi/wifi_apple.m
src/detection/wm/wm_apple.c
src/detection/de/de_nosupport.c
src/detection/wmtheme/wmtheme_apple.m
src/detection/camera/camera_apple.m
src/util/apple/cf_helpers.c
src/util/apple/osascript.m
src/util/platform/FFPlatform_unix.c
@@ -601,20 +624,21 @@ elseif(WIN32)
src/detection/bluetooth/bluetooth_windows.c
src/detection/board/board_windows.c
src/detection/brightness/brightness_windows.cpp
src/detection/chassis/chassis_windows.cpp
src/detection/chassis/chassis_windows.c
src/detection/cpu/cpu_windows.c
src/detection/cpuusage/cpuusage_windows.c
src/detection/cursor/cursor_windows.c
src/detection/disk/disk_windows.c
src/detection/physicaldisk/physicaldisk_windows.c
src/detection/diskio/diskio_windows.c
src/detection/displayserver/displayserver_windows.c
src/detection/font/font_windows.c
src/detection/gpu/gpu_windows.c
src/detection/gpu/gpu_nvidia.c
src/detection/host/host_windows.c
src/detection/icons/icons_windows.c
src/detection/libc/libc_windows.cpp
src/detection/lm/lm_nosupport.c
src/detection/locale/locale_windows.c
src/detection/localip/localip_windows.c
src/detection/gamepad/gamepad_windows.c
src/detection/media/media_nosupport.c
@@ -640,6 +664,7 @@ elseif(WIN32)
src/detection/wm/wm_windows.cpp
src/detection/de/de_nosupport.c
src/detection/wmtheme/wmtheme_windows.c
src/detection/camera/camera_windows.cpp
src/util/windows/getline.c
src/util/windows/com.cpp
src/util/windows/registry.c
@@ -654,6 +679,17 @@ if(ENABLE_DIRECTX_HEADERS)
list(APPEND LIBFASTFETCH_SRC src/detection/gpu/gpu_wsl.cpp)
endif()
if(ENABLE_PROPRIETARY_GPU_DRIVER_API AND (LINUX OR BSD OR WIN32))
message(STATUS "Enabling proprietary GPU driver API")
if(LINUX OR BSD OR WIN32)
list(APPEND LIBFASTFETCH_SRC src/detection/gpu/gpu_nvidia.c)
endif()
if(WIN32)
list(APPEND LIBFASTFETCH_SRC src/detection/gpu/gpu_intel.c)
list(APPEND LIBFASTFETCH_SRC src/detection/gpu/gpu_amd.c)
endif()
endif()
include(CheckFunctionExists)
check_function_exists(wcwidth HAVE_WCWIDTH)
if(NOT HAVE_WCWIDTH)
@@ -677,9 +713,20 @@ add_library(libfastfetch OBJECT
${LIBFASTFETCH_SRC}
)
if(ENABLE_PROPRIETARY_GPU_DRIVER_API AND (LINUX OR BSD OR WIN32))
target_compile_definitions(libfastfetch PRIVATE FF_USE_PROPRIETARY_GPU_DRIVER_API)
endif()
if(yyjson_FOUND)
target_compile_definitions(libfastfetch PRIVATE FF_USE_SYSTEM_YYJSON)
target_link_libraries(libfastfetch PRIVATE yyjson)
target_link_libraries(libfastfetch PRIVATE yyjson::yyjson)
# `target_link_libraries(yyjson::yyjson)` sets rpath implicitly
else()
# Used for dlopen finding dylibs installed by homebrew
# `/opt/homebrew/lib` is not on in dlopen search path by default
if(APPLE AND DEFINED ENV{HOMEBREW_PREFIX})
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,$ENV{HOMEBREW_PREFIX}/lib")
endif()
endif()
if(LINUX AND EXISTS "/lib/ld-musl-${CMAKE_HOST_SYSTEM_PROCESSOR}.so.1")
@@ -751,10 +798,6 @@ function(ff_lib_enable VARNAME PKGCONFIG_NAMES CMAKE_NAME)
endforeach()
endfunction()
ff_lib_enable(LIBPCI
"libpci"
"Pci"
)
ff_lib_enable(VULKAN
"vulkan"
"Vulkan"
@@ -779,6 +822,10 @@ ff_lib_enable(X11
"x11"
"X11"
)
ff_lib_enable(DRM
"libdrm"
"Libdrm"
)
ff_lib_enable(GIO
"gio-2.0"
"GIO"
@@ -873,13 +920,16 @@ if(LINUX)
)
elseif(APPLE)
target_link_libraries(libfastfetch
PRIVATE "-framework AVFoundation"
PRIVATE "-framework Cocoa"
PRIVATE "-framework CoreFoundation"
PRIVATE "-framework CoreAudio"
PRIVATE "-framework CoreMedia"
PRIVATE "-framework CoreVideo"
PRIVATE "-framework CoreWLAN"
PRIVATE "-framework IOBluetooth"
PRIVATE "-framework IOKit"
PRIVATE "-framework Metal"
PRIVATE "-framework OpenGL"
PRIVATE "-framework OpenCL"
PRIVATE "-framework SystemConfiguration"
@@ -893,26 +943,23 @@ elseif(APPLE)
elseif(WIN32)
target_compile_definitions(libfastfetch PRIVATE -D_WIN32_WINNT=0x0601)
target_link_libraries(libfastfetch
PRIVATE "bthprops"
PRIVATE "dwmapi"
PRIVATE "gdi32"
PRIVATE "iphlpapi"
PRIVATE "ole32"
PRIVATE "oleaut32"
PRIVATE "opengl32"
PRIVATE "ws2_32"
PRIVATE "ntdll"
PRIVATE "version"
PRIVATE "setupapi"
PRIVATE "hid"
PRIVATE "wtsapi32"
PRIVATE "dxva2"
)
elseif(BSD)
target_link_libraries(libfastfetch
PRIVATE "m"
PRIVATE "usbhid"
PRIVATE "devstat"
PRIVATE "geom"
)
elseif(ANDROID)
CHECK_LIBRARY_EXISTS(-l:libandroid-wordexp.a wordexp "" HAVE_LIBANDROID_WORDEXP_STATIC)
@@ -969,6 +1016,13 @@ set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "")
set_target_properties(fastfetch PROPERTIES LINKER_LANGUAGE C)
set_target_properties(flashfetch PROPERTIES LINKER_LANGUAGE C)
if(yyjson_FOUND)
target_compile_definitions(fastfetch PRIVATE FF_USE_SYSTEM_YYJSON)
target_link_libraries(fastfetch PRIVATE yyjson::yyjson)
target_compile_definitions(flashfetch PRIVATE FF_USE_SYSTEM_YYJSON)
target_link_libraries(flashfetch PRIVATE yyjson::yyjson)
endif()
if(WIN32)
set(TARGET_NAME fastfetch)
target_sources(fastfetch
@@ -1029,6 +1083,12 @@ install(
RENAME "${CMAKE_PROJECT_NAME}"
)
install(
FILES "${CMAKE_SOURCE_DIR}/completions/fish"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/fish/vendor_completions.d"
RENAME "${CMAKE_PROJECT_NAME}.fish"
)
install(
DIRECTORY "${CMAKE_SOURCE_DIR}/presets"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/${CMAKE_PROJECT_NAME}"
@@ -1039,11 +1099,24 @@ install(
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/licenses/${CMAKE_PROJECT_NAME}"
)
install(
FILES "${PROJECT_BINARY_DIR}/fastfetch.1"
DESTINATION "${CMAKE_INSTALL_MANDIR}/man1"
)
##################
# package target #
##################
set(CPACK_GENERATOR "TGZ;ZIP")
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()
string(TOLOWER "${CMAKE_PROJECT_NAME}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}" CPACK_PACKAGE_FILE_NAME)
endif()
if(LINUX)
set(CPACK_GENERATOR "${CPACK_GENERATOR};DEB;RPM")
@@ -1060,7 +1133,7 @@ set(CPACK_SET_DESTDIR ON)
set(CPACK_PACKAGE_CONTACT "Linus Dierheimer <Linus@Dierheimer.de>")
set(CPACK_PACKAGE_DESCRIPTION "\
fastfetch is a neofetch-like tool for fetching system information and displaying them in a pretty way. \
It is written in c to achieve much better performance.\
It is written mostly in C to achieve much better performance.\
")
include(CPack)
+1 -1
View File
@@ -16,7 +16,7 @@ Here i just add things that are easy to forget.
- [ ] ZSH completions
- [ ] Fish completions
- [ ] Make CPU usage detection much faster and more accurate
- [ ] Detect CPU usage in a common detection methode and expose it both to the cpuUsage module and the cpu format string
- [ ] Detect CPU usage in a common detection method and expose it both to the cpuUsage module and the cpu format string
- [ ] Per session caching
### General
+37 -12
View File
@@ -1,13 +1,13 @@
# Fastfetch
![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/fastfetch-cli/fastfetch/ci.yml)
![GitHub license](https://img.shields.io/github/license/fastfetch-cli/fastfetch)
![GitHub contributors](https://img.shields.io/github/contributors/fastfetch-cli/fastfetch)
![GitHub top language](https://img.shields.io/github/languages/top/fastfetch-cli/fastfetch?logo=c&label=)
![GitHub commit activity (branch)](https://img.shields.io/github/commit-activity/m/fastfetch-cli/fastfetch)
![homebrew downloads](https://img.shields.io/homebrew/installs/dm/fastfetch?logo=homebrew)
![GitHub all releases](https://img.shields.io/github/downloads/fastfetch-cli/fastfetch/total?logo=github)
![GitHub release (with filter)](https://img.shields.io/github/v/release/fastfetch-cli/fastfetch?logo=github)
[![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/fastfetch-cli/fastfetch/ci.yml)](https://github.com/fastfetch-cli/fastfetch/actions)
[![GitHub license](https://img.shields.io/github/license/fastfetch-cli/fastfetch)](https://github.com/fastfetch-cli/fastfetch/blob/dev/LICENSE)
[![GitHub contributors](https://img.shields.io/github/contributors/fastfetch-cli/fastfetch)](https://github.com/fastfetch-cli/fastfetch/graphs/contributors)
[![GitHub top language](https://img.shields.io/github/languages/top/fastfetch-cli/fastfetch?logo=c&label=)](https://github.com/fastfetch-cli/fastfetch/blob/dev/CMakeLists.txt#L5)
[![GitHub commit activity (branch)](https://img.shields.io/github/commit-activity/m/fastfetch-cli/fastfetch)](https://github.com/fastfetch-cli/fastfetch/commits)
[![homebrew downloads](https://img.shields.io/homebrew/installs/dm/fastfetch?logo=homebrew)](https://formulae.brew.sh/formula/fastfetch#default)
[![GitHub all releases](https://img.shields.io/github/downloads/fastfetch-cli/fastfetch/total?logo=github)](https://github.com/fastfetch-cli/fastfetch/releases)
[![GitHub release (with filter)](https://img.shields.io/github/v/release/fastfetch-cli/fastfetch?logo=github)](https://github.com/fastfetch-cli/fastfetch/releases)
[![latest packaged version(s)](https://repology.org/badge/latest-versions/fastfetch.svg)](https://repology.org/project/fastfetch/versions)
[![Packaging status](https://repology.org/badge/tiny-repos/fastfetch.svg)](https://repology.org/project/fastfetch/versions)
@@ -27,17 +27,30 @@ There are [screenshots on different platforms](https://github.com/fastfetch-cli/
### Linux
* Debian / Ubuntu: Download `fastfetch-<version>-Linux.deb` from [Github release page](https://github.com/fastfetch-cli/fastfetch/releases/latest) and `sudo apt install fastfetch-<version>-Linux.deb`
* Arch Linux: `sudo pacman -S fastfetch`
* Ubuntu: `ppa:zhangsongcui3371/fastfetch`
* Debian / Ubuntu: Download `fastfetch-<version>-Linux.deb` from [Github release page](https://github.com/fastfetch-cli/fastfetch/releases/latest) and `dpkg -i fastfetch-<version>-Linux.deb`
* Arch Linux: `sudo pacman -S fastfetch`. You can also find fastfetch [on the AUR](https://aur.archlinux.org/packages/fastfetch-git).
* Fedora: `sudo dnf install fastfetch`
* Gentoo: `sudo emerge --ask app-misc/fastfetch`
* Alpine: `apk add --upgrade fastfetch`
* NixOS: `nix-shell -p fastfetch`
* openSUSE: `sudo zypper install fastfetch`
* ALT Linux: `sudo apt-get install fastfetch`
Replace sudo with doas depending on what you use.
[See also if fastfetch has been packaged for your favorite Linux distro](#Packaging)
### macOS
...via [HomeBrew](https://brew.sh):
`brew install fastfetch`
...via [MacPorts](https://www.macports.org):
`sudo port install fastfetch`
### Windows
`scoop install fastfetch`
@@ -62,7 +75,7 @@ See Wiki: https://github.com/fastfetch-cli/fastfetch/wiki/Building
* Run it with [all supported modules](https://github.com/fastfetch-cli/fastfetch/wiki/Support+Status#available-modules) and find what you interest: `fastfetch -c all.jsonc`
* Find all data that fastfetch detects: `fastfetch -s <module> --format json`
* Display help messages: `fastfetch --help`
* Generate config file based on command line arguments: `fastfetch --arg1 --arg2 --migrate-config`
* Generate config file based on command line arguments: `fastfetch --arg1 --arg2 --gen-config`
## Customization
@@ -85,7 +98,19 @@ Logos can be heavily customized too; see the [logo documentation](https://github
## FAQ
Q: Why do you need a very performant version of neofetch?
> I like putting neofetch in my ~/.bashrc to have a system overwiew whenever I use the terminal, but the slow speed annoyed me, so I created this. Also neofetch didn't output everything correctly (e.g Font is displayed as "[Plasma], Noto Sans, 10 [GTK2/3]") and writing my own tool gave me the possibility to fine tune it to run perfectly on at least my configuration.
> I like putting neofetch in my ~/.bashrc to have a system overview whenever I use the terminal, but the slow speed annoyed me, so I created this. Also neofetch didn't output everything correctly (e.g Font is displayed as "[Plasma], Noto Sans, 10 [GTK2/3]") and writing my own tool gave me the possibility to fine tune it to run perfectly on at least my configuration.
Q: It does not display [*] correctly for me, what can I do?
> This is most likely because your system is not implemented (yet). At the moment I am focusing more on making the core app better, than adding more configurations. Feel free to open a pull request if you want to add support for your configuration
## Star History
Give it a star to support us!
<a href="https://star-history.com/#fastfetch-cli/fastfetch&Date">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=fastfetch-cli/fastfetch&type=Date&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=fastfetch-cli/fastfetch&type=Date" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=fastfetch-cli/fastfetch&type=Date" />
</picture>
</a>
+5 -7
View File
@@ -5,7 +5,7 @@ __fastfetch_complete_help()
local __ff_helps=(
"color"
"format"
"load-config"
"config"
"os-format"
"host-format"
"kernel-format"
@@ -66,7 +66,7 @@ __fastfetch_complete_path()
__fastfetch_complete_logo()
{
COMPREPLY=($(compgen -W "$(fastfetch --list-logos-autocompletion)" -- "$CURRENT_WORD"))
COMPREPLY=($(compgen -W "$(fastfetch --list-logos autocompletion)" -- "$CURRENT_WORD"))
}
__fastfetch_complete_logo_type()
@@ -182,7 +182,6 @@ __fastfetch_completion()
"--cpu-temp"
"--gpu-temp"
"--battery-temp"
"--display-detect-name"
"--display-precise-refresh-rate"
"--localip-show-ipv4"
"--localip-show-ipv6"
@@ -218,10 +217,9 @@ __fastfetch_completion()
"--logo-color-6"
"--logo-color-7"
"--logo-color-8"
"--logo-color-9"
"--logo-width"
"--logo-height"
"--logo-color-9"
"-c"
"--color"
"--color-keys"
"--color-title"
@@ -360,7 +358,8 @@ __fastfetch_completion()
)
local FF_OPTIONS_PATH=(
"--load-config"
"-c"
"--config"
"--os-file"
"--lib-pci"
"--lib-vulkan"
@@ -385,7 +384,6 @@ __fastfetch_completion()
"--lib-pulse"
"--lib-ddcutil"
"--lib-nm"
"--battery-dir"
)
local FF_OPTIONS_LOGO=(
+106
View File
@@ -0,0 +1,106 @@
#!/usr/bin/env fish
if not type -q fastfetch
return
end
complete -c fastfetch -f
function __fastfetch_complete_bool
echo -e "true\tBool"
echo -e "false\tBool"
end
function __fastfetch_complete_color
echo -e "black\tColor"
echo -e "red\tColor"
echo -e "green\tColor"
echo -e "yellow\tColor"
echo -e "blue\tColor"
echo -e "magenta\tColor"
echo -e "cyan\tColor"
echo -e "white\tColor"
echo -e "default\tColor"
end
function __fastfetch_complete_command
for line in (fastfetch --list-modules autocompletion)
set -l pair (string split -m 2 : $line)
set -l module (string lower $pair[1])
echo -e "$module-format\tModule format"
end
echo -e "format\tCustom format"
echo -e "color\tColor format"
end
function __fastfetch_complete_config
for line in (fastfetch --list-presets autocompletion)
echo -e "$line\tPreset"
end
echo -e "none\tDisable loading config file"
end
function __fastfetch_complete_logo
for line in (fastfetch --list-logos autocompletion)
echo -e "$line\tBuiltin logo"
end
echo -e "none\tDon't print logo"
echo -e "small\tPrint small ascii logo if available"
end
function __fastfetch_complete_structure
for line in (fastfetch --list-modules autocompletion)
set -l pair (string split -m 2 : $line)
echo -e "$pair[1]\t$pair[2]"
end
end
string match -r -a -g "^###> ?(.*)" < (status -f) | string collect | python3 | source
###> #!/usr/bin/env python3
###>
###> import json, subprocess, sys
###>
###> def main():
###> data: dict[str, list[dict]] = json.loads(subprocess.check_output(['fastfetch', '--help-raw']))
###>
###> for key in data:
###> for flag in data[key]:
###> if flag.get('pseudo', False):
###> continue
###>
###> command_prefix: str = f'complete -c fastfetch -d "{flag["desc"]}" -l "{flag["long"]}"';
###> if 'short' in flag:
###> command_prefix += f' -o "{flag["short"]}"'
###>
###> if 'arg' in flag:
###> type: str = flag['arg']['type'];
###> if type == 'bool':
###> print(f'{command_prefix} -x -a "(__fastfetch_complete_bool)"')
###> elif type == 'color':
###> print(f'{command_prefix} -x -a "(__fastfetch_complete_color)"')
###> elif type == 'command':
###> print(f'{command_prefix} -x -a "(__fastfetch_complete_command)"')
###> elif type == 'config':
###> print(f'{command_prefix} -x -a "(__fastfetch_complete_config)"')
###> elif type == 'enum':
###> temp: str = ' '.join(map(lambda x: f"{x[0]}\\t{x[1]}", flag["arg"]["enum"].items()))
###> print(f'{command_prefix} -x -a "{temp}"')
###> elif type == 'logo':
###> print(f'{command_prefix} -x -a "(__fastfetch_complete_logo)"')
###> elif type == 'structure':
###> print(f'{command_prefix} -x -a "(__fish_complete_list : __fastfetch_complete_structure)"')
###> elif type == 'path':
###> print(f'{command_prefix} -r -F')
###> else:
###> print(f'{command_prefix} -x')
###> else:
###> print(f'{command_prefix} -f')
###>
###> if __name__ == "__main__":
###> try:
###> main()
###> except:
###> sys.exit(1)
###>
+24
View File
@@ -0,0 +1,24 @@
fastfetch (2.8.4) jammy; urgency=medium
* Update to 2.8.4
-- Carter Li <zhangsongcui@live.cn> Fri, 23 Feb 2024 16:14:57 +0800
fastfetch (2.7.1ubuntu2) jammy; urgency=medium
* Ignore .git
-- Carter Li <zhangsongcui@live.cn> Wed, 07 Feb 2024 14:23:23 +0800
fastfetch (2.7.1ubuntu1) jammy; urgency=medium
* Update build scripts
-- Carter Li <zhangsongcui@live.cn> Wed, 07 Feb 2024 13:53:37 +0800
fastfetch (2.7.1) jammy; urgency=medium
* Initial release.
-- Carter Li <zhangsongcui@live.cn> Tue, 06 Feb 2024 15:01:11 +0800
+1
View File
@@ -0,0 +1 @@
12
+13
View File
@@ -0,0 +1,13 @@
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, libnm-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
Package: fastfetch
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
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.
+11
View File
@@ -0,0 +1,11 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: fastfetch
Source: https://github.com/fastfetch-cli/fastfetch
Files: *
Copyright: 2024 fastfetch-cli
License: Expat
Files: src/3rdparty/yyjson/*
Copyright: 2020 YaoYuan
License: Expat
+1
View File
@@ -0,0 +1 @@
fastfetch_2.8.4_source.buildinfo universe/utils optional
Vendored Executable
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
debuild -S -i -I
dput ppa:zhangsongcui3371/fastfetch ~/fastfetch_*.changes
Vendored Executable
+7
View File
@@ -0,0 +1,7 @@
#!/usr/bin/make -f
%:
dh $@ --buildsystem=cmake+ninja
override_dh_ctest_configure:
dh_ctest_configure -- -DSET_TWEAK=OFF -DBUILD_TESTS=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo
+4
View File
@@ -0,0 +1,4 @@
version=4
opts="filenamemangle=s%.*/@ANY_VERSION@%@PACKAGE@-$1.tar.gz%,searchmode=plain" \
https://api.github.com/repos/fastfetch-cli/fastfetch/releases?per_page=100 \
https://api.github.com/repos/fastfetch-cli/fastfetch/tarball/@ANY_VERSION@
+134
View File
@@ -0,0 +1,134 @@
.TH FASTFETCH 1 "@FASTFETCH_BUILD_DATE@" "@CMAKE_PROJECT_NAME@ @CMAKE_PROJECT_VERSION@"
.SH NAME
fastfetch \- a neofetch\-like tool for fetching system information and
displaying them in a pretty way
.SH SYNOPSIS
.B fastfetch
.I [options...]
.SH DESCRIPTION
Fastfetch is a neofetch\-like tool for fetching system information and
displaying them in a pretty way. It is written mainly in C, with performance
and customizability in mind.
Currently, Linux, Android, FreeBSD, MacOS and Windows 7+ are supported.
.SH "EXIT STATUS"
On successful execution, fastfetch returns zero. If any error happened,
the exit code will be non\-zero.
.SH OPTIONS
.SS "Informative Options"
.TP
.B \-h, \-\-help \fI [command]
Show help output, displaying all available options or help for given command
.TP
.B \-v, \-\-version
Show version of fastfetch
.TP
.B \-\-list\-config\-paths
List search paths of config files
.TP
.B \-\-list\-data\-paths
List search paths of presets and logos
.TP
.B \-\-list\-logos
List available logos, they can be loaded with \fI \-\-logo
.TP
.B \-\-list\-modules
List available modules
.TP
.B \-\-list\-presets
List available presets, they can be loaded with \fI \-\-config
.TP
.B \-\-list\-features
List the supported features fastfetch was compiled with
.TP
.B \-\-print\-logos
Print available logos
.TP
.B \-\-print\-structure
Print the default structure
.SS "Display Options"
.TP
.B \-l, \-\-logo \fI <logo>
Set the logo to display
.TP
.B \-s, \-\-structure \fI <structure>
Set the structure of the fetch. For details about the structure,
see the CONFIGURATION section.
.SS "Config Options"
.TP
.B \-c, \-\-config \fI <config>
Use the specified config file or preset. If "none", disable further config
loading. For details about config files, see the CONFIGURATION section
.TP
.B \-\-gen\-config \fI [file]
Generate a config file with options specified on the command line.
If \fI file \fR is specified, the configuration will written to the
file, otherwise it will be written to stdout.
.TP
.B \-\-gen\-config\-force \fI [file]
Same as \fB \-\-gen\-config\fR, but overwrites existing config
.TP
To list all options, use \fB \-\-help\fR this will also print all available module options.
.SH CONFIGURATION
.SS "Fetch Structure"
The structure of a fetch describes the modules that should be included in
the output. It consists of a string of modules, separated by a colon (:).
To list all available modules, use \fB \-\-list\-modules \fR
.SS "Config Files"
fastfetch supports two types of config files. The legacy
configuration files and a JSONC based format.
A JSONC config file is a JSON file that also supports comments with (//). Those
files must have the extension '.jsonc'. You can migrate a legacy config
file to the JSONC format by using \fB\-\-gen\-config\fR.
The specified configuration/preset files are searched in the following order:
1. relative to the current working directory
2. relative to ~/.local/share/fastfetch/presets/
3. relative to /usr/share/fastfetch/presets/
When both a '.jsonc' and a '.conf' file with the same name is found,
the '.jsonc' file is preferred.
Fastfetch provides some default presets. List them with \fB \-\-print\-available\-presets\fR.
.SH "SEE ALSO"
.BR neofetch (1)
.SH BUGS
Please report bugs to:\fI https://github.com/fastfetch\-cli/fastfetch/issues \fR
+244 -35
View File
@@ -26,6 +26,24 @@
"format": {
"description": "Output format of the module",
"type": "string"
},
"percent": {
"description": "Threshold of percentage colors",
"type": "object",
"properties": {
"green": {
"type": "integer",
"minimum": 0,
"maximum": 100,
"description": "Value less then green will be shown in green"
},
"yellow": {
"type": "integer",
"minimum": 0,
"maximum": 100,
"description": "Value greater than green and less then yellow will be shown in yellow.\nValue greater than yellow will be shown in red"
}
}
}
},
"type": "object",
@@ -251,8 +269,24 @@
"description": "Set the path to the file containing OS information. Linux only"
},
"dsForceDrm": {
"type": "boolean",
"description": "Force display detection to use `/sys/class/drm`. Linux only",
"description": "Force display detection to use DRM. Linux only",
"oneOf": [
{
"type": "bool",
"const": false,
"description": "Try `wayland`, then `x11`, then `drm`"
},
{
"type": "string",
"description": "Use `/sys/class/drm` only.",
"const": "sysfs-only"
},
{
"type": "bool",
"const": true,
"description": "Try `libdrm` first, then `sysfs` if libdrm failed"
}
],
"default": false
},
"wmiTimeout": {
@@ -423,6 +457,24 @@
"minimum": 0,
"maximum": 9,
"default": 0
},
"color": {
"type": "object",
"description": "Set color used in different states of percentage bars and numbers",
"properties": {
"green": {
"description": "Color used in green state",
"$ref": "#/$defs/colors"
},
"yellow": {
"description": "Color used in yellow state",
"$ref": "#/$defs/colors"
},
"red": {
"description": "Color used in red state",
"$ref": "#/$defs/colors"
}
}
}
}
},
@@ -470,6 +522,10 @@
"type": "string",
"description": "X11 sessions for better display detection and faster WM detection.\nThe *randr ones provide multi monitor support The libxcb* ones usually have better performance.\n (Linux, FreeBSD)"
},
"drm": {
"type": "string",
"description": "Used for fast resolution and refresh rate detection (Linux)"
},
"gio": {
"type": "string",
"description": "Needed for values that are only stored GSettings (Linux, FreeBSD)"
@@ -580,6 +636,7 @@
"opengl",
"os",
"packages",
"physicaldisk",
"player",
"poweradapter",
"processes",
@@ -591,6 +648,7 @@
"terminal",
"terminalfont",
"terminalsize",
"terminaltheme",
"title",
"theme",
"uptime",
@@ -651,10 +709,6 @@
"const": "font",
"description": "Print system font name"
},
{
"const": "gamepad",
"description": "List connected gamepads"
},
{
"const": "host",
"description": "Print product name of your computer"
@@ -679,10 +733,6 @@
"const": "media",
"description": "Print playing song name"
},
{
"const": "memory",
"description": "Print system memory usage info"
},
{
"const": "monitor",
"description": "Print connected physical monitor information"
@@ -711,10 +761,6 @@
"const": "shell",
"description": "Print current shell name and version"
},
{
"const": "swap",
"description": "Print swap (paging file) space usage"
},
{
"const": "terminal",
"description": "Print current terminal name and version"
@@ -727,17 +773,21 @@
"const": "terminalsize",
"description": "Print current terminal size"
},
{
"const": "terminaltheme",
"description": "Print current terminal theme (foreground and background colors)"
},
{
"const": "theme",
"description": "Print current theme information"
"description": "Print current theme of desktop environment"
},
{
"const": "uptime",
"description": "Print system uptime"
"description": "Print how long system has been running"
},
{
"const": "users",
"description": "List users currently logged in"
"description": "Print users currently logged in"
},
{
"const": "version",
@@ -783,10 +833,6 @@
"const": "battery",
"description": "Print battery capacity, status, etc"
},
"dir": {
"description": "The directory where the battery folders are. Standard: `/sys/class/power_supply/`. Linux only",
"type": "string"
},
"useSetupApi": {
"description": "Set if `SetupAPI` should be used on Windows to detect battery info, which supports multi batteries, but slower. Windows only",
"type": "boolean",
@@ -797,6 +843,9 @@
"type": "boolean",
"default": false
},
"percent": {
"$ref": "#/$defs/percent"
},
"key": {
"$ref": "#/$defs/key"
},
@@ -824,6 +873,9 @@
"type": "boolean",
"default": false
},
"percent": {
"$ref": "#/$defs/percent"
},
"key": {
"$ref": "#/$defs/key"
},
@@ -844,7 +896,10 @@
"properties": {
"type": {
"const": "brightness",
"description": "Print current brightness / luminance of your monitors"
"description": "Print current brightness level of your monitors"
},
"percent": {
"$ref": "#/$defs/percent"
},
"ddcciSleep": {
"type": "integer",
@@ -862,11 +917,6 @@
"const": "chassis",
"description": "Print chassis type (desktop, laptop, etc)"
},
"useWmi": {
"description": "Set if WMI query should be used on Windows, which detects more information but slower",
"type": "boolean",
"default": false
},
"key": {
"$ref": "#/$defs/key"
},
@@ -922,6 +972,9 @@
"const": "cpuusage",
"description": "Print CPU usage. Costs some time to collect data"
},
"percent": {
"$ref": "#/$defs/percent"
},
"separate": {
"type": "boolean",
"description": "Display CPU usage per CPU logical core, instead of an average result",
@@ -954,6 +1007,29 @@
"type": "integer",
"minimum": 0,
"default": 0
},
"block": {
"description": "Set behavior of block printing",
"type": "object",
"properties": {
"width": {
"description": "Set the block width in spaces",
"type": "integer",
"minimum": 1,
"default": 3
},
"range": {
"description": "Set the range of colors in the blocks to print",
"type": "array",
"items": {
"type": "integer",
"minimum": 0,
"maximum": 15
},
"minItems": 2,
"maxItems": 2
}
}
}
}
},
@@ -1025,7 +1101,9 @@
"enum": [
"none",
"original",
"scaled"
"scaled",
"original-with-refresh-rate",
"scaled-with-refresh-rate"
],
"description": "Set if all displays should be printed in one line",
"default": "none"
@@ -1033,7 +1111,16 @@
"preciseRefreshRate": {
"description": "Set if decimal refresh rates should not be rounded into integers when printing",
"type": "boolean",
"default": true
"default": false
},
"order": {
"description": "Set the order should be used when printing",
"enum": [
"none",
"asc",
"desc"
],
"default": "none"
},
"key": {
"$ref": "#/$defs/key"
@@ -1059,7 +1146,7 @@
},
"folders": {
"type": "string",
"description": "A colon (semicolon on Windows) separated list of folder paths for the disk output\nDefault: \"/:/home\" (\"C:\\\\;D:\\\\ ...\" on Windows)"
"description": "A colon (semicolon on Windows) separated list of folder paths for the disk output\nDefault: auto detection using mount-points"
},
"showExternal": {
"type": "boolean",
@@ -1091,6 +1178,9 @@
"description": "Use f_bavail (lpFreeBytesAvailableToCaller for Windows) instead of f_bfree to calculate used bytes",
"default": false
},
"percent": {
"$ref": "#/$defs/percent"
},
"key": {
"$ref": "#/$defs/key"
},
@@ -1117,6 +1207,11 @@
"description": "Show disks with given name prefix only",
"type": "string"
},
"detectTotal": {
"description": "Detect total bytes instead of current rate",
"type": "boolean",
"default": false
},
"key": {
"$ref": "#/$defs/key"
},
@@ -1158,6 +1253,31 @@
}
}
},
{
"title": "Gamepad",
"properties": {
"type": {
"const": "gamepad",
"description": "List connected gamepads"
},
"percent": {
"$ref": "#/$defs/percent"
},
"key": {
"$ref": "#/$defs/key"
},
"keyColor": {
"$ref": "#/$defs/keyColor"
},
"keyWidth": {
"$ref": "#/$defs/keyWidth"
},
"format": {
"$ref": "#/$defs/format"
}
},
"additionalProperties": false
},
{
"title": "GPU",
"properties": {
@@ -1170,8 +1290,8 @@
"type": "boolean",
"default": false
},
"useNvml": {
"description": "Use nvml (NVIDIA Management Library) to detect more detailed GPU information (memory usage, CUDA core count, etc)",
"driverSpecific": {
"description": "Use driver specific method to detect more detailed GPU information (memory usage, core count, etc)",
"type": "boolean",
"default": false
},
@@ -1260,6 +1380,31 @@
},
"additionalProperties": false
},
{
"title": "Memory",
"properties": {
"type": {
"const": "memory",
"description": "Print system memory usage info"
},
"percent": {
"$ref": "#/$defs/percent"
},
"key": {
"$ref": "#/$defs/key"
},
"keyColor": {
"$ref": "#/$defs/keyColor"
},
"keyWidth": {
"$ref": "#/$defs/keyWidth"
},
"format": {
"$ref": "#/$defs/format"
}
},
"additionalProperties": false
},
{
"title": "NetIO",
"properties": {
@@ -1276,6 +1421,11 @@
"type": "boolean",
"default": true
},
"detectTotal": {
"description": "Detect total bytes instead of current rate",
"type": "boolean",
"default": false
},
"key": {
"$ref": "#/$defs/key"
},
@@ -1330,8 +1480,38 @@
"const": "packages",
"description": "List installed package managers and count of installed packages"
},
"winget": {
"description": "Set if winget package count should be detected.\nNote this is very slow operation. Please make sure `winget list` works before enable this option\nWindows only",
"disabled": {
"description": "A colon separated list of package managers to be disabled when detecting",
"type": "string",
"default": "winget"
},
"key": {
"$ref": "#/$defs/key"
},
"keyColor": {
"$ref": "#/$defs/keyColor"
},
"keyWidth": {
"$ref": "#/$defs/keyWidth"
},
"format": {
"$ref": "#/$defs/format"
}
}
},
{
"title": "Physical Disk",
"properties": {
"type": {
"description": "Print physical disk information",
"const": "physicaldisk"
},
"namePrefix": {
"description": "Show disks with given name prefix only",
"type": "string"
},
"temp": {
"description": "Detect and display SSD temperature if supported",
"type": "boolean",
"default": false
},
@@ -1347,7 +1527,8 @@
"format": {
"$ref": "#/$defs/format"
}
}
},
"additionalProperties": false
},
{
"title": "Public IP",
@@ -1415,6 +1596,34 @@
],
"default": "main"
},
"percent": {
"$ref": "#/$defs/percent"
},
"key": {
"$ref": "#/$defs/key"
},
"keyColor": {
"$ref": "#/$defs/keyColor"
},
"keyWidth": {
"$ref": "#/$defs/keyWidth"
},
"format": {
"$ref": "#/$defs/format"
}
},
"additionalProperties": false
},
{
"title": "Swap",
"properties": {
"type": {
"const": "swap",
"description": "Print swap (paging file) space usage"
},
"percent": {
"$ref": "#/$defs/percent"
},
"key": {
"$ref": "#/$defs/key"
},
-1
View File
@@ -1 +0,0 @@
--structure Title:Separator:OS:Host:Bios:Board:Chassis:Kernel:Uptime:Processes:Packages:Shell:Display:Brightness:Monitor:LM:DE:WM:WMTheme:Theme:Icons:Font:Cursor:Wallpaper:Terminal:TerminalFont:TerminalSize:CPU:CPUUsage:GPU:Memory:Swap:Disk:Battery:PowerAdapter:Player:Media:PublicIP:LocalIP:Wifi:DateTime:Locale:Vulkan:OpenGL:OpenCL:Users:Bluetooth:Sound:Gamepad:Weather:NetIO:DiskIO:Version:Break:Colors
+3
View File
@@ -28,6 +28,7 @@
"terminal",
"terminalfont",
"terminalsize",
"terminaltheme",
"cpu",
"cpuusage",
"gpu",
@@ -49,10 +50,12 @@
"users",
"bluetooth",
"sound",
"camera",
"gamepad",
"weather",
"netio",
"diskio",
"physicaldisk",
"version",
"break",
"colors"
-3
View File
@@ -1,3 +0,0 @@
--logo arch
--os-format "Arch Linux ({12})"
--packages-format "{} (pacman)"
-7
View File
@@ -1,7 +0,0 @@
-c all
--pipe
--show-errors
--no-buffer
--publicip-timeout 1000
--weather-timeout 1000
--stat
+72
View File
@@ -0,0 +1,72 @@
{
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
"display": {
"stat": true,
"pipe": true,
"showErrors": true,
"noBuffer": true
},
"modules": [
"title",
"separator",
"os",
"host",
"bios",
"board",
"chassis",
"kernel",
"uptime",
"processes",
"packages",
"shell",
"display",
"brightness",
"monitor",
"lm",
"de",
"wm",
"wmtheme",
"theme",
"icons",
"font",
"cursor",
"wallpaper",
"terminal",
"terminalfont",
"terminalsize",
"terminaltheme",
"cpu",
"cpuusage",
"gpu",
"memory",
"swap",
"disk",
"battery",
"poweradapter",
"player",
"media",
"publicip",
"localip",
"wifi",
"datetime",
"locale",
"vulkan",
"opengl",
"opencl",
"users",
"bluetooth",
"sound",
"camera",
"gamepad",
{
"type": "weather",
"timeout": 1000
},
"netio",
"diskio",
"physicaldisk",
"version",
"break",
"colors"
]
}
-1
View File
@@ -1 +0,0 @@
# Load with --load-config examples/1
-24
View File
@@ -1,24 +0,0 @@
# Load with --load-config examples/2
# Note that you must replace the image path to an existing image to display it.
--kitty /home/linus/Bilder/Gentoo.png
--logo-width 28
--separator "  "
--set-keyless HardwareStart=┌───────── \e[1mHardware Information\e[0m ─────────┐
--set-keyless SoftwareStart=├───────── \e[1mSoftware Information\e[0m ─────────┤
--set-keyless InformationEnd=└────────────────────────────────────────┘
--set-keyless Colors= \e[38m \e[37m \e[36m \e[35m \e[34m \e[33m \e[32m \e[31m
--structure HardwareStart:Host:CPU:GPU:SoftwareStart:OS:Kernel:WM:Shell:Terminal:TerminalFont:Packages:InformationEnd:Colors
--host-key " "
--cpu-key " "
--gpu-key " ﬙"
--os-key " "
--kernel-key " "
--wm-key " "
--shell-key " "
--terminal-key " "
--terminalfont-key " "
--packages-key " "
-7
View File
@@ -1,7 +0,0 @@
# Load with --load-config example/3
--logo debian_small
--structure Vulkan:OpenGL:OpenCL:Memory:Disk:LocalIP
--binary-prefix si
--localip-show-loop false
--disk-folders /:/home:/boot:/efi
-7
View File
@@ -1,7 +0,0 @@
# Load with --load-config examples/4
--color blue
--logo arch_small
--logo-padding-right 1
--separator "  "
--structure DateTime:Break:Player:Media
-11
View File
@@ -1,11 +0,0 @@
# Load with --load-config examples/5
--logo none
--color reset_magenta
--structure Theme:Icons:Font:Cursor
--theme-key T
--theme-format {7}
--icons-key I
--icons-format {5}
--font-key F
--cursor-key C
-4
View File
@@ -1,4 +0,0 @@
--structure Host:Display:CPU:GPU:Memory:Disk:Battery
--memory-format "{?2}{2}{?}"
--disk-format "{?2}{2}{?}"
--battery-format "{?1}{1} {?}{?2}{2} {?}{?3}({3}){?}"
-9
View File
@@ -1,9 +0,0 @@
--structure "Title:Separator:OS:Host:Kernel:Uptime:Packages:Shell:Display:DE:WM:WMTheme:Theme:Icons:Terminal:TerminalFont:CPU:GPU:Memory:Break:Colors"
--host-format "{/2}{-}{/}{2}{?3} {3}{?}"
--os-format "{3} {12}"
--display-key Resolution
--display-compact-type original
--de-format "{2} {3}"
--theme-format "{?1}{1}{?3} {3}{?} [Plasma], {?}{7}"
--terminalfont-format "{/2}{-}{/}{2}{?3} {3}{?}"
--memory-format "{/1}{-}{/}{/2}{-}{/}{} / {}"
-5
View File
@@ -1,5 +0,0 @@
--structure Title:Separator:OS:Host:Kernel:Uptime:Battery:Break:Packages:Shell:Display:Terminal:Break:CPU:GPU:Memory:Break:Colors
--host-format "{/2}{-}{/}{2}{?3} {3}{?}"
--battery-format "{/4}{-}{/}{4}%{?5} [{5}]{?}"
--display-key "Display"
--gpu-key "GPU"
-1
View File
@@ -1 +0,0 @@
--structure OS:Kernel:Shell:DE:WM:WMTheme:Theme:Icons:Font:Cursor:Terminal:TerminalFont
+383
View File
@@ -0,0 +1,383 @@
//
// 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
@@ -0,0 +1,7 @@
{
"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"
}
+27
View File
@@ -0,0 +1,27 @@
Intel Software License Agreement
10.07.21
Use and Redistribution. You may use and redistribute Intels Control API software and the header files for the Intel® Graphics Control Library (collectively, the “Software”), solely for use on Intel platforms, provided the following conditions are met:
* Redistributions must reproduce the above copyright notice and the following terms of use in the Software and in the documentation and/or other materials provided with the distribution.
* Neither the name of Intel nor the names of its suppliers may be used to endorse or promote products derived from this Software without specific prior written permission.
* No reverse engineering, decompilation, or disassembly of Software provided to you in binary form is permitted.
Third Party Software. The Software may contain Third Party Software. “Third Party Software” is third party software, open source software or other Intel software listed in the “third-party-software.txt” or other similarly named text file that is included with the Software. Third Party Software, even if included with the distribution of the Software, may be governed by separate license terms, including without limitation, third party license terms, open source software notices and terms, and/or other Intel software license terms. These separate license terms solely govern your use of the Third Party Software.
Ownership. Title to the Software and all copies remain with Intel or its suppliers.
DISCLAIMER. THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT ARE DISCLAIMED. THIS SOFTWARE IS NOT INTENDED FOR USE IN SYSTEMS OR APPLICATIONS WHERE FAILURE OF THE SOFTWARE MAY CAUSE PERSONAL INJURY OR DEATH AND YOU AGREE THAT YOU ARE FULLY RESPONSIBLE FOR ANY CLAIMS, COSTS, DAMAGES, EXPENSES, AND ATTORNEYS FEES ARISING OUT OF ANY SUCH USE, EVEN IF ANY CLAIM ALLEGES THAT INTEL WAS NEGLIGENT REGARDING THE DESIGN OR MANUFACTURE OF THE SOFTWARE.
LIMITATION OF LIABILITY; INDEMNITY. IN NO EVENT WILL INTEL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. YOU AGREE TO INDEMNIFY, DEFEND, AND HOLD INTEL HARMLESS AGAINST ANY CLAIMS, DAMAGES, AND EXPENSES RESULTING FROM YOUR USE OR UNAUTHORIZED USE OF THE SOFTWARE.
No support. Intel may make changes to the Software, at any time without notice, and is not obligated to support, update or provide training for the Software.
Termination. Your right to use the Software is terminated immediately in the event of your breach of this agreement.
Feedback. Should you provide Intel with comments, modifications, corrections, enhancements or other input (“Feedback”) related to the Software Intel will be free to use, disclose, reproduce, license or otherwise distribute or exploit the Feedback in its sole discretion without any obligations or restrictions of any kind, including without limitation, intellectual property rights or licensing obligations.
Compliance with laws. You agree to comply with all applicable laws and regulations governing your use, transfer, import or export (or prohibition thereof) of the Software.
Governing law. All disputes will be governed by the laws of the United States of America and the State of Delaware without reference to conflict of law principles and subject to the exclusive jurisdiction of the state or federal courts sitting in the State of Delaware, and each party agrees that it submits to the personal jurisdiction and venue of those courts and waives any objections. The United Nations Convention on Contracts for the International Sale of Goods (1980) is specifically excluded and will not apply to the Software.
Severability. The parties intend that if a court holds that any provision of this agreement is invalid or unenforceable under applicable law, the court will modify the provision to the minimum extent necessary to make it valid and enforceable or sever and delete the provision from this agreement. Any change to or deletion of a provision of this agreement under this Section will not affect the validity or enforceability of the remainder of this agreement, which will continue in full force and effect.
+7649
View File
File diff suppressed because it is too large Load Diff
+6
View File
@@ -0,0 +1,6 @@
{
"home": "https://github.com/intel/drivers.gpu.control-library",
"license": "./LICENSE",
"version": "e1776b7be2ceead1296204371447b27860d25a66",
"author": "Intel Corporation"
}
-111
View File
@@ -1,111 +0,0 @@
#include "common/bar.h"
#include "common/color.h"
#include "util/textModifier.h"
void ffAppendPercentBar(FFstrbuf* buffer, double percent, uint8_t green, uint8_t yellow, uint8_t red)
{
assert(green <= 100 && yellow <= 100 && red <= 100);
const FFOptionsDisplay* options = &instance.config.display;
uint32_t blocksPercent = (uint32_t) (percent / 100.0 * options->barWidth + 0.5);
uint32_t blocksGreen = (uint32_t) (green / 100.0 * options->barWidth + 0.5);
uint32_t blocksYellow = (uint32_t) (yellow / 100.0 * options->barWidth + 0.5);
uint32_t blocksRed = (uint32_t) (red / 100.0 * options->barWidth + 0.5);
assert(blocksPercent <= options->barWidth);
if(options->barBorder)
{
if(!options->pipe)
ffStrbufAppendS(buffer, "\e[" FF_COLOR_FG_LIGHT_WHITE "m[ ");
else
ffStrbufAppendS(buffer, "[ ");
}
for (uint32_t i = 0; i < blocksPercent; ++i)
{
if(!options->pipe)
{
if (i == blocksGreen)
ffStrbufAppendS(buffer, "\e[" FF_COLOR_FG_GREEN "m");
else if (i == blocksYellow)
ffStrbufAppendS(buffer, "\e[" FF_COLOR_FG_LIGHT_YELLOW "m");
else if (i == blocksRed)
ffStrbufAppendS(buffer, "\e[" FF_COLOR_FG_LIGHT_RED "m");
}
ffStrbufAppend(buffer, &options->barCharElapsed);
}
if (blocksPercent < options->barWidth)
{
if(!options->pipe)
ffStrbufAppendS(buffer, "\e[" FF_COLOR_FG_LIGHT_WHITE "m");
for (uint32_t i = blocksPercent; i < options->barWidth; ++i)
ffStrbufAppend(buffer, &options->barCharTotal);
}
if(options->barBorder)
{
if(!options->pipe)
ffStrbufAppendS(buffer, "\e[" FF_COLOR_FG_LIGHT_WHITE "m ]");
else
ffStrbufAppendS(buffer, " ]");
}
if(!options->pipe)
ffStrbufAppendS(buffer, FASTFETCH_TEXT_MODIFIER_RESET);
}
// if (green < yellow)
// [0, green]: print green
// (green, yellow]: print yellow
// (yellow, 100]: print red
//
// if (green > yellow)
// [green, 100]: print green
// [yellow, green): print yellow
// [0, yellow): PRINT RED
void ffAppendPercentNum(FFstrbuf* buffer, double percent, uint8_t green, uint8_t yellow, bool parentheses)
{
assert(green <= 100 && yellow <= 100);
const FFOptionsDisplay* options = &instance.config.display;
bool colored = !!(options->percentType & FF_PERCENTAGE_TYPE_NUM_COLOR_BIT);
if (parentheses)
ffStrbufAppendC(buffer, '(');
if (colored && !options->pipe)
{
if(percent != percent)
ffStrbufAppendS(buffer, "\e[" FF_COLOR_FG_LIGHT_BLACK "m");
else if(green < yellow)
{
if (percent <= green)
ffStrbufAppendS(buffer, "\e[" FF_COLOR_FG_GREEN "m");
else if (percent <= yellow)
ffStrbufAppendS(buffer, "\e[" FF_COLOR_FG_LIGHT_YELLOW "m");
else
ffStrbufAppendS(buffer, "\e[" FF_COLOR_FG_LIGHT_RED "m");
}
else
{
if (percent >= green)
ffStrbufAppendS(buffer, "\e[" FF_COLOR_FG_GREEN "m");
else if (percent >= yellow)
ffStrbufAppendS(buffer, "\e[" FF_COLOR_FG_LIGHT_YELLOW "m");
else
ffStrbufAppendS(buffer, "\e[" FF_COLOR_FG_LIGHT_RED "m");
}
}
ffStrbufAppendF(buffer, "%.*f%%", options->percentNdigits, percent);
if (colored && !options->pipe)
{
ffStrbufAppendS(buffer, FASTFETCH_TEXT_MODIFIER_RESET);
}
if (parentheses)
ffStrbufAppendC(buffer, ')');
}
-19
View File
@@ -1,19 +0,0 @@
#pragma once
#ifndef FF_INCLUDED_common_bar
#define FF_INCLUDED_common_bar
#include "fastfetch.h"
enum
{
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,
};
void ffAppendPercentBar(FFstrbuf* buffer, double percent, uint8_t green, uint8_t yellow, uint8_t red);
void ffAppendPercentNum(FFstrbuf* buffer, double percent, uint8_t green, uint8_t yellow, bool parentheses);
#endif
+1 -6
View File
@@ -1,8 +1,5 @@
#pragma once
#ifndef FF_INCLUDED_common_commandoption
#define FF_INCLUDED_common_commandoption
#include "fastfetch.h"
typedef struct FFCustomValue
@@ -17,12 +14,10 @@ typedef struct FFdata
{
FFstrbuf structure;
FFlist customValues; // List of FFCustomValue
bool loadUserConfig;
bool configLoaded;
} FFdata;
bool ffParseModuleOptions(const char* key, const char* value);
void ffPrepareCommandOption(FFdata* data);
void ffPrintCommandOption(FFdata* data, yyjson_mut_doc* jsonDoc);
void ffMigrateCommandOptionToJsonc(FFdata* data, yyjson_mut_doc* jsonDoc);
#endif
-4
View File
@@ -1,8 +1,5 @@
#pragma once
#ifndef FF_INCLUDED_common_dbus
#define FF_INCLUDED_common_dbus
#ifdef FF_HAVE_DBUS
#include <dbus/dbus.h>
@@ -54,4 +51,3 @@ DBusMessage* ffDBusGetProperty(FFDBusData* dbus, const char* busName, const char
void ffDBusGetPropertyString(FFDBusData* dbus, const char* busName, const char* objectPath, const char* interface, const char* property, FFstrbuf* result);
#endif // FF_HAVE_DBUS
#endif // FF_INCLUDED_common_dbus
+18 -7
View File
@@ -12,6 +12,22 @@ void ffFontInit(FFfont* font)
ffListInit(&font->styles, sizeof(FFstrbuf));
}
static void strbufAppendNSExcludingC(FFstrbuf* strbuf, uint32_t length, const char* value, char exclude)
{
if(value == NULL || length == 0)
return;
ffStrbufEnsureFree(strbuf, length);
for(uint32_t i = 0; i < length; i++)
{
if(value[i] != exclude)
strbuf->chars[strbuf->length++] = value[i];
}
strbuf->chars[strbuf->length] = '\0';
}
static void fontInitPretty(FFfont* font)
{
ffStrbufAppend(&font->pretty, &font->name);
@@ -155,7 +171,7 @@ static void fontPangoParseWord(const char** data, FFfont* font, FFstrbuf* altern
ffStrbufInit(alternativeBuffer);
}
ffStrbufAppendNSExludingC(alternativeBuffer, wordLength, wordStart, '-');
strbufAppendNSExcludingC(alternativeBuffer, wordLength, wordStart, '-');
if(
strncasecmp(wordStart, "Ultra ", 6) == 0 ||
@@ -171,7 +187,7 @@ static void fontPangoParseWord(const char** data, FFfont* font, FFstrbuf* altern
if(alternativeBuffer != NULL)
{
ffStrbufAppendNSExludingC(alternativeBuffer, wordLength, wordStart, '-');
strbufAppendNSExcludingC(alternativeBuffer, wordLength, wordStart, '-');
return;
}
@@ -200,11 +216,6 @@ void ffFontInitValues(FFfont* font, const char* name, const char* size)
fontInitPretty(font);
}
void ffFontInitCopy(FFfont* font, const char* name)
{
ffFontInitValues(font, name, NULL);
}
void ffFontInitWithSpace(FFfont* font, const char* rawName)
{
const char* pspace = strrchr(rawName, ' ');
+4 -5
View File
@@ -1,8 +1,5 @@
#pragma once
#ifndef FF_INCLUDED_common_font
#define FF_INCLUDED_common_font
#include "util/FFstrbuf.h"
#include "util/FFlist.h"
@@ -17,9 +14,11 @@ typedef struct FFfont
void ffFontInit(FFfont* font);
void ffFontInitQt(FFfont* font, const char* data);
void ffFontInitPango(FFfont* font, const char* data);
void ffFontInitCopy(FFfont* font, const char* name);
void ffFontInitValues(FFfont* font, const char* name, const char* size);
void ffFontInitWithSpace(FFfont* font, const char* rawName);
void ffFontDestroy(FFfont* font);
#endif
static inline void ffFontInitCopy(FFfont* font, const char* name)
{
ffFontInitValues(font, name, NULL);
}
+3 -3
View File
@@ -57,7 +57,7 @@ static inline uint32_t getArgumentIndex(const FFstrbuf* placeholderValue)
uint32_t result = UINT32_MAX;
if(placeholderValue->chars[0] != '-')
sscanf(placeholderValue->chars, "%u", &result);
sscanf(placeholderValue->chars, "%" PRIu32, &result);
return result == 0 ? UINT32_MAX : result;
}
@@ -203,7 +203,7 @@ void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t n
}
// fastforward to the end of the if without printing the in between
i = ffStrbufNextIndexS(formatstr, i, "{?}") + 2; // 2 is the length of "{?}" - 1 because the loop will increament it again directly after continue
i = ffStrbufNextIndexS(formatstr, i, "{?}") + 2; // 2 is the length of "{?}" - 1 because the loop will increment it again directly after continue
continue;
}
@@ -229,7 +229,7 @@ void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t n
}
// fastforward to the end of the if without printing the in between
i = ffStrbufNextIndexS(formatstr, i, "{/}") + 2; // 2 is the length of "{/}" - 1 because the loop will increament it again directly after continue
i = ffStrbufNextIndexS(formatstr, i, "{/}") + 2; // 2 is the length of "{/}" - 1 because the loop will increment it again directly after continue
continue;
}
-5
View File
@@ -1,8 +1,5 @@
#pragma once
#ifndef FF_INCLUDED_common_format
#define FF_INCLUDED_common_format
typedef enum FFformatargtype
{
FF_FORMAT_ARG_TYPE_NULL = 0,
@@ -27,5 +24,3 @@ typedef struct FFformatarg
void ffFormatAppendFormatArg(FFstrbuf* buffer, const FFformatarg* formatarg);
void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t numArgs, const FFformatarg* arguments);
#endif
+20 -5
View File
@@ -94,7 +94,10 @@ void ffStart(void)
ffHideCursor = instance.config.display.hideCursor && !instance.config.display.pipe && !instance.state.resultDoc;
#ifdef _WIN32
setvbuf(stdout, NULL, _IOFBF, instance.config.display.noBuffer ? 0 : 4096);
if (instance.config.display.noBuffer)
setvbuf(stdout, NULL, _IONBF, 0);
else
setvbuf(stdout, NULL, _IOFBF, 4096);
SetConsoleCtrlHandler(consoleHandler, TRUE);
HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
DWORD mode = 0;
@@ -144,7 +147,7 @@ static void destroyState(void)
ffPlatformDestroy(&instance.state.platform);
yyjson_doc_free(instance.state.configDoc);
yyjson_mut_doc_free(instance.state.resultDoc);
ffStrbufDestroy(&instance.state.migrateConfigPath);
ffStrbufDestroy(&instance.state.genConfigPath);
}
void ffDestroyInstance(void)
@@ -160,9 +163,6 @@ void ffListFeatures(void)
#ifdef FF_HAVE_THREADS
"threads\n"
#endif
#ifdef FF_HAVE_LIBPCI
"libpci\n"
#endif
#ifdef FF_HAVE_VULKAN
"vulkan\n"
#endif
@@ -181,6 +181,9 @@ void ffListFeatures(void)
#ifdef FF_HAVE_X11
"x11\n"
#endif
#ifdef FF_HAVE_DRM
"drm\n"
#endif
#ifdef FF_HAVE_GIO
"gio\n"
#endif
@@ -235,9 +238,21 @@ void ffListFeatures(void)
#ifdef FF_HAVE_DDCUTIL
"libddcutil\n"
#endif
#if __has_include(<linux/videodev2.h>)
"videodev2\n"
#endif
#ifdef FF_HAVE_DIRECTX_HEADERS
"Directx Headers\n"
#endif
#ifdef FF_USE_PROPRIETARY_GPU_DRIVER_API
"Proprietary GPU driver API\n"
#endif
#ifdef FF_USE_SYSTEM_YYJSON
"System yyjson\n"
#endif
#ifdef FF_USE_PCI_MEMORY
"PCI memory\n"
#endif
""
, stdout);
}
+60 -14
View File
@@ -1,9 +1,7 @@
#pragma once
#ifndef FF_INCLUDED_common_io_io
#define FF_INCLUDED_common_io_io
#include "util/FFstrbuf.h"
#include "util/FFlist.h"
#ifdef _WIN32
#include <fileapi.h>
@@ -13,7 +11,12 @@
#else
#include <unistd.h>
#include <dirent.h>
#include <sys/stat.h>
typedef int FFNativeFD;
// procfs's file can be changed between read calls such as /proc/meminfo and /proc/uptime.
// one safe way to read correct data is reading the whole file in a single read syscall
// 8192 comes from procps-ng: https://gitlab.com/procps-ng/procps/-/blob/master/library/meminfo.c?ref_type=heads#L39
#define PROC_FILE_BUFFSIZ 8192
#endif
static inline FFNativeFD FFUnixFD2NativeFD(int unixfd)
@@ -52,11 +55,11 @@ static inline ssize_t ffReadFDData(FFNativeFD fd, size_t dataSize, void* data)
#ifndef _WIN32
return read(fd, data, dataSize);
#else
DWORD readed;
if(!ReadFile(fd, data, (DWORD)dataSize, &readed, NULL))
DWORD bytesRead;
if(!ReadFile(fd, data, (DWORD)dataSize, &bytesRead, NULL))
return -1;
return (ssize_t)readed;
return (ssize_t)bytesRead;
#endif
}
@@ -74,15 +77,45 @@ static inline bool ffReadFileBuffer(const char* fileName, FFstrbuf* buffer)
//Bit flags, combine with |
typedef enum FFPathType
{
FF_PATHTYPE_REGULAR = 1,
FF_PATHTYPE_LINK = 2,
FF_PATHTYPE_DIRECTORY = 4
FF_PATHTYPE_FILE = 1 << 0,
FF_PATHTYPE_DIRECTORY = 1 << 1,
FF_PATHTYPE_ANY = FF_PATHTYPE_FILE | FF_PATHTYPE_DIRECTORY,
} FFPathType;
#define FF_PATHTYPE_FILE (FF_PATHTYPE_REGULAR | FF_PATHTYPE_LINK)
#define FF_PATHTYPE_ANY (FF_PATHTYPE_FILE | FF_PATHTYPE_DIRECTORY)
static inline bool ffPathExists(const char* path, FFPathType pathType)
{
#ifdef _WIN32
DWORD attr = GetFileAttributesA(path);
if(attr == INVALID_FILE_ATTRIBUTES)
return false;
if(pathType & FF_PATHTYPE_FILE && !(attr & FILE_ATTRIBUTE_DIRECTORY))
return true;
if(pathType & FF_PATHTYPE_DIRECTORY && (attr & FILE_ATTRIBUTE_DIRECTORY))
return true;
#else
struct stat fileStat;
if(stat(path, &fileStat) != 0)
return false;
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
return false;
}
bool ffPathExists(const char* path, FFPathType pathType);
bool ffPathExpandEnv(const char* in, FFstrbuf* out);
#define FF_IO_TERM_RESP_WAIT_MS 100 // #554
@@ -102,7 +135,7 @@ static inline void ffUnsuppressIO(bool* suppressed)
#define FF_SUPPRESS_IO() bool __attribute__((__cleanup__(ffUnsuppressIO), __unused__)) io_suppressed__ = ffSuppressIO(true)
void ffListFilesRecursively(const char* path);
void ffListFilesRecursively(const char* path, bool pretty);
static inline bool wrapClose(FFNativeFD* pfd)
{
@@ -154,4 +187,17 @@ static inline bool wrapClosedir(HANDLE* pdir)
#endif
#define FF_AUTO_CLOSE_DIR __attribute__((__cleanup__(wrapClosedir)))
#endif // FF_INCLUDED_common_io_io
static inline bool ffSearchUserConfigFile(const FFlist* configDirs, const char* fileSubpath, FFstrbuf* result)
{
// configDirs is a list of FFstrbufs include the trailing slash
FF_LIST_FOR_EACH(FFstrbuf, dir, *configDirs)
{
ffStrbufClear(result);
ffStrbufAppend(result, dir);
ffStrbufAppendS(result, fileSubpath);
if (ffPathExists(result->chars, FF_PATHTYPE_FILE))
return true;
}
return false;
}
+71 -60
View File
@@ -3,10 +3,10 @@
#include "util/unused.h"
#include <fcntl.h>
#include <sys/stat.h>
#include <termios.h>
#include <poll.h>
#include <dirent.h>
#include <errno.h>
#if __has_include(<wordexp.h>)
#include <wordexp.h>
@@ -16,63 +16,83 @@ static void createSubfolders(const char* fileName)
{
FF_STRBUF_AUTO_DESTROY path = ffStrbufCreate();
while(*fileName != '\0')
char *token = NULL;
while((token = strchr(fileName, '/')) != NULL)
{
ffStrbufAppendC(&path, *fileName);
if(*fileName == '/')
mkdir(path.chars, S_IRWXU | S_IRGRP | S_IROTH);
++fileName;
ffStrbufAppendNS(&path, (uint32_t)(token - fileName + 1), fileName);
mkdir(path.chars, S_IRWXU | S_IRGRP | S_IROTH);
fileName = token + 1;
}
}
bool ffWriteFileData(const char* fileName, size_t dataSize, const void* data)
{
int openFlagsModes = O_WRONLY | O_CREAT | O_TRUNC;
int openFlagsModes = O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC;
int openFlagsRights = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
int FF_AUTO_CLOSE_FD fd = open(fileName, openFlagsModes, openFlagsRights);
if(fd == -1)
{
createSubfolders(fileName);
fd = open(fileName, openFlagsModes, openFlagsRights);
if(fd == -1)
if (errno == ENOENT)
{
createSubfolders(fileName);
fd = open(fileName, openFlagsModes, openFlagsRights);
if(fd == -1)
return false;
}
else
return false;
}
return write(fd, data, dataSize) > 0;
}
static inline void readWithLength(int fd, FFstrbuf* buffer, uint32_t length)
{
ffStrbufEnsureFixedLengthFree(buffer, length);
ssize_t bytesRead = 0;
while(
length > 0 && (bytesRead = read(fd, buffer->chars + buffer->length, length)) > 0
) {
buffer->length += (uint32_t) bytesRead;
length -= (uint32_t) bytesRead;
}
}
static inline void readUntilEOF(int fd, FFstrbuf* buffer)
{
ffStrbufEnsureFree(buffer, 31);
uint32_t available = ffStrbufGetFree(buffer);
ssize_t bytesRead = 0;
while(
(bytesRead = read(fd, buffer->chars + buffer->length, available)) > 0
) {
buffer->length += (uint32_t) bytesRead;
if((uint32_t) bytesRead == available)
ffStrbufEnsureFree(buffer, buffer->allocated - 1); // Doubles capacity every round. -1 for the null byte.
available = ffStrbufGetFree(buffer);
}
}
bool ffAppendFDBuffer(int fd, FFstrbuf* buffer)
{
ssize_t readed = 0;
struct stat fileInfo;
if(fstat(fd, &fileInfo) != 0)
return false;
ffStrbufEnsureFree(buffer, fileInfo.st_size > 0 ? (uint32_t)fileInfo.st_size : 31);
uint32_t free = ffStrbufGetFree(buffer);
while(
(readed = read(fd, buffer->chars + buffer->length, free)) > 0
) {
buffer->length += (uint32_t) readed;
if((uint32_t) readed == free)
ffStrbufEnsureFree(buffer, buffer->allocated - 1); // Doubles capacity every round. -1 for the null byte.
free = ffStrbufGetFree(buffer);
}
if (fileInfo.st_size > 0)
readWithLength(fd, buffer, (uint32_t)fileInfo.st_size);
else
readUntilEOF(fd, buffer);
buffer->chars[buffer->length] = '\0';
ffStrbufTrimRight(buffer, '\n');
ffStrbufTrimRight(buffer, ' ');
return buffer->length > 0;
}
ssize_t ffReadFileData(const char* fileName, size_t dataSize, void* data)
{
int FF_AUTO_CLOSE_FD fd = open(fileName, O_RDONLY);
int FF_AUTO_CLOSE_FD fd = open(fileName, O_RDONLY | O_CLOEXEC);
if(fd == -1)
return -1;
@@ -81,33 +101,13 @@ ssize_t ffReadFileData(const char* fileName, size_t dataSize, void* data)
bool ffAppendFileBuffer(const char* fileName, FFstrbuf* buffer)
{
int FF_AUTO_CLOSE_FD fd = open(fileName, O_RDONLY);
int FF_AUTO_CLOSE_FD fd = open(fileName, O_RDONLY | O_CLOEXEC);
if(fd == -1)
return false;
return ffAppendFDBuffer(fd, buffer);
}
bool ffPathExists(const char* path, FFPathType type)
{
struct stat fileStat;
if(stat(path, &fileStat) != 0)
return false;
int mode = fileStat.st_mode & S_IFMT;
if(type & FF_PATHTYPE_REGULAR && mode == S_IFREG)
return true;
if(type & FF_PATHTYPE_DIRECTORY && mode == S_IFDIR)
return true;
if(type & FF_PATHTYPE_LINK && mode == S_IFLNK)
return true;
return false;
}
bool ffPathExpandEnv(FF_MAYBE_UNUSED const char* in, FF_MAYBE_UNUSED FFstrbuf* out)
{
bool result = false;
@@ -115,7 +115,7 @@ bool ffPathExpandEnv(FF_MAYBE_UNUSED const char* in, FF_MAYBE_UNUSED FFstrbuf* o
#if __has_include(<wordexp.h>) // https://github.com/termux/termux-packages/pull/7056
wordexp_t exp;
if(wordexp(in, &exp, WRDE_NOCMD) != 0)
if(wordexp(in, &exp, 0) != 0)
return false;
if (exp.we_wordc == 1)
@@ -153,14 +153,14 @@ const char* ffGetTerminalResponse(const char* request, const char* format, ...)
}
char buffer[512];
ssize_t readed = read(STDIN_FILENO, buffer, sizeof(buffer) - 1);
ssize_t bytesRead = read(STDIN_FILENO, buffer, sizeof(buffer) - 1);
tcsetattr(STDIN_FILENO, TCSANOW, &oldTerm);
if(readed <= 0)
if(bytesRead <= 0)
return "read(STDIN_FILENO, buffer, sizeof(buffer) - 1) failed";
buffer[readed] = '\0';
buffer[bytesRead] = '\0';
va_list args;
va_start(args, format);
@@ -184,7 +184,7 @@ bool ffSuppressIO(bool suppress)
origOut = dup(STDOUT_FILENO);
origErr = dup(STDERR_FILENO);
nullFile = open("/dev/null", O_WRONLY);
nullFile = open("/dev/null", O_WRONLY | O_CLOEXEC);
init = true;
}
@@ -199,7 +199,7 @@ bool ffSuppressIO(bool suppress)
return true;
}
void listFilesRecursively(FFstrbuf* folder, uint8_t indentation, const char* folderName)
void listFilesRecursively(uint32_t baseLength, FFstrbuf* folder, uint8_t indentation, const char* folderName, bool pretty)
{
DIR* dir = opendir(folder->chars);
if(dir == NULL)
@@ -207,8 +207,12 @@ void listFilesRecursively(FFstrbuf* folder, uint8_t indentation, const char* fol
uint32_t folderLength = folder->length;
if(folderName != NULL)
if(pretty && folderName != NULL)
{
for(uint8_t i = 0; i < indentation - 1; i++)
fputs(" | ", stdout);
printf("%s/\n", folderName);
}
struct dirent* entry;
@@ -221,13 +225,20 @@ void listFilesRecursively(FFstrbuf* folder, uint8_t indentation, const char* fol
ffStrbufAppendS(folder, entry->d_name);
ffStrbufAppendC(folder, '/');
listFilesRecursively(folder, (uint8_t) (indentation + 1), entry->d_name);
listFilesRecursively(baseLength, folder, (uint8_t) (indentation + 1), entry->d_name, pretty);
ffStrbufSubstrBefore(folder, folderLength);
continue;
}
for(uint8_t i = 0; i < indentation; i++)
fputs(" | ", stdout);
if (pretty)
{
for(uint8_t i = 0; i < indentation; i++)
fputs(" | ", stdout);
}
else
{
fputs(folder->chars + baseLength, stdout);
}
puts(entry->d_name);
}
@@ -235,9 +246,9 @@ void listFilesRecursively(FFstrbuf* folder, uint8_t indentation, const char* fol
closedir(dir);
}
void ffListFilesRecursively(const char* path)
void ffListFilesRecursively(const char* path, bool pretty)
{
FF_STRBUF_AUTO_DESTROY folder = ffStrbufCreateS(path);
ffStrbufEnsureEndsWithC(&folder, '/');
listFilesRecursively(&folder, 0, NULL);
listFilesRecursively(folder.length, &folder, 0, NULL, pretty);
}
+68 -53
View File
@@ -6,23 +6,28 @@
static void createSubfolders(const char* fileName)
{
FF_STRBUF_AUTO_DESTROY path = ffStrbufCreate();
while(*fileName != '\0')
char *token = NULL;
while((token = strchr(fileName, '/')) != NULL)
{
ffStrbufAppendC(&path, *fileName);
if(*fileName == '/')
CreateDirectoryA(path.chars, NULL);
++fileName;
ffStrbufAppendNS(&path, (uint32_t)(token - fileName + 1), fileName);
CreateDirectoryA(path.chars, NULL);
fileName = token + 1;
}
}
bool ffWriteFileData(const char* fileName, size_t dataSize, const void* data)
{
HANDLE FF_AUTO_CLOSE_FD handle = CreateFileA(fileName, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if(handle == INVALID_HANDLE_VALUE)
if (handle == INVALID_HANDLE_VALUE)
{
createSubfolders(fileName);
handle = CreateFileA(fileName, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if(handle == INVALID_HANDLE_VALUE)
if (GetLastError() == ERROR_PATH_NOT_FOUND)
{
createSubfolders(fileName);
handle = CreateFileA(fileName, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (handle == INVALID_HANDLE_VALUE)
return false;
}
else
return false;
}
@@ -30,34 +35,50 @@ bool ffWriteFileData(const char* fileName, size_t dataSize, const void* data)
return !!WriteFile(handle, data, (DWORD)dataSize, &written, NULL);
}
static inline void readWithLength(HANDLE handle, FFstrbuf* buffer, uint32_t length)
{
ffStrbufEnsureFixedLengthFree(buffer, length);
DWORD bytesRead = 0;
while(
length > 0 &&
ReadFile(handle, buffer->chars + buffer->length, length, &bytesRead, NULL) != FALSE &&
bytesRead > 0
) {
buffer->length += (uint32_t) bytesRead;
length -= (uint32_t) bytesRead;
}
}
static inline void readUntilEOF(HANDLE handle, FFstrbuf* buffer)
{
ffStrbufEnsureFree(buffer, 31);
uint32_t available = ffStrbufGetFree(buffer);
DWORD bytesRead = 0;
while(
ReadFile(handle, buffer->chars + buffer->length, available, &bytesRead, NULL) != FALSE &&
bytesRead > 0
) {
buffer->length += (uint32_t) bytesRead;
if((uint32_t) bytesRead == available)
ffStrbufEnsureFree(buffer, buffer->allocated - 1); // Doubles capacity every round. -1 for the null byte.
available = ffStrbufGetFree(buffer);
}
}
bool ffAppendFDBuffer(HANDLE handle, FFstrbuf* buffer)
{
DWORD readed = 0;
LARGE_INTEGER fileSize;
if(!GetFileSizeEx(handle, &fileSize))
fileSize.QuadPart = 0;
ffStrbufEnsureFree(buffer, fileSize.QuadPart > 0 ? (uint32_t)fileSize.QuadPart : 31);
uint32_t free = ffStrbufGetFree(buffer);
bool success;
while(
(success = !!ReadFile(handle, buffer->chars + buffer->length, free, &readed, NULL)) &&
readed > 0
) {
buffer->length += (uint32_t) readed;
if((uint32_t) readed == free)
ffStrbufEnsureFree(buffer, buffer->allocated - 1); // Doubles capacity every round. -1 for the null byte.
free = ffStrbufGetFree(buffer);
}
if (fileSize.QuadPart > 0)
readWithLength(handle, buffer, (uint32_t)fileSize.QuadPart);
else
readUntilEOF(handle, buffer);
buffer->chars[buffer->length] = '\0';
ffStrbufTrimRight(buffer, '\n');
ffStrbufTrimRight(buffer, ' ');
return success;
return buffer->length > 0;
}
ssize_t ffReadFileData(const char* fileName, size_t dataSize, void* data)
@@ -78,24 +99,6 @@ bool ffAppendFileBuffer(const char* fileName, FFstrbuf* buffer)
return ffAppendFDBuffer(handle, buffer);
}
bool ffPathExists(const char* path, FFPathType type)
{
DWORD attr = GetFileAttributesA(path);
if(attr == INVALID_FILE_ATTRIBUTES)
return false;
if(type & FF_PATHTYPE_REGULAR && !(attr & FILE_ATTRIBUTE_DIRECTORY))
return true;
if(type & FF_PATHTYPE_DIRECTORY && (attr & FILE_ATTRIBUTE_DIRECTORY))
return true;
if(type & FF_PATHTYPE_LINK && (attr & FILE_ATTRIBUTE_REPARSE_POINT))
return true;
return false;
}
bool ffPathExpandEnv(const char* in, FFstrbuf* out)
{
DWORD length = ExpandEnvironmentStringsA(in, NULL, 0);
@@ -114,16 +117,21 @@ bool ffSuppressIO(bool suppress)
return false;
}
void listFilesRecursively(FFstrbuf* folder, uint8_t indentation, const char* folderName)
void listFilesRecursively(uint32_t baseLength, FFstrbuf* folder, uint8_t indentation, const char* folderName, bool pretty)
{
uint32_t folderLength = folder->length;
if(folderName != NULL)
if(pretty && folderName != NULL)
{
for(uint8_t i = 0; i < indentation - 1; i++)
fputs(" | ", stdout);
printf("%s/\n", folderName);
}
ffStrbufAppendC(folder, '*');
WIN32_FIND_DATAA entry;
HANDLE hFind = FindFirstFileA(folder->chars, &entry);
ffStrbufTrimRight(folder, '*');
if(hFind == INVALID_HANDLE_VALUE)
return;
@@ -137,24 +145,31 @@ void listFilesRecursively(FFstrbuf* folder, uint8_t indentation, const char* fol
ffStrbufSubstrBefore(folder, folderLength);
ffStrbufAppendS(folder, entry.cFileName);
ffStrbufAppendC(folder, '/');
listFilesRecursively(folder, (uint8_t) (indentation + 1), entry.cFileName);
listFilesRecursively(baseLength, folder, (uint8_t) (indentation + 1), entry.cFileName, pretty);
ffStrbufSubstrBefore(folder, folderLength);
continue;
}
for(uint8_t i = 0; i < indentation; i++)
fputs(" | ", stdout);
if (pretty)
{
for(uint8_t i = 0; i < indentation; i++)
fputs(" | ", stdout);
}
else
{
fputs(folder->chars + baseLength, stdout);
}
puts(entry.cFileName);
} while (FindNextFileA(hFind, &entry));
FindClose(hFind);
}
void ffListFilesRecursively(const char* path)
void ffListFilesRecursively(const char* path, bool pretty)
{
FF_STRBUF_AUTO_DESTROY folder = ffStrbufCreateS(path);
ffStrbufEnsureEndsWithC(&folder, '/');
listFilesRecursively(&folder, 0, NULL);
listFilesRecursively(folder.length, &folder, 0, NULL, pretty);
}
const char* ffGetTerminalResponse(const char* request, const char* format, ...)
-5
View File
@@ -1,8 +1,5 @@
#pragma once
#ifndef FF_INCLUDED_common_library
#define FF_INCLUDED_common_library
#include "fastfetch.h"
#include "util/FFcheckmacros.h"
@@ -74,5 +71,3 @@ static inline void ffLibraryUnload(void** handle)
FF_LIBRARY_LOAD_SYMBOL_ADDRESS(library, (varName)->ff ## symbolName, symbolName, returnValue);
void* ffLibraryLoad(const FFstrbuf* userProvidedName, ...);
#endif
+3
View File
@@ -15,6 +15,7 @@ static FFModuleBaseInfo* B[] = {
};
static FFModuleBaseInfo* C[] = {
(void*) &instance.config.modules.camera,
(void*) &instance.config.modules.chassis,
(void*) &instance.config.modules.command,
(void*) &instance.config.modules.colors,
@@ -96,6 +97,7 @@ static FFModuleBaseInfo* O[] = {
static FFModuleBaseInfo* P[] = {
(void*) &instance.config.modules.packages,
(void*) &instance.config.modules.physicalDisk,
(void*) &instance.config.modules.player,
(void*) &instance.config.modules.powerAdapter,
(void*) &instance.config.modules.processes,
@@ -123,6 +125,7 @@ static FFModuleBaseInfo* T[] = {
(void*) &instance.config.modules.terminal,
(void*) &instance.config.modules.terminalFont,
(void*) &instance.config.modules.terminalSize,
(void*) &instance.config.modules.terminalTheme,
(void*) &instance.config.modules.title,
(void*) &instance.config.modules.theme,
NULL,
-5
View File
@@ -1,8 +1,5 @@
#pragma once
#ifndef FF_INCLUDED_common_networking
#define FF_INCLUDED_common_networking
#include "common/thread.h"
#include "util/FFstrbuf.h"
@@ -35,5 +32,3 @@ static inline bool ffNetworkingGetHttp(const char* host, const char* path, uint3
return ffNetworkingRecvHttpResponse(&state, buffer, timeout);
return false;
}
#endif
+24 -21
View File
@@ -7,22 +7,18 @@
static LPFN_CONNECTEX ConnectEx;
static BOOL WINAPI initWsaData(PINIT_ONCE once, PVOID param, PVOID* context)
static const char* initWsaData(WSADATA* wsaData)
{
(void)once;
(void)param;
static WSADATA wsaData;
*context = &wsaData;
if(WSAStartup(MAKEWORD(2, 2), &wsaData) != 0)
return FALSE;
if(WSAStartup(MAKEWORD(2, 2), wsaData) != 0)
return "WSAStartup() failed";
if(LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 2)
return FALSE;
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 FALSE;
return "socket(AF_INET, SOCK_STREAM) failed";
DWORD dwBytes;
GUID guid = WSAID_CONNECTEX;
@@ -30,28 +26,35 @@ static BOOL WINAPI initWsaData(PINIT_ONCE once, PVOID param, PVOID* context)
&guid, sizeof(guid),
&ConnectEx, sizeof(ConnectEx),
&dwBytes, NULL, NULL) != 0)
return FALSE;
return "WSAIoctl(sockfd, SIO_GET_EXTENSION_FUNCTION_POINTER) failed";
return closesocket(sockfd) == 0;
closesocket(sockfd);
return NULL;
}
bool ffNetworkingSendHttpRequest(FFNetworkingState* state, const char* host, const char* path, const char* headers)
{
static INIT_ONCE once = INIT_ONCE_STATIC_INIT;
WSADATA* pData;
if(!InitOnceExecuteOnce(&once, initWsaData, NULL, (LPVOID*) &pData))
static WSADATA wsaData;
if (wsaData.wVersion == 0)
{
if (initWsaData(&wsaData) != NULL)
{
wsaData.wVersion = (WORD) -1;
return false;
}
}
else if (wsaData.wVersion == (WORD) -1)
return false;
memset(state, 0, sizeof(*state));
struct addrinfo hints = {
.ai_family = AF_INET,
.ai_socktype = SOCK_STREAM,
};
struct addrinfo* addr;
if(getaddrinfo(host, "80", &hints, &addr) != 0)
if(getaddrinfo(host, "80", &(struct addrinfo) {
.ai_family = AF_INET,
.ai_socktype = SOCK_STREAM,
}, &addr) != 0)
return false;
state->sockfd = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol);
+1 -1
View File
@@ -143,7 +143,7 @@ void ffOptionParseColor(const char* value, FFstrbuf* buffer)
while(*value != '\0')
{
#define FF_APPEND_COLOR_CODE_COND(prefix, code) \
if(strncasecmp(value, #prefix, strlen(#prefix)) == 0) { ffStrbufAppendS(buffer, code); value += strlen(#prefix); }
if(ffStrStartsWithIgnCase(value, #prefix)) { ffStrbufAppendS(buffer, code); value += strlen(#prefix); }
FF_APPEND_COLOR_CODE_COND(reset_, FF_COLOR_MODE_RESET)
else FF_APPEND_COLOR_CODE_COND(bright_, FF_COLOR_MODE_BOLD)
+3
View File
@@ -10,6 +10,7 @@ struct yyjson_mut_val;
typedef struct FFModuleBaseInfo
{
const char* name;
const char* description;
// A dirty polymorphic implementation in C.
// This is UB, because `void*` is not compatible with `FF*Options*`.
// However we can't do it better unless we move to C++, so that `option` becomes a `this` pointer
@@ -25,6 +26,7 @@ typedef struct FFModuleBaseInfo
static inline void ffOptionInitModuleBaseInfo(
FFModuleBaseInfo* baseInfo,
const char* name,
const char* description,
void* parseCommandOptions, // bool (*const parseCommandOptions)(void* options, const char* key, const char* value)
void* parseJsonObject, // void (*const parseJsonObject)(void* options, yyjson_val *module)
void* printModule, // void (*const printModule)(void* options)
@@ -34,6 +36,7 @@ static inline void ffOptionInitModuleBaseInfo(
)
{
baseInfo->name = name;
baseInfo->description = description;
baseInfo->parseCommandOptions = (__typeof__(baseInfo->parseCommandOptions)) parseCommandOptions;
baseInfo->parseJsonObject = (__typeof__(baseInfo->parseJsonObject)) parseJsonObject;
baseInfo->printModule = (__typeof__(baseInfo->printModule)) printModule;
-5
View File
@@ -1,8 +1,5 @@
#pragma once
#ifndef FF_INCLUDED_parsing_h
#define FF_INCLUDED_parsing_h
#include "fastfetch.h"
#include <stdint.h>
@@ -24,5 +21,3 @@ int8_t ffVersionCompare(const FFVersion* version1, const FFVersion* version2);
void ffParseSize(uint64_t bytes, FFstrbuf* result);
void ffParseTemperature(double celsius, FFstrbuf* buffer);
#endif
+211
View File
@@ -0,0 +1,211 @@
#include "fastfetch.h"
#include "common/percent.h"
#include "common/color.h"
#include "common/option.h"
#include "common/jsonconfig.h"
#include "util/textModifier.h"
#include "util/stringUtils.h"
void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFPercentConfig config)
{
uint8_t green = config.green, yellow = config.yellow;
assert(green <= 100 && yellow <= 100);
const FFOptionsDisplay* options = &instance.config.display;
uint32_t blocksPercent = (uint32_t) (percent / 100.0 * options->barWidth + 0.5);
assert(blocksPercent <= options->barWidth);
if(options->barBorder)
{
if(!options->pipe)
ffStrbufAppendS(buffer, "\e[" FF_COLOR_FG_LIGHT_WHITE "m[ ");
else
ffStrbufAppendS(buffer, "[ ");
}
if (percent != percent)
{
if(!options->pipe)
ffStrbufAppendS(buffer, "\e[" FF_COLOR_FG_LIGHT_BLACK "m");
for (uint32_t i = 0; i < options->barWidth; ++i)
ffStrbufAppend(buffer, &options->barCharElapsed);
}
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;
for (uint32_t i = 0; i < blocksPercent; ++i)
{
if(!options->pipe)
{
uint32_t section1Begin = (uint32_t) ((green <= yellow ? green : yellow) / 100.0 * options->barWidth + 0.5);
uint32_t section2Begin = (uint32_t) ((green > yellow ? green : yellow) / 100.0 * options->barWidth + 0.5);
if (i == section2Begin)
ffStrbufAppendF(buffer, "\e[%sm", (green > yellow ? colorGreen : colorRed));
else if (i == section1Begin)
ffStrbufAppendF(buffer, "\e[%sm", colorYellow);
else if (i == 0)
ffStrbufAppendF(buffer, "\e[%sm", (green <= yellow ? colorGreen : colorRed));
}
ffStrbufAppend(buffer, &options->barCharElapsed);
}
if (blocksPercent < options->barWidth)
{
if(!options->pipe)
ffStrbufAppendS(buffer, "\e[" FF_COLOR_FG_LIGHT_WHITE "m");
for (uint32_t i = blocksPercent; i < options->barWidth; ++i)
ffStrbufAppend(buffer, &options->barCharTotal);
}
}
if(options->barBorder)
{
if(!options->pipe)
ffStrbufAppendS(buffer, "\e[" FF_COLOR_FG_LIGHT_WHITE "m ]");
else
ffStrbufAppendS(buffer, " ]");
}
if(!options->pipe)
ffStrbufAppendS(buffer, FASTFETCH_TEXT_MODIFIER_RESET);
}
void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFPercentConfig config, bool parentheses)
{
uint8_t green = config.green, yellow = config.yellow;
assert(green <= 100 && yellow <= 100);
const FFOptionsDisplay* options = &instance.config.display;
bool colored = !!(options->percentType & FF_PERCENTAGE_TYPE_NUM_COLOR_BIT);
if (parentheses)
ffStrbufAppendC(buffer, '(');
if (colored && !options->pipe)
{
const char* colorGreen = instance.config.display.percentColorGreen.chars;
const char* colorYellow = instance.config.display.percentColorYellow.chars;
const char* colorRed = instance.config.display.percentColorRed.chars;
if(percent != percent)
ffStrbufAppendS(buffer, "\e[" FF_COLOR_FG_LIGHT_BLACK "m");
else if(green <= yellow)
{
if (percent > yellow)
ffStrbufAppendF(buffer, "\e[%sm", colorRed);
else if (percent > green)
ffStrbufAppendF(buffer, "\e[%sm", colorYellow);
else
ffStrbufAppendF(buffer, "\e[%sm", colorGreen);
}
else
{
if (percent < yellow)
ffStrbufAppendF(buffer, "\e[%sm", colorRed);
else if (percent < green)
ffStrbufAppendF(buffer, "\e[%sm", colorYellow);
else
ffStrbufAppendF(buffer, "\e[%sm", colorGreen);
}
}
ffStrbufAppendF(buffer, "%.*f%%", options->percentNdigits, percent);
if (colored && !options->pipe)
{
ffStrbufAppendS(buffer, FASTFETCH_TEXT_MODIFIER_RESET);
}
if (parentheses)
ffStrbufAppendC(buffer, ')');
}
bool ffPercentParseCommandOptions(const char* key, const char* subkey, const char* value, FFPercentConfig* config)
{
if (!ffStrStartsWithIgnCase(subkey, "percent-"))
return false;
subkey += strlen("percent-");
if (ffStrEqualsIgnCase(subkey, "green"))
{
uint32_t num = ffOptionParseUInt32(key, value);
if (num > 100)
{
fprintf(stderr, "Error: usage: %s must be between 0 and 100\n", key);
exit(480);
}
config->green = (uint8_t) num;
return true;
}
if (ffStrEqualsIgnCase(subkey, "yellow"))
{
uint32_t num = ffOptionParseUInt32(key, value);
if (num > 100)
{
fprintf(stderr, "Error: usage: %s must be between 0 and 100\n", key);
exit(480);
}
config->yellow = (uint8_t) num;
return true;
}
return false;
}
bool ffPercentParseJsonObject(const char* key, yyjson_val* value, FFPercentConfig* config)
{
if (!ffStrEqualsIgnCase(key, "percent"))
return false;
if (!yyjson_is_obj(value))
{
fprintf(stderr, "Error: usage: %s must be an object\n", key);
exit(480);
}
yyjson_val* greenVal = yyjson_obj_get(value, "green");
if (greenVal)
{
int num = yyjson_get_int(greenVal);
if (num < 0 || num > 100)
{
fputs("Error: usage: percent.green must be between 0 and 100\n", stderr);
exit(480);
}
config->green = (uint8_t) num;
}
yyjson_val* yellowVal = yyjson_obj_get(value, "yellow");
if (yellowVal)
{
int num = yyjson_get_int(yellowVal);
if (num < 0 || num > 100)
{
fputs("Error: usage: percent.yellow must be between 0 and 100\n", stderr);
exit(480);
}
config->yellow = (uint8_t) num;
}
return true;
}
void ffPercentGenerateJsonConfig(yyjson_mut_doc* doc, yyjson_mut_val* module, FFPercentConfig defaultConfig, FFPercentConfig config)
{
if (config.green == defaultConfig.green && config.yellow == defaultConfig.yellow)
return;
yyjson_mut_val* percent = yyjson_mut_obj_add_obj(doc, module, "percent");
if (config.green != defaultConfig.green)
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);
}
+37
View File
@@ -0,0 +1,37 @@
#pragma once
#include "util/FFstrbuf.h"
enum
{
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,
};
typedef struct FFPercentConfig
{
uint8_t green;
uint8_t yellow;
} FFPercentConfig;
// if (green <= yellow)
// [0, green]: print green
// (green, yellow]: print yellow
// (yellow, 100]: print red
//
// if (green > yellow)
// [green, 100]: print green
// [yellow, green): print yellow
// [0, yellow): print red
void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFPercentConfig config);
void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFPercentConfig config, bool parentheses);
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, FFPercentConfig* config);
bool ffPercentParseJsonObject(const char* key, yyjson_val* value, FFPercentConfig* config);
void ffPercentGenerateJsonConfig(yyjson_mut_doc* doc, yyjson_mut_val* module, FFPercentConfig defaultConfig, FFPercentConfig config);
+1 -1
View File
@@ -6,7 +6,7 @@ void ffPrintLogoAndKey(const char* moduleName, uint8_t moduleIndex, const FFModu
{
ffLogoPrintLine();
//This is used by --set-keyless, in this case we wan't neither the module name nor the separator
//This is used by --set-keyless, in this case we want neither the module name nor the separator
if(moduleName == NULL)
return;
-5
View File
@@ -1,8 +1,5 @@
#pragma once
#ifndef FF_INCLUDED_common_printing
#define FF_INCLUDED_common_printing
#include "fastfetch.h"
#include "common/format.h"
@@ -26,5 +23,3 @@ void ffPrintColor(const FFstrbuf* colorValue);
void ffPrintCharTimes(char c, uint32_t times);
void ffPrintModuleFormatHelp(const char* name, const char* def, uint32_t numArgs, const char* args[]);
#endif
-5
View File
@@ -1,8 +1,5 @@
#pragma once
#ifndef FF_INCLUDED_common_processing
#define FF_INCLUDED_common_processing
#include "util/FFstrbuf.h"
const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool useStdErr);
@@ -28,5 +25,3 @@ static inline const char* ffProcessAppendStdErr(FFstrbuf* buffer, char* const ar
}
return error;
}
#endif
+42 -26
View File
@@ -11,49 +11,55 @@
#include <errno.h>
#include <sys/wait.h>
enum { FF_PIPE_BUFSIZ = 4096 };
enum { FF_PIPE_BUFSIZ = 8192 };
static inline void waitpid_wrapper(pid_t* pid)
static inline int ffPipe2(int *fds, int flags)
{
// remove zombie processes
if (*pid > 0)
waitpid(*pid, NULL, 0);
#ifdef __APPLE__
if(pipe(fds) == -1)
return -1;
fcntl(fds[0], F_SETFL, fcntl(fds[0], F_GETFL) | flags);
fcntl(fds[1], F_SETFL, fcntl(fds[1], F_GETFL) | flags);
return 0;
#else
return pipe2(fds, flags);
#endif
}
const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool useStdErr)
{
int pipes[2];
const int timeout = instance.config.general.processingTimeout;
if(pipe(pipes) == -1)
if(ffPipe2(pipes, O_CLOEXEC) == -1)
return "pipe() failed";
__attribute__((__cleanup__(waitpid_wrapper))) pid_t childPid = fork();
pid_t childPid = fork();
if(childPid == -1)
{
close(pipes[0]);
close(pipes[1]);
return "fork() failed";
}
//Child
if(childPid == 0)
{
int nullFile = open("/dev/null", O_WRONLY);
int nullFile = open("/dev/null", O_WRONLY | O_CLOEXEC);
dup2(pipes[1], useStdErr ? STDERR_FILENO : STDOUT_FILENO);
dup2(nullFile, useStdErr ? STDOUT_FILENO : STDERR_FILENO);
close(pipes[0]);
close(pipes[1]);
setenv("LANG", "C", 1);
execvp(argv[0], argv);
exit(901);
_exit(127);
}
//Parent
close(pipes[1]);
int FF_AUTO_CLOSE_FD childPipeFd = pipes[0];
char str[FF_PIPE_BUFSIZ];
int timeout = instance.config.general.processingTimeout;
if (timeout >= 0)
fcntl(childPipeFd, F_SETFL, fcntl(childPipeFd, F_GETFL) | O_NONBLOCK);
do
while(1)
{
if (timeout >= 0)
{
@@ -61,27 +67,37 @@ const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool use
if (poll(&pollfd, 1, timeout) == 0)
{
kill(childPid, SIGTERM);
waitpid(childPid, NULL, 0);
return "poll(&pollfd, 1, timeout) timeout";
}
else if (pollfd.revents & POLLERR)
{
kill(childPid, SIGTERM);
waitpid(childPid, NULL, 0);
return "poll(&pollfd, 1, timeout) error";
}
}
char str[FF_PIPE_BUFSIZ];
while (true)
ssize_t nRead = read(childPipeFd, str, FF_PIPE_BUFSIZ);
if (nRead > 0)
ffStrbufAppendNS(buffer, (uint32_t) nRead, str);
else if (nRead == 0)
{
ssize_t nRead = read(childPipeFd, str, FF_PIPE_BUFSIZ);
if (nRead > 0)
ffStrbufAppendNS(buffer, (uint32_t) nRead, str);
else if (nRead == 0)
int stat_loc = 0;
if (waitpid(childPid, &stat_loc, 0) == childPid)
{
if (!WIFEXITED(stat_loc))
return "child process exited abnormally";
if (WEXITSTATUS(stat_loc) == 127)
return "command was not found";
// We only handle 127 as an error. See `getTerminalVersionUrxvt` in `terminalshell.c`
return NULL;
else if (nRead < 0)
break;
}
return "waitpid() failed";
}
} while (errno == EAGAIN);
else if (nRead < 0)
break;
};
return NULL;
return "read(childPipeFd, str, FF_PIPE_BUFSIZ) failed";
}
+4 -5
View File
@@ -4,7 +4,7 @@
#include <Windows.h>
enum { FF_PIPE_BUFSIZ = 4096 };
enum { FF_PIPE_BUFSIZ = 8192 };
const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool useStdErr)
{
@@ -83,8 +83,7 @@ const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool use
char str[FF_PIPE_BUFSIZ];
DWORD nRead = 0;
FF_AUTO_CLOSE_FD HANDLE hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
OVERLAPPED overlapped = { .hEvent = hEvent };
OVERLAPPED overlapped = { };
// ReadFile always completes synchronously if the pipe is not created with FILE_FLAG_OVERLAPPED
do
{
@@ -93,11 +92,11 @@ const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool use
switch (GetLastError())
{
case ERROR_IO_PENDING:
if (!timeout || WaitForSingleObject(hEvent, (DWORD) timeout) != WAIT_OBJECT_0)
if (!timeout || WaitForSingleObject(hChildPipeRead, (DWORD) timeout) != WAIT_OBJECT_0)
{
CancelIo(hChildPipeRead);
TerminateProcess(hProcess, 1);
return "WaitForSingleObject(hEvent) failed or timeout";
return "WaitForSingleObject(hChildPipeRead) failed or timeout";
}
if (!GetOverlappedResult(hChildPipeRead, &overlapped, &nRead, FALSE))
+1 -1
View File
@@ -91,7 +91,7 @@ bool ffParsePropLines(const char* lines, const char* start, FFstrbuf* buffer)
// The following functions return true if the file was found, independently if start was found
// Buffers which already contain content are not overwritten
// The last occurence of start in the first file will be the one used
// The last occurrence of start in the first file will be the one used
bool ffParsePropFileValues(const char* filename, uint32_t numQueries, FFpropquery* queries)
{
-5
View File
@@ -1,8 +1,5 @@
#pragma once
#ifndef FF_INCLUDED_common_properties
#define FF_INCLUDED_common_properties
#include "fastfetch.h"
typedef struct FFpropquery
@@ -51,5 +48,3 @@ static inline bool ffParsePropFileData(const char* relativeFile, const char* sta
{
return ffParsePropFileDataValues(relativeFile, 1, (FFpropquery[]){{start, buffer}});
}
#endif
+2 -3
View File
@@ -411,9 +411,8 @@ bool ffSettingsGetFreeBSDKenv(const char* propName, FFstrbuf* result)
//https://wiki.ghostbsd.org/index.php/Kenv
ffStrbufEnsureFree(result, KENV_MVALLEN);
int len = kenv(KENV_GET, propName, result->chars + result->length, KENV_MVALLEN);
if (len <= 0) return false;
result->length += (uint32_t) len;
result->chars[result->length] = '\0';
if (len <= 1) return false; // number of bytes copied, including NUL terminator
result->length += (uint32_t) len - 1;
return true;
}
#endif
-5
View File
@@ -1,8 +1,5 @@
#pragma once
#ifndef FF_INCLUDED_common_settings
#define FF_INCLUDED_common_settings
#include "fastfetch.h"
typedef enum FFvarianttype
@@ -38,5 +35,3 @@ bool ffSettingsGetAndroidProperty(const char* propName, FFstrbuf* result);
#elif defined(__FreeBSD__)
bool ffSettingsGetFreeBSDKenv(const char* propName, FFstrbuf* result);
#endif
#endif
-5
View File
@@ -1,8 +1,5 @@
#pragma once
#ifndef FF_INCLUDED_common_sysctl
#define FF_INCLUDED_common_sysctl
#include "fastfetch.h"
#include "util/FFcheckmacros.h"
@@ -13,5 +10,3 @@ const char* ffSysctlGetString(const char* propName, FFstrbuf* result);
FF_C_NODISCARD int ffSysctlGetInt(const char* propName, int defaultValue);
FF_C_NODISCARD int64_t ffSysctlGetInt64(const char* propName, int64_t defaultValue);
FF_C_NODISCARD void* ffSysctlGetData(int* request, u_int requestLength, size_t* resultLength);
#endif
-5
View File
@@ -1,8 +1,5 @@
#pragma once
#ifndef FF_INCLUDED_common_thread
#define FF_INCLUDED_common_thread
#include "fastfetch.h"
#ifdef FF_HAVE_THREADS
@@ -82,5 +79,3 @@
static inline void ffThreadMutexUnlock(FFThreadMutex* mutex) { FF_UNUSED(mutex) }
#define FF_THREAD_ENTRY_DECL_WRAPPER(fn, paramType)
#endif //FF_HAVE_THREADS
#endif
+1 -6
View File
@@ -1,8 +1,5 @@
#pragma once
#ifndef FF_INCLUDED_common_time
#define FF_INCLUDED_common_time
#include <stdint.h>
#ifdef _WIN32
#include <synchapi.h>
@@ -45,8 +42,6 @@ static inline void ffTimeSleep(uint32_t msec)
#ifdef _WIN32
SleepEx(msec, TRUE);
#else
nanosleep(&(struct timespec){ msec / 1000, (msec % 1000) * 1000000 }, NULL);
nanosleep(&(struct timespec){ msec / 1000, (long) (msec % 1000) * 1000000 }, NULL);
#endif
}
#endif
-16
View File
@@ -1,16 +0,0 @@
# Fastfetch system configuration
# This file sets the default config for all users of the system.
# For more information about how configuration files work,
# see ~/.config/fastfetch/config.conf.
# All options that can be put there (or passed as argument) can be put here too.
# Use fastfetch --print-config-system > /etc/fastfetch/config.conf
# to overwrite this file with the current default file.
# User config option
# Sets if fastfetch should load user provided configuration.
# If this is off, fastfetch ignores the user config file and any passed arguments
# Must be true or false
# Default is true.
#--load-user-config true
-41
View File
@@ -1,41 +0,0 @@
// ~/.config/fastfetch/config.jsonc
// See https://github.com/fastfetch-cli/fastfetch/wiki/Configuration for more details
// See *.jsonc in https://github.com/fastfetch-cli/fastfetch/tree/dev/presets/examples for more examples
{
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
"logo": {
"padding": {
"top": 2
}
},
"modules": [
"title",
"separator",
"os",
"host",
"kernel",
"uptime",
"packages",
"shell",
"display",
"de",
"wm",
"wmtheme",
"theme",
"icons",
"font",
"cursor",
"terminal",
"terminalfont",
"cpu",
"gpu",
"memory",
"disk",
"localip",
"battery",
"poweradapter",
"locale",
"break",
"colors"
]
}
-519
View File
@@ -1,519 +0,0 @@
# Fastfetch configuration
# Write every argument in different lines.
# Direct arguments will overwrite the corresponding ones in this file.
# Argument keys are not case sensitive.
# Whitespaces are trimmed at the beginning and the end.
# Empty lines or lines starting with # are ignored.
# This file was shipped with $" FASTFETCH_PROJECT_VERSION $".
# Use fastfetch --gen-config-force to overwrite this file with the current defaults
# Below some often usefull options are listed. Uncomment and modify them so they take affect.
# Note that there are a lot more options than the ones listed here, take a look at "fastfetch --help".
# Of course all of them can be made persistent here too.
# Config option:
# Load additional config files.
# Some are shipped with fastfetch, list them with "fastfetch --list-presets".
# Must be a path to a config file or the name of a shipped preset.
# The config file is completely loaded before continuing in the current file, so the placement of this option matters, as later options overwrite already set ones.
# Can be used multiple times to load multiple config files / presets.
#--load-config /path/to/config.txt
# Structure option:
# Sets the modules to use and their order.
# Must be a list of module names, separated by colons.
# List available modules with "fastfetch --list-modules".
# Get the default structure with "fastfetch --print-structure".
#--structure $" FASTFETCH_DATATEXT_STRUCTURE $"
# Multithreading option:
# Sets if fastfetch should use multiple threads to detect the values.
# Must be true or false.
# Default is true.
#--multithreading true
# Print stat option:
# Sets if fastfetch should print time usage (in ms) for individual modules
# If true, it will also enable --show-errors
# Must be true or false.
# Default is false.
#--stat true
# Slow operations option:
# Sets if fastfetch is allowed to use known slow operations to detect more / better values.
# Must be true or false.
# Default is false.
#--allow-slow-operations false
# Linewrap option:
# Sets if fastfetch should disable linewrap during the run.
# Must be true or false.
# Default is true.
#--disable-linewrap true
# Cursor option:
# Sets if fastfetch should hide the console cursor during the run.
# Must be true or false.
# Default is true.
#--hide-cursor true
# Processing timeout option:
# Sets the timeout (ms) when waiting for child processes
# Must be an integer.
# Default is 1000
#--processing-timeout 1000
# WMI timeout option:
# Sets the timeout (ms) for WMI queries. Windows only
# Must be an integer.
# Default is 5000
#--wmi-timeout 5000
# Logo option:
# Sets the logo to use.
# List available logos with "fastfetch --list-logos".
# Print available logos with "fastfetch --print-logos".
# Must be the name of an available logo or a path to a text file containing a custom logo.
# Default is the current distribution.
#--logo arch
# Logo type option:
# Sets the logo type to use.
# Must be auto, builtin, file, file-raw, data, data-raw, sixel, kitty or chafa.
# Default is auto.
#--logo-type auto
# Logo width option:
# Sets the width of the logo (in characters) if the logo is an image.
# Must be a positive integer.
# Default is 65.
#--logo-width 65
# Logo height option:
# Sets the height of the logo (in characters) if the logo is an image.
# Must be a positive integer.
# Default is 0 (keeps aspect ration).
#--logo-height 0
# Logo color options:
# Overwrite a color in the logo. Also works for user provided logos.
# In the user logo, they replace $[1-9]. Use $$ to print a single $ sign.
# Must be linux console color codes or the name of a color.
# Default is the one specified by the logo.
# Use "fastfetch --help color" to learn more and see examples.
# Valid index range is [1-9].
#--logo-color-1 red
#--logo-color-2 32
# [...]
#--logo-color-9 yellow
# Logo padding option:
# Adds a padding to the left and the right side of the logo.
# Must be a positive integer.
# Default is 0.
#--logo-padding 0
# Logo padding left option:
# Adds a padding to the left side of the logo.
# Must be a positive integer.
# Default is 0.
#--logo-padding-left 0
# Logo padding right option:
# Adds a padding to the right side of the logo.
# Must be a positive integer.
# Default is 0.
#--logo-padding-right 0
# Logo padding top option:
# Adds a padding to the top side of the logo.
# Must be a positive integer.
# Default is 0.
#--logo-padding-top 0
# Logo print remaining option:
# Sets if the remaining logo should be printed, it is has more lines than modules to show.
# Must be true or false.
# Default is true.
#--logo-print-remaining true
# Color keys option:
# Sets the color of the keys.
# Must be linux console color codes or the name of a color.
# Default is the key color of the logo.
# Use "fastfetch --help color" to learn more and see examples.
#--color-keys magenta
# Color title option:
# Sets the color of the title.
# Must be linux console color codes or the name of a color.
# Default is the title color of the logo.
# Use "fastfetch --help color" to learn more and see examples.
#--color-title magenta
# Binary prefix option:
# Sets the binary prefix to use.
# Must be a IEC, SI or JEDEC.
# Default is IEC.
#--binary-prefix IEC
# Size number of digits option:
# Sets the number of digits to keep after the decimal point when formatting sizes.
# Must be an possitive integer.
# Default is 2.
#--size-ndigits 2
# Size max prefix option:
# Sets the largest binary prefix to use when formatting sizes.
# Must be one of B, kB, MB, GB, TB, PB, EB, ZB, YB
# Default is YB.
#--size-max-prefix YB
# Disable output buffer option:
# Sets if the stdout application buffer should be disabled.
# Must be true or false.
# Default is false.
#--no-buffer false
# Title FQDN option:
# Sets if the title should use the fully qualified domain name.
# Must be true or false.
# Default is false.
#--title-fqdn false
# Title user color option:
# Sets color of the user name (left part).
# Default is empty (use color of `--color-title`).
#--title-color-user
# Title at color option:
# Sets color of the @ symbol (middle part).
# Default is empty (use color of `--color-title`).
#--title-color-at
# Title host color option:
# Sets color of the host name (right part).
# Default is empty (use color of `--color-title`).
#--title-color-host
# Separator option:
# Sets the string placed between a key and its value.
# Can be any string.
# Default is ": ".
#--separator ": "
# Separator string option:
# Sets the string printed by the "separator" module (usually between title and rest of output)
# Must be any string. It is repated / cut to fit perfectly.
# Default is "-"
#--separator-string -
# Public IP URL option:
# Sets the URL of public IP detection server to be used.
# Only HTTP protocol is supported, and the value should not contain "http://" prefix.
# Default is "ipinfo.io/ip".
#--publicip-url "ipinfo.io/ip"
# Public IP timeout option:
# Sets the time to wait for the public ip server to respond.
# Must be a positive integer.
# Default is 0 (disabled).
#--publicip-timeout 0
# Weather location option:
# Sets the location to be used. It must be URI encoded (eg a whitespace must be encoded as `+`).
# Default is empty (guessing by public IP)
#--weather-location "Location"
# Weather output format option:
# Sets the weather format to be used. It must be URI encoded.
# See: https://github.com/chubin/wttr.in#one-line-output
# Default is "%t+-+%C+(%l)".
#--weather-output-format "%t+-+%C+(%l)"
# Weather timeout option:
# Sets the time to wait for the weather server (wttr.in) to respond.
# Must be a positive integer.
# Default is 0 (disabled).
#--weather-timeout 0
# OS file option
# Sets the path to the file containing the operating system information.
# Should be a valid path to an existing file.
# Default is /etc/os-release.
#--os-file /etc/os-release
# Player name option
# Sets the name of the player. This is also used in song detection
# Must be the exact name of the player or a dbus address (e.g. org.mpris.MediaPlayer2.spotify)
# Default is the first match starting with org.mpris.MediaPlayer2.
#--player-name spotify
# Display server force DRM option
# Sets if fastfetch should only use `/sys/class/drm` to detect displays if you get issues with the default behavior.
# Note DRM doesn't support refresh rate or scaled resolution detection.
# Only supported on Linux.
# Must be true or false.
# Default is false.
#--ds-force-drm false
# Escape bedrock option
# Sets if fastfetch should escape the bedrock jail, if it detectes that it is running in one
# Must be true or false.
# Default is true.
#--escape-bedrock true
# OpenGL option
# Sets with opengl context creation library to use
# Must be either auto, egl, glx or osmesa
# Default is auto.
#--opengl-library auto
# GPU hide options
# Sets whether to hide certain gpu types
# Must be either true or false
# Default is false.
#--gpu-hide-integrated
#--gpu-hide-discrete
# GPU detection options
# Forces using vulkan to detect GPUs
# which support video memory usage detection with `--allow-slow-operations`
# Must be either true or false
# Default is false.
#--gpu-force-vulkan
# Disk show options
# Sets if certain types of disk should be printed
# Must be either true or false
# Default is false except for --disk-show-external.
#--disk-show-external true
#--disk-show-hidden false
#--disk-show-subvolumes false
#--disk-show-unknown false
# Disk option
# A colon (semicolon on Windows) separated list of folder paths for the disk output
# This option override `--disk-show-*` options above
# Must be a string
# Default is "/:/home" ("C:\\;D:\\ ..." on Windows).
#--disk-folders /:/home
# Bluetooth show disconnected option
# Sets if disconnected bluetooth devices should be printed
# Must be either true or false
# Default is false.
#--bluetooth-show-disconnected false
# Display compact output option
# Sets if all displays should be printed in one line
# Must be either original (print pixel resolution) or scaled (print scaled resolution)
# Default is none.
#--display-compact-type none
# Display detect name option
# Sets if display name should be detected and printed (if supported)
# Must be either true of false
# Default is false.
#--display-detect-name none
# Display precise refresh rate option
# Sets if decimal refresh rates should not be rounded into integers when printing
# Must be either true (keep decimals) of false (round into integers)
# Default is false.
#--display-precise-refresh-rate false
# Sound show all option
# Sets if all sound devices should be printed
# Must be either main, active or all. Default is main
# Default is main.
#--sound-type main
# Percentage output type option
# Applies to all modules that prints percentage values. Currently memory, swap, disk, battery and CPU usage are supported.
# Only works with default format ( without --module-format option ).
# 0: prints none; 1: prints percent number only; 2: prints bar only; 3: prints both percent number and bar; 6: prints bar and hide other texts; 9: prints colored number
#--percent-type 1
# Key options:
# Sets the displayed key of a module
# Can be any string. Some of theme take an argument like a format string. See "fastfetch --help format" for help.
#--os-key OS
#--host-key Host
#--chassis-key Chassis
#--kernel-key Kernel
#--uptime-key Uptime
#--processes-key Processes
#--packages-key Packages
#--shell-key Shell
#--display-key Display {1}
#--brightness-key Brightness ({1})
#--monitor-key Monitor
#--de-key DE
#--wm-key WM
#--wmtheme-key WM Theme
#--theme-key Theme
#--icons-key Icons
#--font-key Font
#--cursor-key Cursor
#--terminal-key Terminal
#--terminalfont-key Terminal Font
#--cpu-key CPU
#--cpuusage-key CPU Usage
#--gpu-key GPU {1}
#--memory-key Memory
#--swap-key Swap
#--disk-key Disk ({1})
#--battery-key Battery {1}
#--poweradapter-key Power Adapter {1}
#--lm-key LM
#--locale-key Locale
#--localip-key Local IP ({1})
#--netio-key Network IO ({1})
#--publicip-key Public IP
#--wifi-key Wifi
#--weather-key Weather
#--player-key Media Player
#--media-key Media
#--datetime-key Date Time
#--version-key Version
#--vulkan-key Vulkan
#--opengl-key OpenGL
#--opencl-key OpenCL
#--users-key Users
#--bluetooth-key Bluetooth
#--sound-key Sound
#--gamepad-key Gamepad
#--wallpaper-key Wallpaper
# Format options:
# Sets the format string for module values.
# For information on format strings, see "fastfetch --help format".
# To see the parameter they take and their default value, see "fastfetch --help *-format", e.g. "fastfetch --help os-format".
# An empty format string (As they are currently below) will behave as if it was not set.
#--title-format
#--os-format
#--host-format
#--chassis-format
#--kernel-format
#--uptime-format
#--processes-format
#--packages-format
#--shell-format
#--display-format
#--brightness-format
#--de-format
#--wm-format
#--wmtheme-format
#--theme-format
#--icons-format
#--font-format
#--cursor-format
#--terminal-format
#--terminalfont-format
#--cpu-format
#--cpuusage-format
#--gpu-format
#--memory-format
#--swap-format
#--disk-format
#--battery-format
#--poweradapter-format
#--lm-format
#--locale-format
#--localip-format
#--netio-format
#--publicip-format
#--weather-format
#--monitor-format
#--player-format
#--media-format
#--datetime-format
#--version-format
#--vulkan-format
#--opengl-format
#--opencl-format
#--users-format
#--bluetooth-format
#--sound-format
#--gamepad-format
#--wallpaper-format
# Key color options:
# Overrides the global `--color-keys` for one specified module
#--title-key-color
#--os-key-color
#--host-key-color
#--chassis-key-color
#--kernel-key-color
#--uptime-key-color
#--processes-key-color
#--packages-key-color
#--shell-key-color
#--display-key-color
#--brightness-key-color
#--de-key-color
#--wm-key-color
#--wmtheme-key-color
#--theme-key-color
#--icons-key-color
#--font-key-color
#--cursor-key-color
#--terminal-key-color
#--terminalfont-key-color
#--cpu-key-color
#--cpuusage-key-color
#--gpu-key-color
#--memory-key-color
#--swap-key-color
#--disk-key-color
#--battery-key-color
#--poweradapter-key-color
#--lm-key-color
#--locale-key-color
#--localip-key-color
#--netio-key-color
#--publicip-key-color
#--weather-key-color
#--monitor-key-color
#--player-key-color
#--media-key-color
#--datetime-key-color
#--version-key-color
#--vulkan-key-color
#--opengl-key-color
#--opencl-key-color
#--users-key-color
#--bluetooth-key-color
#--sound-key-color
#--gamepad-key-color
#--wallpaper-key-color
# Library options:
# Sets an user specific path to a library to load.
# Must be a valid path to a library.
#--lib-PCI /usr/lib/libpci.so
#--lib-vulkan /usr/lib/libvulkan.so (libMoltenVK.dylib on macOS)
#--lib-wayland /usr/lib/libwayland-client.so
#--lib-xcb-randr /usr/lib/libxcb-randr.so
#--lib-xcb /usr/lib/libxcb.so
#--lib-Xrandr /usr/lib/libXrandr.so
#--lib-X11 /usr/lib/libX11.so
#--lib-gio /usr/lib/libgio-2.0.so
#--lib-DConf /usr/lib/libdconf.so
#--lib-DBus /usr/lib/libdbus-1.so
#--lib-XFConf /usr/lib/libxfconf-0.so
#--lib-sqlite3 /usr/lib/libsqlite3.so
#--lib-rpm /usr/lib/librpm.so
#--lib-imagemagick /usr/lib/libMagickCore-7.Q16HDRI.so
#--lib-z /usr/lib/libz.so
#--lib-chafa /usr/lib/libchafa.so
#--lib-egl /usr/lib/libEGL.so
#--lib-glx /usr/lib/libGLX.so
#--lib-osmesa /usr/lib/libOSMesa.so
#--lib-opencl /usr/lib/libOpenCL.so
#--lib-freetype /data/data/com.termux/files/usr/lib
#--lib-pulse /usr/lib/libpulse.so
#--lib-ddcutil /usr/lib/libddcutil.so
#--lib-nm /usr/lib/libnm.so
+1502
View File
File diff suppressed because it is too large Load Diff
+3 -185
View File
@@ -1,186 +1,4 @@
Fastfetch is a neofetch-like tool for fetching system information and displaying them in a pretty way
Usage: fastfetch <?options>
Informative options:
-h, --help: Show this message
-h, --help <command>: Show help for a specific command
-v, --version: Show the version of fastfetch
--list-config-paths: List search paths of config files
--list-data-paths: List search paths of presets and logos
--list-logos: List available logos
--list-modules: List available modules
--list-presets: List presets fastfetch knows about; they can be loaded with --load-config (+)
--list-features: List the supported features fastfetch was compiled with (mainly for development)
--print-logos: Print available logos
--print-config-system: Print the default system config
--print-config-user: Print the default user config
--print-structure: Print the default structure
Config options:
-c, --load-config <file>: Load a config file or preset (+)
--gen-config <type>: Generate a sample config file in the default path. Param `type` can be `jsonc` or deprecated `conf`
--gen-config-force <type>: Generate a sample config file in the default path. Overwrite the existing one
--migrate-config <?path>: Migrate old flag based config file to new JSONC format. Optional param `path` is the file path that new file should be write to
General options:
--thread <?value>: Use separate threads to send HTTP requests
--escape-bedrock <?value>: On Bedrock Linux, whether to escape the bedrock jail
--wmi-timeout <num>: Set the timeout (ms) for WMI queries. Windows only. Default is 5000
--processing-timeout <num>: Set the timeout (ms) when waiting for child processes. Default is 1000
--ds-force-drm <?value>: Set if only DRM should be used to detect displays. Default is false. Linux only
Logo options:
-l, --logo <logo>: Set the logo; if default, the name of a builtin logo or a path to a file
--logo-type <type>: Set the type of the logo given; must be auto, builtin, file, file-raw, data, data-raw, sixel, kitty, iterm or chafa
--logo-width <width>: Set the width of the logo (in characters), if it is an image. Required for iTerm image protocol
--logo-height <height>: Set the height of the logo (in characters), if it is an image. Required for iTerm image protocol
--logo-preserve-aspect-ratio <?value>: Set if the logo should fill the specified width and height as much as possible without stretching. Supported by iTerm image protocol
--logo-color-[1-9] <color>: Overwrite a color in the logo
--logo-padding <padding>: Set the padding on the left and the right of the logo
--logo-padding-left <padding>: Set the padding on the left of the logo
--logo-padding-right <padding>: Set the padding on the right of the logo
--logo-padding-top <padding>: Set the padding on the top of the logo
--logo-print-remaining <?value>: Whether to print the remaining logo, if it has more lines than modules to display
--logo-separate <?value>: If true, print modules at bottom of the logo
--logo-recache <?value>: If true, regenerate image logo cache
--file <file>: Short for --logo-type file --logo <file>
--file-raw <file>: Short for --logo-type file-raw --logo <file>
--data <data>: Short for --logo-type data --logo <data>
--data-raw <data>: Short for --logo-type data-raw --logo <data>
--sixel <file>: Short for --logo-type sixel --logo <file>
--kitty <file>: Short for --logo-type kitty --logo <file>
--iterm <file>: Short for --logo-type iterm --logo <file>
--chafa <file>: Short for --logo-type chafa --logo <file>
--chafa-fg-only <?value>: Produce character-cell output using foreground colors only. See chafa document for detail
--chafa-symbols <str>: Specify character symbols to employ in final output. See chafa document for detail
--chafa-canvas-mode <value>: Determine how colors are used in the output. This value maps the int value of enum ChafaCanvasMode. See chafa document for detail
--chafa-color-space <value>: Set color space used for quantization. 0 for RGB; 1 for DIN99d. See chafa document for detail
--chafa-dither-mode <value>: Set output dither mode (No effect with 24-bit color). This value maps the int value of enum ChafaDitherMode. See chafa document for detail
Display options:
-s,--structure <structure>: Set the structure of the fetch. Must be a colon separated list of keys. Use `fastfetch --list-modules` to see the ones available.
--stat <?value>: Show time usage (in ms) for individual modules
--pipe <?value>: Disable logo and all escape sequences
--color-keys <color>: Set the color of the keys
--color-title <color>: Set the color of the title
--color <color>: Set the color of both the keys and title
--key-width <num>: Align the width of keys to <num> characters
--bright-color <?value>: Set if the keys, title and ASCII logo should be printed in bright color. Default is true
--separator <str>: Set the separator between key and value. Default is a colon with a space
--set <key=value>: Hard set the value of a key
--set-keyless <key=value>: Hard set the value of a key, but don't print the key or the separator
--show-errors <?value>: Print occurring errors
--disable-linewrap <?value>: Whether to disable line wrap during the run
--hide-cursor <?value>: Whether to hide the cursor during the run
--binary-prefix <value>: Set the binary prefix to used. Must be IEC, SI or JEDEC. Default is IEC
--percent-type <value>: Set the percentage output type. 1 for percentage number, 2 for bar, 3 for both, 6 for bar only, 9 for colored number. Default is 9
--percent-ndigits <value>: Set the number of digits to keep after the decimal point when formatting percentage numbers. Default is 0
--bar-char-elapsed <str>: Set the character to use in elapsed part. Default is '■'
--bar-char-total <str>: Set the character to use in total part. Default is '-'
--bar-width <?num>: Set the width of the bar, in number of characters. Default is 10
--bar-border <?value>: Whether to show a border around the bar. Default is true
--no-buffer <?value>: Set if the stdout application buffer should be disabled. Default is false
--size-ndigits <value>: Set the number of digits to keep after the decimal point when formatting sizes
--size-max-prefix <value>: Set the largest binary prefix to use when formatting sizes. Default is YB
--temperature-unit <value>: Set the unit of the temperature. Must be one of C, F and K. Default is C
General module options:
--<module>-format <format>: Set the format string to use for each specific module.
To see how a format string works, use `fastfetch --help format`.
To see help about a specific format string, use `fastfetch --help <module>-format`.
--<module>-key <key>: Set the key to use for each specific module.
For modules which print multiple lines, the string is parsed as a format string with the index as first character.
--<module>-key-color <format>: Override the global `--color-keys` option for each specific module.
--<module>-key-width <num>: Override the global `--key-width` option for each specific module.
Library options: Set the path of a library to load
--lib-PCI <path>: GPU output
--lib-vulkan <path>: Vulkan module & fallback for GPU output
--lib-wayland <path>: Better display performance and output in wayland sessions
--lib-xcb-randr <path>: X11 sessions for better display detection and faster WM detection
--lib-xcb <path>: X11 sessions for better display detection and faster WM detection
--lib-Xrandr <path>: X11 sessions for better display detection and faster WM detection
--lib-X11 <path>: X11 sessions for better display detection and faster WM detection
--lib-gio <path>: Needed for values that are only stored GSettings
--lib-DConf <path>: Needed for values that are only stored in DConf + Fallback for GSettings
--lib-DBus <path>: Bluetooth, Player & Media detection
--lib-XFConf <path>: Needed for XFWM theme and XFCE Terminal font
--lib-sqlite3 <path>: Needed for pkg & rpm package count
--lib-rpm <path>: Slower fallback for rpm package count
--lib-imagemagick <path>: Images in terminal using sixel or kitty graphics protocol
--lib-z <path>: Libz. Faster image output when using kitty graphics protocol
--lib-chafa <path>: Image output as ascii art
--lib-egl <path>: Needed by the OpenGL module for gl context creation
--lib-glx <path>: Needed by the OpenGL module for gl context creation
--lib-osmesa <path>: Needed by the OpenGL module for gl context creation
--lib-opencl <path>: OpenCL module
--lib-pulse <path>: Pulseaudio. Used for Sound detection
--lib-nm: NetworkManager. Used for Wifi detection
--lib-freetype <path>: Used for Termux font detection
--lib-ddcutil <path>: Used for brightness detection of external displays
Module specific options:
--title-fqdn <?value>: Set if the title should use fully qualified domain name. Default is false
--title-color-user <color>: Set color of the user name (left part). Default is empty (use color of `--color-title`).
--title-color-at <color>: Set color of the @ symbol (middle part). Default is empty (use color of `--color-title`)
--title-color-host <color>: Set color of the host name (right part). Default is empty (use color of `--color-title`)
--chassis-use-wmi <?value>: Set if WMI query should be used on Windows, which detects more information but slower. Default is false
--separator-string <str>: Set the string printed by the separator module
--os-file <path>: Set the path to the file containing OS information. Linux only
--disk-folders <folders>: A colon (semicolon on Windows) separated list of folder paths for the disk output. Default is "/:/home" ("C:\\;D:\\ ..." on Windows)
--disk-show-regular <?value>: Set if regular volume should be printed. Default is true
--disk-show-external <?value>: Set if external volume should be printed. Default is true
--disk-show-hidden <?value>: Set if hidden volumes should be printed. Default is false
--disk-show-subvolumes <?value>: Set if subvolumes should be printed. Default is false
--disk-show-readonly <?value>: Set if read only volumes should be printed. Default is false
--disk-show-unknown <?value>: Set if unknown (unable to detect sizes) volumes should be printed. Default is false
--disk-use-available <?value>: Use f_bavail (lpFreeBytesAvailableToCaller for Windows) instead of f_bfree to calculate used bytes. Default is false
--diskio-name-prefix <str>: Show disks with given name prefix only. Default is empty
--bluetooth-show-disconnected <?value>: Set if disconnected bluetooth devices should be printed. Default is false
--packages-winget <?value>: Set if winget package count should be detected. Default is false
--display-compact-type <?string>: Set if all displays should be printed in one line. Default is none
--display-detect-name <?value>: Set if display name should be detected and printed (if supported). Default is false
--display-precise-refresh-rate <?value>: Set if decimal refresh rates should not be rounded into integers when printing. Default is true
--brightness-ddcci-sleep <num>: Set the sleep times (in ms) when sending DDC/CI requests. See <https://www.ddcutil.com/performance_options/#option-sleep-multiplier> for detail. Default is 10
--sound-type <value>: Set what type of sound devices should be printed. Should be either main, active or all. Default is main
--battery-dir <folder>: The directory where the battery folders are. Standard: `/sys/class/power_supply/`. Linux only
--battery-use-setup-api <?value>: Set if `SetupAPI` should be used on Windows to detect battery info, which supports multi batteries, but slower. Windows only
--cpu-temp <?value>: Detect and display CPU temperature if supported. Default is false
--cpu-freq-ndigits <num>: Set the number of digits to keep after the decimal point when printing CPU frequency. Default is 2
--cpuusage-separate <?value>: Display CPU usage per CPU logical core, instead of an average result. Default is false
--de-slow-version-detection <?value>: Set if DE version should be detected with slow operations. Default is false
--gpu-temp <?value>: Detect and display GPU temperature if supported. Default is false
--gpu-use-nvml <?value>: Use nvml (NVIDIA Management Library) to detect more detailed GPU information (memory usage, CUDA core count, etc). Default is false
--gpu-force-vulkan <?value>: Force using vulkan to detect GPUs, which support video memory usage detection with `--allow-slow-operations`. Default is false
--gpu-hide-type <?value>: Specify the type of GPUs should not be printed. Must be `integrated`, `discrete` or `none`. Default is none
--battery-temp <?value>: Detect and display Battery temperature if supported. Default is false
--localip-show-ipv4 <?value>: Show IPv4 addresses in local ip module. Default is true
--localip-show-ipv6 <?value>: Show IPv6 addresses in local ip module. Default is false
--localip-show-mac <?value>: Show mac addresses in local ip module. Default is false
--localip-show-loop <?value>: Show loop back addresses (127.0.0.1) in local ip module. Default is false
--localip-name-prefix <str>: Show interfaces with given interface name prefix only. Default is empty
--localip-default-route-only <?value>: Show the interface that is used for default routing only. Default is true
--localip-compact <?value>: Show all IPs in one line. Default is false
--netio-name-prefix <str>: Show interfaces with given name prefix only. Default is empty
--netio-default-route-only <?value>: Show the interfac that is used for default routing only. Default is true
--publicip-timeout <num>: Time in milliseconds to wait for the public ip server to respond. Default is disabled (0)
--publicip-url <str>: The URL of public IP detection server to be used.
--weather-location <str>: Set the location to be used. It must be URI encoded (eg a whitespace must be encoded as `+`).
--weather-timeout <num>: Time in milliseconds to wait for the weather server to respond. Default is disabled (0)
--weather-output-format <str>: The output weather format to be used. It must be URI encoded.
--wm-detect-plugin <?value>: Set if window manager plugin should be detected on supported platforms. Default is false
--player-name <str>: The name of the player to use for module Media and Player. Linux only
--opengl-library <str>: Set the OpenGL context creation library to use. Must be auto, egl, glx or osmesa. Default is auto
--command-shell <str>: Set the shell program to execute the command text. Default is cmd for Windows, /bin/sh for *nix
--command-key <str>: Set the module key to display
--command-text <str>: Set the command text to be executed
--colors-symbol <str>: Set the symbol to be printed by Colors module. Default is block
--colors-padding-left <value>: Set the number of white spaces to print before the symbol. Default is 0
Parsing is not case sensitive. E.g. "--lib-PCI" is equal to "--Lib-Pci"
If a value starts with a ?, it is optional. "true" will be used if not set.
A (+) at the end indicates that more help can be printed with --help <option>
All options can be made permanent with command `fastfetch <options> --migrate-config`
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"
+1 -1
View File
@@ -3,7 +3,7 @@ Usage: fastfetch --color <color>
<color> must be a color encoding as ANSI escape sequences. It is inserted between "ESC[" and "m".
Infos about them can be found here: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters.
Examples:
--color 35: sets the color to pink
--color 35: sets the color to magenta. `--color magenta` is also supported
--color 4;92: sets the color to bright Green with underline
--color 5;104: blinking text on a blue background
If no color is set, the main color of the logo will be used.
+1 -2
View File
@@ -5,5 +5,4 @@ If the file is relative it looks in the following order:
- relative to the current working directory
- relative to ~/.local/share/fastfetch/presets/
- relative to /usr/share/fastfetch/presets/
Fastfetch provides some default presets. List them with --print-available-presets.
Note that this will only print presets fastfetch knows about and not every possible one.
Fastfetch provides some default presets. List them with "fastfetch --list-presets".
+2 -2
View File
@@ -1,7 +1,7 @@
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
The format string can contain placeholders in any order and have multiple occurences.
The format string can contain placeholders in any order and have multiple occurrences.
To include spaces when setting from the command line, surround the whole string with double quotes (").
If the value index is missing, meaning the placeholder is "{}", an internal counter sets the value index.
@@ -22,7 +22,7 @@ For example to print a fallback for a second value if it is not set, use "{?2}{2
To stop formatting at any point in the format string, use "{-}".
To print something with color, start a placeholder with a '#' and then the linux terminal color encoding.
"\\033[" at the start, and an 'm' at the end is automatically added, so don't do that.
"\033[" at the start, and an 'm' at the end is automatically added, so don't do that.
A "{#}" is equivalent to a "{#0}" and resets everything to normal.
For example to print something pink and underline, use "{#4;35}...{#}".
Information about what the numbers mean can be found here: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Sele
+3 -6
View File
@@ -1,8 +1,5 @@
#pragma once
#ifndef FF_INCLUDED_detection_battery_battery
#define FF_INCLUDED_detection_battery_battery
#include "fastfetch.h"
#define FF_BATTERY_TEMP_UNSET (0/0.0)
@@ -10,14 +7,14 @@
typedef struct FFBatteryResult
{
FFstrbuf manufacturer;
FFstrbuf manufactureDate;
FFstrbuf modelName;
FFstrbuf technology;
double capacity;
FFstrbuf status;
FFstrbuf serial;
double capacity;
double temperature;
uint32_t cycleCount;
} FFBatteryResult;
const char* ffDetectBattery(FFBatteryOptions* options, FFlist* results);
#endif
+2
View File
@@ -40,6 +40,7 @@ static const char* parseTermuxApi(FFBatteryOptions* options, FFlist* results)
ffStrbufInit(&battery->modelName);
ffStrbufInit(&battery->status);
ffStrbufInit(&battery->technology);
ffStrbufInit(&battery->manufactureDate);
battery->capacity = yyjson_get_num(yyjson_obj_get(root, "percentage"));
ffStrbufAppendS(&battery->status, yyjson_get_str(yyjson_obj_get(root, "status")));
@@ -71,6 +72,7 @@ static const char* parseDumpsys(FFBatteryOptions* options, FFlist* results)
FFBatteryResult* battery = ffListAdd(results);
battery->temperature = FF_BATTERY_TEMP_UNSET;
battery->cycleCount = 0;
ffStrbufInit(&battery->manufacturer);
ffStrbufInit(&battery->modelName);
ffStrbufInit(&battery->status);
+54 -34
View File
@@ -4,84 +4,104 @@
#include "detection/temps/temps_apple.h"
#include <IOKit/IOKitLib.h>
#include <IOKit/pwr_mgt/IOPM.h>
const char* ffDetectBattery(FFBatteryOptions* options, FFlist* results)
{
io_iterator_t iterator;
if(IOServiceGetMatchingServices(MACH_PORT_NULL, IOServiceMatching("AppleSmartBattery"), &iterator) != kIOReturnSuccess)
FF_IOOBJECT_AUTO_RELEASE io_iterator_t iterator = IO_OBJECT_NULL;
if (IOServiceGetMatchingServices(MACH_PORT_NULL, IOServiceMatching("AppleSmartBattery"), &iterator) != kIOReturnSuccess)
return "IOServiceGetMatchingServices() failed";
io_registry_entry_t registryEntry;
while((registryEntry = IOIteratorNext(iterator)) != 0)
while ((registryEntry = IOIteratorNext(iterator)) != IO_OBJECT_NULL)
{
FF_IOOBJECT_AUTO_RELEASE io_registry_entry_t entryBattery = registryEntry;
FF_CFTYPE_AUTO_RELEASE CFMutableDictionaryRef properties = NULL;
if(IORegistryEntryCreateCFProperties(registryEntry, &properties, kCFAllocatorDefault, kNilOptions) != kIOReturnSuccess)
{
IOObjectRelease(registryEntry);
if (IORegistryEntryCreateCFProperties(entryBattery, &properties, kCFAllocatorDefault, kNilOptions) != kIOReturnSuccess)
continue;
int currentCapacity, maxCapacity;
if (ffCfDictGetInt(properties, CFSTR(kIOPMPSMaxCapacityKey), &maxCapacity) != NULL || maxCapacity <= 0)
continue;
if (ffCfDictGetInt(properties, CFSTR(kIOPMPSCurrentCapacityKey), &currentCapacity) != NULL || currentCapacity <= 0)
continue;
}
bool boolValue;
const char* error;
FFBatteryResult* battery = ffListAdd(results);
battery->temperature = FF_BATTERY_TEMP_UNSET;
ffStrbufInit(&battery->manufacturer);
ffStrbufInit(&battery->modelName);
ffStrbufInit(&battery->serial);
ffStrbufInit(&battery->technology);
ffStrbufInit(&battery->status);
battery->capacity = 0.0/0.0;
int currentCapacity, maxCapacity;
if ((error = ffCfDictGetInt(properties, CFSTR("MaxCapacity"), &maxCapacity)))
return error;
if (maxCapacity <= 0)
return "Querying MaxCapacity failed";
if ((error = ffCfDictGetInt(properties, CFSTR("CurrentCapacity"), &currentCapacity)))
return error;
if(currentCapacity <= 0)
return "Querying CurrentCapacity failed";
ffStrbufInit(&battery->manufactureDate);
battery->capacity = currentCapacity * 100.0 / maxCapacity;
ffCfDictGetString(properties, CFSTR("DeviceName"), &battery->modelName);
ffCfDictGetString(properties, CFSTR(kIOPMDeviceNameKey), &battery->modelName);
ffCfDictGetString(properties, CFSTR(kIOPMPSSerialKey), &battery->serial);
ffCfDictGetString(properties, CFSTR(kIOPMPSManufacturerKey), &battery->manufacturer);
if (!ffCfDictGetBool(properties, CFSTR("built-in"), &boolValue) && boolValue)
{
ffStrbufAppendS(&battery->manufacturer, "Apple Inc.");
if (!battery->manufacturer.length)
ffStrbufAppendS(&battery->manufacturer, "Apple Inc.");
ffStrbufAppendS(&battery->technology, "Lithium");
if (!battery->modelName.length)
ffStrbufAppendS(&battery->modelName, "Built-in");
}
ffCfDictGetInt(properties, CFSTR("CycleCount"), (int32_t*) &battery->cycleCount);
int32_t cycleCount = 0;
ffCfDictGetInt(properties, CFSTR(kIOPMPSCycleCountKey), &cycleCount);
battery->cycleCount = cycleCount < 0 ? 0 : (uint32_t) cycleCount;
if (!ffCfDictGetBool(properties, CFSTR("ExternalConnected"), &boolValue) && boolValue)
if (!ffCfDictGetBool(properties, CFSTR(kIOPMPSExternalConnectedKey), &boolValue) && boolValue)
ffStrbufAppendS(&battery->status, "AC connected, ");
else
ffStrbufAppendS(&battery->status, "Discharging, ");
if (!ffCfDictGetBool(properties, CFSTR("IsCharging"), &boolValue) && boolValue)
if (!ffCfDictGetBool(properties, CFSTR(kIOPMPSIsChargingKey), &boolValue) && boolValue)
ffStrbufAppendS(&battery->status, "Charging, ");
if (!ffCfDictGetBool(properties, CFSTR("AtCriticalLevel"), &boolValue) && boolValue)
if (!ffCfDictGetBool(properties, CFSTR(kIOPMPSAtCriticalLevelKey), &boolValue) && boolValue)
ffStrbufAppendS(&battery->status, "Critical, ");
ffStrbufTrimRight(&battery->status, ' ');
ffStrbufTrimRight(&battery->status, ',');
int sbdsManufactureDate = 0;
if (ffCfDictGetInt(properties, CFSTR(kIOPMPSManufactureDateKey), &sbdsManufactureDate) == NULL)
{
int day = sbdsManufactureDate & 0b11111;
int month = (sbdsManufactureDate >> 5) & 0b1111;
int year = (sbdsManufactureDate >> 9) + 1800;
ffStrbufSetF(&battery->manufactureDate, "%.4d-%.2d-%.2d", year, month, day);
}
else
{
CFDictionaryRef batteryData;
if (ffCfDictGetDict(properties, CFSTR("BatteryData"), &batteryData) == NULL)
{
char manufactureDate[sizeof(uint64_t)];
if (ffCfDictGetInt64(batteryData, CFSTR(kIOPMPSManufactureDateKey), (int64_t*) manufactureDate) == NULL)
{
// 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');
ffStrbufSetF(&battery->manufactureDate, "%.4d-%.2d-%.2d", year, month, day);
}
}
}
if (options->temp)
{
int64_t temp;
if (!ffCfDictGetInt64(properties, CFSTR("Temperature"), &temp))
if (!ffCfDictGetInt64(properties, CFSTR(kIOPMPSBatteryTemperatureKey), &temp))
battery->temperature = (double) temp / 10 - 273.15;
else
ffDetectCoreTemps(FF_TEMP_BATTERY, &battery->temperature);
ffDetectSmcTemps(FF_TEMP_BATTERY, &battery->temperature);
}
IOObjectRelease(registryEntry);
}
IOObjectRelease(iterator);
return NULL;
}
+6 -4
View File
@@ -20,9 +20,9 @@ const char* ffDetectBattery(FF_MAYBE_UNUSED FFBatteryOptions* options, FFlist* r
if(units == 0)
return NULL;
FF_AUTO_CLOSE_FD int acpifd = open("/dev/acpi", O_RDONLY);
FF_AUTO_CLOSE_FD int acpifd = open("/dev/acpi", O_RDONLY | O_CLOEXEC);
if(acpifd < 0)
return "open(\"/dev/acpi\", O_RDONLY) failed";
return "open(\"/dev/acpi\", O_RDONLY | O_CLOEXEC) failed";
for(int i = 0; i < units; ++i)
{
@@ -39,6 +39,8 @@ const char* ffDetectBattery(FF_MAYBE_UNUSED FFBatteryOptions* options, FFlist* r
ffStrbufInit(&battery->modelName);
ffStrbufInit(&battery->status);
ffStrbufInit(&battery->technology);
ffStrbufInit(&battery->serial);
ffStrbufInit(&battery->manufactureDate);
battery->capacity = battio.battinfo.cap;
if(battio.battinfo.state == ACPI_BATT_STAT_INVALID)
@@ -52,13 +54,13 @@ const char* ffDetectBattery(FF_MAYBE_UNUSED FFBatteryOptions* options, FFlist* r
else if(battio.battinfo.state & ACPI_BATT_STAT_CHARGING)
ffStrbufAppendS(&battery->status, "Charging, ");
if(battio.battinfo.state & ACPI_BATT_STAT_CRITICAL)
ffStrbufAppendS(&battery->status, "Ctritical, ");
ffStrbufAppendS(&battery->status, "Critical, ");
}
int acadStatus;
if (ioctl(acpifd, ACPIIO_ACAD_GET_STATUS, &acadStatus) >= 0 && acadStatus)
{
ffStrbufAppendS(&battery->status, "AC connected");
ffStrbufAppendS(&battery->status, "AC Connected");
}
else
{
+96 -44
View File
@@ -5,107 +5,159 @@
#include <dirent.h>
// https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-power
static void parseBattery(FFstrbuf* dir, const char* id, FFBatteryOptions* options, FFlist* results)
{
uint32_t dirLength = dir->length;
FF_STRBUF_AUTO_DESTROY testBatteryBuffer = ffStrbufCreate();
FF_STRBUF_AUTO_DESTROY tmpBuffer = ffStrbufCreate();
//type must exist and be "Battery"
ffStrbufAppendS(dir, "/type");
ffReadFileBuffer(dir->chars, &testBatteryBuffer);
if (ffReadFileBuffer(dir->chars, &tmpBuffer))
ffStrbufTrimRightSpace(&tmpBuffer);
ffStrbufSubstrBefore(dir, dirLength);
if(ffStrbufIgnCaseCompS(&testBatteryBuffer, "Battery") != 0)
if(!ffStrbufIgnCaseEqualS(&tmpBuffer, "Battery"))
return;
//scope may not exist or must not be "Device"
ffStrbufAppendS(dir, "/scope");
ffReadFileBuffer(dir->chars, &testBatteryBuffer);
if (ffReadFileBuffer(dir->chars, &tmpBuffer))
ffStrbufTrimRightSpace(&tmpBuffer);
ffStrbufSubstrBefore(dir, dirLength);
if(ffStrbufIgnCaseCompS(&testBatteryBuffer, "Device") == 0)
if(ffStrbufIgnCaseEqualS(&tmpBuffer, "Device"))
return;
FFBatteryResult* result = ffListAdd(results);
//capacity must exist and be not empty
ffStrbufAppendS(dir, "/capacity");
bool available = ffReadFileBuffer(dir->chars, &testBatteryBuffer);
bool available = ffReadFileBuffer(dir->chars, &tmpBuffer);
ffStrbufSubstrBefore(dir, dirLength);
if(available)
result->capacity = ffStrbufToDouble(&testBatteryBuffer);
if(!available)
{
result->capacity = 0.0/0.0;
--results->length;
if (!available)
return;
}
FFBatteryResult* result = ffListAdd(results);
result->capacity = ffStrbufToDouble(&tmpBuffer);
//At this point, we have a battery. Try to get as much values as possible.
ffStrbufInit(&result->manufacturer);
ffStrbufAppendS(dir, "/manufacturer");
ffReadFileBuffer(dir->chars, &result->manufacturer);
if (ffReadFileBuffer(dir->chars, &result->manufacturer))
ffStrbufTrimRightSpace(&result->manufacturer);
else if (ffStrEquals(id, "macsmc-battery")) // asahi
ffStrbufSetStatic(&result->manufacturer, "Apple Inc.");
ffStrbufSubstrBefore(dir, dirLength);
ffStrbufInit(&result->modelName);
ffStrbufAppendS(dir, "/model_name");
ffReadFileBuffer(dir->chars, &result->modelName);
if (ffReadFileBuffer(dir->chars, &result->modelName))
ffStrbufTrimRightSpace(&result->modelName);
ffStrbufSubstrBefore(dir, dirLength);
ffStrbufInit(&result->technology);
ffStrbufAppendS(dir, "/technology");
ffReadFileBuffer(dir->chars, &result->technology);
if (ffReadFileBuffer(dir->chars, &result->technology))
ffStrbufTrimRightSpace(&result->technology);
ffStrbufSubstrBefore(dir, dirLength);
ffStrbufInit(&result->status);
ffStrbufAppendS(dir, "/status");
ffReadFileBuffer(dir->chars, &result->status);
if (ffReadFileBuffer(dir->chars, &result->status))
ffStrbufTrimRightSpace(&result->status);
ffStrbufSubstrBefore(dir, dirLength);
// Unknown, Charging, Discharging, Not charging, Full
if (ffStrbufEqualS(&result->status, "Not charging") || ffStrbufEqualS(&result->status, "Full"))
ffStrbufSetStatic(&result->status, "AC Connected");
else if (ffStrbufEqualS(&result->status, "Unknown"))
ffStrbufClear(&result->status);
ffStrbufAppendS(dir, "/capacity_level");
if (ffReadFileBuffer(dir->chars, &tmpBuffer))
{
ffStrbufTrimRightSpace(&result->manufacturer);
if (ffStrbufEqualS(&tmpBuffer, "Critical"))
{
if (result->status.length)
ffStrbufAppendS(&result->status, ", Critical");
else
ffStrbufSetStatic(&result->status, "Critical");
}
}
ffStrbufSubstrBefore(dir, dirLength);
ffStrbufInit(&result->serial);
ffStrbufAppendS(dir, "/serial_number");
if (ffReadFileBuffer(dir->chars, &result->serial))
ffStrbufTrimRightSpace(&result->serial);
ffStrbufSubstrBefore(dir, dirLength);
ffStrbufAppendS(dir, "/cycle_count");
ffReadFileBuffer(dir->chars, &testBatteryBuffer);
available = ffReadFileBuffer(dir->chars, &tmpBuffer);
ffStrbufSubstrBefore(dir, dirLength);
if(dir->length)
result->cycleCount = (uint32_t) ffStrbufToUInt(&testBatteryBuffer, 0);
if (available)
{
int64_t cycleCount = ffStrbufToSInt(&tmpBuffer, 0);
result->cycleCount = cycleCount < 0 || cycleCount > UINT32_MAX ? 0 : (uint32_t) cycleCount;
}
ffStrbufInit(&result->manufactureDate);
ffStrbufAppendS(dir, "/manufacture_year");
available = ffReadFileBuffer(dir->chars, &tmpBuffer);
ffStrbufSubstrBefore(dir, dirLength);
if (available)
{
int year = (int) ffStrbufToSInt(&tmpBuffer, 0);
if (year > 0)
{
ffStrbufAppendS(dir, "/manufacture_month");
available = ffReadFileBuffer(dir->chars, &tmpBuffer);
ffStrbufSubstrBefore(dir, dirLength);
if (available)
{
int month = (int) ffStrbufToSInt(&tmpBuffer, 0);
if (month > 0)
{
ffStrbufAppendS(dir, "/manufacture_day");
available = ffReadFileBuffer(dir->chars, &tmpBuffer);
ffStrbufSubstrBefore(dir, dirLength);
if (available)
{
int day = (int) ffStrbufToSInt(&tmpBuffer, 0);
if (day > 0)
{
ffStrbufSetF(&result->manufactureDate, "%.4d-%.2d-%.2d", year, month, day);
}
}
}
}
}
}
result->temperature = FF_BATTERY_TEMP_UNSET;
if (options->temp)
{
const FFlist* tempsResult = ffDetectTemps();
FF_LIST_FOR_EACH(FFTempValue, value, *tempsResult)
{
if (ffStrbufEqualS(&value->name, id))
{
result->temperature = value->value;
break;
}
}
ffStrbufAppendS(dir, "/temp");
if (ffReadFileBuffer(dir->chars, &tmpBuffer))
result->temperature = ffStrbufToDouble(&tmpBuffer) / 10;
ffStrbufSubstrBefore(dir, dirLength);
}
}
const char* ffDetectBattery(FFBatteryOptions* options, FFlist* results)
{
FF_STRBUF_AUTO_DESTROY baseDir = ffStrbufCreateA(64);
if(options->dir.length > 0)
{
ffStrbufAppend(&baseDir, &options->dir);
ffStrbufEnsureEndsWithC(&baseDir, '/');
}
else
{
ffStrbufAppendS(&baseDir, "/sys/class/power_supply/");
}
ffStrbufAppendS(&baseDir, "/sys/class/power_supply/");
uint32_t baseDirLength = baseDir.length;
FF_AUTO_CLOSE_DIR DIR* dirp = opendir(baseDir.chars);
if(dirp == NULL)
return "opendir(batteryDir) == NULL";
return "opendir(\"/sys/class/power_supply/\") == NULL";
struct dirent* entry;
while((entry = readdir(dirp)) != NULL)
@@ -119,7 +171,7 @@ const char* ffDetectBattery(FFBatteryOptions* options, FFlist* results)
}
if(results->length == 0)
return "batteryDir doesn't contain any battery folder";
return "\"/sys/class/power_supply/\" doesn't contain any battery folder";
return NULL;
}
+109 -10
View File
@@ -1,6 +1,7 @@
#include "battery.h"
#include "util/windows/unicode.h"
#include "util/mallocHelper.h"
#include "util/smbiosHelper.h"
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -75,19 +76,19 @@ static const char* detectWithSetupApi(FFBatteryOptions* options, FFlist* results
FFBatteryResult* battery = (FFBatteryResult*)ffListAdd(results);
if(memcmp(bi.Chemistry, "PbAc", 4) == 0)
ffStrbufInitS(&battery->technology, "Lead Acid");
ffStrbufInitStatic(&battery->technology, "Lead Acid");
else if(memcmp(bi.Chemistry, "LION", 4) == 0 || memcmp(bi.Chemistry, "Li-I", 4) == 0)
ffStrbufInitS(&battery->technology, "Lithium Ion");
ffStrbufInitStatic(&battery->technology, "Lithium Ion");
else if(memcmp(bi.Chemistry, "NiCd", 4) == 0)
ffStrbufInitS(&battery->technology, "Nickel Cadmium");
ffStrbufInitStatic(&battery->technology, "Nickel Cadmium");
else if(memcmp(bi.Chemistry, "NiMH", 4) == 0)
ffStrbufInitS(&battery->technology, "Nickel Metal Hydride");
ffStrbufInitStatic(&battery->technology, "Nickel Metal Hydride");
else if(memcmp(bi.Chemistry, "NiZn", 4) == 0)
ffStrbufInitS(&battery->technology, "Nickel Zinc");
ffStrbufInitStatic(&battery->technology, "Nickel Zinc");
else if(memcmp(bi.Chemistry, "RAM\0", 4) == 0)
ffStrbufInitS(&battery->technology, "Rechargeable Alkaline-Manganese");
ffStrbufInitStatic(&battery->technology, "Rechargeable Alkaline-Manganese");
else
ffStrbufInitS(&battery->technology, "Unknown");
ffStrbufInitStatic(&battery->technology, "Unknown");
{
ffStrbufInit(&battery->modelName);
@@ -105,6 +106,22 @@ static const char* detectWithSetupApi(FFBatteryOptions* options, FFlist* results
ffStrbufSetWS(&battery->manufacturer, name);
}
{
ffStrbufInit(&battery->manufactureDate);
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);
}
{
ffStrbufInit(&battery->serial);
bqi.InformationLevel = BatterySerialNumber;
wchar_t name[64];
if(DeviceIoControl(hBattery, IOCTL_BATTERY_QUERY_INFORMATION, &bqi, sizeof(bqi), name, sizeof(name), &dwOut, NULL))
ffStrbufSetWS(&battery->serial, name);
}
battery->cycleCount = bi.CycleCount;
battery->temperature = 0.0/0.0;
@@ -113,7 +130,7 @@ static const char* detectWithSetupApi(FFBatteryOptions* options, FFlist* results
bqi.InformationLevel = BatteryTemperature;
ULONG temp;
if(DeviceIoControl(hBattery, IOCTL_BATTERY_QUERY_INFORMATION, &bqi, sizeof(bqi), &temp, sizeof(temp), &dwOut, NULL))
battery->temperature = temp;
battery->temperature = temp / 10.0 - 273.15;
}
{
@@ -140,6 +157,83 @@ static const char* detectWithSetupApi(FFBatteryOptions* options, FFlist* results
return NULL;
}
typedef struct FFSmbiosPortableBattery
{
FFSmbiosHeader Header;
// 2.1+
uint8_t Location; // string
uint8_t Manufacturer; // string
uint8_t ManufactureDate; // string
uint8_t SerialNumber; // string
uint8_t DeviceName; // string
uint8_t DeviceChemistry; // enum
uint16_t DesignCapacity; // varies
uint16_t DesignVoltage; // varies
uint8_t SbdsVersionNumber; // string
uint8_t MaximumErrorInBatteryData; // varies
// 2.2+
uint16_t SbdsSerialNumber; // varies
uint16_t SbdsManufactureDate; // varies
uint8_t SbdsDeviceChemistry; // string
uint8_t DesignCapacityMultiplier; // varies
uint16_t OEMSpecific; // varies
} FFSmbiosPortableBattery;
const char* detectBySmbios(FFBatteryResult* battery)
{
const FFSmbiosPortableBattery* data = (const FFSmbiosPortableBattery*) (*ffGetSmbiosHeaderTable())[FF_SMBIOS_TYPE_PORTABLE_BATTERY];
if (!data)
return "Portable battery section is not found in SMBIOS data";
const char* strings = (const char*) data + data->Header.Length;
ffStrbufSetStatic(&battery->modelName, ffSmbiosLocateString(strings, data->DeviceName));
ffCleanUpSmbiosValue(&battery->modelName);
ffStrbufSetStatic(&battery->manufacturer, ffSmbiosLocateString(strings, data->Manufacturer));
ffCleanUpSmbiosValue(&battery->manufacturer);
if (data->ManufactureDate)
{
ffStrbufSetStatic(&battery->manufactureDate, ffSmbiosLocateString(strings, data->ManufactureDate));
ffCleanUpSmbiosValue(&battery->manufactureDate);
}
else if (data->Header.Length > offsetof(FFSmbiosPortableBattery, SbdsManufactureDate))
{
int day = data->SbdsManufactureDate & 0b11111;
int month = (data->SbdsManufactureDate >> 5) & 0b1111;
int year = (data->SbdsManufactureDate >> 9) + 1800;
ffStrbufSetF(&battery->manufactureDate, "%.4d-%.2d-%.2d", year, month, day);
}
switch (data->DeviceChemistry)
{
case 0x01: ffStrbufSetStatic(&battery->technology, "Other"); break;
case 0x02: ffStrbufSetStatic(&battery->technology, "Unknown"); break;
case 0x03: ffStrbufSetStatic(&battery->technology, "Lead Acid"); break;
case 0x04: ffStrbufSetStatic(&battery->technology, "Nickel Cadmium"); break;
case 0x05: ffStrbufSetStatic(&battery->technology, "Nickel metal hydride"); break;
case 0x06: ffStrbufSetStatic(&battery->technology, "Lithium-ion"); break;
case 0x07: ffStrbufSetStatic(&battery->technology, "Zinc air"); break;
case 0x08: ffStrbufSetStatic(&battery->technology, "Lithium Polymer"); break;
}
if (data->SerialNumber)
{
ffStrbufSetStatic(&battery->serial, ffSmbiosLocateString(strings, data->SerialNumber));
ffCleanUpSmbiosValue(&battery->serial);
}
else if (data->Header.Length > offsetof(FFSmbiosPortableBattery, SbdsSerialNumber))
{
ffStrbufSetF(&battery->serial, "%4X", data->SbdsSerialNumber);
}
return NULL;
}
static const char* detectWithNtApi(FF_MAYBE_UNUSED FFBatteryOptions* options, FFlist* results)
{
SYSTEM_BATTERY_STATE info;
@@ -148,9 +242,11 @@ static const char* detectWithNtApi(FF_MAYBE_UNUSED FFBatteryOptions* options, FF
FFBatteryResult* battery = (FFBatteryResult*)ffListAdd(results);
ffStrbufInit(&battery->modelName);
ffStrbufInit(&battery->manufacturer);
ffStrbufInit(&battery->manufactureDate);
ffStrbufInit(&battery->technology);
ffStrbufInit(&battery->status);
battery->temperature = 0.0/0.0;
ffStrbufInit(&battery->serial);
battery->temperature = FF_BATTERY_TEMP_UNSET;
battery->cycleCount = 0;
battery->capacity = info.RemainingCapacity * 100.0 / info.MaxCapacity;
@@ -162,6 +258,9 @@ static const char* detectWithNtApi(FF_MAYBE_UNUSED FFBatteryOptions* options, FF
}
else if(info.Discharging)
ffStrbufAppendS(&battery->status, "Discharging");
detectBySmbios(battery);
return NULL;
}
return "NtPowerInformation(SystemBatteryState) failed";
@@ -169,7 +268,7 @@ static const char* detectWithNtApi(FF_MAYBE_UNUSED FFBatteryOptions* options, FF
const char* ffDetectBattery(FFBatteryOptions* options, FFlist* results)
{
return true
return options->useSetupApi
? detectWithSetupApi(options, results)
: detectWithNtApi(options, results);
}
-5
View File
@@ -1,8 +1,5 @@
#pragma once
#ifndef FF_INCLUDED_detection_bios_bios
#define FF_INCLUDED_detection_bios_bios
#include "fastfetch.h"
typedef struct FFBiosResult
@@ -15,5 +12,3 @@ typedef struct FFBiosResult
} FFBiosResult;
const char* ffDetectBios(FFBiosResult* bios);
#endif
+14
View File
@@ -2,6 +2,7 @@
#include "common/settings.h"
#include "common/sysctl.h"
#include "common/io/io.h"
#include "util/smbiosHelper.h"
const char* ffDetectBios(FFBiosResult* result)
@@ -15,5 +16,18 @@ const char* ffDetectBios(FFBiosResult* result)
ffSettingsGetFreeBSDKenv("smbios.bios.version", &result->version);
ffCleanUpSmbiosValue(&result->version);
ffSysctlGetString("machdep.bootmethod", &result->type);
if (result->type.length == 0)
{
if (ffSettingsGetFreeBSDKenv("loader.efi", &result->type))
ffStrbufSetStatic(&result->type, ffStrbufEqualS(&result->type, "1") ? "UEFI" : "BIOS");
else
{
ffStrbufSetStatic(&result->type,
ffPathExists("/dev/efi" /*efidev*/, FF_PATHTYPE_FILE) ||
ffPathExists("/boot/efi/efi" /*efi partition*/, FF_PATHTYPE_DIRECTORY)
? "UEFI" : "BIOS");
}
}
return NULL;
}
+5 -18
View File
@@ -4,25 +4,12 @@
#include <stdlib.h>
static void getSmbiosValue(const char* devicesPath, const char* classPath, FFstrbuf* buffer)
const char* ffDetectBios(FFBiosResult* bios)
{
ffReadFileBuffer(devicesPath, buffer);
if(ffIsSmbiosValueSet(buffer))
return;
ffReadFileBuffer(classPath, buffer);
if(ffIsSmbiosValueSet(buffer))
return;
ffStrbufClear(buffer);
}
const char* ffDetectBios(FFBiosResult* bios)
{
getSmbiosValue("/sys/devices/virtual/dmi/id/bios_date", "/sys/class/dmi/id/bios_date", &bios->date);
getSmbiosValue("/sys/devices/virtual/dmi/id/bios_release", "/sys/class/dmi/id/bios_release", &bios->release);
getSmbiosValue("/sys/devices/virtual/dmi/id/bios_vendor", "/sys/class/dmi/id/bios_vendor", &bios->vendor);
getSmbiosValue("/sys/devices/virtual/dmi/id/bios_version", "/sys/class/dmi/id/bios_version", &bios->version);
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);
ffGetSmbiosValue("/sys/devices/virtual/dmi/id/bios_vendor", "/sys/class/dmi/id/bios_vendor", &bios->vendor);
ffGetSmbiosValue("/sys/devices/virtual/dmi/id/bios_version", "/sys/class/dmi/id/bios_version", &bios->version);
if (ffPathExists("/sys/firmware/efi", FF_PATHTYPE_DIRECTORY) || ffPathExists("/sys/firmware/acpi/tables/UEFI", FF_PATHTYPE_FILE))
ffStrbufSetStatic(&bios->type, "UEFI");
else
+32 -14
View File
@@ -1,5 +1,4 @@
#include "bios.h"
#include "util/windows/registry.h"
#include "util/smbiosHelper.h"
#include <ntstatus.h>
@@ -26,27 +25,46 @@ typedef struct _SYSTEM_BOOT_ENVIRONMENT_INFORMATION
};
} SYSTEM_BOOT_ENVIRONMENT_INFORMATION;
typedef struct FFSmbiosBios
{
FFSmbiosHeader Header;
uint8_t Vendor; // string
uint8_t BiosVersion; // string
uint16_t BiosStartingAddressSegment; // varies
uint8_t BiosReleaseDate; // string
uint8_t BiosRomSize; // string
uint32_t BiosCharacteristics; // bit field
// 2.4+
uint8_t BiosCharacteristicsExtensionBytes[2]; // bit field
uint8_t SystemBiosMajorRelease; // varies
uint8_t SystemBiosMinorRelease; // varies
uint8_t EmbeddedControllerFirmwareMajorRelease; // varies
uint8_t EmbeddedControllerFirmwareMinorRelease; // varies
// 3.1+
uint16_t ExtendedBiosRomSize; // bit field
} FFSmbiosBios;
const char* ffDetectBios(FFBiosResult* bios)
{
FF_HKEY_AUTO_DESTROY hKey = NULL;
if(!ffRegOpenKeyForRead(HKEY_LOCAL_MACHINE, L"HARDWARE\\DESCRIPTION\\System\\BIOS", &hKey, NULL))
return "ffRegOpenKeyForRead(HKEY_LOCAL_MACHINE, L\"HARDWARE\\DESCRIPTION\\System\\BIOS\", &hKey, NULL) failed";
const FFSmbiosBios* data = (const FFSmbiosBios*) (*ffGetSmbiosHeaderTable())[FF_SMBIOS_TYPE_BIOS];
if (!data)
return "BIOS section is not found in SMBIOS data";
if(!ffRegReadStrbuf(hKey, L"BIOSVersion", &bios->version, NULL))
return "\"HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\BIOS\\BIOSVersion\" doesn't exist";
const char* strings = (const char*) data + data->Header.Length;
ffStrbufSetStatic(&bios->version, ffSmbiosLocateString(strings, data->BiosVersion));
ffCleanUpSmbiosValue(&bios->version);
ffRegReadStrbuf(hKey, L"BIOSVendor", &bios->vendor, NULL);
ffStrbufSetStatic(&bios->vendor, ffSmbiosLocateString(strings, data->Vendor));
ffCleanUpSmbiosValue(&bios->vendor);
ffRegReadStrbuf(hKey, L"BIOSReleaseDate", &bios->date, NULL);
ffStrbufSetStatic(&bios->date, ffSmbiosLocateString(strings, data->BiosReleaseDate));
ffCleanUpSmbiosValue(&bios->date);
uint32_t major, minor;
if(
ffRegReadUint(hKey, L"BiosMajorRelease", &major, NULL) &&
ffRegReadUint(hKey, L"BiosMinorRelease", &minor, NULL)
)
ffStrbufAppendF(&bios->release, "%u.%u", (unsigned)major, (unsigned)minor);
if (data->Header.Length > offsetof(FFSmbiosBios, SystemBiosMajorRelease))
ffStrbufSetF(&bios->release, "%u.%u", data->SystemBiosMajorRelease, data->SystemBiosMinorRelease);
// Same as GetFirmwareType, but support (?) Windows 7
// https://ntdoc.m417z.com/system_information_class
-5
View File
@@ -1,8 +1,5 @@
#pragma once
#ifndef FF_INCLUDED_detection_bluetooth_bluetooth
#define FF_INCLUDED_detection_bluetooth_bluetooth
#include "fastfetch.h"
typedef struct FFBluetoothResult
@@ -15,5 +12,3 @@ typedef struct FFBluetoothResult
} FFBluetoothResult;
const char* ffDetectBluetooth(FFlist* devices /* FFBluetoothResult */);
#endif
+17 -6
View File
@@ -1,14 +1,20 @@
#include "bluetooth.h"
#include "common/library.h"
#include "util/windows/unicode.h"
#include <windows.h>
#include <bluetoothapis.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpointer-sign"
const char* ffDetectBluetooth(FFlist* devices /* FFBluetoothResult */)
{
// Actually bluetoothapis.dll, but it's missing on Windows 7
FF_LIBRARY_LOAD(bluetoothapis, NULL, "dlopen bthprops.cpl failed", "bthprops.cpl", 1)
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(bluetoothapis, BluetoothFindFirstDevice)
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(bluetoothapis, BluetoothFindNextDevice)
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(bluetoothapis, BluetoothFindDeviceClose)
BLUETOOTH_DEVICE_SEARCH_PARAMS btsp = {
.fReturnConnected = TRUE,
.fReturnRemembered = TRUE,
@@ -20,9 +26,14 @@ const char* ffDetectBluetooth(FFlist* devices /* FFBluetoothResult */)
BLUETOOTH_DEVICE_INFO btdi = {
.dwSize = sizeof(btdi)
};
HBLUETOOTH_DEVICE_FIND hFind = BluetoothFindFirstDevice(&btsp, &btdi);
HBLUETOOTH_DEVICE_FIND hFind = ffBluetoothFindFirstDevice(&btsp, &btdi);
if(!hFind)
return "BluetoothFindFirstDevice() failed or no devices found";
{
if (GetLastError() == ERROR_NO_MORE_ITEMS)
return "No Bluetooth devices found";
else
return "BluetoothFindFirstDevice() failed";
}
do {
FFBluetoothResult* device = ffListAdd(devices);
@@ -114,9 +125,9 @@ const char* ffDetectBluetooth(FFlist* devices /* FFBluetoothResult */)
ffStrbufTrimRight(&device->type, ' ');
ffStrbufTrimRight(&device->type, ',');
}
} while (BluetoothFindNextDevice(hFind, &btdi));
} while (ffBluetoothFindNextDevice(hFind, &btdi));
ffBluetoothFindDeviceClose(hFind);
return NULL;
}
#pragma GCC diagnostic pop
+2 -6
View File
@@ -1,8 +1,5 @@
#pragma once
#ifndef FF_INCLUDED_detection_board_board
#define FF_INCLUDED_detection_board_board
#include "fastfetch.h"
typedef struct FFBoardResult
@@ -10,8 +7,7 @@ typedef struct FFBoardResult
FFstrbuf name;
FFstrbuf vendor;
FFstrbuf version;
FFstrbuf serial;
} FFBoardResult;
const char* ffDetectBoard(FFBoardResult* result);
#endif
const char* ffDetectBoard(FFBoardResult* board);
+21
View File
@@ -0,0 +1,21 @@
#include "board.h"
#include "common/sysctl.h"
#include "util/apple/cf_helpers.h"
const char* ffDetectBoard(FFBoardResult* result)
{
FF_IOOBJECT_AUTO_RELEASE io_registry_entry_t service = IOServiceGetMatchingService(MACH_PORT_NULL, IOServiceMatching("IOPlatformExpertDevice"));
if (!service)
return "No IOPlatformExpertDevice found";
io_name_t name;
if (IORegistryEntryGetName(service, name) == kIOReturnSuccess)
ffStrbufSetS(&result->name, name);
FF_CFTYPE_AUTO_RELEASE CFTypeRef manufacturer = IORegistryEntryCreateCFProperty(service, CFSTR("manufacturer"), kCFAllocatorDefault, kNilOptions);
if (manufacturer)
ffCfStrGetString(manufacturer, &result->vendor);
return NULL;
}
+2
View File
@@ -6,6 +6,8 @@ const char* ffDetectBoard(FFBoardResult* result)
{
ffSettingsGetFreeBSDKenv("smbios.planar.product", &result->name);
ffCleanUpSmbiosValue(&result->name);
ffSettingsGetFreeBSDKenv("smbios.planar.serial", &result->serial);
ffCleanUpSmbiosValue(&result->serial);
ffSettingsGetFreeBSDKenv("smbios.planar.maker", &result->vendor);
ffCleanUpSmbiosValue(&result->vendor);
ffSettingsGetFreeBSDKenv("smbios.planar.version", &result->version);
+4 -16
View File
@@ -4,23 +4,11 @@
#include <stdlib.h>
static void getSmbiosValue(const char* devicesPath, const char* classPath, FFstrbuf* buffer)
{
ffReadFileBuffer(devicesPath, buffer);
if(ffIsSmbiosValueSet(buffer))
return;
ffReadFileBuffer(classPath, buffer);
if(ffIsSmbiosValueSet(buffer))
return;
ffStrbufClear(buffer);
}
const char* ffDetectBoard(FFBoardResult* board)
{
getSmbiosValue("/sys/devices/virtual/dmi/id/board_name", "/sys/class/dmi/id/board_name", &board->name);
getSmbiosValue("/sys/devices/virtual/dmi/id/board_vendor", "/sys/class/dmi/id/board_vendor", &board->vendor);
getSmbiosValue("/sys/devices/virtual/dmi/id/board_version", "/sys/class/dmi/id/board_version", &board->version);
ffGetSmbiosValue("/sys/devices/virtual/dmi/id/board_name", "/sys/class/dmi/id/board_name", &board->name);
ffGetSmbiosValue("/sys/devices/virtual/dmi/id/board_serial", "/sys/class/dmi/id/board_serial", &board->serial);
ffGetSmbiosValue("/sys/devices/virtual/dmi/id/board_vendor", "/sys/class/dmi/id/board_vendor", &board->vendor);
ffGetSmbiosValue("/sys/devices/virtual/dmi/id/board_version", "/sys/class/dmi/id/board_version", &board->version);
return NULL;
}
+26 -9
View File
@@ -1,21 +1,38 @@
#include "board.h"
#include "util/windows/registry.h"
#include "util/smbiosHelper.h"
typedef struct FFSmbiosBaseboard
{
FFSmbiosHeader Header;
uint8_t Manufacturer; // string
uint8_t Product; // string
uint8_t Version; // string
uint8_t SerialNumber; // string
uint8_t AssetTag; // string
uint8_t FeatureFlags; // bit field
uint8_t LocationInChassis; // string
uint16_t ChassisHandle; // varies
uint8_t BoardType; // enum
uint8_t NumberOfContainedObjectHandle; // varies
uint16_t ContainedObjectHandle[]; // varies
} FFSmbiosBaseboard;
const char* ffDetectBoard(FFBoardResult* board)
{
FF_HKEY_AUTO_DESTROY hKey = NULL;
const FFSmbiosBaseboard* data = (const FFSmbiosBaseboard*) (*ffGetSmbiosHeaderTable())[FF_SMBIOS_TYPE_BASEBOARD_INFO];
if (!data)
return "Baseboard information section is not found in SMBIOS data";
if(!ffRegOpenKeyForRead(HKEY_LOCAL_MACHINE, L"HARDWARE\\DESCRIPTION\\System\\BIOS", &hKey, NULL))
return "ffRegOpenKeyForRead(HKEY_LOCAL_MACHINE, L\"HARDWARE\\DESCRIPTION\\System\\BIOS\") failed";
if(!ffRegReadStrbuf(hKey, L"BaseBoardProduct", &board->name, NULL))
return "ffRegReadStrbuf(hKey, L\"BaseBoardProduct\") failed";
const char* strings = (const char*) data + data->Header.Length;
ffStrbufSetStatic(&board->name, ffSmbiosLocateString(strings, data->Product));
ffCleanUpSmbiosValue(&board->name);
ffRegReadStrbuf(hKey, L"BaseBoardManufacturer", &board->vendor, NULL);
ffStrbufSetStatic(&board->serial, ffSmbiosLocateString(strings, data->SerialNumber));
ffCleanUpSmbiosValue(&board->serial);
ffStrbufSetStatic(&board->vendor, ffSmbiosLocateString(strings, data->Manufacturer));
ffCleanUpSmbiosValue(&board->vendor);
ffRegReadStrbuf(hKey, L"BaseBoardVersion", &board->version, NULL);
ffStrbufSetStatic(&board->version, ffSmbiosLocateString(strings, data->Version));
ffCleanUpSmbiosValue(&board->version);
return NULL;
-5
View File
@@ -1,8 +1,5 @@
#pragma once
#ifndef FF_INCLUDED_detection_brightness_brightness
#define FF_INCLUDED_detection_brightness_brightness
#include "fastfetch.h"
#include "util/FFlist.h"
@@ -13,5 +10,3 @@ typedef struct FFBrightnessResult
} FFBrightnessResult;
const char* ffDetectBrightness(FFBrightnessOptions* options, FFlist* result); // list of FFBrightnessResult
#endif

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