mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-12 09:58:03 +02:00
Compare commits
479 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c3e5222bcd | |||
| c0c76292cb | |||
| 49840a8f70 | |||
| 44257b7ede | |||
| d7e9094297 | |||
| 1863bde916 | |||
| 7c1b6c6a10 | |||
| 7e8b204644 | |||
| e8dc500f24 | |||
| bb11cff700 | |||
| 90690ba315 | |||
| 3811bb1be4 | |||
| 1f3d18cdbc | |||
| 3ae2047364 | |||
| 66ba5d0a5f | |||
| 983e5c680f | |||
| 745865d66a | |||
| 8bdca1b1a8 | |||
| 5172a13b15 | |||
| 3ba899261f | |||
| 5fa18a8a1c | |||
| 81e0af8999 | |||
| a14a73b259 | |||
| c8451cab52 | |||
| 965777323e | |||
| ad709c4153 | |||
| 0869bfaeed | |||
| dee208f3e3 | |||
| 7e1c426e34 | |||
| 0ae2d389da | |||
| 20b433f40a | |||
| 152f5d3fa6 | |||
| b030bd6751 | |||
| e0d5a9024a | |||
| f83a31e0a6 | |||
| 099e2b5f8f | |||
| 374997b599 | |||
| f938f5e03b | |||
| d7098e728d | |||
| 5302a82444 | |||
| 64a3573c49 | |||
| 3d48de8c98 | |||
| 4b33e1b691 | |||
| 6326405c26 | |||
| b25e8c2721 | |||
| 81318f45bb | |||
| 2f6cabb839 | |||
| 4fd65ad0b8 | |||
| 6ecb383a6a | |||
| 1b3977fc47 | |||
| f00969cb81 | |||
| b3e79477a6 | |||
| 82c7f27ae7 | |||
| 624a4956fc | |||
| 30a5dd52b1 | |||
| 92136370bb | |||
| d196b8079e | |||
| a3dbac7dfc | |||
| 59c853fb01 | |||
| 5ec272acff | |||
| c72fdab301 | |||
| 183f12d8b5 | |||
| 395810cd79 | |||
| 36cf5856b5 | |||
| 01d1336cf0 | |||
| 28f2e9ea96 | |||
| 2d4e7f10c4 | |||
| aa1a5b8c36 | |||
| 43bdb68cbf | |||
| 8b43e331e3 | |||
| 302716fa61 | |||
| 188b6aba10 | |||
| 7af9cab688 | |||
| 714b88c638 | |||
| d9f1db10aa | |||
| bb10e1c9a3 | |||
| 264b6794f3 | |||
| a8b734c877 | |||
| 10ca77610e | |||
| c2eaea3665 | |||
| 1619f0ab6c | |||
| aba211221b | |||
| 81485baadb | |||
| 1b4fc38330 | |||
| 3571d9277d | |||
| e9b535d277 | |||
| 09ffd32144 | |||
| 27aa5c0343 | |||
| 1d95f9b224 | |||
| 4f1cb779ab | |||
| 758ddae344 | |||
| 14969b31d0 | |||
| d88e2eeb36 | |||
| 7946e69a66 | |||
| 15766f5266 | |||
| ed02845c40 | |||
| 4ffa0ffcb7 | |||
| c04c040713 | |||
| c763896b49 | |||
| e9a44f71b2 | |||
| 5078c8d910 | |||
| f9e0efb7ee | |||
| 926390508e | |||
| 45446c1c1d | |||
| b79c47cac9 | |||
| fd16e69464 | |||
| 92abf3e063 | |||
| 90a242a4aa | |||
| 1118c57d8f | |||
| eda9496479 | |||
| 0b94ff5adb | |||
| 62bf3ec021 | |||
| ab2268a927 | |||
| 1421627a47 | |||
| 02e5232bda | |||
| 289d03cfb2 | |||
| 965ab1abc4 | |||
| 06b2ff9a08 | |||
| b4a6606faf | |||
| def758580f | |||
| 5ea2b2ecc9 | |||
| b3886c6c47 | |||
| bc76220a5b | |||
| 60fa7946f5 | |||
| b6a703bd56 | |||
| 462c3b0e06 | |||
| 72138dbde5 | |||
| b2ea5d8f3e | |||
| 49080c5361 | |||
| 445dd94b53 | |||
| 7c03fc1550 | |||
| 06a8f12d6a | |||
| 8c7edf4d2d | |||
| 85b4679373 | |||
| 215029ea27 | |||
| 533f54fb73 | |||
| a6212c5b01 | |||
| ba76b18367 | |||
| 4290efb49d | |||
| 30b85fc169 | |||
| dc94ac8d0c | |||
| 1d9e612262 | |||
| be1791e386 | |||
| 3b8c2d6ee6 | |||
| c661e55053 | |||
| 56403bab5c | |||
| caef317ade | |||
| 131e01f35b | |||
| c8e3c6882a | |||
| c985bdbbfd | |||
| b80eb47ecd | |||
| 68942c1d3f | |||
| b36b74448f | |||
| 217bb6657e | |||
| df2862996b | |||
| df6ab6427e | |||
| 82d848727c | |||
| d0d6323b1f | |||
| 6439921f85 | |||
| d28907ee9d | |||
| 41f0971570 | |||
| ab0bd79bb8 | |||
| 07747aa819 | |||
| 68efcdd0dd | |||
| fef3100fd7 | |||
| 08a940bfd4 | |||
| d6a99c631e | |||
| 3d4077c2d0 | |||
| ce6b595421 | |||
| 7d8c085254 | |||
| ec0af17fb5 | |||
| 2accfbc894 | |||
| 01d2fa1228 | |||
| f16843d60f | |||
| acc77ebddd | |||
| 7eb145fb7f | |||
| 34a6eb13c6 | |||
| 0f5e746fe2 | |||
| b62ad16aa6 | |||
| f79498e4b5 | |||
| 31c433b353 | |||
| 852c6abf2e | |||
| df3fa6f8a8 | |||
| 738daa1c77 | |||
| 4204cfc500 | |||
| 9cb08d115a | |||
| 459f159b1b | |||
| 2880536513 | |||
| 64cb1bfdfd | |||
| b80c30ace3 | |||
| 19b8849bfc | |||
| 8f457f047c | |||
| 299bc7468f | |||
| c213b0769b | |||
| 260c883d07 | |||
| da0db042fa | |||
| ae5732e2a8 | |||
| 1f05a33807 | |||
| f090951abc | |||
| 855fd6edee | |||
| d4bd4401a8 | |||
| 689feb39a4 | |||
| 0f64e2830a | |||
| 3e24cdc752 | |||
| dc9c285a0b | |||
| 1d03c9c85e | |||
| 4eae11df64 | |||
| eba13d5485 | |||
| 16b875ef5a | |||
| 366138e1bd | |||
| 7fe18a5b7c | |||
| 39cd8cfb4c | |||
| 8b441c85e5 | |||
| f66e901c44 | |||
| 3815823a20 | |||
| 33ff4870dc | |||
| 479731f076 | |||
| d2f3f47457 | |||
| 5ea89ecba5 | |||
| 865f57bd76 | |||
| e98e2a3d52 | |||
| 6bb748869e | |||
| 654721b8c5 | |||
| 0542eac1b9 | |||
| b9faf8d77f | |||
| 61f848146a | |||
| 4175dfdc3a | |||
| 861d9006d7 | |||
| 7ba07bd2e0 | |||
| 9fee36a286 | |||
| 2fc9230b29 | |||
| 5fb1286e15 | |||
| a4cace4765 | |||
| c6d2467a83 | |||
| db0d38202e | |||
| 9fbb23b135 | |||
| 3a990e495b | |||
| 648530ee8f | |||
| b12a59cdaf | |||
| 83c1fe26e6 | |||
| 217f98a36c | |||
| 1011e21ba8 | |||
| 08c6a6e4cb | |||
| 5e9fcaf7ca | |||
| 8b838cef61 | |||
| 22d9d8e196 | |||
| a789b8330a | |||
| 903ecf37f7 | |||
| c4a876f6aa | |||
| 82285ebeb4 | |||
| 36dadcdc7f | |||
| 030c05429a | |||
| a462a12370 | |||
| b386365d95 | |||
| 158db9d7c7 | |||
| 407bfa8c95 | |||
| 1449290e9e | |||
| 4c0ea7354d | |||
| 71cba2451a | |||
| ef3b5df048 | |||
| 3e98034e55 | |||
| 1c89101522 | |||
| 757e6271ff | |||
| c5c846aa22 | |||
| 23a59a15ec | |||
| 4798c619d0 | |||
| 023e767237 | |||
| 688d9b00ab | |||
| c2fe2f70dc | |||
| 3430c10ec2 | |||
| 9afcc00201 | |||
| cd783d1267 | |||
| 81480532e2 | |||
| 982e8a0117 | |||
| 8af88a3376 | |||
| 9ed2f13c78 | |||
| d7ea774d71 | |||
| a4b9784c48 | |||
| 3fe2d8091a | |||
| 78c903c403 | |||
| c42711ee26 | |||
| 367264e549 | |||
| 36a0c273f9 | |||
| 418106c485 | |||
| 1058e876a7 | |||
| 8721cc1ab5 | |||
| e12642e0b9 | |||
| 315bbb3020 | |||
| 0576d4ca26 | |||
| c309dbb844 | |||
| c71b04ba93 | |||
| f3417b1b05 | |||
| c597b7ec3a | |||
| 8b4586b914 | |||
| b65a0e2543 | |||
| 6e15a44168 | |||
| 6bd3d2c434 | |||
| 29644ef904 | |||
| 39dfcb6f10 | |||
| 882b17834c | |||
| bdd2908e6a | |||
| d4a402f4dd | |||
| 115b293ff5 | |||
| 6831c095ec | |||
| 81fb146869 | |||
| 35b54fd064 | |||
| 866e65749e | |||
| e157b9a51f | |||
| 74c89cc03f | |||
| 229c6674a4 | |||
| ab8ad7ffc0 | |||
| 6805cb16fb | |||
| e596d76430 | |||
| de4afb6507 | |||
| beb5f479d9 | |||
| e660e61027 | |||
| e3cdecdb14 | |||
| 40320e5efa | |||
| c2fd057126 | |||
| ea1ef0f347 | |||
| 04456d9807 | |||
| 18240524dc | |||
| 42b7d567a1 | |||
| 2790493cba | |||
| 8eabc49e12 | |||
| 3252812699 | |||
| 3fa308386f | |||
| 84ee7cef7c | |||
| 57f6aff2de | |||
| d745d7afef | |||
| 510a1f57f8 | |||
| a1c9b24755 | |||
| 75e6f48dfd | |||
| ed7b12e733 | |||
| 9c56839c97 | |||
| 6647980ce3 | |||
| 80f8b086ca | |||
| 8c2dd1aeac | |||
| ae3c6f1e63 | |||
| 7cc381339c | |||
| aa58a0999d | |||
| 4580f3fd54 | |||
| 6c0c4fa2cf | |||
| 526324be38 | |||
| efb0f335e1 | |||
| 9b23ce94ab | |||
| 47000f2aaf | |||
| cb3ca73f60 | |||
| fd0b35f21a | |||
| 0e7dda4043 | |||
| 5f7b9d2473 | |||
| f8cbe4c008 | |||
| 41df915f29 | |||
| ef440a015d | |||
| 180cbce3a2 | |||
| 64ec76f5a6 | |||
| 9860fb67d4 | |||
| 08cbba1d9d | |||
| 095149a4e9 | |||
| a561a96a5f | |||
| 073d6a9337 | |||
| 6851c9cc1a | |||
| 2862f466f3 | |||
| 5e3fdc6c33 | |||
| 03fe5803de | |||
| 6d36ec55c5 | |||
| f098cdbf69 | |||
| 07d3fe3044 | |||
| 636b6fc43d | |||
| ccfba6786c | |||
| 7c2c631807 | |||
| 6769410753 | |||
| 40b9af6c36 | |||
| e63dfdd8b1 | |||
| a6639d7211 | |||
| 3e251f602a | |||
| ec25ca9fc7 | |||
| 396d20f2da | |||
| 49181fd0bf | |||
| 5eb1dbe7bf | |||
| 690e988cab | |||
| fd41770d6e | |||
| fb26cb1394 | |||
| 4e4efa67e6 | |||
| 0dfb1b6bb1 | |||
| bcbca38b1e | |||
| 3f0ccf802c | |||
| 691cb4ac24 | |||
| 282939f548 | |||
| 6f35b2f382 | |||
| 6700f63091 | |||
| 5c37ebec70 | |||
| 28a419d252 | |||
| 95128ee95f | |||
| c94180b3d2 | |||
| 12ca1a0cf7 | |||
| 67564dfa2c | |||
| a1e79a9522 | |||
| e16f8ef349 | |||
| fd1a2072b3 | |||
| aa45e70910 | |||
| 5374feb24b | |||
| 12ac0ac7a9 | |||
| 3d78666ed3 | |||
| dd2cc116bd | |||
| ba2636dc1a | |||
| 69589f1ad5 | |||
| 39da11de8e | |||
| 8b7a4daeda | |||
| 82af7a5b52 | |||
| a2d99695fd | |||
| 3a2786a89f | |||
| a6cb30d6c8 | |||
| de6b1f9542 | |||
| 77431671bb | |||
| 4430b7145e | |||
| 898859cc7a | |||
| 43b96df112 | |||
| bb97893bd0 | |||
| 9b21ec6e1f | |||
| ffac354368 | |||
| a9aab51764 | |||
| 4d1fc9ceb1 | |||
| e897a98153 | |||
| 0a8056d835 | |||
| 9681e176b3 | |||
| 1f8be43881 | |||
| 30813551be | |||
| beb564f374 | |||
| 5c97c012a9 | |||
| 50da7cabd6 | |||
| a6528cdfd6 | |||
| 588201fe46 | |||
| 6184b5ee96 | |||
| 5e7baa9d0a | |||
| 79ae650c58 | |||
| 44107f289e | |||
| 75927a87b2 | |||
| 85da30ccf5 | |||
| f73c3b85c2 | |||
| 66bef2fc19 | |||
| 7c5eb021ee | |||
| f902e3b3d8 | |||
| 553124ab5b | |||
| 6c6d93370d | |||
| 55ae3a7dbd | |||
| 586874080f | |||
| d5b91a8983 | |||
| 72fee13112 | |||
| 20ae897f39 | |||
| 6f756d103f | |||
| c9dd858ce3 | |||
| 2e201eaaf7 | |||
| 7c54dcba69 | |||
| a107395707 | |||
| 8a9fe22855 | |||
| 7e04e23528 | |||
| 8d779f68f3 | |||
| 98ba08c1a0 | |||
| a1499b82f8 | |||
| c6c866d78a | |||
| 7a6999bd20 | |||
| 1084cf3523 | |||
| ed5f2a3968 | |||
| 17e1d4b72d | |||
| 912f6c4f3c | |||
| 77d71b5fef | |||
| 6938a73a8a | |||
| cee9df189d | |||
| 2a125e226b | |||
| 4a7e60ef57 | |||
| 0a6140346e | |||
| 01862ebc04 | |||
| 3185299214 | |||
| 5b6ebe4f11 | |||
| 6274ef591b | |||
| 7acdaebee4 | |||
| 6dcfb6b88f | |||
| 064972aecd |
@@ -7,12 +7,15 @@ assignees: ''
|
||||
|
||||
---
|
||||
|
||||
Be sure to read [FAQ](https://github.com/fastfetch-cli/fastfetch?tab=readme-ov-file#faq) before submitting a new issue.
|
||||
|
||||
<!-- We will try hard to solve the issue. However since platforms and hardwares vary greatly, it can be hard to find the root cause is. Providing following information may help us greatly. Thanks in advance -->
|
||||
|
||||
# General description of bug:
|
||||
|
||||
* What happened:
|
||||
* What should happen:
|
||||
* Fastfetch version used: <!-- please use the latest version, if possible -->
|
||||
* Did it work in an older version: <!-- if yes, which version -->
|
||||
* Where did you get the binary: <!-- Github Release / Github Actions / Installed with a package manager (What package manager) / Built from source yourself -->
|
||||
* Does this issue still occurs in [the latest dev build](https://github.com/fastfetch-cli/fastfetch/actions/)?
|
||||
@@ -41,22 +44,27 @@ Output of `fastfetch --list-features`:
|
||||
//paste here
|
||||
```
|
||||
|
||||
## If fastfatch crashed
|
||||
## If fastfatch crashed or freezed
|
||||
|
||||
Paste the stacktrace here. You may get it with:
|
||||
|
||||
```
|
||||
$ gdb -q -ex 'set confirm off' -ex run -ex 'bt full' -ex quit --args /path/to/fastfetch
|
||||
```shell
|
||||
# You may need Ctrl+C to stop the process if it freezes
|
||||
gdb -q -ex 'set confirm off' -ex run -ex 'bt full' -ex quit --args /path/to/fastfetch
|
||||
```
|
||||
|
||||
If you are able to identify which module crashed, the strace can be helpful too
|
||||
|
||||
```
|
||||
$ strace /path/to/fastfetch --multithreading false --structure {MODULE} --pipe
|
||||
```shell
|
||||
strace /path/to/fastfetch --multithreading false -s {MODULE} --pipe
|
||||
```
|
||||
|
||||
If you cannot do the instructions above, please upload the core dump file:
|
||||
|
||||
## If fastfetch is slow
|
||||
|
||||
Use `time fastfetch --stat` to show time usage for each module.
|
||||
|
||||
## If my image logo didn't show / work
|
||||
|
||||
<!-- Please make sure the terminal does support the image protocol you used. Note Gnome terminal doesn't support any image protocols -->
|
||||
@@ -68,10 +76,5 @@ If you cannot do the instructions above, please upload the core dump file:
|
||||
|
||||
## If fastfetch behaves incorrectly on shell starting
|
||||
|
||||
<!-- NOTE for zsh / p10k users:
|
||||
There are known incompatibility between fastfetch and p10k instant prompt.
|
||||
The p10k doc clearly states that you should NOT print anything to stdout after p10k-instant-prompt is initialized.
|
||||
You should either put `fastfetch` before initialization of p10k-instant-prompt (recommended), remove it or use `fastfetch --pipe false` -->
|
||||
|
||||
* The bug is reproduceable with fresh / clean shell configuration (i.e. `fastfetch` is the single line of `.zshrc` or `~/.config/fish/config.fish`):
|
||||
* Does `sleep 1` before running `fastfetch` work?
|
||||
|
||||
@@ -7,10 +7,12 @@ assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!-- Before requesting a new feature, please try `fastfetch -c all.jsonc` to see if it has been supported -->
|
||||
Be sure to read [FAQ](https://github.com/fastfetch-cli/fastfetch?tab=readme-ov-file#faq) before submitting a new issue.
|
||||
|
||||
# Current state:
|
||||
## Wanted features:
|
||||
|
||||
# Wanted state:
|
||||
<!-- Your features here -->
|
||||
|
||||
# Why the change is sensible:
|
||||
## Motivation:
|
||||
|
||||
<!-- Your motivation here -->
|
||||
|
||||
@@ -7,9 +7,11 @@ assignees: ''
|
||||
|
||||
---
|
||||
|
||||
Tip: A logo can be displayed by fastfetch without getting into fastfetch's official repo. For highly customized logo for personal use, it's recommended to keep it locally. Please refer to https://github.com/fastfetch-cli/fastfetch/wiki/Migrate-Neofetch-Logo-To-Fastfetch
|
||||
|
||||
# OS
|
||||
```
|
||||
Paste content of /etc/os-release here. If this file doesn't exist, describe a way to identify the distro.
|
||||
Paste content of /etc/os-release and /etc/lsb-release here. If none of these files exist, describe a way to identify the distro
|
||||
```
|
||||
|
||||
# Ascii
|
||||
|
||||
+137
-92
@@ -14,66 +14,16 @@ jobs:
|
||||
|
||||
- name: Install codespell
|
||||
shell: bash
|
||||
run: sudo apt update && sudo apt install -y codespell
|
||||
run: |
|
||||
sudo apt-get update || true
|
||||
sudo apt-get install -y codespell
|
||||
|
||||
- name: Run Spellchecker
|
||||
run: codespell
|
||||
|
||||
linux-buildtest:
|
||||
name: Linux build test
|
||||
permissions:
|
||||
contents: read
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
compiler: [
|
||||
{ cc: gcc, cxx: "g++" },
|
||||
{ cc: clang, cxx: "clang++" },
|
||||
{ cc: "musl-gcc", cxx: "musl-g++" }
|
||||
]
|
||||
enableFeatures: [ON, OFF]
|
||||
exclude:
|
||||
# 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: ubuntu-22.04
|
||||
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 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_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 . --verbose -j4
|
||||
|
||||
- name: run tests
|
||||
run: ctest
|
||||
|
||||
- name: run fastfetch --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
|
||||
|
||||
Linux-old-amd64:
|
||||
name: Linux-old-amd64
|
||||
runs-on: ubuntu-20.04
|
||||
no-features-test:
|
||||
name: No-features-test
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
security-events: write
|
||||
contents: read
|
||||
@@ -84,28 +34,12 @@ jobs:
|
||||
- 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 .
|
||||
run: cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_INSTALL_PREFIX=/usr . -DENABLE_VULKAN=OFF -DENABLE_WAYLAND=OFF -DENABLE_XCB_RANDR=OFF -DENABLE_XCB=OFF -DENABLE_XRANDR=OFF -DENABLE_X11=OFF -DENABLE_DRM=OFF -DENABLE_GIO=OFF -DENABLE_DCONF=OFF -DENABLE_DBUS=OFF -DENABLE_XFCONF=OFF -DENABLE_SQLITE3=OFF -DENABLE_RPM=OFF -DENABLE_IMAGEMAGICK7=OFF -DENABLE_IMAGEMAGICK6=OFF -DENABLE_CHAFA=OFF -DENABLE_ZLIB=OFF -DENABLE_EGL=OFF -DENABLE_GLX=OFF -DENABLE_OSMESA=OFF -DENABLE_OPENCL=OFF -DENABLE_LIBNM=OFF -DENABLE_FREETYPE=OFF -DENABLE_PULSE=OFF -DENABLE_DDCUTIL=OFF -DENABLE_DIRECTX_HEADERS=OFF -DENABLE_THREADS=OFF
|
||||
|
||||
- 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
|
||||
|
||||
@@ -124,15 +58,9 @@ jobs:
|
||||
- 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)
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
security-events: write
|
||||
contents: read
|
||||
@@ -146,12 +74,12 @@ jobs:
|
||||
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 libddcutil-dev libchafa-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 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 --ignore-dependencies
|
||||
/home/linuxbrew/.linuxbrew/bin/brew install imagemagick chafa ddcutil --ignore-dependencies
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3
|
||||
@@ -230,9 +158,129 @@ jobs:
|
||||
name: fastfetch-linux-aarch64
|
||||
path: ./fastfetch-*.*
|
||||
|
||||
linux-armv7:
|
||||
name: Linux-armv7
|
||||
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: armv7
|
||||
distro: ubuntu20.04
|
||||
githubToken: ${{ github.token }}
|
||||
run: |
|
||||
uname -a
|
||||
apt-get update && apt-get install -y wget
|
||||
# CMake installed by apt has bug `list sub-command REMOVE_ITEM requires two or more arguments`
|
||||
wget --no-check-certificate https://apt.kitware.com/ubuntu/pool/main/c/cmake/{cmake_3.29.2-0kitware1ubuntu20.04.1_armhf.deb,cmake-data_3.29.2-0kitware1ubuntu20.04.1_all.deb}
|
||||
dpkg -i *.deb
|
||||
apt-get install -y make g++ libvulkan-dev libwayland-dev libxrandr-dev libxcb-randr0-dev libdconf-dev libdbus-1-dev libmagickcore-dev libxfconf-0-dev libsqlite3-dev librpm-dev libegl-dev libglx-dev libosmesa6-dev ocl-icd-opencl-dev libnm-dev libpulse-dev libdrm-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-armv7
|
||||
path: ./fastfetch-*.*
|
||||
|
||||
musl-amd64:
|
||||
name: Musl-amd64
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: setup alpine linux
|
||||
uses: jirutka/setup-alpine@master
|
||||
with:
|
||||
branch: v3.19
|
||||
|
||||
- name: install dependencies
|
||||
run: |
|
||||
cat /etc/alpine-release
|
||||
uname -a
|
||||
apk add cmake samurai vulkan-loader-dev libxcb-dev wayland-dev libdrm-dev dconf-dev imagemagick-dev chafa-dev zlib-dev dbus-dev mesa-dev opencl-dev xfconf-dev sqlite-dev networkmanager-dev pulseaudio-dev ddcutil-dev gcc g++
|
||||
shell: alpine.sh --root {0}
|
||||
|
||||
- name: build
|
||||
run: |
|
||||
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_INSTALL_PREFIX=/usr -DIS_MUSL=ON -GNinja .
|
||||
cmake --build . --target package --verbose -j4
|
||||
shell: alpine.sh {0}
|
||||
|
||||
- name: run
|
||||
run: |
|
||||
./fastfetch --list-features
|
||||
time ./fastfetch -c presets/ci.jsonc
|
||||
time ./fastfetch -c presets/ci.jsonc --format json
|
||||
time ./flashfetch
|
||||
ldd fastfetch
|
||||
ctest
|
||||
shell: alpine.sh {0}
|
||||
|
||||
- name: upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: fastfetch-musl-amd64
|
||||
path: ./fastfetch-*.*
|
||||
|
||||
musl-aarch64:
|
||||
name: Musl-aarch64
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: setup alpine linux
|
||||
uses: jirutka/setup-alpine@master
|
||||
with:
|
||||
branch: v3.19
|
||||
arch: aarch64
|
||||
|
||||
- name: install dependencies
|
||||
run: |
|
||||
cat /etc/alpine-release
|
||||
uname -a
|
||||
apk add cmake samurai vulkan-loader-dev libxcb-dev wayland-dev libdrm-dev dconf-dev imagemagick-dev chafa-dev zlib-dev dbus-dev mesa-dev opencl-dev xfconf-dev sqlite-dev networkmanager-dev pulseaudio-dev ddcutil-dev gcc g++
|
||||
shell: alpine.sh --root {0}
|
||||
|
||||
- name: build
|
||||
run: |
|
||||
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_INSTALL_PREFIX=/usr -DIS_MUSL=ON -GNinja .
|
||||
cmake --build . --target package --verbose -j4
|
||||
shell: alpine.sh {0}
|
||||
|
||||
- name: run
|
||||
run: |
|
||||
./fastfetch --list-features
|
||||
time ./fastfetch -c presets/ci.jsonc
|
||||
time ./fastfetch -c presets/ci.jsonc --format json
|
||||
time ./flashfetch
|
||||
ldd fastfetch
|
||||
ctest
|
||||
shell: alpine.sh {0}
|
||||
|
||||
- name: upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: fastfetch-musl-aarch64
|
||||
path: ./fastfetch-*.*
|
||||
|
||||
macos-universal:
|
||||
name: macOS-universal
|
||||
runs-on: macos-latest
|
||||
runs-on: macos-12
|
||||
permissions:
|
||||
security-events: write
|
||||
contents: read
|
||||
@@ -245,8 +293,7 @@ jobs:
|
||||
|
||||
- name: install required packages
|
||||
run: |
|
||||
brew update
|
||||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install vulkan-loader vulkan-headers molten-vk imagemagick chafa
|
||||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install --overwrite vulkan-loader vulkan-headers molten-vk imagemagick chafa
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3
|
||||
@@ -378,7 +425,7 @@ jobs:
|
||||
with:
|
||||
msystem: CLANG64
|
||||
update: true
|
||||
install: git mingw-w64-clang-x86_64-7zip mingw-w64-clang-x86_64-cmake mingw-w64-clang-x86_64-clang mingw-w64-clang-x86_64-vulkan-loader mingw-w64-clang-x86_64-opencl-icd
|
||||
install: git mingw-w64-clang-x86_64-7zip mingw-w64-clang-x86_64-cmake mingw-w64-clang-x86_64-clang mingw-w64-clang-x86_64-vulkan-loader mingw-w64-clang-x86_64-vulkan-headers mingw-w64-clang-x86_64-opencl-icd
|
||||
|
||||
- name: print msys version
|
||||
run: uname -a
|
||||
@@ -440,7 +487,7 @@ jobs:
|
||||
with:
|
||||
msystem: CLANG32
|
||||
update: true
|
||||
install: git mingw-w64-clang-i686-7zip mingw-w64-clang-i686-cmake mingw-w64-clang-i686-clang mingw-w64-clang-i686-vulkan-loader mingw-w64-clang-i686-opencl-icd
|
||||
install: git p7zip mingw-w64-clang-i686-cmake mingw-w64-clang-i686-clang mingw-w64-clang-i686-vulkan-loader mingw-w64-clang-i686-vulkan-headers mingw-w64-clang-i686-opencl-icd
|
||||
|
||||
- name: print msys version
|
||||
run: uname -a
|
||||
@@ -496,6 +543,9 @@ jobs:
|
||||
needs:
|
||||
- linux-amd64
|
||||
- linux-aarch64
|
||||
- linux-armv7
|
||||
- musl-amd64
|
||||
- musl-aarch64
|
||||
- macos-universal
|
||||
- freebsd-amd64
|
||||
- freebsd-aarch64
|
||||
@@ -514,11 +564,6 @@ jobs:
|
||||
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-amd64.outputs.ffversion != steps.get_version_release.outputs.release
|
||||
uses: ncipollo/release-action@v1
|
||||
|
||||
+7
-6
@@ -1,10 +1,11 @@
|
||||
**/build/
|
||||
**/.vscode/
|
||||
**/.cache/
|
||||
**/.kdev4/
|
||||
**/.DS_Store
|
||||
/.vs
|
||||
build/
|
||||
.vs/
|
||||
.vscode/
|
||||
.cache/
|
||||
.kdev4/
|
||||
.DS_Store
|
||||
cscope.*
|
||||
tags
|
||||
fastfetch.kdev4
|
||||
*.user
|
||||
*.user.*
|
||||
|
||||
+356
@@ -1,3 +1,359 @@
|
||||
# 2.14.0
|
||||
|
||||
Features:
|
||||
* Support monochrome bar type (#960)
|
||||
* Support editor version detection on Windows (Editor, Windows)
|
||||
* Apply default color palettes in `--file` and `--data` (Logo)
|
||||
* Print all presets in `--list-presets` for better Windows support (Windows)
|
||||
* Support for guix package manager detection (Packages, Linux)
|
||||
* Support named variable placeholders in custom module formattion string (#796)
|
||||
* `--title-format '{user-name-colored}{at-symbol-colored}{host-name-colored}'` is equivalent to `--title-format '{6}{7}{8}'`
|
||||
* Support named color placeholders in custom module formattion string
|
||||
* `--<module>-format '{#red}'` is equivalent to `--<module>-format '{#31}'`
|
||||
* `'{#red}'` or `'{#31}'` is preferred over `\u001b[31m` because is more readable and `--pipe` aware (will be ignored in pipe mode)
|
||||
* Supported in `Custom` module too
|
||||
* See `fastfetch -h format` for detail
|
||||
* Add option `--color-separator` to set the color of key-value separators
|
||||
* Support Guix package manager count (#792, Packages, Linux)
|
||||
* Improve python based shell detection (#977, Shell, macOS)
|
||||
* Print error reason when vulkan init fails (Vulkan)
|
||||
|
||||
Bugfixes:
|
||||
* Don't detect `.conf` files in `--list-config-paths`
|
||||
* Don't try to detect terminals in MSYS shell with process backtracing (Windows)
|
||||
* Fix `outputColor` doesn't work if module keys are disabled
|
||||
|
||||
Logos:
|
||||
* Add Cereus Linux
|
||||
* Re-add special handling of Loc-OS
|
||||
|
||||
# 2.13.2
|
||||
|
||||
Another hotfix release :(
|
||||
|
||||
Bugfixes:
|
||||
* Remove DRM driver version detection feature, which caused a performance regression for nouveau drivers (#956, Display, Linux)
|
||||
* Fix compatibility for old python versions. Regression of `2.13.0`
|
||||
* Don't use `*-unknown` as display name for Wayland protocol (Display, Linux)
|
||||
|
||||
Features:
|
||||
* Add new module `Editor` which prints information of the default editor, i.e. $VISUAL or $EDITOR (#430, Editor)
|
||||
|
||||
Logos:
|
||||
* Added CuerdOS
|
||||
* Remove special handling of Loc-OS
|
||||
|
||||
# 2.13.1
|
||||
|
||||
Fix a regression introduced in v2.13.0
|
||||
|
||||
Bugfixes:
|
||||
* Fix CPU frequency not displayed if `bios_limit` is not available (CPU, Linux)
|
||||
|
||||
Features:
|
||||
* Add `--cpu-show-pe-core-count` to detect and display core count for performance / efficiency cores (CPU, FreeBSD)
|
||||
|
||||
# 2.13.0
|
||||
|
||||
Changes:
|
||||
* Option `--gpu-force-vulkan <?bool>` has been changed to `--gpu-detection-method <enum>`
|
||||
* Use `--gpu-detection-method vulkan` to get the old behavior
|
||||
* See `fastfetch -h gpu-detection-method` for detail
|
||||
* In Linux, BIOS limited CPU frequency is printed by default to match the behavior of neofetch (CPU, Linux, #947)
|
||||
|
||||
Features:
|
||||
* Add new module `Bootmgr` which prints information of stage 2 bootloader (grub, system-boot, etc)
|
||||
* Requires root permission to work on Windows and FreeBSD
|
||||
* Requires booting in UEFI mode
|
||||
* Add package manager lpkg and lpkg-build support (Packages, Linux)
|
||||
* Improve macOS 10.13 compatibility (macOS)
|
||||
* Detect core count for performance / efficiency cores (CPU)
|
||||
* Test it with `fastfetch -s cpu --cpu-format '{9}'`
|
||||
* Support min / max frequency and physical core count detection in FreeBSD, if kernel supports it (CPU, FreeBSD)
|
||||
* Detect DRM driver version if DRM detection method is used (GPU, Linux)
|
||||
|
||||
Bugfixes:
|
||||
* Don't detect `clifm` and `valgrind` as a terminal (Terminal, Linux)
|
||||
* Improve stability (PhysicalMemory, FreeBSD)
|
||||
* Fix bssid & status detection (Wifi, FreeBSD)
|
||||
* Ensure createTime is correctly initialized (Disk, FreeBSD / macOS)
|
||||
* Fix `--cpu-freq-ndigits` not working if `--cpu-format` is used
|
||||
* Fix `nix-user` package count detection (Packages, Linux)
|
||||
* Fix some memory leaks
|
||||
|
||||
Logos:
|
||||
* Fix Manjaro logo not displayed
|
||||
* Add SpoinkOS
|
||||
* Add Loc-OS
|
||||
* Add Furreto Linux
|
||||
* Fix TorizonCore logo colors
|
||||
* Fix KDE neon logo not displayed
|
||||
|
||||
# 2.12.0
|
||||
|
||||
Changes:
|
||||
* The long deprecated flag based config files are removed.
|
||||
* They can still be used with `xargs fastfetch < /path/to/config.conf`
|
||||
* `--gen-config` can be used to migrate them to json based config files
|
||||
* The long deprecated options `--set` and `--set-keyless` are removed.
|
||||
* `Kernel` module now prints kernel name by default
|
||||
|
||||
Features:
|
||||
* Support `st` terminal font detection for font configuration compiled in `st` binary (TerminalFont, Linux)
|
||||
* Add option `--color-output` to change output color of all modules except `Title`, `Separator`
|
||||
* `display.color.output` in JSONC config file
|
||||
* Add option `--<module>-output-color` to change output color of one specified module, which overrides the global option `--color-output`
|
||||
* Add option `--publicip-ipv6` to print IPv6 address (PublicIP)
|
||||
* Add new module `Loadavg` to print load averages (Loadavg)
|
||||
* Add new module `PhysicalMemory` to print information of physical memory devices (PhysicalMemory)
|
||||
* Requires root permission to work on Linux and FreeBSD
|
||||
* Support specifying `--logo-width` only for `--kitty-direct` and `--iterm` (Logo)
|
||||
* Add option `--localip-show-all-ips` to show all IPs assigned to the same interface (LocalIP)
|
||||
* Default to `false`
|
||||
* Improve compatibility with `(*term)` (#909, Terminal, macOS)
|
||||
* Support GPU core count and frequency detection for Asahi Linux (GPU, Linux)
|
||||
|
||||
Bugfixes:
|
||||
* Rename option `--temperature-unit` to `--temp-unit` as documented in help messages
|
||||
* Fix alternate logo doesn't work with `{ "type": "builtin" }` (#914, Logo)
|
||||
|
||||
Logos:
|
||||
* Fix DahliaOS detection
|
||||
* Add openSUSE Slowroll
|
||||
* Add macOS3
|
||||
* Add Quirinux
|
||||
|
||||
# 2.11.5
|
||||
|
||||
Bugfix:
|
||||
* Fix logo printing for OpenMandriva (#896)
|
||||
* Remove `--os-file` in help messages
|
||||
|
||||
# 2.11.4
|
||||
|
||||
Changes:
|
||||
* Fastfetch will print a colorless ascii logo in `--pipe` mode for better `lolcat` compatibility. `fastfetch | lolcat` should work and no `--pipe false` needed.
|
||||
* Previously the logo would be disabled in `--pipe` mode.
|
||||
* Use `--pipe -l none` to get the old beheavior
|
||||
* `--os-file` was removed and CMake option `-DCUSTOM_OS_RELEASE_PATH=/path/to/os-release` was introduced for configuring at compile time by package managers if needed. This option should not used in most cases.
|
||||
|
||||
Bugfixes:
|
||||
* Fix possible out-of-bound memory access (#868)
|
||||
* Fix Apple Terminal detection (#878, macOS, Terminal)
|
||||
* Fix deprecation warning for macOS 14.0 hopefully (#860, macOS, Camera)
|
||||
* Fix memory leaks when passing informative options (#888)
|
||||
* Fix JSON config `size.ndigits` doesn't work
|
||||
|
||||
Features:
|
||||
* Enable `--pipe` mode if environment variable `$NO_COLOR` is set
|
||||
* Support Armbian and Proxmox distro detection (OS, Linux)
|
||||
|
||||
Logo:
|
||||
* Add Armbian
|
||||
|
||||
# 2.11.3
|
||||
|
||||
Hotfix for nix (https://github.com/NixOS/nixpkgs/issues/308849#issuecomment-2093962376)
|
||||
|
||||
Features:
|
||||
* Add cmake option `CUSTOM_AMDGPU_IDS_PATH` for specifying custom path of `amdgpu.ids`
|
||||
|
||||
Bugfixes:
|
||||
* Fix hanging when detecting disconnected network drive (Disk, Windows)
|
||||
* Ensure line ending is printed when printing image logo errors (Logo)
|
||||
* Revert image logo limitation change in 2.11.2; allow image logo in SSH session and tmux again (#861, Logo)
|
||||
* Fix doubled output in custom formation (PhysicalDisk, Windows)
|
||||
|
||||
# 2.11.2
|
||||
|
||||
Hotfix for Debian 11
|
||||
|
||||
Changes:
|
||||
* Error messages when trying to print image logo will only be printed with `--show-errors`
|
||||
* When generating JSON output, fastfetch will generate an empty array when no result is detected, instead of an error.
|
||||
|
||||
Bugfixes:
|
||||
* Fix segfault in Debian 11 and some old kernels. Regression introduced in 2.11.0 (#845, GPU, Linux)
|
||||
* Don't try detecting version of raw `sh` shell (#849, Shell, Linux)
|
||||
* Trim `\r` on Windows
|
||||
|
||||
Features:
|
||||
* Check xdg state home for nix user packages (#837, Packages, Linux)
|
||||
* Disable image logos in ssh and tmux sessions (#839)
|
||||
* Support MX Linux distro detection (#847, OS, Linux)
|
||||
|
||||
Logo:
|
||||
* Add KernelOS
|
||||
* Fix name of DraugerOS
|
||||
* Add missing `FF_LOGO_LINE_TYPE_SMALL_BIT` flags
|
||||
* Add MX2
|
||||
|
||||
# 2.11.1
|
||||
|
||||
Hotfix for Android
|
||||
|
||||
Bugfixes:
|
||||
* Fix uninitialized variables which can cause crashes (#760 #838, Battery, Android)
|
||||
* Don't detect hyfetch as shell when used as backend of [hyfetch](https://github.com/hykilpikonna/hyfetch)
|
||||
* Fix incorrect information in man page (#828)
|
||||
|
||||
Features:
|
||||
* Support sorcery package manager detection (Packages, Linux)
|
||||
* Make `--custom-format` optional (Custom)
|
||||
* Make `/` an alias of `C:\` for `--disk-folders` (Disk, Windows)
|
||||
* Build for Linux armv7
|
||||
|
||||
Logo:
|
||||
* Fix colors of Source Mage logo
|
||||
|
||||
# 2.11.0
|
||||
|
||||
Changes:
|
||||
* Default `hideCursor` to false. It doesn't make much difference but makes user's terminal unusable if fastfetch is not exited correctly.
|
||||
* Linux amd64 binaries are built with Ubuntu 20.04 again (#808)
|
||||
|
||||
Bugfixes:
|
||||
* Fix swap usage detection in x86-32 build (Windows, Swap)
|
||||
* Fix minimum cmake version support (#810)
|
||||
* Fix wifi detection on platforms that don't use NetworkManager (#811, Wifi, Linux)
|
||||
* Fix NixOS wrapped process name (#814, Terminal, Linux)
|
||||
* Fix GPU type detection for AMD cards (#816, GPU, Linux)
|
||||
* Silence system deprecation warnings (#822, Camera, macOS)
|
||||
|
||||
Features:
|
||||
* Add basic support DE detection support for UKUI (DE, Linux)
|
||||
* Support printing total number of nix / flatpak / brew packages (Packages)
|
||||
* See `fastfetch -h packages-format` for detail
|
||||
* Better max CPU frequency detection support with `CPUID / 16H` instruction (CPU, Windows)
|
||||
* This requires Intel Core I Gen 6 or newer, and with `Virtual Machine Platform` Windows feature disabled. X86 only.
|
||||
* Improve performance of nix packages detection (Packages, Linux)
|
||||
* Make config specified in JSONC overridable by command line flags
|
||||
* Note this change only make global config overridable; module configs are still not
|
||||
* Suggest increasing `--processing-timeout` when child process timeouts
|
||||
* Only detect folders that specified by `--disk-folders`
|
||||
* Previously `--disk-folders` only omits unmatched disks from output
|
||||
* This option can be used to improve detection performance by ignoring slow network drives
|
||||
|
||||
# 2.10.2
|
||||
|
||||
Bugfixes:
|
||||
* Fix a regression that detect x11 as wayland (#805, WM, Linux)
|
||||
|
||||
# 2.10.1
|
||||
|
||||
Bugfixes:
|
||||
* Fix build with `-DENABLE_DBUS=OFF` (Linux)
|
||||
|
||||
# 2.10.0
|
||||
|
||||
Changes:
|
||||
* We now always detect max frequency of GPUs for consistent, instead of current frequency
|
||||
|
||||
Features:
|
||||
* Improve display detection for wlroots based WMs. Fastfetch now correctly reports fractional scale factors in hyprland (Display, Linux)
|
||||
* Improve GPU detection on Linux (GPU, Linux)
|
||||
* Support GPU memory usage detection for AMD GPUs
|
||||
* Support GPU frequency detection for Intel GPUs
|
||||
* Improve performance of Gnome version detection (DE, Linux)
|
||||
* Improve performance of kitty version detection (Terminal, Linux)
|
||||
* Detect refresh rate when using `--ds-force-drm sysfs-only` (Display, Linux)
|
||||
* Add option `--ts-version` to disable terminal and shell version detection. Mainly for benchmarking purposes
|
||||
* Improve performance of detecting WSL version (Host, Linux)
|
||||
|
||||
Bugfixes:
|
||||
* Correctly detect `/bin/sh` as current shell if it's used as default shell (#798, Shell, Linux)
|
||||
* Work around an issue which CPU module reports incorrect CPU frequency that is too high (#800, CPU, Linux)
|
||||
* Don't print ANSI escape codes in `--pipe` mode
|
||||
|
||||
# 2.9.2
|
||||
|
||||
Changes:
|
||||
* To make use of the newly introduced `yyjson` flag `YYJSON_WRITE_NEWLINE_AT_END`, fastfetch now requires `yyjson` 0.9.0 or later
|
||||
|
||||
Features:
|
||||
* Always add a final new-line when generating JSON output
|
||||
* Detect partition create time, which can be used as OS installation time (Disk)
|
||||
* Print time string when generating JSON result instead of UNIX epoch time number, which is more human-readable
|
||||
|
||||
Bugfixes:
|
||||
* Fix a memory leak
|
||||
* Better portable mode detection of Windows Terminal (TerminalFont, Windows)
|
||||
* Fix parsing of option `--packages-disabled` (Packages)
|
||||
* Don't use command `time` as a shell (Shell)
|
||||
|
||||
Logos:
|
||||
* Add openSUSE MicroOS
|
||||
* Fix color of AOSC OS
|
||||
|
||||
# 2.9.1
|
||||
|
||||
Features:
|
||||
* Support weston-terminal (missed commit in v2.9.0) (TerminalFont, Linux)
|
||||
* Support hyprcursor detection (#776, Cursor, Linux)
|
||||
|
||||
Bugfixes:
|
||||
* Fix `fastfetch --gen-config` raises SIGSEGV when `~/.config/fastfetch` doesn't exist. Regression of `2.9.0` (#778)
|
||||
|
||||
# 2.9.0
|
||||
|
||||
Features:
|
||||
* Support Lxterminal version detection (Terminal, Linux)
|
||||
* Support weston-terminal version detection (Terminal, Linux)
|
||||
* Support `am` package manager detection (#771, Packages, Linux)
|
||||
* Support network prefix length detection for IPv6 (LocalIP)
|
||||
* Display all IPs when multiple IPs are assigned to the same interface (LocalIP)
|
||||
* Add option `--localip-show-prefix-len` to show network prefix length for both IPv4 and IPv6. Defaults to `true` (LocalIP)
|
||||
|
||||
Bugfixes:
|
||||
* Fix network prefix length detection when the value is greater than 24 (#773, LocalIP, Linux)
|
||||
* For xfce4-terminal, use system mono font if no config file is found (TerminalFont, Linux)
|
||||
|
||||
# 2.8.10
|
||||
|
||||
Bugfixes:
|
||||
* Don't display 0.00 GHz (CPU, FreeBSD)
|
||||
* Don't detect manufactor of Qualcomm as ARM (CPU, Android)
|
||||
* Ignore `chezmoi` (Terminal, Linux)
|
||||
* Trim trailing possible whitespaces (PublicIP)
|
||||
* Fix detection compatibility for KDE 6 (Font, Linux)
|
||||
* Always use Metal API to detect vmem size (GPU, macOS)
|
||||
|
||||
Features:
|
||||
* Improve stability; print more useful error message; avoid misuse (PublicIP / Weather)
|
||||
* Use MS-DOS device name as mountFrom result, instead of useless GUID volume name (Windows, Disk)
|
||||
* Some adjustments to Terminal detection (Terminal, Windows)
|
||||
* Don't pretty print CMD
|
||||
* Print conhost as Windows Console
|
||||
* Don't detect `wininit` as Terminal
|
||||
|
||||
Logo:
|
||||
* Fix color of Arco Linux
|
||||
|
||||
# 2.8.9
|
||||
|
||||
Bugfixes:
|
||||
* Don't detect `SessionLeader` as terminal, actually (Terminal, Linux)
|
||||
* Fix blurry chafa result when specifying both width and height (#757, Logo)
|
||||
|
||||
Features:
|
||||
* Support new MacBook Air (Host, macOS)
|
||||
* Distinguish min frequency and base frequency (CPU)
|
||||
|
||||
Logo:
|
||||
* Fix proxmox
|
||||
|
||||
# 2.8.8
|
||||
|
||||
Bugfixes:
|
||||
* Fix old fish version compatibility (#744)
|
||||
* Fix truncated texts in `--help format` (#745)
|
||||
* Fix old vulkan-header and libdrm library compatibility (#748, Linux)
|
||||
* Fix possible segfaults in `--help *-format` (#749)
|
||||
* Fix invalid resolution detection when using libdrm (Linux, Display)
|
||||
* Fix segfault when `/sys/devices/system/cpu/cpufreq/` doesn't exist (#750, CPU, Linux)
|
||||
* Don't detect `SessionLeader` as terminal (Terminal, Linux)
|
||||
* Fix detection of client IP (Users, Linux)
|
||||
|
||||
# 2.8.7
|
||||
|
||||
Bugfixes:
|
||||
|
||||
+109
-19
@@ -1,7 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url
|
||||
|
||||
project(fastfetch
|
||||
VERSION 2.8.7
|
||||
VERSION 2.14.0
|
||||
LANGUAGES C
|
||||
DESCRIPTION "Fast neofetch-like system information tool"
|
||||
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
|
||||
@@ -14,9 +14,9 @@ set(PROJECT_LICENSE "MIT license")
|
||||
###################
|
||||
if(ANDROID)
|
||||
set(LINUX FALSE)
|
||||
elseif("${CMAKE_SYSTEM_NAME}" MATCHES ".*[Ll]inux.*")
|
||||
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
|
||||
set(LINUX TRUE CACHE BOOL "..." FORCE) # LINUX means GNU/Linux, not just the kernel
|
||||
elseif("${CMAKE_SYSTEM_NAME}" MATCHES ".*[Bb][Ss][Dd].*")
|
||||
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
|
||||
set(BSD TRUE CACHE BOOL "..." FORCE)
|
||||
elseif(NOT APPLE AND NOT WIN32)
|
||||
message(FATAL_ERROR "Unsupported platform: ${CMAKE_SYSTEM_NAME}")
|
||||
@@ -75,9 +75,19 @@ 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
|
||||
option(IS_MUSL "Build with musl libc" OFF) # Used by Github Actions
|
||||
|
||||
set(BINARY_LINK_TYPE_OPTIONS dlopen dynamic static)
|
||||
set(BINARY_LINK_TYPE dlopen CACHE STRING "How to link fastfetch")
|
||||
set_property(CACHE BINARY_LINK_TYPE PROPERTY STRINGS ${BINARY_LINK_TYPE_OPTIONS})
|
||||
if(NOT BINARY_LINK_TYPE IN_LIST BINARY_LINK_TYPE_OPTIONS)
|
||||
message(FATAL_ERROR "BINARY_LINK_TYPE must be one of ${BINARY_LINK_TYPE_OPTIONS}")
|
||||
endif()
|
||||
|
||||
if (LINUX)
|
||||
set(CUSTOM_PCI_IDS_PATH "" CACHE STRING "Custom path to file pci.ids, defaults to `/usr/share/hwdata/pci.ids`")
|
||||
set(CUSTOM_AMDGPU_IDS_PATH "" CACHE STRING "Custom path to file amdgpu.ids, defaults to `/usr/share/libdrm/amdgpu.ids`")
|
||||
set(CUSTOM_OS_RELEASE_PATH "" CACHE STRING "Custom path to file os-release, defaults to `/etc/os-release`")
|
||||
endif()
|
||||
|
||||
####################
|
||||
@@ -112,7 +122,7 @@ 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")
|
||||
elseif(APPLE)
|
||||
elseif(APPLE AND CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fobjc-arc")
|
||||
endif()
|
||||
|
||||
@@ -254,7 +264,7 @@ file(GLOB LOGO_FILES "src/logo/ascii/*.txt")
|
||||
set(LOGO_BUILTIN_H "#pragma once\n#pragma GCC diagnostic ignored \"-Wtrigraphs\"\n\n")
|
||||
foreach(file ${LOGO_FILES})
|
||||
fastfetch_load_text("${file}" content)
|
||||
get_filename_component(file "${file}" NAME_WLE)
|
||||
get_filename_component(file "${file}" NAME_WE)
|
||||
string(TOUPPER "${file}" file)
|
||||
string(REGEX REPLACE "\\$\\{c([0-9]+)\\}" "$\\1" content "${content}")
|
||||
set(LOGO_BUILTIN_H "${LOGO_BUILTIN_H}#define FASTFETCH_DATATEXT_LOGO_${file} ${content}\n")
|
||||
@@ -281,12 +291,14 @@ set(LIBFASTFETCH_SRC
|
||||
src/common/properties.c
|
||||
src/common/settings.c
|
||||
src/common/temps.c
|
||||
src/detection/bootmgr/bootmgr.c
|
||||
src/detection/chassis/chassis.c
|
||||
src/detection/cpu/cpu.c
|
||||
src/detection/cpuusage/cpuusage.c
|
||||
src/detection/disk/disk.c
|
||||
src/detection/diskio/diskio.c
|
||||
src/detection/displayserver/displayserver.c
|
||||
src/detection/editor/editor.c
|
||||
src/detection/font/font.c
|
||||
src/detection/gpu/gpu.c
|
||||
src/detection/media/media.c
|
||||
@@ -294,6 +306,7 @@ set(LIBFASTFETCH_SRC
|
||||
src/detection/opencl/opencl.c
|
||||
src/detection/os/os.c
|
||||
src/detection/packages/packages.c
|
||||
src/detection/physicalmemory/physicalmemory.c
|
||||
src/detection/publicip/publicip.c
|
||||
src/detection/terminaltheme/terminaltheme.c
|
||||
src/detection/terminalfont/terminalfont.c
|
||||
@@ -310,6 +323,7 @@ set(LIBFASTFETCH_SRC
|
||||
src/modules/bios/bios.c
|
||||
src/modules/bluetooth/bluetooth.c
|
||||
src/modules/board/board.c
|
||||
src/modules/bootmgr/bootmgr.c
|
||||
src/modules/brightness/brightness.c
|
||||
src/modules/break/break.c
|
||||
src/modules/camera/camera.c
|
||||
@@ -324,13 +338,16 @@ set(LIBFASTFETCH_SRC
|
||||
src/modules/de/de.c
|
||||
src/modules/disk/disk.c
|
||||
src/modules/diskio/diskio.c
|
||||
src/modules/editor/editor.c
|
||||
src/modules/font/font.c
|
||||
src/modules/gpu/gpu.c
|
||||
src/modules/host/host.c
|
||||
src/modules/icons/icons.c
|
||||
src/modules/initsystem/initsystem.c
|
||||
src/modules/gamepad/gamepad.c
|
||||
src/modules/kernel/kernel.c
|
||||
src/modules/lm/lm.c
|
||||
src/modules/loadavg/loadavg.c
|
||||
src/modules/locale/locale.c
|
||||
src/modules/localip/localip.c
|
||||
src/modules/memory/memory.c
|
||||
@@ -341,6 +358,7 @@ set(LIBFASTFETCH_SRC
|
||||
src/modules/os/os.c
|
||||
src/modules/packages/packages.c
|
||||
src/modules/physicaldisk/physicaldisk.c
|
||||
src/modules/physicalmemory/physicalmemory.c
|
||||
src/modules/processes/processes.c
|
||||
src/modules/player/player.c
|
||||
src/modules/poweradapter/poweradapter.c
|
||||
@@ -388,6 +406,7 @@ if(LINUX)
|
||||
src/detection/battery/battery_linux.c
|
||||
src/detection/bios/bios_linux.c
|
||||
src/detection/board/board_linux.c
|
||||
src/detection/bootmgr/bootmgr_linux.c
|
||||
src/detection/brightness/brightness_linux.c
|
||||
src/detection/chassis/chassis_linux.c
|
||||
src/detection/cpu/cpu_linux.c
|
||||
@@ -396,10 +415,14 @@ if(LINUX)
|
||||
src/detection/bluetooth/bluetooth_linux.c
|
||||
src/detection/disk/disk_linux.c
|
||||
src/detection/physicaldisk/physicaldisk_linux.c
|
||||
src/detection/physicalmemory/physicalmemory_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/wayland/wayland.c
|
||||
src/detection/displayserver/linux/wayland/global-output.c
|
||||
src/detection/displayserver/linux/wayland/zwlr-output.c
|
||||
src/detection/displayserver/linux/wayland/wlr-output-management-unstable-v1-protocol.c
|
||||
src/detection/displayserver/linux/wmde.c
|
||||
src/detection/displayserver/linux/xcb.c
|
||||
src/detection/displayserver/linux/xlib.c
|
||||
@@ -409,8 +432,10 @@ if(LINUX)
|
||||
src/detection/gtk_qt/gtk.c
|
||||
src/detection/host/host_linux.c
|
||||
src/detection/icons/icons_linux.c
|
||||
src/detection/initsystem/initsystem_linux.c
|
||||
src/detection/libc/libc_linux.c
|
||||
src/detection/lm/lm_linux.c
|
||||
src/detection/loadavg/loadavg_linux.c
|
||||
src/detection/locale/locale_linux.c
|
||||
src/detection/localip/localip_linux.c
|
||||
src/detection/gamepad/gamepad_linux.c
|
||||
@@ -451,6 +476,7 @@ elseif(ANDROID)
|
||||
src/detection/bios/bios_android.c
|
||||
src/detection/bluetooth/bluetooth_nosupport.c
|
||||
src/detection/board/board_android.c
|
||||
src/detection/bootmgr/bootmgr_nosupport.c
|
||||
src/detection/brightness/brightness_nosupport.c
|
||||
src/detection/chassis/chassis_nosupport.c
|
||||
src/detection/cpu/cpu_linux.c
|
||||
@@ -458,14 +484,17 @@ elseif(ANDROID)
|
||||
src/detection/cpuusage/cpuusage_linux.c
|
||||
src/detection/disk/disk_linux.c
|
||||
src/detection/physicaldisk/physicaldisk_linux.c
|
||||
src/detection/physicalmemory/physicalmemory_nosupport.c
|
||||
src/detection/diskio/diskio_linux.c
|
||||
src/detection/displayserver/displayserver_android.c
|
||||
src/detection/font/font_nosupport.c
|
||||
src/detection/gpu/gpu_nosupport.c
|
||||
src/detection/host/host_android.c
|
||||
src/detection/icons/icons_nosupport.c
|
||||
src/detection/initsystem/initsystem_linux.c
|
||||
src/detection/libc/libc_android.c
|
||||
src/detection/lm/lm_nosupport.c
|
||||
src/detection/loadavg/loadavg_linux.c
|
||||
src/detection/locale/locale_linux.c
|
||||
src/detection/localip/localip_linux.c
|
||||
src/detection/gamepad/gamepad_nosupport.c
|
||||
@@ -507,6 +536,7 @@ elseif(BSD)
|
||||
src/detection/bios/bios_bsd.c
|
||||
src/detection/bluetooth/bluetooth_linux.c
|
||||
src/detection/board/board_bsd.c
|
||||
src/detection/bootmgr/bootmgr_bsd.c
|
||||
src/detection/brightness/brightness_bsd.c
|
||||
src/detection/chassis/chassis_bsd.c
|
||||
src/detection/cpu/cpu_bsd.c
|
||||
@@ -514,10 +544,14 @@ elseif(BSD)
|
||||
src/detection/cursor/cursor_linux.c
|
||||
src/detection/disk/disk_bsd.c
|
||||
src/detection/physicaldisk/physicaldisk_bsd.c
|
||||
src/detection/physicalmemory/physicalmemory_linux.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/wayland/wayland.c
|
||||
src/detection/displayserver/linux/wayland/global-output.c
|
||||
src/detection/displayserver/linux/wayland/zwlr-output.c
|
||||
src/detection/displayserver/linux/wayland/wlr-output-management-unstable-v1-protocol.c
|
||||
src/detection/displayserver/linux/wmde.c
|
||||
src/detection/displayserver/linux/xcb.c
|
||||
src/detection/displayserver/linux/xlib.c
|
||||
@@ -528,7 +562,9 @@ elseif(BSD)
|
||||
src/detection/host/host_bsd.c
|
||||
src/detection/lm/lm_linux.c
|
||||
src/detection/icons/icons_linux.c
|
||||
src/detection/initsystem/initsystem_linux.c
|
||||
src/detection/libc/libc_bsd.c
|
||||
src/detection/loadavg/loadavg_bsd.c
|
||||
src/detection/locale/locale_linux.c
|
||||
src/detection/localip/localip_linux.c
|
||||
src/detection/gamepad/gamepad_bsd.c
|
||||
@@ -570,6 +606,7 @@ elseif(APPLE)
|
||||
src/detection/bios/bios_apple.c
|
||||
src/detection/bluetooth/bluetooth_apple.m
|
||||
src/detection/board/board_apple.c
|
||||
src/detection/bootmgr/bootmgr_apple.c
|
||||
src/detection/brightness/brightness_apple.c
|
||||
src/detection/chassis/chassis_nosupport.c
|
||||
src/detection/cpu/cpu_apple.c
|
||||
@@ -577,14 +614,17 @@ elseif(APPLE)
|
||||
src/detection/cursor/cursor_apple.m
|
||||
src/detection/disk/disk_bsd.c
|
||||
src/detection/physicaldisk/physicaldisk_apple.c
|
||||
src/detection/physicalmemory/physicalmemory_apple.m
|
||||
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/initsystem/initsystem_linux.c
|
||||
src/detection/lm/lm_nosupport.c
|
||||
src/detection/loadavg/loadavg_bsd.c
|
||||
src/detection/libc/libc_apple.c
|
||||
src/detection/locale/locale_linux.c
|
||||
src/detection/localip/localip_linux.c
|
||||
@@ -627,6 +667,7 @@ elseif(WIN32)
|
||||
src/detection/bios/bios_windows.c
|
||||
src/detection/bluetooth/bluetooth_windows.c
|
||||
src/detection/board/board_windows.c
|
||||
src/detection/bootmgr/bootmgr_windows.c
|
||||
src/detection/brightness/brightness_windows.cpp
|
||||
src/detection/chassis/chassis_windows.c
|
||||
src/detection/cpu/cpu_windows.c
|
||||
@@ -640,13 +681,16 @@ elseif(WIN32)
|
||||
src/detection/gpu/gpu_windows.c
|
||||
src/detection/host/host_windows.c
|
||||
src/detection/icons/icons_windows.c
|
||||
src/detection/initsystem/initsystem_nosupport.c
|
||||
src/detection/libc/libc_windows.cpp
|
||||
src/detection/lm/lm_nosupport.c
|
||||
src/detection/loadavg/loadavg_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
|
||||
src/detection/memory/memory_windows.c
|
||||
src/detection/physicalmemory/physicalmemory_linux.c
|
||||
src/detection/monitor/monitor_windows.c
|
||||
src/detection/netio/netio_windows.c
|
||||
src/detection/opengl/opengl_windows.c
|
||||
@@ -699,6 +743,9 @@ check_function_exists(wcwidth HAVE_WCWIDTH)
|
||||
if(NOT HAVE_WCWIDTH)
|
||||
list(APPEND LIBFASTFETCH_SRC src/3rdparty/mk_wcwidch/wcwidth.c)
|
||||
endif()
|
||||
if(LINUX)
|
||||
check_function_exists(statx HAVE_STATX)
|
||||
endif()
|
||||
|
||||
if(ENABLE_SYSTEM_YYJSON)
|
||||
find_package(yyjson)
|
||||
@@ -755,13 +802,17 @@ if(BSD AND EXISTS "/usr/local/bin/objdump")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_compile_definitions(libfastfetch PUBLIC _GNU_SOURCE _XOPEN_SOURCE __STDC_WANT_LIB_EXT1__=1)
|
||||
target_compile_definitions(libfastfetch PUBLIC _GNU_SOURCE _XOPEN_SOURCE __STDC_WANT_LIB_EXT1__=1 _FILE_OFFSET_BITS=64)
|
||||
if(WIN32)
|
||||
target_compile_definitions(libfastfetch PUBLIC WIN32_LEAN_AND_MEAN=1)
|
||||
elseif(APPLE)
|
||||
target_compile_definitions(libfastfetch PUBLIC _DARWIN_C_SOURCE)
|
||||
endif()
|
||||
|
||||
if(HAVE_STATX)
|
||||
target_compile_definitions(libfastfetch PRIVATE FF_HAVE_STATX)
|
||||
endif()
|
||||
|
||||
if(HAVE_WCWIDTH)
|
||||
target_compile_definitions(libfastfetch PRIVATE FF_HAVE_WCWIDTH)
|
||||
endif()
|
||||
@@ -770,6 +821,19 @@ if(NOT "${CUSTOM_PCI_IDS_PATH}" STREQUAL "")
|
||||
message(STATUS "Custom file path of pci.ids: ${CUSTOM_PCI_IDS_PATH}")
|
||||
target_compile_definitions(libfastfetch PRIVATE FF_CUSTOM_PCI_IDS_PATH=${CUSTOM_PCI_IDS_PATH})
|
||||
endif()
|
||||
if(NOT "${CUSTOM_AMDGPU_IDS_PATH}" STREQUAL "")
|
||||
message(STATUS "Custom file path of amdgpu.ids: ${CUSTOM_AMDGPU_IDS_PATH}")
|
||||
target_compile_definitions(libfastfetch PRIVATE FF_CUSTOM_AMDGPU_IDS_PATH=${CUSTOM_AMDGPU_IDS_PATH})
|
||||
endif()
|
||||
if(NOT "${CUSTOM_OS_RELEASE_PATH}" STREQUAL "")
|
||||
message(STATUS "Custom file path of os_release: ${CUSTOM_OS_RELEASE_PATH}")
|
||||
target_compile_definitions(libfastfetch PRIVATE FF_CUSTOM_OS_RELEASE_PATH=${CUSTOM_OS_RELEASE_PATH})
|
||||
endif()
|
||||
|
||||
if(NOT BINARY_LINK_TYPE STREQUAL "dlopen")
|
||||
message(STATUS "Enabling custom link type: ${BINARY_LINK_TYPE}")
|
||||
target_compile_definitions(libfastfetch PRIVATE FF_DISABLE_DLOPEN=1)
|
||||
endif()
|
||||
|
||||
function(ff_lib_enable VARNAME PKGCONFIG_NAMES CMAKE_NAME)
|
||||
if(NOT ENABLE_${VARNAME})
|
||||
@@ -799,6 +863,11 @@ function(ff_lib_enable VARNAME PKGCONFIG_NAMES CMAKE_NAME)
|
||||
target_compile_definitions(libfastfetch PRIVATE FF_HAVE_${VARNAME}=1)
|
||||
target_include_directories(libfastfetch PRIVATE ${${VARNAME}_INCLUDE_DIRS})
|
||||
|
||||
if(NOT BINARY_LINK_TYPE STREQUAL "dlopen")
|
||||
target_link_directories(libfastfetch PUBLIC ${${VARNAME}_LIBRARY_DIRS})
|
||||
target_link_libraries(libfastfetch PRIVATE ${${VARNAME}_LIBRARIES})
|
||||
endif()
|
||||
|
||||
foreach(FLAG ${${VARNAME}_CFLAGS_OTHER})
|
||||
if(FLAG MATCHES "-D.*")
|
||||
string(SUBSTRING ${FLAG} 2 -1 FLAG)
|
||||
@@ -919,10 +988,6 @@ if(ENABLE_THREADS)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ENABLE_PCI_MEMORY)
|
||||
target_compile_definitions(libfastfetch PRIVATE FF_USE_PCI_MEMORY)
|
||||
endif()
|
||||
|
||||
if(LINUX)
|
||||
target_link_libraries(libfastfetch
|
||||
PRIVATE "m"
|
||||
@@ -1051,6 +1116,11 @@ elseif(APPLE)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(BINARY_LINK_TYPE STREQUAL "static")
|
||||
target_link_options(fastfetch PRIVATE "-static")
|
||||
target_link_options(flashfetch PRIVATE "-static")
|
||||
endif()
|
||||
|
||||
###################
|
||||
# Testing targets #
|
||||
###################
|
||||
@@ -1124,17 +1194,37 @@ 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)
|
||||
if(IS_MUSL)
|
||||
string(TOLOWER "${CMAKE_PROJECT_NAME}-musl-${CMAKE_SYSTEM_PROCESSOR}" CPACK_PACKAGE_FILE_NAME)
|
||||
else()
|
||||
string(TOLOWER "${CMAKE_PROJECT_NAME}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}" CPACK_PACKAGE_FILE_NAME)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LINUX)
|
||||
set(CPACK_GENERATOR "${CPACK_GENERATOR};DEB;RPM")
|
||||
find_program(HAVE_DPKG "dpkg")
|
||||
if(HAVE_DPKG)
|
||||
set(CPACK_GENERATOR "${CPACK_GENERATOR};DEB")
|
||||
|
||||
set(CPACK_DEBIAN_PACKAGE_SECTION, "utils")
|
||||
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6")
|
||||
set(CPACK_DEBIAN_PACKAGE_SECTION, "utils")
|
||||
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
|
||||
|
||||
set(CPACK_RPM_PACKAGE_LICENSE "MIT")
|
||||
if(NOT IS_MUSL)
|
||||
EXECUTE_PROCESS (
|
||||
COMMAND getconf GNU_LIBC_VERSION
|
||||
OUTPUT_VARIABLE GLIBC_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
STRING (REPLACE "glibc " "" GLIBC_VERSION ${GLIBC_VERSION})
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= ${GLIBC_VERSION})")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_program(HAVE_RPMBUILD "rpmbuild")
|
||||
if(HAVE_RPMBUILD)
|
||||
set(CPACK_GENERATOR "${CPACK_GENERATOR};RPM")
|
||||
|
||||
set(CPACK_RPM_PACKAGE_LICENSE "MIT")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CPACK_SET_DESTDIR ON)
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, caste, color, religion, or sexual
|
||||
identity and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our
|
||||
community include:
|
||||
|
||||
* Demonstrating empathy and kindness toward other people
|
||||
* Being respectful of differing opinions, viewpoints, and experiences
|
||||
* Giving and gracefully accepting constructive feedback
|
||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
* Focusing on what is best not just for us as individuals, but for the overall
|
||||
community
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
* The use of sexualized language or imagery, and sexual attention or advances of
|
||||
any kind
|
||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or email address,
|
||||
without their explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of
|
||||
acceptable behavior and will take appropriate and fair corrective action in
|
||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||
or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject
|
||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||
decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when
|
||||
an individual is officially representing the community in public spaces.
|
||||
Examples of representing our community include using an official email address,
|
||||
posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders responsible for enforcement at
|
||||
[INSERT CONTACT METHOD].
|
||||
All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
reporter of any incident.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining
|
||||
the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||
unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A private, written warning from community leaders, providing
|
||||
clarity around the nature of the violation and an explanation of why the
|
||||
behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
### 2. Warning
|
||||
|
||||
**Community Impact**: A violation through a single incident or series of
|
||||
actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No
|
||||
interaction with the people involved, including unsolicited interaction with
|
||||
those enforcing the Code of Conduct, for a specified period of time. This
|
||||
includes avoiding interactions in community spaces as well as external channels
|
||||
like social media. Violating these terms may lead to a temporary or permanent
|
||||
ban.
|
||||
|
||||
### 3. Temporary Ban
|
||||
|
||||
**Community Impact**: A serious violation of community standards, including
|
||||
sustained inappropriate behavior.
|
||||
|
||||
**Consequence**: A temporary ban from any sort of interaction or public
|
||||
communication with the community for a specified period of time. No public or
|
||||
private interaction with the people involved, including unsolicited interaction
|
||||
with those enforcing the Code of Conduct, is allowed during this period.
|
||||
Violating these terms may lead to a permanent ban.
|
||||
|
||||
### 4. Permanent Ban
|
||||
|
||||
**Community Impact**: Demonstrating a pattern of violation of community
|
||||
standards, including sustained inappropriate behavior, harassment of an
|
||||
individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within the
|
||||
community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 2.1, available at
|
||||
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
||||
|
||||
Community Impact Guidelines were inspired by
|
||||
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
||||
[https://www.contributor-covenant.org/translations][translations].
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
||||
[Mozilla CoC]: https://github.com/mozilla/diversity
|
||||
[FAQ]: https://www.contributor-covenant.org/faq
|
||||
[translations]: https://www.contributor-covenant.org/translations
|
||||
@@ -1,34 +0,0 @@
|
||||
# Development help
|
||||
|
||||
This file is not an official documentation!
|
||||
Here i just add things that are easy to forget.
|
||||
|
||||
## Features i am planning to implement
|
||||
|
||||
### Specific
|
||||
|
||||
- [ ] Split the project in different libs / executables, all linking static by default:
|
||||
- `libffdetect`: contains all the detection stuff. To be used by anything that needs system information
|
||||
- `libffprint`: contains the printing functions, logos, format etc
|
||||
- `fastfetch` and `flashfetch`: Executables, that initialize the config of libffprint. Fist one at runtime, second one at compile time
|
||||
- [ ] Make LocalIP module more configurable
|
||||
- [ ] Automatic migrate old config files to newer versions
|
||||
- [ ] ZSH completions
|
||||
- [ ] Fish completions
|
||||
- [ ] Make CPU usage detection much faster and more accurate
|
||||
- [ ] 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
|
||||
- More presets
|
||||
- More logos
|
||||
- More package managers
|
||||
- More DE detections
|
||||
- More WM theme detections
|
||||
- More terminal font detections
|
||||
- Performance optimizations
|
||||
- More module specific options
|
||||
- Better error handling, especially the messages shown when using --show-errors
|
||||
- Using package managers libraries for package count detection instead own. E.g. using libalpm instead of counting files in /var/lib/pacman/local
|
||||
- Better documentation (especially default config file and the various --help options. Colored output?)
|
||||
- General feature parity with neofetch, to demonstrate supremity of c
|
||||
@@ -27,9 +27,11 @@ There are [screenshots on different platforms](https://github.com/fastfetch-cli/
|
||||
|
||||
### Linux
|
||||
|
||||
* 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).
|
||||
Some distros packaged an outdated fastfetch version. Older version is not supported, please always ensure that the latest version is used.
|
||||
|
||||
* Ubuntu: [`ppa:zhangsongcui3371/fastfetch`](https://launchpad.net/~zhangsongcui3371/+archive/ubuntu/fastfetch) (for Ubuntu 22.04 or newer)
|
||||
* Debian / Ubuntu: Download `fastfetch-linux-<proper architecture>.deb` from [Github release page](https://github.com/fastfetch-cli/fastfetch/releases/latest) and double-click it (for Ubuntu 20.04 or newer and Debian 11 or newer).
|
||||
* Arch Linux: `sudo pacman -S fastfetch`
|
||||
* Fedora: `sudo dnf install fastfetch`
|
||||
* Gentoo: `sudo emerge --ask app-misc/fastfetch`
|
||||
* Alpine: `apk add --upgrade fastfetch`
|
||||
@@ -39,31 +41,30 @@ There are [screenshots on different platforms](https://github.com/fastfetch-cli/
|
||||
|
||||
Replace sudo with doas depending on what you use.
|
||||
|
||||
[See also if fastfetch has been packaged for your favorite Linux distro](#Packaging)
|
||||
[See also if fastfetch has been packaged for your favorite Linux distro](#Packaging).
|
||||
|
||||
If fastfetch is not packaged for your distro or an outdated version is packaged, [linuxbrew](https://brew.sh/) is a good alternative: `brew install fastfetch`
|
||||
|
||||
### macOS
|
||||
|
||||
...via [HomeBrew](https://brew.sh):
|
||||
|
||||
`brew install fastfetch`
|
||||
|
||||
...via [MacPorts](https://www.macports.org):
|
||||
|
||||
`sudo port install fastfetch`
|
||||
* [HomeBrew](https://formulae.brew.sh/formula/fastfetch#default): `brew install fastfetch`
|
||||
* [MacPorts](https://ports.macports.org/port/fastfetch/): `sudo port install fastfetch`
|
||||
|
||||
### Windows
|
||||
|
||||
`scoop install fastfetch`
|
||||
* [scoop](https://scoop.sh/#/apps?q=fastfetch): `scoop install fastfetch`
|
||||
* [winget](https://github.com/microsoft/winget-pkgs/tree/master/manifests/f/Fastfetch-cli/Fastfetch): `winget install fastfetch`
|
||||
* [MSYS2 MinGW](https://github.com/msys2/MINGW-packages/tree/master/mingw-w64-fastfetch): `pacman -S mingw-w64-<subsystem>-<arch>-fastfetch`
|
||||
|
||||
You may also download it directly from [GitHub releases page](https://github.com/fastfetch-cli/fastfetch/releases/latest) and extract the archive.
|
||||
|
||||
### FreeBSD
|
||||
|
||||
`pkg install fastfetch`
|
||||
* `pkg install fastfetch`
|
||||
|
||||
### Android (Termux)
|
||||
|
||||
`pkg install fastfetch`
|
||||
* `pkg install fastfetch`
|
||||
|
||||
## Build from source
|
||||
|
||||
@@ -97,11 +98,99 @@ 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 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: Neofetch is good enough. Why do I need fastfetch?
|
||||
|
||||
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
|
||||
1. Fastfetch is actively maintained.
|
||||
2. Fastfetch is faster. As the name suggests.
|
||||
3. Fastfetch is more feature-rich. By default fastfetch only has a few modules enabled. Use `fastfetch -c all` to find what you want.
|
||||
4. Fastfetch is more configurable. You can find more information in the Wiki: <https://github.com/fastfetch-cli/fastfetch/wiki/Configuration>
|
||||
5. Fastfetch is more polished. For example, neofetch prints `555MiB` in `Memory` module and `23G` in `Disk` module (notibily the difference of `MiB` and `G`), while fastfetch prints `555.00 MiB` and `22.97 GiB` respectively.
|
||||
6. Fastfetch is more accurate. For example, [neofetch never actually supports Wayland protocol](https://github.com/dylanaraps/neofetch/pull/2395).
|
||||
|
||||
### Q: Fastfetch shows my local IP address. It leaks my privacy!
|
||||
|
||||
A local IP (10.x.x.x, 172.x.x.x, 192.168.x.x) has nothing to do with privacy. It only makes sense if you are on the same network, for example, if you connect to the same Wi-Fi network.
|
||||
|
||||
Actually the `Local IP` module is the most useful module for me personally. I (@CarterLi) have several VMs installed to test fastfetch and often need to SSH into them. I have fastfetch running on shell startup and I never need to type `ip addr` manually.
|
||||
|
||||
If you really don't like it, you can disable the `Local IP` module in `config.jsonc`.
|
||||
|
||||
### Q: Where is the config file? I can't find it.
|
||||
|
||||
`Fastfetch` don't generate config file automatically. You can use `fastfetch --gen-config` to generate one. The config file will be saved in `~/.config/fastfetch/config.jsonc` by default. See [Wiki for detail](https://github.com/fastfetch-cli/fastfetch/wiki/Configuration).
|
||||
|
||||
### Q: The configuration is so complex. Where is the documentation?
|
||||
|
||||
Fastfetch uses JSON (with comments) for configuration. I suggest you use an IDE with JSON schema support (like VSCode) to edit it.
|
||||
|
||||
Alternatively, you can refer to the presets in [`presets` directory](https://github.com/fastfetch-cli/fastfetch/tree/dev/presets).
|
||||
|
||||
### Q: I WANT THE DOCUMENTATION!
|
||||
|
||||
[Here is the documentation](https://github.com/fastfetch-cli/fastfetch/wiki/Json-Schema). It is generated from [JSON schema](https://github.com/fastfetch-cli/fastfetch/blob/dev/doc/json_schema.json) but you won't like it.
|
||||
|
||||
### Q: How can I customize the module output?
|
||||
|
||||
Fastfetch uses `format` to generate output. For example to make `GPU` module show GPU name only and ignore other information, you can use
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"modules": [
|
||||
{
|
||||
"type": "gpu",
|
||||
"format": "{2}" // See `fastfetch -h gpu-format` for detail
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
which is equivalent to `fastfetch -s gpu --gpu-format '{2}'`
|
||||
|
||||
See `fastfetch -h format` for basic usage. For module specific formattion, see `fastfetch -h <module>-format`
|
||||
|
||||
### Q: I have my own ascii-art / image file. How can I show it with fastfetch?
|
||||
|
||||
Try `fastfetch -l /path/to/logo`. See [logo documentation](https://github.com/fastfetch-cli/fastfetch/wiki/Logo-options) for detail.
|
||||
|
||||
If you just want to display distro name in [FIGlet text](https://github.com/pwaller/pyfiglet)
|
||||
|
||||
```bash
|
||||
# install pyfiglet and jq first
|
||||
pyfiglet -s -f small_slant $(fastfetch -s os --format json | jq -r '.[0].result.name') && fastfetch -l none
|
||||
```
|
||||
|
||||

|
||||
|
||||
### Q: Fastfetch runs in white and black on shell startup. Why?
|
||||
|
||||
This issue usually happens when using fastfetch with `p10k`. There are known incompatibility between fastfetch and p10k instant prompt.
|
||||
The p10k doc clearly states that you should NOT print anything to stdout after `p10k-instant-prompt` is initialized. You should either put `fastfetch` before initialization of `p10k-instant-prompt` (recommended)
|
||||
|
||||
You can always use `fastfetch --pipe false` to force fastfetch running in colorful mode.
|
||||
|
||||
### Q: I want feature A / B / C. Will fastfetch support it?
|
||||
|
||||
Fastfetch is a system information tool. We only accept hardware or system level software feature requests. For most personal uses, I recommend using `Command` module to detect it yourself, which can be used to grab output from a custom shell script:
|
||||
|
||||
```jsonc
|
||||
// This module shows the default editor
|
||||
{
|
||||
"modules": [
|
||||
{
|
||||
"type": "command",
|
||||
"text": "$EDITOR --version | head -1",
|
||||
"key": "Editor"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Otherwise, open a feature request in [GitHub Issues](https://github.com/fastfetch-cli/fastfetch/issues).
|
||||
|
||||
### Q: I have questions. Where can I get help?
|
||||
|
||||
* For usage questions, please start a discussion in [GitHub Discussions](https://github.com/fastfetch-cli/fastfetch/discussions).
|
||||
* For possible bugs, please open an issue in [GitHub Issues](https://github.com/fastfetch-cli/fastfetch/issues). Be sure to fill the bug-report template carefully for developers to investigate.
|
||||
|
||||
## Star History
|
||||
|
||||
|
||||
+1
-5
@@ -191,14 +191,13 @@ __fastfetch_completion()
|
||||
"--escape-bedrock"
|
||||
"--pipe"
|
||||
"--title-fqdn"
|
||||
"--escape-bedrock"
|
||||
"--disk-folders"
|
||||
"--disk-show-external"
|
||||
"--disk-show-hidden"
|
||||
"--disk-show-subvolumes"
|
||||
"--gpu-hide-integrated"
|
||||
"--gpu-hide-discrete"
|
||||
"--gpu-force-vulkan"
|
||||
"--gpu-force-method"
|
||||
"--disk-show-unknown"
|
||||
"--bluetooth-show-disconnected"
|
||||
)
|
||||
@@ -227,8 +226,6 @@ __fastfetch_completion()
|
||||
"--separator"
|
||||
"-s"
|
||||
"--structure"
|
||||
"--set"
|
||||
"--set-keyless"
|
||||
"--player-name"
|
||||
"--percent-type"
|
||||
"--publicip-url"
|
||||
@@ -360,7 +357,6 @@ __fastfetch_completion()
|
||||
local FF_OPTIONS_PATH=(
|
||||
"-c"
|
||||
"--config"
|
||||
"--os-file"
|
||||
"--lib-pci"
|
||||
"--lib-vulkan"
|
||||
"--lib-wayland"
|
||||
|
||||
+1
-1
@@ -85,7 +85,7 @@ string match -r -a -g "^###> ?(.*)" < (status -f) | string collect | python3 | s
|
||||
###> 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()))
|
||||
###> temp: str = ' '.join(flag["arg"]["enum"])
|
||||
###> print(f'{command_prefix} -x -a "{temp}"')
|
||||
###> elif type == 'logo':
|
||||
###> print(f'{command_prefix} -x -a "(__fastfetch_complete_logo)"')
|
||||
|
||||
Vendored
+72
@@ -1,3 +1,75 @@
|
||||
fastfetch (2.13.2) jammy; urgency=medium
|
||||
|
||||
* Update to 2.13.2
|
||||
|
||||
-- Carter Li <zhangsongcui@live.cn> Fri, 24 May 2024 13:48:59 +0800
|
||||
|
||||
fastfetch (2.13.1) jammy; urgency=medium
|
||||
|
||||
* Update to 2.13.1
|
||||
|
||||
-- Carter Li <zhangsongcui@live.cn> Tue, 21 May 2024 15:10:37 +0800
|
||||
|
||||
fastfetch (2.12.0) jammy; urgency=medium
|
||||
|
||||
* Update to 2.12.0
|
||||
|
||||
-- Carter Li <zhangsongcui@live.cn> Tue, 14 May 2024 16:33:33 +0800
|
||||
|
||||
fastfetch (2.11.5) jammy; urgency=medium
|
||||
|
||||
* Update to 2.11.5
|
||||
|
||||
-- Carter Li <zhangsongcui@live.cn> Tue, 07 May 2024 09:30:05 +0800
|
||||
|
||||
fastfetch (2.11.3) jammy; urgency=medium
|
||||
|
||||
* Update to 2.11.3
|
||||
|
||||
-- Carter Li <zhangsongcui@live.cn> Mon, 06 May 2024 08:46:45 +0800
|
||||
|
||||
fastfetch (2.10.2) jammy; urgency=medium
|
||||
|
||||
* Update to 2.10.2
|
||||
|
||||
-- Carter Li <zhangsongcui@live.cn> Tue, 23 Apr 2024 15:18:23 +0800
|
||||
|
||||
fastfetch (2.10.1) jammy; urgency=medium
|
||||
|
||||
* Update to 2.10.1
|
||||
|
||||
-- Carter Li <zhangsongcui@live.cn> Tue, 23 Apr 2024 09:55:02 +0800
|
||||
|
||||
fastfetch (2.9.2) jammy; urgency=medium
|
||||
|
||||
* Update to 2.9.2
|
||||
|
||||
-- Carter Li <zhangsongcui@live.cn> Tue, 16 Apr 2024 16:32:40 +0800
|
||||
|
||||
fastfetch (2.9.1) jammy; urgency=medium
|
||||
|
||||
* Update to 2.9.1
|
||||
|
||||
-- Carter Li <zhangsongcui@live.cn> Mon, 08 Apr 2024 09:34:30 +0800
|
||||
|
||||
fastfetch (2.8.10) jammy; urgency=medium
|
||||
|
||||
* Update to 2.8.10
|
||||
|
||||
-- Carter Li <zhangsongcui@live.cn> Mon, 25 Mar 2024 15:01:53 +0800
|
||||
|
||||
fastfetch (2.8.9) jammy; urgency=medium
|
||||
|
||||
* Update to 2.8.9
|
||||
|
||||
-- Carter Li <zhangsongcui@live.cn> Fri, 15 Mar 2024 10:49:42 +0800
|
||||
|
||||
fastfetch (2.8.8) jammy; urgency=medium
|
||||
|
||||
* Update to 2.8.8
|
||||
|
||||
-- Carter Li <zhangsongcui@live.cn> Fri, 08 Mar 2024 09:59:41 +0800
|
||||
|
||||
fastfetch (2.8.6) jammy; urgency=medium
|
||||
|
||||
* Update to 2.8.6
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
fastfetch_2.8.6_source.buildinfo universe/utils optional
|
||||
fastfetch_2.13.2_source.buildinfo universe/utils optional
|
||||
|
||||
+5
-8
@@ -107,12 +107,12 @@ 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.
|
||||
Fastfetch uses JSONC based format for configuration. Fastfetch doesn't generate
|
||||
config file automatically; it should be generated manually by \fB \-\-gen\-config\fR.
|
||||
The config file will be saved in \fB~/.config/fastfetch/config.jsonc\fR by default.
|
||||
|
||||
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.
|
||||
files must have the extension '.jsonc'.
|
||||
|
||||
The specified configuration/preset files are searched in the following order:
|
||||
|
||||
@@ -122,10 +122,7 @@ The specified configuration/preset files are searched in the following order:
|
||||
|
||||
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.
|
||||
Fastfetch provides some default presets. List them with \fB\-\-list\-presets\fR.
|
||||
|
||||
.SH "SEE ALSO"
|
||||
.BR neofetch (1)
|
||||
|
||||
+234
-24
@@ -4,9 +4,8 @@
|
||||
"colors": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"reset_", "bright_", "dim_",
|
||||
"black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "default",
|
||||
"bright_black", "bright_red", "bright_green", "bright_yellow", "bright_blue", "bright_magenta", "bright_cyan", "bright_white"
|
||||
"reset_", "bright_", "dim_", "italic_", "underline_", "blink_", "inverse_", "hidden_", "strike_", "light_",
|
||||
"black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "default"
|
||||
]
|
||||
},
|
||||
"key": {
|
||||
@@ -24,9 +23,13 @@
|
||||
"default": 0
|
||||
},
|
||||
"format": {
|
||||
"description": "Output format of the module",
|
||||
"description": "Output format of the module. See `-h <module>-format` for detail",
|
||||
"type": "string"
|
||||
},
|
||||
"outputColor": {
|
||||
"description": "Output color of the module. Left empty to use `display.color.output`",
|
||||
"$ref": "#/$defs/colors"
|
||||
},
|
||||
"percent": {
|
||||
"description": "Threshold of percentage colors",
|
||||
"type": "object",
|
||||
@@ -294,10 +297,6 @@
|
||||
"type": "string",
|
||||
"description": "The name of the player to use for module Media and Player. Linux only"
|
||||
},
|
||||
"osFile": {
|
||||
"type": "string",
|
||||
"description": "Set the path to the file containing OS information. Linux only"
|
||||
},
|
||||
"dsForceDrm": {
|
||||
"description": "Force display detection to use DRM. Linux only",
|
||||
"oneOf": [
|
||||
@@ -384,6 +383,14 @@
|
||||
"title": {
|
||||
"description": "Set the color of the title",
|
||||
"$ref": "#/$defs/colors"
|
||||
},
|
||||
"output": {
|
||||
"description": "Set the color of the module output",
|
||||
"$ref": "#/$defs/colors"
|
||||
},
|
||||
"separator": {
|
||||
"description": "Set the color of the key-value separator",
|
||||
"$ref": "#/$defs/colors"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -512,7 +519,7 @@
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "number",
|
||||
"description": "Set the percentage output type. 1 for percentage number, 2 for bar, 3 for both, 6 for bar only, 9 for colored number",
|
||||
"description": "Set the percentage output type. 1 for percentage number, 2 for multi-color bar, 3 for both, 6 for bar only, 9 for colored number, 10 for monochrome bar",
|
||||
"minimum": 0,
|
||||
"maximum": 255,
|
||||
"default": 9
|
||||
@@ -549,6 +556,11 @@
|
||||
"type": "boolean",
|
||||
"description": "Whether to disable the stdout application buffer",
|
||||
"default": false
|
||||
},
|
||||
"tsVersion": {
|
||||
"type": "boolean",
|
||||
"description": "Whether to detect and display the version of terminal and shell. Mainly for benchmarking",
|
||||
"default": true
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -672,8 +684,10 @@
|
||||
"bios",
|
||||
"bluetooth",
|
||||
"board",
|
||||
"bootmgr",
|
||||
"break",
|
||||
"brightness",
|
||||
"camera",
|
||||
"chassis",
|
||||
"cpu",
|
||||
"cpuusage",
|
||||
@@ -685,6 +699,7 @@
|
||||
"disk",
|
||||
"diskio",
|
||||
"de",
|
||||
"editor",
|
||||
"font",
|
||||
"gamepad",
|
||||
"gpu",
|
||||
@@ -692,6 +707,7 @@
|
||||
"icons",
|
||||
"kernel",
|
||||
"lm",
|
||||
"loadavg",
|
||||
"locale",
|
||||
"localip",
|
||||
"media",
|
||||
@@ -703,6 +719,7 @@
|
||||
"os",
|
||||
"packages",
|
||||
"physicaldisk",
|
||||
"physicalmemory",
|
||||
"player",
|
||||
"poweradapter",
|
||||
"processes",
|
||||
@@ -730,7 +747,6 @@
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"description": "Run module with custom configurations",
|
||||
"required": [
|
||||
"type"
|
||||
@@ -762,11 +778,19 @@
|
||||
"anyOf": [
|
||||
{
|
||||
"const": "bios",
|
||||
"description": "Print BIOS name, version, release date, etc"
|
||||
"description": "Print information of 1st-stage bootloader (name, version, release date, etc)"
|
||||
},
|
||||
{
|
||||
"const": "board",
|
||||
"description": "Print mather board name and other info"
|
||||
"description": "Print motherboard name and other info"
|
||||
},
|
||||
{
|
||||
"const": "bootmgr",
|
||||
"description": "Print information of 2nd-stage bootloader (name, firmware, etc)"
|
||||
},
|
||||
{
|
||||
"const": "camera",
|
||||
"description": "Print available cameras"
|
||||
},
|
||||
{
|
||||
"const": "cursor",
|
||||
@@ -776,6 +800,10 @@
|
||||
"const": "datetime",
|
||||
"description": "Print current date and time"
|
||||
},
|
||||
{
|
||||
"const": "editor",
|
||||
"description": "Print information of the default editor ($VISUAL or $EDITOR)"
|
||||
},
|
||||
{
|
||||
"const": "font",
|
||||
"description": "Print system font name"
|
||||
@@ -816,6 +844,10 @@
|
||||
"const": "os",
|
||||
"description": "Print operating system name and version"
|
||||
},
|
||||
{
|
||||
"const": "physicalmemory",
|
||||
"description": "Print system physical memory devices"
|
||||
},
|
||||
{
|
||||
"const": "player",
|
||||
"description": "Print music player name"
|
||||
@@ -888,6 +920,9 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
@@ -922,6 +957,9 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
@@ -953,6 +991,9 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
@@ -979,6 +1020,21 @@
|
||||
"minimum": 0,
|
||||
"maximum": 400,
|
||||
"default": 10
|
||||
},
|
||||
"key": {
|
||||
"$ref": "#/$defs/key"
|
||||
},
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -997,6 +1053,9 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
@@ -1024,12 +1083,20 @@
|
||||
"maximum": 9,
|
||||
"default": 2
|
||||
},
|
||||
"showPeCoreCount": {
|
||||
"description": "Detect and display CPU frequency of different core types (eg. Pcore and Ecore) if supported",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"key": {
|
||||
"$ref": "#/$defs/key"
|
||||
},
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
@@ -1108,6 +1175,9 @@
|
||||
"maxItems": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
"key": {
|
||||
"$ref": "#/$defs/key"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -1134,6 +1204,9 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
@@ -1158,6 +1231,9 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
@@ -1165,10 +1241,7 @@
|
||||
"description": "Text to print",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"format"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Display",
|
||||
@@ -1210,6 +1283,9 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
@@ -1229,7 +1305,7 @@
|
||||
},
|
||||
"folders": {
|
||||
"type": "string",
|
||||
"description": "A colon (semicolon on Windows) separated list of folder paths for the disk output\nDefault: auto detection using mount-points"
|
||||
"description": "A colon (semicolon on Windows) separated list of folder paths for the disk output\nDefault: auto detection using mount-points\nThis option overrides other `show*` options"
|
||||
},
|
||||
"showExternal": {
|
||||
"type": "boolean",
|
||||
@@ -1270,6 +1346,9 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
@@ -1302,6 +1381,9 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
@@ -1330,6 +1412,9 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
@@ -1356,6 +1441,9 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
@@ -1381,10 +1469,16 @@
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"forceVulkan": {
|
||||
"description": "Force using vulkan to detect GPUs, which support video memory usage detection with `--allow-slow-operations`",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
"detectionMethod": {
|
||||
"description": "Force using a specified method to detect GPUs",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"auto",
|
||||
"pci",
|
||||
"vulkan",
|
||||
"opengl"
|
||||
],
|
||||
"default": "auto"
|
||||
},
|
||||
"hideType": {
|
||||
"description": "Specify the type of GPUs should not be printed",
|
||||
@@ -1401,6 +1495,9 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
@@ -1438,6 +1535,16 @@
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"showPrefixLen": {
|
||||
"description": "Show network prefix length (/N)",
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
"showAllIps": {
|
||||
"description": "Show all IPs bound to the same interface.\nBy default only the first IP is shown",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"compact": {
|
||||
"description": "Show all IPs in one line",
|
||||
"type": "boolean",
|
||||
@@ -1458,6 +1565,9 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
@@ -1484,6 +1594,42 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Loadavg",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"const": "loadavg",
|
||||
"description": "Print system load averages"
|
||||
},
|
||||
"ndigits": {
|
||||
"type": "integer",
|
||||
"description": "Set the number of digits to keep after the decimal point",
|
||||
"minimum": 0,
|
||||
"maximum": 9,
|
||||
"default": 2
|
||||
},
|
||||
"key": {
|
||||
"$ref": "#/$defs/key"
|
||||
},
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
@@ -1521,6 +1667,9 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
@@ -1554,6 +1703,9 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
@@ -1572,9 +1724,35 @@
|
||||
"description": "List installed package managers and count of installed packages"
|
||||
},
|
||||
"disabled": {
|
||||
"description": "A colon separated list of package managers to be disabled when detecting",
|
||||
"type": "string",
|
||||
"default": "winget"
|
||||
"description": "List of package managers to be disabled when detecting",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"am",
|
||||
"apk",
|
||||
"brew",
|
||||
"choco",
|
||||
"dpkg",
|
||||
"emerge",
|
||||
"eopkg",
|
||||
"flatpak",
|
||||
"macports",
|
||||
"nix",
|
||||
"opkg",
|
||||
"pacman",
|
||||
"paludis",
|
||||
"pkg",
|
||||
"pkgtool",
|
||||
"rpm",
|
||||
"scoop",
|
||||
"snap",
|
||||
"winget",
|
||||
"xbps"
|
||||
],
|
||||
"uniqueItems": true
|
||||
},
|
||||
"default": ["winget"]
|
||||
},
|
||||
"key": {
|
||||
"$ref": "#/$defs/key"
|
||||
@@ -1582,6 +1760,9 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
@@ -1612,6 +1793,9 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
@@ -1641,12 +1825,20 @@
|
||||
"minimum": 0,
|
||||
"default": "disabled (0)"
|
||||
},
|
||||
"ipv6": {
|
||||
"description": "Whether to use IPv6 for public IP detection server",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"key": {
|
||||
"$ref": "#/$defs/key"
|
||||
},
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
@@ -1668,6 +1860,9 @@
|
||||
"description": "Set the string to be printed",
|
||||
"type": "string",
|
||||
"default": "-"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -1699,6 +1894,9 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
@@ -1725,6 +1923,9 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
@@ -1772,6 +1973,9 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
@@ -1810,6 +2014,9 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
@@ -1838,6 +2045,9 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
|
||||
+14
-2
@@ -6,13 +6,17 @@
|
||||
"os",
|
||||
"host",
|
||||
"bios",
|
||||
"bootmgr",
|
||||
"board",
|
||||
"chassis",
|
||||
"kernel",
|
||||
"initsystem",
|
||||
"uptime",
|
||||
"loadavg",
|
||||
"processes",
|
||||
"packages",
|
||||
"shell",
|
||||
"editor",
|
||||
"display",
|
||||
"brightness",
|
||||
"monitor",
|
||||
@@ -29,10 +33,14 @@
|
||||
"terminalfont",
|
||||
"terminalsize",
|
||||
"terminaltheme",
|
||||
"cpu",
|
||||
{
|
||||
"type": "cpu",
|
||||
"showPeCoreCount": true
|
||||
},
|
||||
"cpuusage",
|
||||
"gpu",
|
||||
"memory",
|
||||
"physicalmemory",
|
||||
"swap",
|
||||
"disk",
|
||||
"battery",
|
||||
@@ -40,7 +48,11 @@
|
||||
"player",
|
||||
"media",
|
||||
"publicip",
|
||||
"localip",
|
||||
{
|
||||
"type": "localip",
|
||||
"showIpV6": true,
|
||||
"showMac": true
|
||||
},
|
||||
"wifi",
|
||||
"datetime",
|
||||
"locale",
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
{
|
||||
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
|
||||
"modules": [
|
||||
{
|
||||
"type": "title",
|
||||
"key": "User",
|
||||
"format": "{1}"
|
||||
},
|
||||
{
|
||||
"type": "title",
|
||||
"key": "Hostname",
|
||||
"format": "{2}"
|
||||
},
|
||||
{
|
||||
"type": "host",
|
||||
"key": "Model"
|
||||
},
|
||||
{
|
||||
"type": "os",
|
||||
"format": "{3} {9} {12}"
|
||||
},
|
||||
"kernel",
|
||||
"uptime",
|
||||
{
|
||||
"type": "loadavg",
|
||||
"key": "Load Average"
|
||||
},
|
||||
"processes",
|
||||
{
|
||||
"type": "wm",
|
||||
"key": "Window Manager"
|
||||
},
|
||||
{
|
||||
"type": "de",
|
||||
"key": "Desktop Environment"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"format": "{7}"
|
||||
},
|
||||
{
|
||||
"type": "terminal",
|
||||
"format": "{5} {6} {#37}█{#97}█ {#36}█{#96}█ {#35}█{#95}█ {#34}█{#94}█ {#33}█{#93}█ {#32}█{#92}█ {#31}█{#91}█ {#30}█{#90}█"
|
||||
},
|
||||
{
|
||||
"type": "packages",
|
||||
"format": "{1}"
|
||||
},
|
||||
{
|
||||
"type": "cpu",
|
||||
"key": "Temperature",
|
||||
"temp": true,
|
||||
"format": "{8}"
|
||||
},
|
||||
{
|
||||
"type": "cpu",
|
||||
"key": "CPU",
|
||||
"format": "{4} x {1}"
|
||||
},
|
||||
{
|
||||
"type": "gpu",
|
||||
"format": "{2}"
|
||||
},
|
||||
{
|
||||
"type": "memory",
|
||||
"key": "RAM"
|
||||
},
|
||||
{
|
||||
"type": "disk",
|
||||
"key": "Disk",
|
||||
"folders": "/"
|
||||
},
|
||||
{
|
||||
"type": "localip",
|
||||
"key": "LAN IP",
|
||||
"showIpv6": true,
|
||||
"showPrefixLen": false
|
||||
},
|
||||
{
|
||||
"type": "publicip",
|
||||
"key": "WAN IP"
|
||||
}
|
||||
]
|
||||
}
|
||||
+15
-2
@@ -6,19 +6,24 @@
|
||||
"showErrors": true,
|
||||
"noBuffer": true
|
||||
},
|
||||
"logo": null,
|
||||
"modules": [
|
||||
"title",
|
||||
"separator",
|
||||
"os",
|
||||
"host",
|
||||
"bios",
|
||||
"bootmgr",
|
||||
"board",
|
||||
"chassis",
|
||||
"kernel",
|
||||
"initsystem",
|
||||
"uptime",
|
||||
"loadavg",
|
||||
"processes",
|
||||
"packages",
|
||||
"shell",
|
||||
"editor",
|
||||
"display",
|
||||
"brightness",
|
||||
"monitor",
|
||||
@@ -35,10 +40,14 @@
|
||||
"terminalfont",
|
||||
"terminalsize",
|
||||
"terminaltheme",
|
||||
"cpu",
|
||||
{
|
||||
"type": "cpu",
|
||||
"showPeCoreCount": true
|
||||
},
|
||||
"cpuusage",
|
||||
"gpu",
|
||||
"memory",
|
||||
"physicalmemory",
|
||||
"swap",
|
||||
"disk",
|
||||
"battery",
|
||||
@@ -46,7 +55,11 @@
|
||||
"player",
|
||||
"media",
|
||||
"publicip",
|
||||
"localip",
|
||||
{
|
||||
"type": "localip",
|
||||
"showIpV6": true,
|
||||
"showMac": true
|
||||
},
|
||||
"wifi",
|
||||
"datetime",
|
||||
"locale",
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
"modules": [
|
||||
{
|
||||
"type": "custom",
|
||||
"format": "\u001b[90m┌────────────────────────────────────────────────────────────┐"
|
||||
"format": "┌────────────────────────────────────────────────────────────┐",
|
||||
"outputColor": "90"
|
||||
},
|
||||
{
|
||||
"type": "title",
|
||||
@@ -22,15 +23,17 @@
|
||||
},
|
||||
{
|
||||
"type": "custom",
|
||||
"format": "\u001b[90m└────────────────────────────────────────────────────────────┘"
|
||||
"format": "└────────────────────────────────────────────────────────────┘",
|
||||
"outputColor": "90"
|
||||
},
|
||||
{
|
||||
"type": "custom",
|
||||
"format": " \u001b[90m \u001b[31m \u001b[32m \u001b[33m \u001b[34m \u001b[35m \u001b[36m \u001b[37m \u001b[38m \u001b[39m \u001b[38m \u001b[37m \u001b[36m \u001b[35m \u001b[34m \u001b[33m \u001b[32m \u001b[31m \u001b[90m"
|
||||
"format": " {#90} {#31} {#32} {#33} {#34} {#35} {#36} {#37} {#38} {#39} {#38} {#37} {#36} {#35} {#34} {#33} {#32} {#31} {#90}"
|
||||
},
|
||||
{
|
||||
"type": "custom",
|
||||
"format": "\u001b[90m┌────────────────────────────────────────────────────────────┐"
|
||||
"format": "┌────────────────────────────────────────────────────────────┐",
|
||||
"outputColor": "90"
|
||||
},
|
||||
{
|
||||
"type": "os",
|
||||
@@ -84,17 +87,17 @@
|
||||
},
|
||||
{
|
||||
"type": "host",
|
||||
"key": " PC",
|
||||
"key": " PC",
|
||||
"keyColor": "green"
|
||||
},
|
||||
{
|
||||
"type": "cpu",
|
||||
"key": "│ ├",
|
||||
"key": "│ ├",
|
||||
"keyColor": "green"
|
||||
},
|
||||
{
|
||||
"type": "gpu",
|
||||
"key": "│ ├",
|
||||
"key": "│ ├",
|
||||
"keyColor": "green"
|
||||
},
|
||||
{
|
||||
@@ -139,12 +142,13 @@
|
||||
},
|
||||
{
|
||||
"type": "custom",
|
||||
"format": "\u001b[90m└────────────────────────────────────────────────────────────┘"
|
||||
"format": "└────────────────────────────────────────────────────────────┘",
|
||||
"outputColor": "90"
|
||||
},
|
||||
"break",
|
||||
{
|
||||
"type": "custom",
|
||||
"format": " \u001b[90m \u001b[31m \u001b[32m \u001b[33m \u001b[34m \u001b[35m \u001b[36m \u001b[37m \u001b[38m \u001b[39m \u001b[38m \u001b[37m \u001b[36m \u001b[35m \u001b[34m \u001b[33m \u001b[32m \u001b[31m \u001b[90m"
|
||||
"format": " {#90} {#31} {#32} {#33} {#34} {#35} {#36} {#37} {#38} {#39} {#38} {#37} {#36} {#35} {#34} {#33} {#32} {#31} {#90}"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
{
|
||||
"$schema": "file:///C:/msys64/home/zhang/fastfetch/doc/json_schema.json",
|
||||
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
|
||||
"logo": {
|
||||
"type": "small"
|
||||
},
|
||||
"display": {
|
||||
"separator": "\u001b[31m-> "
|
||||
"separator": "-> ",
|
||||
"color": {
|
||||
"separator": "red"
|
||||
}
|
||||
},
|
||||
"modules": [
|
||||
{
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
{
|
||||
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
|
||||
"logo": {
|
||||
"type": "none"
|
||||
},
|
||||
"display": {
|
||||
"separator": "-> ",
|
||||
"color": {
|
||||
"separator": "1"
|
||||
}
|
||||
},
|
||||
"modules": [
|
||||
{
|
||||
"type": "title",
|
||||
"format": " {6}{7}{8}"
|
||||
},
|
||||
"break",
|
||||
{
|
||||
"type": "custom",
|
||||
"format": "┌───────────────────────────── {#1}System Information{#} ─────────────────────────────┐"
|
||||
},
|
||||
"break",
|
||||
{
|
||||
"key": " OS ",
|
||||
"keyColor": "red",
|
||||
"type": "os"
|
||||
},
|
||||
{
|
||||
"key": " Machine ",
|
||||
"keyColor": "green",
|
||||
"type": "host"
|
||||
},
|
||||
{
|
||||
"key": " Kernel ",
|
||||
"keyColor": "magenta",
|
||||
"type": "kernel"
|
||||
},
|
||||
{
|
||||
"key": " Uptime ",
|
||||
"keyColor": "red",
|
||||
"type": "uptime"
|
||||
},
|
||||
{
|
||||
"key": " Resolution ",
|
||||
"keyColor": "yellow",
|
||||
"type": "display",
|
||||
"compactType": "original-with-refresh-rate"
|
||||
},
|
||||
{
|
||||
"key": " WM ",
|
||||
"keyColor": "blue",
|
||||
"type": "wm"
|
||||
},
|
||||
{
|
||||
"key": " DE ",
|
||||
"keyColor": "green",
|
||||
"type": "de"
|
||||
},
|
||||
{
|
||||
"key": " Shell ",
|
||||
"keyColor": "cyan",
|
||||
"type": "shell"
|
||||
},
|
||||
{
|
||||
"key": " Terminal ",
|
||||
"keyColor": "red",
|
||||
"type": "terminal"
|
||||
},
|
||||
{
|
||||
"key": " CPU ",
|
||||
"keyColor": "yellow",
|
||||
"type": "cpu"
|
||||
},
|
||||
{
|
||||
"key": " GPU ",
|
||||
"keyColor": "blue",
|
||||
"type": "gpu"
|
||||
},
|
||||
{
|
||||
"key": " Memory ",
|
||||
"keyColor": "magenta",
|
||||
"type": "memory"
|
||||
},
|
||||
{
|
||||
"key": " Local IP ",
|
||||
"keyColor": "red",
|
||||
"type": "localip",
|
||||
"compact": true
|
||||
},
|
||||
{
|
||||
"key": " Public IP ",
|
||||
"keyColor": "cyan",
|
||||
"type": "publicip"
|
||||
},
|
||||
"break",
|
||||
{
|
||||
"type": "custom",
|
||||
"format": "└──────────────────────────────────────────────────────────────────────────────┘"
|
||||
},
|
||||
"break",
|
||||
{
|
||||
"type": "colors",
|
||||
"paddingLeft": 34,
|
||||
"symbol": "circle"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
|
||||
"logo": {
|
||||
"type": "small",
|
||||
"padding": {
|
||||
"top": 1
|
||||
}
|
||||
},
|
||||
"display": {
|
||||
"separator": "",
|
||||
"keyWidth": 15
|
||||
},
|
||||
"modules": [
|
||||
{
|
||||
"key": "╭───────────╮",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
// draw borders first to make colors of left and right border consistant
|
||||
"key": "│ │\u001b[11D{#31} user",
|
||||
"type": "title",
|
||||
"format": "{1}"
|
||||
},
|
||||
{
|
||||
"key": "│ │\u001b[11D{#32} hname",
|
||||
"type": "title",
|
||||
"format": "{2}"
|
||||
},
|
||||
{
|
||||
"key": "│ │\u001b[11D{#33} uptime",
|
||||
"type": "uptime"
|
||||
},
|
||||
{
|
||||
"key": "│ │\u001b[11D{#34} distro",
|
||||
"type": "os"
|
||||
},
|
||||
{
|
||||
"key": "│ │\u001b[11D{#35} kernel",
|
||||
"type": "kernel"
|
||||
},
|
||||
{
|
||||
"key": "│ │\u001b[11D{#36} desktop",
|
||||
"type": "de"
|
||||
},
|
||||
{
|
||||
"key": "│ │\u001b[11D{#31} term",
|
||||
"type": "terminal"
|
||||
},
|
||||
{
|
||||
"key": "│ │\u001b[11D{#32} shell",
|
||||
"type": "shell"
|
||||
},
|
||||
{
|
||||
"key": "│ │\u001b[11D{#33} cpu",
|
||||
"type": "cpu",
|
||||
"showPeCoreCount": true
|
||||
},
|
||||
{
|
||||
"key": "│ │\u001b[11D{#34} disk",
|
||||
"type": "disk",
|
||||
"folders": "/"
|
||||
},
|
||||
{
|
||||
"key": "│ │\u001b[11D{#35} memory",
|
||||
"type": "memory"
|
||||
},
|
||||
{
|
||||
"key": "│ │\u001b[11D{#36} network",
|
||||
"type": "localip",
|
||||
"format": "{1} ({4})"
|
||||
},
|
||||
{
|
||||
"key": "├───────────┤",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"key": "│ │\u001b[11D{#39} colors",
|
||||
"type": "colors",
|
||||
"symbol": "circle"
|
||||
},
|
||||
{
|
||||
"key": "╰───────────╯",
|
||||
"type": "custom"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -15,19 +15,19 @@
|
||||
"modules": [
|
||||
{
|
||||
"type": "custom", // HardwareStart
|
||||
"format": "┌─────────── \u001b[1mHardware Information\u001b[0m ───────────┐" // `\u001b` is `\033`, or `\e`
|
||||
"format": "┌─────────── {#1}Hardware Information{#} ───────────┐" // {#1} is the same as `\u001b[1m`. {#} is `\u001b[m`
|
||||
},
|
||||
{
|
||||
"type": "host",
|
||||
"key": " "
|
||||
"key": " "
|
||||
},
|
||||
{
|
||||
"type": "cpu",
|
||||
"key": " "
|
||||
"key": " "
|
||||
},
|
||||
{
|
||||
"type": "gpu",
|
||||
"key": " "
|
||||
"key": " "
|
||||
},
|
||||
{
|
||||
"type": "disk",
|
||||
@@ -71,7 +71,7 @@
|
||||
},
|
||||
{
|
||||
"type": "custom", // SoftwareStart
|
||||
"format": "├─────────── \u001b[1mSoftware Information\u001b[0m ───────────┤"
|
||||
"format": "├─────────── {#1}Software Information{#} ───────────┤"
|
||||
},
|
||||
{
|
||||
"type": "title",
|
||||
|
||||
@@ -9,13 +9,11 @@
|
||||
"modules": [
|
||||
{
|
||||
"type": "theme",
|
||||
"key": "T",
|
||||
"format": "{7}"
|
||||
"key": "T"
|
||||
},
|
||||
{
|
||||
"type": "icons",
|
||||
"key": "I",
|
||||
"format": "{5}"
|
||||
"key": "I"
|
||||
},
|
||||
{
|
||||
"type": "font",
|
||||
|
||||
@@ -15,17 +15,17 @@
|
||||
"modules": [
|
||||
{
|
||||
"type": "host",
|
||||
"key": "╭─",
|
||||
"key": "╭─",
|
||||
"keyColor": "green"
|
||||
},
|
||||
{
|
||||
"type": "cpu",
|
||||
"key": "├─",
|
||||
"key": "├─",
|
||||
"keyColor": "green"
|
||||
},
|
||||
{
|
||||
"type": "gpu",
|
||||
"key": "├─",
|
||||
"key": "├─",
|
||||
"keyColor": "green"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
"type": "os",
|
||||
"key": "├", // Just get your distro's logo off nerdfonts.com
|
||||
"keyColor": "yellow",
|
||||
"format": "{6}{?6} {?}{10} {8}"
|
||||
"format": "{6}{?6} {?}{10}{?10} {?}{8}{?8} {?}{11}"
|
||||
},
|
||||
{
|
||||
"type": "kernel",
|
||||
@@ -77,17 +77,17 @@
|
||||
"break",
|
||||
{
|
||||
"type": "host",
|
||||
"key": " PC",
|
||||
"key": " PC",
|
||||
"keyColor": "green"
|
||||
},
|
||||
{
|
||||
"type": "cpu",
|
||||
"key": "├",
|
||||
"key": "├",
|
||||
"keyColor": "green"
|
||||
},
|
||||
{
|
||||
"type": "gpu",
|
||||
"key": "├",
|
||||
"key": "├",
|
||||
"keyColor": "green"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -24,29 +24,29 @@
|
||||
},
|
||||
{
|
||||
"type": "os",
|
||||
"key": "",
|
||||
"key": "",
|
||||
"format": "{2} {8}"
|
||||
},
|
||||
{
|
||||
"type": "kernel",
|
||||
"key": ""
|
||||
"key": ""
|
||||
},
|
||||
{
|
||||
"type": "memory",
|
||||
"key": ""
|
||||
"key": ""
|
||||
},
|
||||
{
|
||||
"type": "packages",
|
||||
"key": ""
|
||||
"key": ""
|
||||
},
|
||||
{
|
||||
"type": "uptime",
|
||||
"key": ""
|
||||
"key": ""
|
||||
},
|
||||
{
|
||||
"type": "custom",
|
||||
"key": "",
|
||||
"format": "\u001b[31m███\u001b[32m███\u001b[33m███\u001b[34m███\u001b[35m███\u001b[36m███"
|
||||
"format": "{#31}███{#32}███{#33}███{#34}███{#35}███{#36}███"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
+25
-13
@@ -1,25 +1,37 @@
|
||||
{
|
||||
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
|
||||
"logo": {
|
||||
"type": "builtin",
|
||||
"source": "arch"
|
||||
},
|
||||
"modules": [
|
||||
"host",
|
||||
"display",
|
||||
{
|
||||
"type": "host",
|
||||
"format": "{?2}{2}{?}{?5} ({5}){?}"
|
||||
},
|
||||
"chassis",
|
||||
{
|
||||
"type": "board",
|
||||
"format": "{?1}{1}{?}{?2} ({2}){?}"
|
||||
},
|
||||
"cpu",
|
||||
"gpu",
|
||||
{
|
||||
"type": "memory",
|
||||
"format": "{?2}{2}{?}"
|
||||
},
|
||||
{
|
||||
"type": "disk",
|
||||
"format": "{?2}{2}{?}"
|
||||
},
|
||||
"physicaldisk",
|
||||
"gpu",
|
||||
"display",
|
||||
"monitor",
|
||||
{
|
||||
"type": "wifi",
|
||||
"format": "{?1}{1}{?}{?6} - {6}{?}"
|
||||
},
|
||||
{
|
||||
"type": "sound",
|
||||
"format": "{?2}{2}{?}"
|
||||
},
|
||||
"camera",
|
||||
{
|
||||
"type": "battery",
|
||||
"format": "{?1}{1} {?}{?2}{2} {?}{?3}({3}){?}"
|
||||
}
|
||||
"format": "{?1}{1}{?}{?2} {2}{?}{?3} ({3}){?}"
|
||||
},
|
||||
"poweradapter"
|
||||
]
|
||||
}
|
||||
|
||||
+9
-12
@@ -1,16 +1,16 @@
|
||||
{
|
||||
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
|
||||
"display": {
|
||||
"size": {
|
||||
"maxPrefix": "MB",
|
||||
"ndigits": 0
|
||||
}
|
||||
},
|
||||
"modules": [
|
||||
"title",
|
||||
"separator",
|
||||
{
|
||||
"type": "os",
|
||||
"format": "{3} {12}"
|
||||
},
|
||||
{
|
||||
"type": "host",
|
||||
"format": "{/2}{-}{/}{2}{?3} {3}{?}"
|
||||
},
|
||||
"os",
|
||||
"host",
|
||||
"kernel",
|
||||
"uptime",
|
||||
"packages",
|
||||
@@ -23,10 +23,7 @@
|
||||
"de",
|
||||
"wm",
|
||||
"wmtheme",
|
||||
{
|
||||
"type": "theme",
|
||||
"format": "{?1}{1}{?3} {3}{?} [Plasma], {?}{7}"
|
||||
},
|
||||
"theme",
|
||||
"icons",
|
||||
"terminal",
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
"uptime",
|
||||
{
|
||||
"type": "battery",
|
||||
"format": "{/4}{-}{/}{4}%{?5} [{5}]{?}"
|
||||
"format": "{/4}{-}{/}{4}{?5} [{5}]{?}"
|
||||
},
|
||||
"break",
|
||||
"packages",
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 285 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 133 KiB |
Vendored
+257
@@ -1229,6 +1229,18 @@ typedef struct _ctl_lda_args_t ctl_lda_args_t;
|
||||
/// @brief Forward-declare ctl_dce_args_t
|
||||
typedef struct _ctl_dce_args_t ctl_dce_args_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Forward-declare ctl_wire_format_t
|
||||
typedef struct _ctl_wire_format_t ctl_wire_format_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Forward-declare ctl_get_set_wire_format_config_t
|
||||
typedef struct _ctl_get_set_wire_format_config_t ctl_get_set_wire_format_config_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Forward-declare ctl_display_settings_t
|
||||
typedef struct _ctl_display_settings_t ctl_display_settings_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Forward-declare ctl_engine_properties_t
|
||||
typedef struct _ctl_engine_properties_t ctl_engine_properties_t;
|
||||
@@ -2029,6 +2041,8 @@ typedef enum _ctl_std_display_feature_flag_t
|
||||
CTL_STD_DISPLAY_FEATURE_FLAG_VESA_COMPRESSION = CTL_BIT(4), ///< [out] Is display compression (VESA DSC) supported
|
||||
CTL_STD_DISPLAY_FEATURE_FLAG_HDR = CTL_BIT(5), ///< [out] Is HDR supported
|
||||
CTL_STD_DISPLAY_FEATURE_FLAG_HDMI_QMS = CTL_BIT(6), ///< [out] Is HDMI QMS supported
|
||||
CTL_STD_DISPLAY_FEATURE_FLAG_HDR10_PLUS_CERTIFIED = CTL_BIT(7), ///< [out] Is HDR10+ certified
|
||||
CTL_STD_DISPLAY_FEATURE_FLAG_VESA_HDR_CERTIFIED = CTL_BIT(8), ///< [out] Is VESA HDR certified - for future use
|
||||
CTL_STD_DISPLAY_FEATURE_FLAG_MAX = 0x80000000
|
||||
|
||||
} ctl_std_display_feature_flag_t;
|
||||
@@ -2042,6 +2056,7 @@ typedef enum _ctl_intel_display_feature_flag_t
|
||||
CTL_INTEL_DISPLAY_FEATURE_FLAG_DPST = CTL_BIT(0), ///< [out] Is DPST supported
|
||||
CTL_INTEL_DISPLAY_FEATURE_FLAG_LACE = CTL_BIT(1), ///< [out] Is LACE supported
|
||||
CTL_INTEL_DISPLAY_FEATURE_FLAG_DRRS = CTL_BIT(2), ///< [out] Is DRRS supported
|
||||
CTL_INTEL_DISPLAY_FEATURE_FLAG_ARC_ADAPTIVE_SYNC_CERTIFIED = CTL_BIT(3),///< [out] Is Intel Arc certified adaptive sync display
|
||||
CTL_INTEL_DISPLAY_FEATURE_FLAG_MAX = 0x80000000
|
||||
|
||||
} ctl_intel_display_feature_flag_t;
|
||||
@@ -4398,6 +4413,232 @@ ctlGetSetDynamicContrastEnhancement(
|
||||
ctl_dce_args_t* pDceArgs ///< [in,out] Dynamic Contrast Enhancement arguments
|
||||
);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Color model
|
||||
typedef enum _ctl_wire_format_color_model_t
|
||||
{
|
||||
CTL_WIRE_FORMAT_COLOR_MODEL_RGB = 0, ///< Color model RGB
|
||||
CTL_WIRE_FORMAT_COLOR_MODEL_YCBCR_420 = 1, ///< Color model YCBCR 420
|
||||
CTL_WIRE_FORMAT_COLOR_MODEL_YCBCR_422 = 2, ///< Color model YCBCR 422
|
||||
CTL_WIRE_FORMAT_COLOR_MODEL_YCBCR_444 = 3, ///< Color model YCBCR 444
|
||||
CTL_WIRE_FORMAT_COLOR_MODEL_MAX
|
||||
|
||||
} ctl_wire_format_color_model_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Operation type
|
||||
typedef enum _ctl_wire_format_operation_type_t
|
||||
{
|
||||
CTL_WIRE_FORMAT_OPERATION_TYPE_GET = 0, ///< Get request
|
||||
CTL_WIRE_FORMAT_OPERATION_TYPE_SET = 1, ///< Set request
|
||||
CTL_WIRE_FORMAT_OPERATION_TYPE_RESTORE_DEFAULT = 2, ///< Restore to default values
|
||||
CTL_WIRE_FORMAT_OPERATION_TYPE_MAX
|
||||
|
||||
} ctl_wire_format_operation_type_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Wire Format
|
||||
typedef struct _ctl_wire_format_t
|
||||
{
|
||||
uint32_t Size; ///< [in] size of this structure
|
||||
uint8_t Version; ///< [in] version of this structure
|
||||
ctl_wire_format_color_model_t ColorModel; ///< [in,out] Color model
|
||||
ctl_output_bpc_flags_t ColorDepth; ///< [in,out] Color Depth
|
||||
|
||||
} ctl_wire_format_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef CTL_MAX_WIREFORMAT_COLOR_MODELS_SUPPORTED
|
||||
/// @brief Maximum Wire Formats Supported
|
||||
#define CTL_MAX_WIREFORMAT_COLOR_MODELS_SUPPORTED 4
|
||||
#endif // CTL_MAX_WIREFORMAT_COLOR_MODELS_SUPPORTED
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Get Set Wire Format
|
||||
typedef struct _ctl_get_set_wire_format_config_t
|
||||
{
|
||||
uint32_t Size; ///< [in] size of this structure
|
||||
uint8_t Version; ///< [in] version of this structure
|
||||
ctl_wire_format_operation_type_t Operation; ///< [in] Get/Set Operation
|
||||
ctl_wire_format_t SupportedWireFormat[CTL_MAX_WIREFORMAT_COLOR_MODELS_SUPPORTED]; ///< [out] Array of WireFormats supported
|
||||
ctl_wire_format_t WireFormat; ///< [in,out] Current/Requested WireFormat based on Operation. During SET
|
||||
///< Operation, if multiple bpc is set, the MIN bpc will be applied
|
||||
|
||||
} ctl_get_set_wire_format_config_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Get/Set Color Format and Color Depth
|
||||
///
|
||||
/// @details
|
||||
/// - Get and Set the Color Format and Color Depth of a target
|
||||
///
|
||||
/// @returns
|
||||
/// - CTL_RESULT_SUCCESS
|
||||
/// - CTL_RESULT_ERROR_UNINITIALIZED
|
||||
/// - CTL_RESULT_ERROR_DEVICE_LOST
|
||||
/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE
|
||||
/// + `nullptr == hDisplayOutput`
|
||||
/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER
|
||||
/// + `nullptr == pGetSetWireFormatSetting`
|
||||
/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version"
|
||||
/// - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid data passed as argument, WireFormat is not supported"
|
||||
/// - ::CTL_RESULT_ERROR_DISPLAY_NOT_ACTIVE - "Display not active"
|
||||
/// - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type"
|
||||
/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle"
|
||||
/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface"
|
||||
/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle"
|
||||
CTL_APIEXPORT ctl_result_t CTL_APICALL
|
||||
ctlGetSetWireFormat(
|
||||
ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output
|
||||
ctl_get_set_wire_format_config_t* pGetSetWireFormatSetting ///< [in][release] Get/Set Wire Format settings to be fetched/applied
|
||||
);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Various display settings
|
||||
typedef uint32_t ctl_display_setting_flags_t;
|
||||
typedef enum _ctl_display_setting_flag_t
|
||||
{
|
||||
CTL_DISPLAY_SETTING_FLAG_LOW_LATENCY = CTL_BIT(0), ///< Low latency
|
||||
CTL_DISPLAY_SETTING_FLAG_SOURCE_TM = CTL_BIT(1),///< Source tone mapping
|
||||
CTL_DISPLAY_SETTING_FLAG_CONTENT_TYPE = CTL_BIT(2), ///< Content type
|
||||
CTL_DISPLAY_SETTING_FLAG_QUANTIZATION_RANGE = CTL_BIT(3), ///< Quantization range, full range or limited range
|
||||
CTL_DISPLAY_SETTING_FLAG_PICTURE_AR = CTL_BIT(4), ///< Picture aspect ratio
|
||||
CTL_DISPLAY_SETTING_FLAG_AUDIO = CTL_BIT(5), ///< Audio settings
|
||||
CTL_DISPLAY_SETTING_FLAG_MAX = 0x80000000
|
||||
|
||||
} ctl_display_setting_flag_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Low latency setting
|
||||
typedef enum _ctl_display_setting_low_latency_t
|
||||
{
|
||||
CTL_DISPLAY_SETTING_LOW_LATENCY_DEFAULT = 0, ///< Default
|
||||
CTL_DISPLAY_SETTING_LOW_LATENCY_DISABLED = 1, ///< Disabled
|
||||
CTL_DISPLAY_SETTING_LOW_LATENCY_ENABLED = 2, ///< Enabled
|
||||
CTL_DISPLAY_SETTING_LOW_LATENCY_MAX
|
||||
|
||||
} ctl_display_setting_low_latency_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Source tone mapping setting
|
||||
typedef enum _ctl_display_setting_sourcetm_t
|
||||
{
|
||||
CTL_DISPLAY_SETTING_SOURCETM_DEFAULT = 0, ///< Default
|
||||
CTL_DISPLAY_SETTING_SOURCETM_DISABLED = 1, ///< Disabled
|
||||
CTL_DISPLAY_SETTING_SOURCETM_ENABLED = 2, ///< Enabled
|
||||
CTL_DISPLAY_SETTING_SOURCETM_MAX
|
||||
|
||||
} ctl_display_setting_sourcetm_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Content type settings
|
||||
typedef enum _ctl_display_setting_content_type_t
|
||||
{
|
||||
CTL_DISPLAY_SETTING_CONTENT_TYPE_DEFAULT = 0, ///< Default content type used by driver. Driver will use internal
|
||||
///< techniques to determine content type and indicate to panel
|
||||
CTL_DISPLAY_SETTING_CONTENT_TYPE_DISABLED = 1, ///< Content type indication is disabled
|
||||
CTL_DISPLAY_SETTING_CONTENT_TYPE_DESKTOP = 2, ///< Typical desktop with a mix of text and graphics
|
||||
CTL_DISPLAY_SETTING_CONTENT_TYPE_MEDIA = 3, ///< Video or media content
|
||||
CTL_DISPLAY_SETTING_CONTENT_TYPE_GAMING = 4, ///< Gaming content
|
||||
CTL_DISPLAY_SETTING_CONTENT_TYPE_MAX
|
||||
|
||||
} ctl_display_setting_content_type_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Quantization range
|
||||
typedef enum _ctl_display_setting_quantization_range_t
|
||||
{
|
||||
CTL_DISPLAY_SETTING_QUANTIZATION_RANGE_DEFAULT = 0, ///< Default based on video format
|
||||
CTL_DISPLAY_SETTING_QUANTIZATION_RANGE_LIMITED_RANGE = 1, ///< Limited range
|
||||
CTL_DISPLAY_SETTING_QUANTIZATION_RANGE_FULL_RANGE = 2, ///< Full range
|
||||
CTL_DISPLAY_SETTING_QUANTIZATION_RANGE_MAX
|
||||
|
||||
} ctl_display_setting_quantization_range_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Picture aspect ratio
|
||||
typedef uint32_t ctl_display_setting_picture_ar_flags_t;
|
||||
typedef enum _ctl_display_setting_picture_ar_flag_t
|
||||
{
|
||||
CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_DEFAULT = CTL_BIT(0), ///< Default picture aspect ratio
|
||||
CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_DISABLED = CTL_BIT(1), ///< Picture aspect ratio indication is explicitly disabled
|
||||
CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_AR_4_3 = CTL_BIT(2),///< Aspect ratio of 4:3
|
||||
CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_AR_16_9 = CTL_BIT(3), ///< Aspect ratio of 16:9
|
||||
CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_AR_64_27 = CTL_BIT(4), ///< Aspect ratio of 64:27 or 21:9 anamorphic
|
||||
CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_AR_256_135 = CTL_BIT(5),///< Aspect ratio of 256:135
|
||||
CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_MAX = 0x80000000
|
||||
|
||||
} ctl_display_setting_picture_ar_flag_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Audio settings
|
||||
typedef enum _ctl_display_setting_audio_t
|
||||
{
|
||||
CTL_DISPLAY_SETTING_AUDIO_DEFAULT = 0, ///< Default audio settings, always enumerated and enabled if display
|
||||
///< supports it
|
||||
CTL_DISPLAY_SETTING_AUDIO_DISABLED = 1, ///< Forcefully disable display audio end point enumeration to OS
|
||||
CTL_DISPLAY_SETTING_AUDIO_MAX
|
||||
|
||||
} ctl_display_setting_audio_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Get/Set end display settings
|
||||
typedef struct _ctl_display_settings_t
|
||||
{
|
||||
uint32_t Size; ///< [in] size of this structure
|
||||
uint8_t Version; ///< [in] version of this structure
|
||||
bool Set; ///< [in] Flag to indicate Set or Get operation. Default option for all
|
||||
///< features are reserved for Set=true calls, which will reset the setting
|
||||
///< to driver defaults.
|
||||
ctl_display_setting_flags_t SupportedFlags; ///< [out] Display setting flags supported by the display.
|
||||
ctl_display_setting_flags_t ControllableFlags; ///< [out] Display setting flags which can be controlled by the caller.
|
||||
///< Features which doesn't have this flag set cannot be changed by caller.
|
||||
ctl_display_setting_flags_t ValidFlags; ///< [in,out] Display setting flags which caller can use to indicate the
|
||||
///< features it's interested in. This cannot have a bit set which is not
|
||||
///< supported by SupportedFlags and ControllableFlags.
|
||||
ctl_display_setting_low_latency_t LowLatency; ///< [in,out] Low latency state of panel. For HDR10+ Gaming this need to be
|
||||
///< in ENABLED state.
|
||||
ctl_display_setting_sourcetm_t SourceTM; ///< [in,out] Source tone mapping state known to panel. For HDR10+ Gaming
|
||||
///< this need to be in ENABLED state.
|
||||
ctl_display_setting_content_type_t ContentType; ///< [in,out] Source content type known to panel.
|
||||
ctl_display_setting_quantization_range_t QuantizationRange; ///< [in,out] Quantization range
|
||||
ctl_display_setting_picture_ar_flags_t SupportedPictureAR; ///< [out] Supported Picture aspect ratios
|
||||
ctl_display_setting_picture_ar_flag_t PictureAR;///< [in,out] Picture aspect ratio
|
||||
ctl_display_setting_audio_t AudioSettings; ///< [in,out] Audio settings
|
||||
uint32_t Reserved[25]; ///< [out] Reserved fields for future enumerations
|
||||
|
||||
} ctl_display_settings_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Get/Set Display settings
|
||||
///
|
||||
/// @details
|
||||
/// - To get/set end display settings like low latency, HDR10+ signaling
|
||||
/// etc. which are controlled via info-frames/secondary data packets
|
||||
///
|
||||
/// @returns
|
||||
/// - CTL_RESULT_SUCCESS
|
||||
/// - CTL_RESULT_ERROR_UNINITIALIZED
|
||||
/// - CTL_RESULT_ERROR_DEVICE_LOST
|
||||
/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE
|
||||
/// + `nullptr == hDisplayOutput`
|
||||
/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER
|
||||
/// + `nullptr == pDisplaySettings`
|
||||
/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version"
|
||||
/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle"
|
||||
/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface"
|
||||
/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle"
|
||||
/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure"
|
||||
/// - ::CTL_RESULT_ERROR_INVALID_NULL_HANDLE - "Invalid or Null handle passed"
|
||||
/// - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer"
|
||||
/// - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type"
|
||||
/// - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid combination of parameters"
|
||||
CTL_APIEXPORT ctl_result_t CTL_APICALL
|
||||
ctlGetSetDisplaySettings(
|
||||
ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output
|
||||
ctl_display_settings_t* pDisplaySettings ///< [in,out] End display capabilities
|
||||
);
|
||||
|
||||
|
||||
#if !defined(__GNUC__)
|
||||
#pragma endregion // display
|
||||
@@ -7229,6 +7470,22 @@ typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSetDynamicContrastEnhancement_t)(
|
||||
);
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Function-pointer for ctlGetSetWireFormat
|
||||
typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSetWireFormat_t)(
|
||||
ctl_display_output_handle_t,
|
||||
ctl_get_set_wire_format_config_t*
|
||||
);
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Function-pointer for ctlGetSetDisplaySettings
|
||||
typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSetDisplaySettings_t)(
|
||||
ctl_display_output_handle_t,
|
||||
ctl_display_settings_t*
|
||||
);
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Function-pointer for ctlEnumEngineGroups
|
||||
typedef ctl_result_t (CTL_APICALL *ctl_pfnEnumEngineGroups_t)(
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"home": "https://github.com/intel/drivers.gpu.control-library",
|
||||
"license": "./LICENSE",
|
||||
"version": "e1776b7be2ceead1296204371447b27860d25a66",
|
||||
"version": "v184",
|
||||
"author": "Intel Corporation"
|
||||
}
|
||||
|
||||
Vendored
-10359
File diff suppressed because it is too large
Load Diff
Vendored
-6
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"home": "https://github.com/NVIDIA/nvidia-settings/blob/main/src/nvml.h",
|
||||
"license": "Embed in source",
|
||||
"version": "545.23.06",
|
||||
"author": "NVIDIA Corporation"
|
||||
}
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"home": "https://github.com/ibireme/yyjson",
|
||||
"license": "MIT ( embed in source )",
|
||||
"version": "0.8.0",
|
||||
"version": "0.9.0",
|
||||
"author": "ibireme"
|
||||
}
|
||||
|
||||
Vendored
+31
-5
@@ -1407,6 +1407,7 @@ bool yyjson_mut_doc_set_val_pool_size(yyjson_mut_doc *doc, size_t count) {
|
||||
void yyjson_mut_doc_free(yyjson_mut_doc *doc) {
|
||||
if (doc) {
|
||||
yyjson_alc alc = doc->alc;
|
||||
memset(&doc->alc, 0, sizeof(alc));
|
||||
unsafe_yyjson_str_pool_release(&doc->str_pool, &alc);
|
||||
unsafe_yyjson_val_pool_release(&doc->val_pool, &alc);
|
||||
alc.free(alc.ctx, doc);
|
||||
@@ -8309,13 +8310,15 @@ static_inline u8 *yyjson_write_single(yyjson_val *val,
|
||||
bool cpy = (enc_table == enc_table_cpy);
|
||||
bool esc = has_write_flag(ESCAPE_UNICODE) != 0;
|
||||
bool inv = has_write_flag(ALLOW_INVALID_UNICODE) != 0;
|
||||
bool newline = has_write_flag(NEWLINE_AT_END) != 0;
|
||||
const usize end_len = 2; /* '\n' and '\0' */
|
||||
|
||||
switch (unsafe_yyjson_get_type(val)) {
|
||||
case YYJSON_TYPE_RAW:
|
||||
str_len = unsafe_yyjson_get_len(val);
|
||||
str_ptr = (const u8 *)unsafe_yyjson_get_str(val);
|
||||
check_str_len(str_len);
|
||||
incr_len(str_len + 1);
|
||||
incr_len(str_len + end_len);
|
||||
cur = write_raw(cur, str_ptr, str_len);
|
||||
break;
|
||||
|
||||
@@ -8323,7 +8326,7 @@ static_inline u8 *yyjson_write_single(yyjson_val *val,
|
||||
str_len = unsafe_yyjson_get_len(val);
|
||||
str_ptr = (const u8 *)unsafe_yyjson_get_str(val);
|
||||
check_str_len(str_len);
|
||||
incr_len(str_len * 6 + 4);
|
||||
incr_len(str_len * 6 + 2 + end_len);
|
||||
if (likely(cpy) && unsafe_yyjson_get_subtype(val)) {
|
||||
cur = write_string_noesc(cur, str_ptr, str_len);
|
||||
} else {
|
||||
@@ -8333,7 +8336,7 @@ static_inline u8 *yyjson_write_single(yyjson_val *val,
|
||||
break;
|
||||
|
||||
case YYJSON_TYPE_NUM:
|
||||
incr_len(32);
|
||||
incr_len(32 + end_len);
|
||||
cur = write_number(cur, val, flg);
|
||||
if (unlikely(!cur)) goto fail_num;
|
||||
break;
|
||||
@@ -8349,13 +8352,13 @@ static_inline u8 *yyjson_write_single(yyjson_val *val,
|
||||
break;
|
||||
|
||||
case YYJSON_TYPE_ARR:
|
||||
incr_len(4);
|
||||
incr_len(2 + end_len);
|
||||
byte_copy_2(cur, "[]");
|
||||
cur += 2;
|
||||
break;
|
||||
|
||||
case YYJSON_TYPE_OBJ:
|
||||
incr_len(4);
|
||||
incr_len(2 + end_len);
|
||||
byte_copy_2(cur, "{}");
|
||||
cur += 2;
|
||||
break;
|
||||
@@ -8364,6 +8367,7 @@ static_inline u8 *yyjson_write_single(yyjson_val *val,
|
||||
goto fail_type;
|
||||
}
|
||||
|
||||
if (newline) *cur++ = '\n';
|
||||
*cur = '\0';
|
||||
*dat_len = (usize)(cur - hdr);
|
||||
memset(err, 0, sizeof(yyjson_write_err));
|
||||
@@ -8436,6 +8440,7 @@ static_inline u8 *yyjson_write_minify(const yyjson_val *root,
|
||||
bool cpy = (enc_table == enc_table_cpy);
|
||||
bool esc = has_write_flag(ESCAPE_UNICODE) != 0;
|
||||
bool inv = has_write_flag(ALLOW_INVALID_UNICODE) != 0;
|
||||
bool newline = has_write_flag(NEWLINE_AT_END) != 0;
|
||||
|
||||
alc_len = root->uni.ofs / sizeof(yyjson_val);
|
||||
alc_len = alc_len * YYJSON_WRITER_ESTIMATED_MINIFY_RATIO + 64;
|
||||
@@ -8542,6 +8547,11 @@ ctn_end:
|
||||
}
|
||||
|
||||
doc_end:
|
||||
if (newline) {
|
||||
incr_len(2);
|
||||
*(cur - 1) = '\n';
|
||||
cur++;
|
||||
}
|
||||
*--cur = '\0';
|
||||
*dat_len = (usize)(cur - hdr);
|
||||
memset(err, 0, sizeof(yyjson_write_err));
|
||||
@@ -8615,6 +8625,7 @@ static_inline u8 *yyjson_write_pretty(const yyjson_val *root,
|
||||
bool esc = has_write_flag(ESCAPE_UNICODE) != 0;
|
||||
bool inv = has_write_flag(ALLOW_INVALID_UNICODE) != 0;
|
||||
usize spaces = has_write_flag(PRETTY_TWO_SPACES) ? 2 : 4;
|
||||
bool newline = has_write_flag(NEWLINE_AT_END) != 0;
|
||||
|
||||
alc_len = root->uni.ofs / sizeof(yyjson_val);
|
||||
alc_len = alc_len * YYJSON_WRITER_ESTIMATED_PRETTY_RATIO + 64;
|
||||
@@ -8745,6 +8756,10 @@ ctn_end:
|
||||
}
|
||||
|
||||
doc_end:
|
||||
if (newline) {
|
||||
incr_len(2);
|
||||
*cur++ = '\n';
|
||||
}
|
||||
*cur = '\0';
|
||||
*dat_len = (usize)(cur - hdr);
|
||||
memset(err, 0, sizeof(yyjson_write_err));
|
||||
@@ -8977,6 +8992,7 @@ static_inline u8 *yyjson_mut_write_minify(const yyjson_mut_val *root,
|
||||
bool cpy = (enc_table == enc_table_cpy);
|
||||
bool esc = has_write_flag(ESCAPE_UNICODE) != 0;
|
||||
bool inv = has_write_flag(ALLOW_INVALID_UNICODE) != 0;
|
||||
bool newline = has_write_flag(NEWLINE_AT_END) != 0;
|
||||
|
||||
alc_len = estimated_val_num * YYJSON_WRITER_ESTIMATED_MINIFY_RATIO + 64;
|
||||
alc_len = size_align_up(alc_len, sizeof(yyjson_mut_write_ctx));
|
||||
@@ -9087,6 +9103,11 @@ ctn_end:
|
||||
}
|
||||
|
||||
doc_end:
|
||||
if (newline) {
|
||||
incr_len(2);
|
||||
*(cur - 1) = '\n';
|
||||
cur++;
|
||||
}
|
||||
*--cur = '\0';
|
||||
*dat_len = (usize)(cur - hdr);
|
||||
err->code = YYJSON_WRITE_SUCCESS;
|
||||
@@ -9162,6 +9183,7 @@ static_inline u8 *yyjson_mut_write_pretty(const yyjson_mut_val *root,
|
||||
bool esc = has_write_flag(ESCAPE_UNICODE) != 0;
|
||||
bool inv = has_write_flag(ALLOW_INVALID_UNICODE) != 0;
|
||||
usize spaces = has_write_flag(PRETTY_TWO_SPACES) ? 2 : 4;
|
||||
bool newline = has_write_flag(NEWLINE_AT_END) != 0;
|
||||
|
||||
alc_len = estimated_val_num * YYJSON_WRITER_ESTIMATED_PRETTY_RATIO + 64;
|
||||
alc_len = size_align_up(alc_len, sizeof(yyjson_mut_write_ctx));
|
||||
@@ -9296,6 +9318,10 @@ ctn_end:
|
||||
}
|
||||
|
||||
doc_end:
|
||||
if (newline) {
|
||||
incr_len(2);
|
||||
*cur++ = '\n';
|
||||
}
|
||||
*cur = '\0';
|
||||
*dat_len = (usize)(cur - hdr);
|
||||
err->code = YYJSON_WRITE_SUCCESS;
|
||||
|
||||
Vendored
+35
-21
@@ -527,16 +527,16 @@ extern "C" {
|
||||
#define YYJSON_VERSION_MAJOR 0
|
||||
|
||||
/** The minor version of yyjson. */
|
||||
#define YYJSON_VERSION_MINOR 8
|
||||
#define YYJSON_VERSION_MINOR 9
|
||||
|
||||
/** The patch version of yyjson. */
|
||||
#define YYJSON_VERSION_PATCH 0
|
||||
|
||||
/** The version of yyjson in hex: `(major << 16) | (minor << 8) | (patch)`. */
|
||||
#define YYJSON_VERSION_HEX 0x000800
|
||||
#define YYJSON_VERSION_HEX 0x000900
|
||||
|
||||
/** The version string of yyjson. */
|
||||
#define YYJSON_VERSION_STRING "0.8.0"
|
||||
#define YYJSON_VERSION_STRING "0.9.0"
|
||||
|
||||
/** The version of yyjson in hex, same as `YYJSON_VERSION_HEX`. */
|
||||
yyjson_api uint32_t yyjson_version(void);
|
||||
@@ -738,7 +738,7 @@ typedef uint32_t yyjson_read_flag;
|
||||
- Report error if double number is infinity.
|
||||
- Report error if string contains invalid UTF-8 character or BOM.
|
||||
- Report error on trailing commas, comments, inf and nan literals. */
|
||||
static const yyjson_read_flag YYJSON_READ_NOFLAG = 0 << 0;
|
||||
static const yyjson_read_flag YYJSON_READ_NOFLAG = 0;
|
||||
|
||||
/** Read the input data in-situ.
|
||||
This option allows the reader to modify and use input data to store string
|
||||
@@ -1067,7 +1067,7 @@ typedef uint32_t yyjson_write_flag;
|
||||
- Report error on inf or nan number.
|
||||
- Report error on invalid UTF-8 string.
|
||||
- Do not escape unicode or slash. */
|
||||
static const yyjson_write_flag YYJSON_WRITE_NOFLAG = 0 << 0;
|
||||
static const yyjson_write_flag YYJSON_WRITE_NOFLAG = 0;
|
||||
|
||||
/** Write JSON pretty with 4 space indent. */
|
||||
static const yyjson_write_flag YYJSON_WRITE_PRETTY = 1 << 0;
|
||||
@@ -1096,6 +1096,10 @@ static const yyjson_write_flag YYJSON_WRITE_ALLOW_INVALID_UNICODE = 1 << 5;
|
||||
This flag will override `YYJSON_WRITE_PRETTY` flag. */
|
||||
static const yyjson_write_flag YYJSON_WRITE_PRETTY_TWO_SPACES = 1 << 6;
|
||||
|
||||
/** Adds a newline character `\n` at the end of the JSON.
|
||||
This can be helpful for text editors or NDJSON. */
|
||||
static const yyjson_write_flag YYJSON_WRITE_NEWLINE_AT_END = 1 << 7;
|
||||
|
||||
|
||||
|
||||
/** Result code for JSON writer */
|
||||
@@ -3695,7 +3699,7 @@ yyjson_api_inline bool yyjson_mut_obj_add_strcpy(yyjson_mut_doc *doc,
|
||||
The `len` should be the length of the `val`, in bytes.
|
||||
This function allows duplicated key in one object.
|
||||
|
||||
@warning The key/value strings are not copied, you should keep these strings
|
||||
@warning The key strings are not copied, you should keep these strings
|
||||
unmodified for the lifetime of this JSON document. */
|
||||
yyjson_api_inline bool yyjson_mut_obj_add_strncpy(yyjson_mut_doc *doc,
|
||||
yyjson_mut_val *obj,
|
||||
@@ -4829,6 +4833,7 @@ yyjson_api_inline size_t yyjson_doc_get_val_count(yyjson_doc *doc) {
|
||||
yyjson_api_inline void yyjson_doc_free(yyjson_doc *doc) {
|
||||
if (doc) {
|
||||
yyjson_alc alc = doc->alc;
|
||||
memset(&doc->alc, 0, sizeof(alc));
|
||||
if (doc->str_pool) alc.free(alc.ctx, doc->str_pool);
|
||||
alc.free(alc.ctx, doc);
|
||||
}
|
||||
@@ -5668,6 +5673,7 @@ yyjson_api_inline yyjson_mut_val *yyjson_mut_bool(yyjson_mut_doc *doc,
|
||||
if (yyjson_likely(doc)) {
|
||||
yyjson_mut_val *val = unsafe_yyjson_mut_val(doc, 1);
|
||||
if (yyjson_likely(val)) {
|
||||
_val = !!_val;
|
||||
val->tag = YYJSON_TYPE_BOOL | (uint8_t)((uint8_t)_val << 3);
|
||||
return val;
|
||||
}
|
||||
@@ -5920,7 +5926,8 @@ yyjson_api_inline yyjson_mut_val *yyjson_mut_arr(yyjson_mut_doc *doc) {
|
||||
yyjson_api_inline yyjson_mut_val *yyjson_mut_arr_with_bool(
|
||||
yyjson_mut_doc *doc, const bool *vals, size_t count) {
|
||||
yyjson_mut_arr_with_func({
|
||||
val->tag = YYJSON_TYPE_BOOL | (uint8_t)((uint8_t)vals[i] << 3);
|
||||
bool _val = !!vals[i];
|
||||
val->tag = YYJSON_TYPE_BOOL | (uint8_t)((uint8_t)_val << 3);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -6872,6 +6879,7 @@ yyjson_api_inline bool yyjson_mut_obj_add_bool(yyjson_mut_doc *doc,
|
||||
const char *_key,
|
||||
bool _val) {
|
||||
yyjson_mut_obj_add_func({
|
||||
_val = !!_val;
|
||||
val->tag = YYJSON_TYPE_BOOL | (uint8_t)((uint8_t)(_val) << 3);
|
||||
});
|
||||
}
|
||||
@@ -7730,33 +7738,39 @@ yyjson_api_inline bool yyjson_ptr_get_bool(
|
||||
}
|
||||
|
||||
/**
|
||||
Set provided `value` if the JSON Pointer (RFC 6901) exists and is type uint.
|
||||
Returns true if value at `ptr` exists and is the correct type, otherwise false.
|
||||
Set provided `value` if the JSON Pointer (RFC 6901) exists and is an integer
|
||||
that fits in `uint64_t`. Returns true if successful, otherwise false.
|
||||
*/
|
||||
yyjson_api_inline bool yyjson_ptr_get_uint(
|
||||
yyjson_val *root, const char *ptr, uint64_t *value) {
|
||||
yyjson_val *val = yyjson_ptr_get(root, ptr);
|
||||
if (value && yyjson_is_uint(val)) {
|
||||
*value = unsafe_yyjson_get_uint(val);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
if (value && val) {
|
||||
uint64_t ret = val->uni.u64;
|
||||
if (unsafe_yyjson_is_uint(val) ||
|
||||
(unsafe_yyjson_is_sint(val) && !(ret >> 63))) {
|
||||
*value = ret;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
Set provided `value` if the JSON Pointer (RFC 6901) exists and is type sint.
|
||||
Returns true if value at `ptr` exists and is the correct type, otherwise false.
|
||||
Set provided `value` if the JSON Pointer (RFC 6901) exists and is an integer
|
||||
that fits in `int64_t`. Returns true if successful, otherwise false.
|
||||
*/
|
||||
yyjson_api_inline bool yyjson_ptr_get_sint(
|
||||
yyjson_val *root, const char *ptr, int64_t *value) {
|
||||
yyjson_val *val = yyjson_ptr_get(root, ptr);
|
||||
if (value && yyjson_is_sint(val)) {
|
||||
*value = unsafe_yyjson_get_sint(val);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
if (value && val) {
|
||||
int64_t ret = val->uni.i64;
|
||||
if (unsafe_yyjson_is_sint(val) ||
|
||||
(unsafe_yyjson_is_uint(val) && ret >= 0)) {
|
||||
*value = ret;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
bool ffParseModuleOptions(const char* key, const char* value)
|
||||
{
|
||||
if (!ffStrStartsWith(key, "--") || !isalpha(key[2])) return false;
|
||||
if (!ffStrStartsWith(key, "--") || !ffCharIsEnglishAlphabet(key[2])) return false;
|
||||
|
||||
for (FFModuleBaseInfo** modules = ffModuleInfos[toupper(key[2]) - 'A']; *modules; ++modules)
|
||||
{
|
||||
@@ -79,30 +79,11 @@ static void genJsonResult(FFModuleBaseInfo* baseInfo, yyjson_mut_doc* doc)
|
||||
|
||||
static void parseStructureCommand(
|
||||
const char* line,
|
||||
FFlist* customValues,
|
||||
void (*fn)(FFModuleBaseInfo *baseInfo, yyjson_mut_doc* jsonDoc),
|
||||
yyjson_mut_doc* jsonDoc
|
||||
)
|
||||
{
|
||||
// handle `--set` and `--set-keyless`
|
||||
FF_LIST_FOR_EACH(FFCustomValue, customValue, *customValues)
|
||||
{
|
||||
if (ffStrbufEqualS(&customValue->key, line))
|
||||
{
|
||||
__attribute__((__cleanup__(ffDestroyCustomOptions))) FFCustomOptions options;
|
||||
ffInitCustomOptions(&options);
|
||||
if (customValue->printKey)
|
||||
ffStrbufAppend(&options.moduleArgs.key, &customValue->key);
|
||||
ffStrbufAppend(&options.moduleArgs.outputFormat, &customValue->value);
|
||||
if (__builtin_expect(jsonDoc != NULL, false))
|
||||
fn((FFModuleBaseInfo*) &options, jsonDoc);
|
||||
else
|
||||
ffPrintCustom(&options);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(isalpha(line[0]))
|
||||
if(ffCharIsEnglishAlphabet(line[0]))
|
||||
{
|
||||
for (FFModuleBaseInfo** modules = ffModuleInfos[toupper(line[0]) - 'A']; *modules; ++modules)
|
||||
{
|
||||
@@ -118,7 +99,7 @@ static void parseStructureCommand(
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintErrorString(line, 0, NULL, FF_PRINT_TYPE_NO_CUSTOM_KEY, "<no implementation provided>");
|
||||
ffPrintError(line, 0, NULL, FF_PRINT_TYPE_NO_CUSTOM_KEY, "<no implementation provided>");
|
||||
}
|
||||
|
||||
void ffPrintCommandOption(FFdata* data, yyjson_mut_doc* jsonDoc)
|
||||
@@ -134,7 +115,7 @@ void ffPrintCommandOption(FFdata* data, yyjson_mut_doc* jsonDoc)
|
||||
if(instance.config.display.stat)
|
||||
ms = ffTimeGetTick();
|
||||
|
||||
parseStructureCommand(data->structure.chars + startIndex, &data->customValues, genJsonResult, jsonDoc);
|
||||
parseStructureCommand(data->structure.chars + startIndex, genJsonResult, jsonDoc);
|
||||
|
||||
if(instance.config.display.stat)
|
||||
{
|
||||
@@ -177,7 +158,7 @@ void ffMigrateCommandOptionToJsonc(FFdata* data, yyjson_mut_doc* jsonDoc)
|
||||
uint32_t colonIndex = ffStrbufNextIndexC(&data->structure, startIndex, ':');
|
||||
data->structure.chars[colonIndex] = '\0';
|
||||
|
||||
parseStructureCommand(data->structure.chars + startIndex, &data->customValues, genJsonConfig, jsonDoc);
|
||||
parseStructureCommand(data->structure.chars + startIndex, genJsonConfig, jsonDoc);
|
||||
|
||||
startIndex = colonIndex + 1;
|
||||
}
|
||||
|
||||
@@ -2,18 +2,10 @@
|
||||
|
||||
#include "fastfetch.h"
|
||||
|
||||
typedef struct FFCustomValue
|
||||
{
|
||||
bool printKey;
|
||||
FFstrbuf key;
|
||||
FFstrbuf value;
|
||||
} FFCustomValue;
|
||||
|
||||
// Things only needed by fastfetch
|
||||
typedef struct FFdata
|
||||
{
|
||||
FFstrbuf structure;
|
||||
FFlist customValues; // List of FFCustomValue
|
||||
bool configLoaded;
|
||||
} FFdata;
|
||||
|
||||
|
||||
+6
-4
@@ -181,22 +181,24 @@ DBusMessage* ffDBusGetProperty(FFDBusData* dbus, const char* busName, const char
|
||||
return reply;
|
||||
}
|
||||
|
||||
void ffDBusGetPropertyString(FFDBusData* dbus, const char* busName, const char* objectPath, const char* interface, const char* property, FFstrbuf* result)
|
||||
bool ffDBusGetPropertyString(FFDBusData* dbus, const char* busName, const char* objectPath, const char* interface, const char* property, FFstrbuf* result)
|
||||
{
|
||||
DBusMessage* reply = ffDBusGetProperty(dbus, busName, objectPath, interface, property);
|
||||
if(reply == NULL)
|
||||
return;
|
||||
return false;
|
||||
|
||||
DBusMessageIter rootIterator;
|
||||
if(!dbus->lib->ffdbus_message_iter_init(reply, &rootIterator))
|
||||
{
|
||||
dbus->lib->ffdbus_message_unref(reply);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
ffDBusGetValue(dbus, &rootIterator, result);
|
||||
bool ret = ffDBusGetValue(dbus, &rootIterator, result);
|
||||
|
||||
dbus->lib->ffdbus_message_unref(reply);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif //FF_HAVE_DBUS
|
||||
|
||||
+1
-1
@@ -48,6 +48,6 @@ bool ffDBusGetBool(FFDBusData* dbus, DBusMessageIter* iter, bool* result);
|
||||
bool ffDBusGetByte(FFDBusData* dbus, DBusMessageIter* iter, uint8_t* result);
|
||||
DBusMessage* ffDBusGetMethodReply(FFDBusData* dbus, const char* busName, const char* objectPath, const char* interface, const char* method);
|
||||
DBusMessage* ffDBusGetProperty(FFDBusData* dbus, const char* busName, const char* objectPath, const char* interface, const char* property);
|
||||
void ffDBusGetPropertyString(FFDBusData* dbus, const char* busName, const char* objectPath, const char* interface, const char* property, FFstrbuf* result);
|
||||
bool ffDBusGetPropertyString(FFDBusData* dbus, const char* busName, const char* objectPath, const char* interface, const char* property, FFstrbuf* result);
|
||||
|
||||
#endif // FF_HAVE_DBUS
|
||||
|
||||
+19
-44
@@ -2,6 +2,7 @@
|
||||
#include "common/font.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
void ffFontInit(FFfont* font)
|
||||
{
|
||||
@@ -66,59 +67,33 @@ void ffFontInitQt(FFfont* font, const char* data)
|
||||
//See https://doc.qt.io/qt-5/qfont.html#toString
|
||||
|
||||
//Family
|
||||
while(*data != ',' && *data != '\0')
|
||||
{
|
||||
ffStrbufAppendC(&font->name, *data);
|
||||
++data;
|
||||
}
|
||||
if(*data != '\0')
|
||||
++data;
|
||||
data = ffStrbufAppendSUntilC(&font->name, data, ',');
|
||||
ffStrbufTrim(&font->name, ' ');
|
||||
if (!data) goto exit;
|
||||
data++;
|
||||
|
||||
//Size
|
||||
while(*data != ',' && *data != '\0')
|
||||
{
|
||||
ffStrbufAppendC(&font->size, *data);
|
||||
++data;
|
||||
}
|
||||
if(*data != '\0')
|
||||
++data;
|
||||
data = ffStrbufAppendSUntilC(&font->size, data, ',');
|
||||
ffStrbufTrim(&font->size, ' ');
|
||||
if (!data) goto exit;
|
||||
data++;
|
||||
|
||||
#define FF_FONT_QT_SKIP_VALUE \
|
||||
while(*data != ',' && *data != '\0') \
|
||||
++data; \
|
||||
if(*data != '\0') \
|
||||
++data;
|
||||
|
||||
FF_FONT_QT_SKIP_VALUE //Pixel size
|
||||
FF_FONT_QT_SKIP_VALUE //Style hint
|
||||
FF_FONT_QT_SKIP_VALUE //Font weight
|
||||
FF_FONT_QT_SKIP_VALUE //Font style
|
||||
FF_FONT_QT_SKIP_VALUE //Underline
|
||||
FF_FONT_QT_SKIP_VALUE //Strike out
|
||||
FF_FONT_QT_SKIP_VALUE //Fixed pitch
|
||||
FF_FONT_QT_SKIP_VALUE //Always 0
|
||||
|
||||
#undef FF_FONT_QT_SKIP_VALUE
|
||||
|
||||
while(*data != '\0')
|
||||
//Style
|
||||
data = strrchr(data, ',');
|
||||
if (!data) goto exit;
|
||||
data++;
|
||||
if (isalpha(*data))
|
||||
{
|
||||
while(*data == ' ')
|
||||
++data;
|
||||
|
||||
if(*data == '\0')
|
||||
break;
|
||||
|
||||
FFstrbuf* style = ffListAdd(&font->styles);
|
||||
ffStrbufInit(style);
|
||||
while(*data != ' ' && *data != '\0')
|
||||
do
|
||||
{
|
||||
ffStrbufAppendC(style, *data);
|
||||
++data;
|
||||
}
|
||||
FFstrbuf* style = ffListAdd(&font->styles);
|
||||
ffStrbufInit(style);
|
||||
data = ffStrbufAppendSUntilC(style, data, ' ');
|
||||
if (data) data++;
|
||||
} while (data);
|
||||
}
|
||||
|
||||
exit:
|
||||
fontInitPretty(font);
|
||||
}
|
||||
|
||||
|
||||
+78
-57
@@ -52,14 +52,29 @@ void ffFormatAppendFormatArg(FFstrbuf* buffer, const FFformatarg* formatarg)
|
||||
* @param placeholderValue the string to parse
|
||||
* @return uint32_t the parsed value
|
||||
*/
|
||||
static inline uint32_t getArgumentIndex(const FFstrbuf* placeholderValue)
|
||||
static uint32_t getArgumentIndex(const FFstrbuf* placeholderValue, uint32_t numArgs, const FFformatarg* arguments)
|
||||
{
|
||||
uint32_t result = UINT32_MAX;
|
||||
char firstChar = placeholderValue->chars[0];
|
||||
|
||||
if(placeholderValue->chars[0] != '-')
|
||||
sscanf(placeholderValue->chars, "%" PRIu32, &result);
|
||||
if(firstChar >= '1' && firstChar <= '9')
|
||||
{
|
||||
char* pEnd = NULL;
|
||||
unsigned long result = strtoul(placeholderValue->chars, &pEnd, 10);
|
||||
if (pEnd != placeholderValue->chars + placeholderValue->length || result > numArgs)
|
||||
return UINT32_MAX;
|
||||
return (uint32_t) result;
|
||||
}
|
||||
else if (ffCharIsEnglishAlphabet(firstChar))
|
||||
{
|
||||
for (uint32_t i = 0; i < numArgs; ++i)
|
||||
{
|
||||
const FFformatarg* arg = &arguments[i];
|
||||
if(arg->name && ffStrbufIgnCaseEqualS(placeholderValue, arg->name))
|
||||
return i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return result == 0 ? UINT32_MAX : result;
|
||||
return UINT32_MAX;
|
||||
}
|
||||
|
||||
static inline void appendInvalidPlaceholder(FFstrbuf* buffer, const char* start, const FFstrbuf* placeholderValue, uint32_t index, uint32_t formatStringLength)
|
||||
@@ -101,7 +116,8 @@ void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t n
|
||||
|
||||
uint32_t numOpenIfs = 0;
|
||||
uint32_t numOpenNotIfs = 0;
|
||||
uint32_t numOpenColors = 0;
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY placeholderValue = ffStrbufCreate();
|
||||
|
||||
for(uint32_t i = 0; i < formatstr->length; ++i)
|
||||
{
|
||||
@@ -136,67 +152,70 @@ void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t n
|
||||
continue;
|
||||
}
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY placeholderValue = ffStrbufCreate();
|
||||
ffStrbufClear(&placeholderValue);
|
||||
|
||||
while(i < formatstr->length && formatstr->chars[i] != '}')
|
||||
ffStrbufAppendC(&placeholderValue, formatstr->chars[i++]);
|
||||
|
||||
// test if for stop, if so break the loop
|
||||
if(placeholderValue.length == 1 && placeholderValue.chars[0] == '-')
|
||||
break;
|
||||
|
||||
// test for end of an if, if so do nothing
|
||||
if(placeholderValue.length == 1 && placeholderValue.chars[0] == '?')
|
||||
{
|
||||
if(numOpenIfs == 0)
|
||||
appendInvalidPlaceholder(buffer, "{", &placeholderValue, i, formatstr->length);
|
||||
else
|
||||
--numOpenIfs;
|
||||
|
||||
continue;
|
||||
uint32_t iEnd = ffStrbufNextIndexC(formatstr, i, '}');
|
||||
ffStrbufAppendNS(&placeholderValue, iEnd - i, &formatstr->chars[i]);
|
||||
i = iEnd;
|
||||
}
|
||||
|
||||
// test for end of a not if, if so do nothing
|
||||
if(placeholderValue.length == 1 && placeholderValue.chars[0] == '/')
|
||||
{
|
||||
if(numOpenNotIfs == 0)
|
||||
appendInvalidPlaceholder(buffer, "{", &placeholderValue, i, formatstr->length);
|
||||
else
|
||||
--numOpenNotIfs;
|
||||
char firstChar = placeholderValue.chars[0];
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// test for end of a color, if so do nothing
|
||||
if(placeholderValue.length == 1 && placeholderValue.chars[0] == '#')
|
||||
if (placeholderValue.length == 1)
|
||||
{
|
||||
if(numOpenColors == 0)
|
||||
appendInvalidPlaceholder(buffer, "{", &placeholderValue, i, formatstr->length);
|
||||
else
|
||||
// test if for stop, if so break the loop
|
||||
if (firstChar == '-')
|
||||
break;
|
||||
|
||||
// test for end of an if, if so do nothing
|
||||
if (firstChar == '?')
|
||||
{
|
||||
ffStrbufAppendS(buffer, FASTFETCH_TEXT_MODIFIER_RESET);
|
||||
--numOpenColors;
|
||||
if(numOpenIfs == 0)
|
||||
appendInvalidPlaceholder(buffer, "{", &placeholderValue, i, formatstr->length);
|
||||
else
|
||||
--numOpenIfs;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
continue;
|
||||
// test for end of a not if, if so do nothing
|
||||
if (firstChar == '/')
|
||||
{
|
||||
if(numOpenNotIfs == 0)
|
||||
appendInvalidPlaceholder(buffer, "{", &placeholderValue, i, formatstr->length);
|
||||
else
|
||||
--numOpenNotIfs;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// test for end of a color, if so do nothing
|
||||
if (firstChar == '#')
|
||||
{
|
||||
if (!instance.config.display.pipe)
|
||||
ffStrbufAppendS(buffer, FASTFETCH_TEXT_MODIFIER_RESET);
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// test for if, if so evaluate it
|
||||
if(placeholderValue.chars[0] == '?')
|
||||
if (firstChar == '?')
|
||||
{
|
||||
ffStrbufSubstrAfter(&placeholderValue, 0);
|
||||
|
||||
uint32_t index = getArgumentIndex(&placeholderValue);
|
||||
uint32_t index = getArgumentIndex(&placeholderValue, numArgs, arguments);
|
||||
|
||||
// testing for an invalid index
|
||||
if(index > numArgs)
|
||||
if (index > numArgs)
|
||||
{
|
||||
appendInvalidPlaceholder(buffer, "{?", &placeholderValue, i, formatstr->length);
|
||||
continue;
|
||||
}
|
||||
|
||||
// continue normally if an format arg is set and the value is > 0
|
||||
if(formatArgSet(&arguments[index - 1]))
|
||||
if (formatArgSet(&arguments[index - 1]))
|
||||
{
|
||||
++numOpenIfs;
|
||||
continue;
|
||||
@@ -208,21 +227,21 @@ void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t n
|
||||
}
|
||||
|
||||
// test for not if, if so evaluate it
|
||||
if(placeholderValue.chars[0] == '/')
|
||||
if (firstChar == '/')
|
||||
{
|
||||
ffStrbufSubstrAfter(&placeholderValue, 0);
|
||||
|
||||
uint32_t index = getArgumentIndex(&placeholderValue);
|
||||
uint32_t index = getArgumentIndex(&placeholderValue, numArgs, arguments);
|
||||
|
||||
// testing for an invalid index
|
||||
if(index > numArgs)
|
||||
if (index > numArgs)
|
||||
{
|
||||
appendInvalidPlaceholder(buffer, "{/", &placeholderValue, i, formatstr->length);
|
||||
continue;
|
||||
}
|
||||
|
||||
//continue normally if an format arg is not set or the value is 0
|
||||
if(!formatArgSet(&arguments[index - 1]))
|
||||
if (!formatArgSet(&arguments[index - 1]))
|
||||
{
|
||||
++numOpenNotIfs;
|
||||
continue;
|
||||
@@ -234,20 +253,21 @@ void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t n
|
||||
}
|
||||
|
||||
//test for color, if so evaluate it
|
||||
if(placeholderValue.chars[0] == '#')
|
||||
if (firstChar == '#')
|
||||
{
|
||||
++numOpenColors;
|
||||
ffStrbufSubstrAfter(&placeholderValue, 0);
|
||||
ffStrbufAppendS(buffer, "\033[");
|
||||
ffStrbufAppend(buffer, &placeholderValue);
|
||||
ffStrbufAppendC(buffer, 'm');
|
||||
if (!instance.config.display.pipe)
|
||||
{
|
||||
ffStrbufAppendS(buffer, "\e[");
|
||||
ffOptionParseColorNoClear(placeholderValue.chars + 1, buffer);
|
||||
ffStrbufAppendC(buffer, 'm');
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32_t index = getArgumentIndex(&placeholderValue);
|
||||
uint32_t index = getArgumentIndex(&placeholderValue, numArgs, arguments);
|
||||
|
||||
// test for invalid index
|
||||
if(index > numArgs)
|
||||
if (index > numArgs)
|
||||
{
|
||||
appendInvalidPlaceholder(buffer, "{", &placeholderValue, i, formatstr->length);
|
||||
continue;
|
||||
@@ -256,5 +276,6 @@ void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t n
|
||||
ffFormatAppendFormatArg(buffer, &arguments[index - 1]);
|
||||
}
|
||||
|
||||
ffStrbufAppendS(buffer, FASTFETCH_TEXT_MODIFIER_RESET);
|
||||
if (!instance.config.display.pipe)
|
||||
ffStrbufAppendS(buffer, FASTFETCH_TEXT_MODIFIER_RESET);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,12 @@ typedef struct FFformatarg
|
||||
{
|
||||
FFformatargtype type;
|
||||
const void* value;
|
||||
const char* name; // argument name, must start with an alphabet
|
||||
} FFformatarg;
|
||||
|
||||
void ffFormatAppendFormatArg(FFstrbuf* buffer, const FFformatarg* formatarg);
|
||||
void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t numArgs, const FFformatarg* arguments);
|
||||
#define FF_PARSE_FORMAT_STRING_CHECKED(buffer, formatstr, numArgs, arguments) do {\
|
||||
static_assert(sizeof(arguments) / sizeof(*(arguments)) == (numArgs), "Invalid number of format arguments");\
|
||||
ffParseFormatString((buffer), (formatstr), (numArgs), (arguments));\
|
||||
} while (0)
|
||||
|
||||
+5
-5
@@ -238,9 +238,6 @@ 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
|
||||
@@ -250,8 +247,11 @@ void ffListFeatures(void)
|
||||
#ifdef FF_USE_SYSTEM_YYJSON
|
||||
"System yyjson\n"
|
||||
#endif
|
||||
#ifdef FF_USE_PCI_MEMORY
|
||||
"PCI memory\n"
|
||||
#if __has_include(<linux/videodev2.h>)
|
||||
"linux/videodev2\n"
|
||||
#endif
|
||||
#if __has_include(<linux/wireless.h>)
|
||||
"linux/wireless\n"
|
||||
#endif
|
||||
""
|
||||
, stdout);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "io.h"
|
||||
#include "fastfetch.h"
|
||||
#include "util/stringUtils.h"
|
||||
#include "util/unused.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <termios.h>
|
||||
@@ -133,6 +133,9 @@ bool ffPathExpandEnv(FF_MAYBE_UNUSED const char* in, FF_MAYBE_UNUSED FFstrbuf* o
|
||||
|
||||
const char* ffGetTerminalResponse(const char* request, const char* format, ...)
|
||||
{
|
||||
if (instance.config.display.pipe)
|
||||
return "Not supported in --pipe mode";
|
||||
|
||||
struct termios oldTerm, newTerm;
|
||||
if(tcgetattr(STDIN_FILENO, &oldTerm) == -1)
|
||||
return "tcgetattr(STDIN_FILENO, &oldTerm) failed";
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "io.h"
|
||||
#include "fastfetch.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#include <windows.h>
|
||||
@@ -174,6 +175,9 @@ void ffListFilesRecursively(const char* path, bool pretty)
|
||||
|
||||
const char* ffGetTerminalResponse(const char* request, const char* format, ...)
|
||||
{
|
||||
if (instance.config.display.pipe)
|
||||
return "Not supported in --pipe mode";
|
||||
|
||||
HANDLE hInput = GetStdHandle(STD_INPUT_HANDLE);
|
||||
DWORD prev_mode;
|
||||
GetConsoleMode(hInput, &prev_mode);
|
||||
|
||||
@@ -22,6 +22,11 @@ bool ffJsonConfigParseModuleArgs(const char* key, yyjson_val* val, FFModuleArgs*
|
||||
ffStrbufSetNS(&moduleArgs->outputFormat, (uint32_t) yyjson_get_len(val), yyjson_get_str(val));
|
||||
return true;
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(key, "outputColor"))
|
||||
{
|
||||
ffOptionParseColor(yyjson_get_str(val), &moduleArgs->outputColor);
|
||||
return true;
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(key, "keyColor"))
|
||||
{
|
||||
ffOptionParseColor(yyjson_get_str(val), &moduleArgs->keyColor);
|
||||
@@ -94,7 +99,7 @@ static inline void genJsonResult(FFModuleBaseInfo* baseInfo, yyjson_mut_doc* doc
|
||||
|
||||
static bool parseModuleJsonObject(const char* type, yyjson_val* jsonVal, yyjson_mut_doc* jsonDoc)
|
||||
{
|
||||
if(!isalpha(type[0])) return false;
|
||||
if(!ffCharIsEnglishAlphabet(type[0])) return false;
|
||||
|
||||
for (FFModuleBaseInfo** modules = ffModuleInfos[toupper(type[0]) - 'A']; *modules; ++modules)
|
||||
{
|
||||
@@ -235,6 +240,6 @@ void ffPrintJsonConfig(bool prepare, yyjson_mut_doc* jsonDoc)
|
||||
yyjson_mut_doc_set_root(jsonDoc, obj);
|
||||
}
|
||||
else
|
||||
ffPrintErrorString("JsonConfig", 0, NULL, FF_PRINT_TYPE_NO_CUSTOM_KEY, "%s", error);
|
||||
ffPrintError("JsonConfig", 0, NULL, FF_PRINT_TYPE_NO_CUSTOM_KEY, "%s", error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
#include "fastfetch.h"
|
||||
#include "common/library.h"
|
||||
|
||||
#ifndef FF_DISABLE_DLOPEN
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
//Clang doesn't define __SANITIZE_ADDRESS__ but defines __has_feature(address_sanitizer)
|
||||
#if defined(__has_feature)
|
||||
#if !defined(__SANITIZE_ADDRESS__) && defined(__has_feature)
|
||||
#if __has_feature(address_sanitizer)
|
||||
#define __SANITIZE_ADDRESS__
|
||||
#endif
|
||||
@@ -77,3 +79,5 @@ void* ffLibraryLoad(const FFstrbuf* userProvidedName, ...)
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#include "fastfetch.h"
|
||||
#include "util/FFcheckmacros.h"
|
||||
|
||||
#ifndef FF_DISABLE_DLOPEN
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <libloaderapi.h>
|
||||
#define FF_DLOPEN_FLAGS 0
|
||||
@@ -71,3 +73,45 @@ static inline void ffLibraryUnload(void** handle)
|
||||
FF_LIBRARY_LOAD_SYMBOL_ADDRESS(library, (varName)->ff ## symbolName, symbolName, returnValue);
|
||||
|
||||
void* ffLibraryLoad(const FFstrbuf* userProvidedName, ...);
|
||||
|
||||
#else
|
||||
|
||||
#define FF_LIBRARY_EXTENSION ""
|
||||
|
||||
#define FF_LIBRARY_SYMBOL(symbolName) \
|
||||
__typeof__(&symbolName) ff ## symbolName;
|
||||
|
||||
#define FF_LIBRARY_LOAD(libraryObjectName, userLibraryName, returnValue, ...) \
|
||||
FF_MAYBE_UNUSED void* libraryObjectName = NULL; // Placeholder
|
||||
|
||||
#define FF_LIBRARY_LOAD_SYMBOL_ADDRESS(library, symbolMapping, symbolName, returnValue) \
|
||||
symbolMapping = (__typeof__(&symbolName)) &symbolName
|
||||
|
||||
#define FF_LIBRARY_LOAD_SYMBOL_ADDRESS2(library, symbolMapping, symbolName, alternateName, returnValue) \
|
||||
symbolMapping = (__typeof__(&symbolName)) &symbolName
|
||||
|
||||
#define FF_LIBRARY_LOAD_SYMBOL(library, symbolName, returnValue) \
|
||||
FF_MAYBE_UNUSED __typeof__(&symbolName) FF_LIBRARY_LOAD_SYMBOL_ADDRESS(library, ff ## symbolName, symbolName, returnValue);
|
||||
|
||||
#define FF_LIBRARY_LOAD_SYMBOL_LAZY(library, symbolName) \
|
||||
FF_MAYBE_UNUSED __typeof__(&symbolName) ff ## symbolName = (__typeof__(&symbolName)) &symbolName;
|
||||
|
||||
#define FF_LIBRARY_LOAD_SYMBOL_MESSAGE(library, symbolName) \
|
||||
FF_MAYBE_UNUSED __typeof__(&symbolName) FF_LIBRARY_LOAD_SYMBOL_ADDRESS(library, ff ## symbolName, symbolName, "dlsym " #symbolName " failed");
|
||||
|
||||
#define FF_LIBRARY_LOAD_SYMBOL_MESSAGE2(library, symbolName, alternateName) \
|
||||
FF_MAYBE_UNUSED __typeof__(&symbolName) FF_LIBRARY_LOAD_SYMBOL_ADDRESS2(library, ff ## symbolName, symbolName, alternateName, "dlsym " #symbolName " failed");
|
||||
|
||||
#define FF_LIBRARY_LOAD_SYMBOL_VAR(library, varName, symbolName, returnValue) \
|
||||
FF_LIBRARY_LOAD_SYMBOL_ADDRESS(library, (varName).ff ## symbolName, symbolName, returnValue);
|
||||
|
||||
#define FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(library, varName, symbolName) \
|
||||
FF_LIBRARY_LOAD_SYMBOL_ADDRESS(library, (varName).ff ## symbolName, symbolName, "dlsym " #symbolName " failed");
|
||||
|
||||
#define FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE2(library, varName, symbolName, alternateName) \
|
||||
FF_LIBRARY_LOAD_SYMBOL_ADDRESS2(library, (varName).ff ## symbolName, symbolName, alternateName, "dlsym " #symbolName " failed");
|
||||
|
||||
#define FF_LIBRARY_LOAD_SYMBOL_PTR(library, varName, symbolName, returnValue) \
|
||||
FF_LIBRARY_LOAD_SYMBOL_ADDRESS(library, (varName)->ff ## symbolName, symbolName, returnValue);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,6 +9,7 @@ static FFModuleBaseInfo* B[] = {
|
||||
(void*) &instance.config.modules.bios,
|
||||
(void*) &instance.config.modules.bluetooth,
|
||||
(void*) &instance.config.modules.board,
|
||||
(void*) &instance.config.modules.bootmgr,
|
||||
(void*) &instance.config.modules.break_,
|
||||
(void*) &instance.config.modules.brightness,
|
||||
NULL,
|
||||
@@ -36,6 +37,7 @@ static FFModuleBaseInfo* D[] = {
|
||||
};
|
||||
|
||||
static FFModuleBaseInfo* E[] = {
|
||||
(void*) &instance.config.modules.editor,
|
||||
NULL,
|
||||
};
|
||||
|
||||
@@ -57,6 +59,7 @@ static FFModuleBaseInfo* H[] = {
|
||||
|
||||
static FFModuleBaseInfo* I[] = {
|
||||
(void*) &instance.config.modules.icons,
|
||||
(void*) &instance.config.modules.initSystem,
|
||||
NULL,
|
||||
};
|
||||
|
||||
@@ -71,6 +74,7 @@ static FFModuleBaseInfo* K[] = {
|
||||
|
||||
static FFModuleBaseInfo* L[] = {
|
||||
(void*) &instance.config.modules.lm,
|
||||
(void*) &instance.config.modules.loadavg,
|
||||
(void*) &instance.config.modules.locale,
|
||||
(void*) &instance.config.modules.localIP,
|
||||
NULL,
|
||||
@@ -98,6 +102,7 @@ static FFModuleBaseInfo* O[] = {
|
||||
static FFModuleBaseInfo* P[] = {
|
||||
(void*) &instance.config.modules.packages,
|
||||
(void*) &instance.config.modules.physicalDisk,
|
||||
(void*) &instance.config.modules.physicalMemory,
|
||||
(void*) &instance.config.modules.player,
|
||||
(void*) &instance.config.modules.powerAdapter,
|
||||
(void*) &instance.config.modules.processes,
|
||||
|
||||
+5
-10
@@ -20,15 +20,10 @@ typedef struct FFNetworkingState {
|
||||
FFThreadType thread;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
uint32_t timeout;
|
||||
bool ipv6;
|
||||
} FFNetworkingState;
|
||||
|
||||
bool ffNetworkingSendHttpRequest(FFNetworkingState* state, const char* host, const char* path, const char* headers);
|
||||
bool ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buffer, uint32_t timeout);
|
||||
|
||||
static inline bool ffNetworkingGetHttp(const char* host, const char* path, uint32_t timeout, const char* headers, FFstrbuf* buffer)
|
||||
{
|
||||
FFNetworkingState state;
|
||||
if(ffNetworkingSendHttpRequest(&state, host, path, headers))
|
||||
return ffNetworkingRecvHttpResponse(&state, buffer, timeout);
|
||||
return false;
|
||||
}
|
||||
const char* ffNetworkingSendHttpRequest(FFNetworkingState* state, const char* host, const char* path, const char* headers);
|
||||
const char* ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buffer);
|
||||
|
||||
@@ -5,30 +5,50 @@
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h> // For FreeBSD
|
||||
#include <netinet/tcp.h>
|
||||
|
||||
static void connectAndSend(FFNetworkingState* state)
|
||||
static const char* connectAndSend(FFNetworkingState* state)
|
||||
{
|
||||
struct addrinfo hints = {
|
||||
.ai_family = AF_INET,
|
||||
.ai_socktype = SOCK_STREAM,
|
||||
};
|
||||
|
||||
const char* ret = NULL;
|
||||
struct addrinfo* addr;
|
||||
|
||||
if(getaddrinfo(state->host.chars, "80", &hints, &addr) != 0)
|
||||
if(getaddrinfo(state->host.chars, "80", &(struct addrinfo) {
|
||||
.ai_family = state->ipv6 ? AF_INET6 : AF_INET,
|
||||
.ai_socktype = SOCK_STREAM,
|
||||
}, &addr) != 0)
|
||||
{
|
||||
ret = "getaddrinfo() failed";
|
||||
goto error;
|
||||
}
|
||||
|
||||
state->sockfd = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol);
|
||||
if(state->sockfd == -1)
|
||||
{
|
||||
freeaddrinfo(addr);
|
||||
ret = "socket() failed";
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (state->timeout > 0)
|
||||
{
|
||||
FF_MAYBE_UNUSED uint32_t sec = state->timeout / 1000;
|
||||
if (sec == 0) sec = 1;
|
||||
|
||||
#ifdef TCP_CONNECTIONTIMEOUT
|
||||
setsockopt(state->sockfd, IPPROTO_TCP, TCP_CONNECTIONTIMEOUT, &sec, sizeof(sec));
|
||||
#elif defined(TCP_KEEPINIT)
|
||||
setsockopt(state->sockfd, IPPROTO_TCP, TCP_KEEPINIT, &sec, sizeof(sec));
|
||||
#elif defined(TCP_USER_TIMEOUT)
|
||||
setsockopt(state->sockfd, IPPROTO_TCP, TCP_USER_TIMEOUT, &state->timeout, sizeof(state->timeout));
|
||||
#endif
|
||||
}
|
||||
|
||||
if(connect(state->sockfd, addr->ai_addr, addr->ai_addrlen) == -1)
|
||||
{
|
||||
close(state->sockfd);
|
||||
freeaddrinfo(addr);
|
||||
ret = "connect() failed";
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -37,6 +57,7 @@ static void connectAndSend(FFNetworkingState* state)
|
||||
if(send(state->sockfd, state->command.chars, state->command.length, 0) < 0)
|
||||
{
|
||||
close(state->sockfd);
|
||||
ret = "send() failed";
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -48,11 +69,13 @@ error:
|
||||
exit:
|
||||
ffStrbufDestroy(&state->host);
|
||||
ffStrbufDestroy(&state->command);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
FF_THREAD_ENTRY_DECL_WRAPPER(connectAndSend, FFNetworkingState*);
|
||||
|
||||
bool ffNetworkingSendHttpRequest(FFNetworkingState* state, const char* host, const char* path, const char* headers)
|
||||
const char* ffNetworkingSendHttpRequest(FFNetworkingState* state, const char* host, const char* path, const char* headers)
|
||||
{
|
||||
ffStrbufInitS(&state->host, host);
|
||||
|
||||
@@ -66,22 +89,30 @@ bool ffNetworkingSendHttpRequest(FFNetworkingState* state, const char* host, con
|
||||
ffStrbufAppendS(&state->command, "\r\n");
|
||||
|
||||
#ifdef FF_HAVE_THREADS
|
||||
if (instance.config.general.multithreading)
|
||||
{
|
||||
state->thread = ffThreadCreate(connectAndSendThreadMain, state);
|
||||
return !!state->thread;
|
||||
#else
|
||||
connectAndSend(state);
|
||||
return state->sockfd != -1;
|
||||
return state->thread ? NULL : "ffThreadCreate(connectAndSend) failed";
|
||||
}
|
||||
#endif
|
||||
|
||||
return connectAndSend(state);
|
||||
}
|
||||
|
||||
bool ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buffer, uint32_t timeout)
|
||||
const char* ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buffer)
|
||||
{
|
||||
uint32_t timeout = state->timeout;
|
||||
|
||||
#ifdef FF_HAVE_THREADS
|
||||
if (instance.config.general.multithreading)
|
||||
{
|
||||
if (!ffThreadJoin(state->thread, timeout))
|
||||
return false;
|
||||
return "ffThreadJoin() failed or timeout";
|
||||
}
|
||||
#endif
|
||||
|
||||
if(state->sockfd == -1)
|
||||
return false;
|
||||
return "ffNetworkingSendHttpRequest() failed";
|
||||
|
||||
if(timeout > 0)
|
||||
{
|
||||
@@ -91,14 +122,15 @@ bool ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buffer, ui
|
||||
setsockopt(state->sockfd, SOL_SOCKET, SO_RCVTIMEO, &timev, sizeof(timev));
|
||||
}
|
||||
|
||||
ssize_t received = recv(state->sockfd, buffer->chars + buffer->length, ffStrbufGetFree(buffer), 0);
|
||||
|
||||
if(received > 0)
|
||||
{
|
||||
uint32_t recvStart;
|
||||
do {
|
||||
recvStart = buffer->length;
|
||||
ssize_t received = recv(state->sockfd, buffer->chars + buffer->length, ffStrbufGetFree(buffer), 0);
|
||||
if (received <= 0) break;
|
||||
buffer->length += (uint32_t) received;
|
||||
buffer->chars[buffer->length] = '\0';
|
||||
}
|
||||
} while (ffStrbufGetFree(buffer) > 0 && strstr(buffer->chars + recvStart, "\r\n\r\n") == NULL);
|
||||
|
||||
close(state->sockfd);
|
||||
return ffStrbufStartsWithS(buffer, "HTTP/1.1 200 OK\r\n");
|
||||
return ffStrbufStartsWithS(buffer, "HTTP/1.1 200 OK\r\n") ? NULL : "Invalid response";
|
||||
}
|
||||
|
||||
@@ -33,48 +33,48 @@ static const char* initWsaData(WSADATA* wsaData)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool ffNetworkingSendHttpRequest(FFNetworkingState* state, const char* host, const char* path, const char* headers)
|
||||
const char* ffNetworkingSendHttpRequest(FFNetworkingState* state, const char* host, const char* path, const char* headers)
|
||||
{
|
||||
static WSADATA wsaData;
|
||||
if (wsaData.wVersion == 0)
|
||||
{
|
||||
if (initWsaData(&wsaData) != NULL)
|
||||
const char* error = initWsaData(&wsaData);
|
||||
if (error != NULL)
|
||||
{
|
||||
wsaData.wVersion = (WORD) -1;
|
||||
return false;
|
||||
return error;
|
||||
}
|
||||
}
|
||||
else if (wsaData.wVersion == (WORD) -1)
|
||||
return false;
|
||||
|
||||
memset(state, 0, sizeof(*state));
|
||||
return "initWsaData() failed before";
|
||||
|
||||
struct addrinfo* addr;
|
||||
|
||||
if(getaddrinfo(host, "80", &(struct addrinfo) {
|
||||
.ai_family = AF_INET,
|
||||
.ai_family = state->ipv6 ? AF_INET6 : AF_INET,
|
||||
.ai_socktype = SOCK_STREAM,
|
||||
}, &addr) != 0)
|
||||
return false;
|
||||
return "getaddrinfo() failed";
|
||||
|
||||
state->sockfd = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol);
|
||||
if(state->sockfd == INVALID_SOCKET)
|
||||
{
|
||||
freeaddrinfo(addr);
|
||||
return false;
|
||||
return "socket() failed";
|
||||
}
|
||||
|
||||
{
|
||||
//ConnectEx requires the socket to be initially bound
|
||||
struct sockaddr_in addr = {
|
||||
if(bind(state->sockfd, (SOCKADDR *) &(struct sockaddr_in) {
|
||||
.sin_family = AF_INET,
|
||||
.sin_addr.s_addr = INADDR_ANY,
|
||||
.sin_port = 0,
|
||||
};
|
||||
if(bind(state->sockfd, (SOCKADDR *)&addr, sizeof(addr)) != 0)
|
||||
}, sizeof(struct sockaddr_in)) != 0)
|
||||
{
|
||||
printf("bind %d\n", WSAGetLastError());
|
||||
return false;
|
||||
closesocket(state->sockfd);
|
||||
freeaddrinfo(addr);
|
||||
state->sockfd = INVALID_SOCKET;
|
||||
return "bind() failed";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,35 +93,52 @@ bool ffNetworkingSendHttpRequest(FFNetworkingState* state, const char* host, con
|
||||
if(!result && WSAGetLastError() != WSA_IO_PENDING)
|
||||
{
|
||||
closesocket(state->sockfd);
|
||||
return false;
|
||||
freeaddrinfo(addr);
|
||||
state->sockfd = INVALID_SOCKET;
|
||||
return "ConnectEx() failed";
|
||||
}
|
||||
|
||||
return true;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buffer, uint32_t timeout)
|
||||
const char* ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buffer)
|
||||
{
|
||||
if (state->sockfd == INVALID_SOCKET)
|
||||
return "ffNetworkingSendHttpRequest() failed";
|
||||
|
||||
uint32_t timeout = state->timeout;
|
||||
if (timeout > 0)
|
||||
{
|
||||
if (WaitForSingleObject((HANDLE) state->sockfd, timeout) != WAIT_OBJECT_0)
|
||||
{
|
||||
CancelIo((HANDLE) state->sockfd);
|
||||
closesocket(state->sockfd);
|
||||
return "WaitForSingleObject(state->sockfd) failed or timeout";
|
||||
}
|
||||
}
|
||||
|
||||
DWORD transfer, flags;
|
||||
if (!WSAGetOverlappedResult(state->sockfd, &state->overlapped, &transfer, TRUE, &flags))
|
||||
{
|
||||
closesocket(state->sockfd);
|
||||
return false;
|
||||
return "WSAGetOverlappedResult() failed";
|
||||
}
|
||||
|
||||
if(timeout > 0)
|
||||
{
|
||||
//https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt
|
||||
setsockopt(state->sockfd, SOL_SOCKET, SO_RCVTIMEO, (const char*)&timeout, sizeof(timeout));
|
||||
setsockopt(state->sockfd, SOL_SOCKET, SO_RCVTIMEO, (const char*) &timeout, sizeof(timeout));
|
||||
}
|
||||
|
||||
ssize_t received = recv(state->sockfd, buffer->chars + buffer->length, (int)ffStrbufGetFree(buffer), 0);
|
||||
|
||||
if(received > 0)
|
||||
{
|
||||
buffer->length += (uint32_t) received;
|
||||
uint32_t recvStart;
|
||||
do {
|
||||
recvStart = buffer->length;
|
||||
ssize_t received = recv(state->sockfd, buffer->chars + buffer->length, (int) ffStrbufGetFree(buffer), 0);
|
||||
if (received <= 0) break;
|
||||
buffer->length = recvStart + (uint32_t) received;
|
||||
buffer->chars[buffer->length] = '\0';
|
||||
}
|
||||
} while (ffStrbufGetFree(buffer) > 0 && strstr(buffer->chars + recvStart, "\r\n\r\n") == NULL);
|
||||
|
||||
closesocket(state->sockfd);
|
||||
return ffStrbufStartsWithS(buffer, "HTTP/1.1 200 OK\r\n");
|
||||
return ffStrbufStartsWithS(buffer, "HTTP/1.1 200 OK\r\n") ? NULL : "Invalid response";
|
||||
}
|
||||
|
||||
+43
-26
@@ -39,6 +39,16 @@ bool ffOptionParseModuleArgs(const char* argumentKey, const char* subKey, const
|
||||
ffOptionParseString(argumentKey, value, &result->outputFormat);
|
||||
return true;
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(subKey, "output-color"))
|
||||
{
|
||||
if(value == NULL)
|
||||
{
|
||||
fprintf(stderr, "Error: usage: %s <str>\n", argumentKey);
|
||||
exit(477);
|
||||
}
|
||||
ffOptionParseColor(value, &result->outputColor);
|
||||
return true;
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(subKey, "key-color"))
|
||||
{
|
||||
if(value == NULL)
|
||||
@@ -135,41 +145,46 @@ bool ffOptionParseBoolean(const char* str)
|
||||
);
|
||||
}
|
||||
|
||||
void ffOptionParseColor(const char* value, FFstrbuf* buffer)
|
||||
void ffOptionParseColorNoClear(const char* value, FFstrbuf* buffer)
|
||||
{
|
||||
ffStrbufClear(buffer);
|
||||
ffStrbufEnsureFree(buffer, 63);
|
||||
|
||||
while(*value != '\0')
|
||||
{
|
||||
#define FF_APPEND_COLOR_CODE_COND(prefix, code) \
|
||||
if(ffStrStartsWithIgnCase(value, #prefix)) { ffStrbufAppendS(buffer, code); value += strlen(#prefix); }
|
||||
if(ffStrStartsWithIgnCase(value, #prefix)) { ffStrbufAppendS(buffer, code); value += strlen(#prefix); continue; }
|
||||
|
||||
FF_APPEND_COLOR_CODE_COND(reset_, FF_COLOR_MODE_RESET)
|
||||
else FF_APPEND_COLOR_CODE_COND(bright_, FF_COLOR_MODE_BOLD)
|
||||
else FF_APPEND_COLOR_CODE_COND(dim_, FF_COLOR_MODE_DIM)
|
||||
else FF_APPEND_COLOR_CODE_COND(black, FF_COLOR_FG_BLACK)
|
||||
else FF_APPEND_COLOR_CODE_COND(red, FF_COLOR_FG_RED)
|
||||
else FF_APPEND_COLOR_CODE_COND(green, FF_COLOR_FG_GREEN)
|
||||
else FF_APPEND_COLOR_CODE_COND(yellow, FF_COLOR_FG_YELLOW)
|
||||
else FF_APPEND_COLOR_CODE_COND(blue, FF_COLOR_FG_BLUE)
|
||||
else FF_APPEND_COLOR_CODE_COND(magenta, FF_COLOR_FG_MAGENTA)
|
||||
else FF_APPEND_COLOR_CODE_COND(cyan, FF_COLOR_FG_CYAN)
|
||||
else FF_APPEND_COLOR_CODE_COND(white, FF_COLOR_FG_WHITE)
|
||||
else FF_APPEND_COLOR_CODE_COND(default, FF_COLOR_FG_DEFAULT)
|
||||
else FF_APPEND_COLOR_CODE_COND(light_black, FF_COLOR_FG_LIGHT_BLACK)
|
||||
else FF_APPEND_COLOR_CODE_COND(light_red, FF_COLOR_FG_LIGHT_RED)
|
||||
else FF_APPEND_COLOR_CODE_COND(light_green, FF_COLOR_FG_LIGHT_GREEN)
|
||||
else FF_APPEND_COLOR_CODE_COND(light_yellow, FF_COLOR_FG_LIGHT_YELLOW)
|
||||
else FF_APPEND_COLOR_CODE_COND(light_blue, FF_COLOR_FG_LIGHT_BLUE)
|
||||
else FF_APPEND_COLOR_CODE_COND(light_magenta, FF_COLOR_FG_LIGHT_MAGENTA)
|
||||
else FF_APPEND_COLOR_CODE_COND(light_cyan, FF_COLOR_FG_LIGHT_CYAN)
|
||||
else FF_APPEND_COLOR_CODE_COND(light_white, FF_COLOR_FG_LIGHT_WHITE)
|
||||
else
|
||||
if (ffCharIsEnglishAlphabet(value[0]))
|
||||
{
|
||||
ffStrbufAppendC(buffer, *value);
|
||||
++value;
|
||||
FF_APPEND_COLOR_CODE_COND(reset_, FF_COLOR_MODE_RESET)
|
||||
else FF_APPEND_COLOR_CODE_COND(bright_, FF_COLOR_MODE_BOLD)
|
||||
else FF_APPEND_COLOR_CODE_COND(dim_, FF_COLOR_MODE_DIM)
|
||||
else FF_APPEND_COLOR_CODE_COND(italic_, FF_COLOR_MODE_ITALIC)
|
||||
else FF_APPEND_COLOR_CODE_COND(underline_, FF_COLOR_MODE_UNDERLINE)
|
||||
else FF_APPEND_COLOR_CODE_COND(blink_, FF_COLOR_MODE_BLINK)
|
||||
else FF_APPEND_COLOR_CODE_COND(inverse_, FF_COLOR_MODE_INVERSE)
|
||||
else FF_APPEND_COLOR_CODE_COND(hidden_, FF_COLOR_MODE_HIDDEN)
|
||||
else FF_APPEND_COLOR_CODE_COND(strike_, FF_COLOR_MODE_STRIKETHROUGH)
|
||||
else FF_APPEND_COLOR_CODE_COND(black, FF_COLOR_FG_BLACK)
|
||||
else FF_APPEND_COLOR_CODE_COND(red, FF_COLOR_FG_RED)
|
||||
else FF_APPEND_COLOR_CODE_COND(green, FF_COLOR_FG_GREEN)
|
||||
else FF_APPEND_COLOR_CODE_COND(yellow, FF_COLOR_FG_YELLOW)
|
||||
else FF_APPEND_COLOR_CODE_COND(blue, FF_COLOR_FG_BLUE)
|
||||
else FF_APPEND_COLOR_CODE_COND(magenta, FF_COLOR_FG_MAGENTA)
|
||||
else FF_APPEND_COLOR_CODE_COND(cyan, FF_COLOR_FG_CYAN)
|
||||
else FF_APPEND_COLOR_CODE_COND(white, FF_COLOR_FG_WHITE)
|
||||
else FF_APPEND_COLOR_CODE_COND(default, FF_COLOR_FG_DEFAULT)
|
||||
else FF_APPEND_COLOR_CODE_COND(light_black, FF_COLOR_FG_LIGHT_BLACK)
|
||||
else FF_APPEND_COLOR_CODE_COND(light_red, FF_COLOR_FG_LIGHT_RED)
|
||||
else FF_APPEND_COLOR_CODE_COND(light_green, FF_COLOR_FG_LIGHT_GREEN)
|
||||
else FF_APPEND_COLOR_CODE_COND(light_yellow, FF_COLOR_FG_LIGHT_YELLOW)
|
||||
else FF_APPEND_COLOR_CODE_COND(light_blue, FF_COLOR_FG_LIGHT_BLUE)
|
||||
else FF_APPEND_COLOR_CODE_COND(light_magenta, FF_COLOR_FG_LIGHT_MAGENTA)
|
||||
else FF_APPEND_COLOR_CODE_COND(light_cyan, FF_COLOR_FG_LIGHT_CYAN)
|
||||
else FF_APPEND_COLOR_CODE_COND(light_white, FF_COLOR_FG_LIGHT_WHITE)
|
||||
}
|
||||
ffStrbufAppendC(buffer, *value);
|
||||
++value;
|
||||
|
||||
#undef FF_APPEND_COLOR_CODE_COND
|
||||
}
|
||||
@@ -180,6 +195,7 @@ void ffOptionInitModuleArg(FFModuleArgs* args)
|
||||
ffStrbufInit(&args->key);
|
||||
ffStrbufInit(&args->keyColor);
|
||||
ffStrbufInit(&args->outputFormat);
|
||||
ffStrbufInit(&args->outputColor);
|
||||
args->keyWidth = 0;
|
||||
}
|
||||
|
||||
@@ -188,4 +204,5 @@ void ffOptionDestroyModuleArg(FFModuleArgs* args)
|
||||
ffStrbufDestroy(&args->key);
|
||||
ffStrbufDestroy(&args->keyColor);
|
||||
ffStrbufDestroy(&args->outputFormat);
|
||||
ffStrbufDestroy(&args->outputColor);
|
||||
}
|
||||
|
||||
+7
-1
@@ -50,6 +50,7 @@ typedef struct FFModuleArgs
|
||||
FFstrbuf key;
|
||||
FFstrbuf keyColor;
|
||||
FFstrbuf outputFormat;
|
||||
FFstrbuf outputColor;
|
||||
uint32_t keyWidth;
|
||||
} FFModuleArgs;
|
||||
|
||||
@@ -66,6 +67,11 @@ FF_C_NODISCARD uint32_t ffOptionParseUInt32(const char* argumentKey, const char*
|
||||
FF_C_NODISCARD int32_t ffOptionParseInt32(const char* argumentKey, const char* value);
|
||||
FF_C_NODISCARD int ffOptionParseEnum(const char* argumentKey, const char* requestedKey, FFKeyValuePair pairs[]);
|
||||
FF_C_NODISCARD bool ffOptionParseBoolean(const char* str);
|
||||
void ffOptionParseColor(const char* value, FFstrbuf* buffer);
|
||||
void ffOptionParseColorNoClear(const char* value, FFstrbuf* buffer);
|
||||
static inline void ffOptionParseColor(const char* value, FFstrbuf* buffer)
|
||||
{
|
||||
ffStrbufClear(buffer);
|
||||
ffOptionParseColorNoClear(value, buffer);
|
||||
}
|
||||
void ffOptionInitModuleArg(FFModuleArgs* args);
|
||||
void ffOptionDestroyModuleArg(FFModuleArgs* args);
|
||||
|
||||
@@ -100,19 +100,19 @@ void ffParseGTK(FFstrbuf* buffer, const FFstrbuf* gtk2, const FFstrbuf* gtk3, co
|
||||
{
|
||||
if(gtk2->length > 0 && gtk3->length > 0 && gtk4->length > 0)
|
||||
{
|
||||
if((ffStrbufIgnCaseComp(gtk2, gtk3) == 0) && (ffStrbufIgnCaseComp(gtk2, gtk4) == 0))
|
||||
if((ffStrbufIgnCaseEqual(gtk2, gtk3)) && (ffStrbufIgnCaseEqual(gtk2, gtk4)))
|
||||
{
|
||||
ffStrbufAppend(buffer, gtk4);
|
||||
ffStrbufAppendS(buffer, " [GTK2/3/4]");
|
||||
}
|
||||
else if(ffStrbufIgnCaseComp(gtk2, gtk3) == 0)
|
||||
else if(ffStrbufIgnCaseEqual(gtk2, gtk3))
|
||||
{
|
||||
ffStrbufAppend(buffer, gtk3);
|
||||
ffStrbufAppendS(buffer, " [GTK2/3], ");
|
||||
ffStrbufAppend(buffer, gtk4);
|
||||
ffStrbufAppendS(buffer, " [GTK4]");
|
||||
}
|
||||
else if(ffStrbufIgnCaseComp(gtk3, gtk4) == 0)
|
||||
else if(ffStrbufIgnCaseEqual(gtk3, gtk4))
|
||||
{
|
||||
ffStrbufAppend(buffer, gtk2);
|
||||
ffStrbufAppendS(buffer, " [GTK2], ");
|
||||
@@ -131,7 +131,7 @@ void ffParseGTK(FFstrbuf* buffer, const FFstrbuf* gtk2, const FFstrbuf* gtk3, co
|
||||
}
|
||||
else if(gtk2->length > 0 && gtk3->length > 0)
|
||||
{
|
||||
if(ffStrbufIgnCaseComp(gtk2, gtk3) == 0)
|
||||
if(ffStrbufIgnCaseEqual(gtk2, gtk3))
|
||||
{
|
||||
ffStrbufAppend(buffer, gtk3);
|
||||
ffStrbufAppendS(buffer, " [GTK2/3]");
|
||||
@@ -146,7 +146,7 @@ void ffParseGTK(FFstrbuf* buffer, const FFstrbuf* gtk2, const FFstrbuf* gtk3, co
|
||||
}
|
||||
else if(gtk3->length > 0 && gtk4->length > 0)
|
||||
{
|
||||
if(ffStrbufIgnCaseComp(gtk3, gtk4) == 0)
|
||||
if(ffStrbufIgnCaseEqual(gtk3, gtk4))
|
||||
{
|
||||
ffStrbufAppend(buffer, gtk4);
|
||||
ffStrbufAppendS(buffer, " [GTK3/4]");
|
||||
|
||||
+43
-11
@@ -6,7 +6,15 @@
|
||||
#include "util/textModifier.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFColorRangeConfig config)
|
||||
static void appendOutputColor(FFstrbuf* buffer, const FFModuleArgs* module)
|
||||
{
|
||||
if (module->outputColor.length)
|
||||
ffStrbufAppendF(buffer, "\e[%sm", module->outputColor.chars);
|
||||
else if (instance.config.display.colorOutput.length)
|
||||
ffStrbufAppendF(buffer, "\e[%sm", instance.config.display.colorOutput.chars);
|
||||
}
|
||||
|
||||
void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFColorRangeConfig config, const FFModuleArgs* module)
|
||||
{
|
||||
uint8_t green = config.green, yellow = config.yellow;
|
||||
assert(green <= 100 && yellow <= 100);
|
||||
@@ -42,14 +50,34 @@ void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFColorRangeConfig con
|
||||
{
|
||||
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));
|
||||
if (options->percentType & FF_PERCENTAGE_TYPE_BAR_MONOCHROME_BIT)
|
||||
{
|
||||
const char* color = NULL;
|
||||
if (green <= yellow)
|
||||
{
|
||||
if (percent < green) color = colorGreen;
|
||||
else if (percent < yellow) color = colorYellow;
|
||||
else color = colorRed;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (percent < yellow) color = colorRed;
|
||||
else if (percent < green) color = colorYellow;
|
||||
else color = colorGreen;
|
||||
}
|
||||
ffStrbufAppendF(buffer, "\e[%sm", color);
|
||||
}
|
||||
else
|
||||
{
|
||||
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);
|
||||
}
|
||||
@@ -66,16 +94,19 @@ void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFColorRangeConfig con
|
||||
if(options->barBorder)
|
||||
{
|
||||
if(!options->pipe)
|
||||
ffStrbufAppendS(buffer, "\e[" FF_COLOR_FG_LIGHT_WHITE "m ]");
|
||||
ffStrbufAppendS(buffer, "\e[" FF_COLOR_FG_LIGHT_WHITE "m ]");\
|
||||
else
|
||||
ffStrbufAppendS(buffer, " ]");
|
||||
}
|
||||
|
||||
if(!options->pipe)
|
||||
{
|
||||
ffStrbufAppendS(buffer, FASTFETCH_TEXT_MODIFIER_RESET);
|
||||
appendOutputColor(buffer, module);
|
||||
}
|
||||
}
|
||||
|
||||
void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFColorRangeConfig config, bool parentheses)
|
||||
void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFColorRangeConfig config, bool parentheses, const FFModuleArgs* module)
|
||||
{
|
||||
uint8_t green = config.green, yellow = config.yellow;
|
||||
assert(green <= 100 && yellow <= 100);
|
||||
@@ -120,6 +151,7 @@ void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFColorRangeConfig con
|
||||
if (colored && !options->pipe)
|
||||
{
|
||||
ffStrbufAppendS(buffer, FASTFETCH_TEXT_MODIFIER_RESET);
|
||||
appendOutputColor(buffer, module);
|
||||
}
|
||||
|
||||
if (parentheses)
|
||||
|
||||
@@ -2,13 +2,15 @@
|
||||
|
||||
#include "util/FFstrbuf.h"
|
||||
#include "common/parsing.h"
|
||||
#include "common/option.h"
|
||||
|
||||
enum
|
||||
enum FFPercentageTypeFlags
|
||||
{
|
||||
FF_PERCENTAGE_TYPE_NUM_BIT = 1 << 0,
|
||||
FF_PERCENTAGE_TYPE_BAR_BIT = 1 << 1,
|
||||
FF_PERCENTAGE_TYPE_HIDE_OTHERS_BIT = 1 << 2,
|
||||
FF_PERCENTAGE_TYPE_NUM_COLOR_BIT = 1 << 3,
|
||||
FF_PERCENTAGE_TYPE_BAR_MONOCHROME_BIT = FF_PERCENTAGE_TYPE_NUM_COLOR_BIT,
|
||||
};
|
||||
|
||||
// if (green <= yellow)
|
||||
@@ -21,8 +23,8 @@ enum
|
||||
// [yellow, green): print yellow
|
||||
// [0, yellow): print red
|
||||
|
||||
void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFColorRangeConfig config);
|
||||
void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFColorRangeConfig config, bool parentheses);
|
||||
void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFColorRangeConfig config, const FFModuleArgs* module);
|
||||
void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFColorRangeConfig config, bool parentheses, const FFModuleArgs* module);
|
||||
|
||||
typedef struct yyjson_val yyjson_val;
|
||||
typedef struct yyjson_mut_doc yyjson_mut_doc;
|
||||
|
||||
+52
-52
@@ -11,56 +11,67 @@ void ffPrintLogoAndKey(const char* moduleName, uint8_t moduleIndex, const FFModu
|
||||
return;
|
||||
|
||||
//This is used as a magic value for hiding keys
|
||||
if(moduleArgs && ffStrbufEqualS(&moduleArgs->key, " "))
|
||||
return;
|
||||
|
||||
if(!instance.config.display.pipe)
|
||||
if (!(moduleArgs && ffStrbufEqualS(&moduleArgs->key, " ")))
|
||||
{
|
||||
fputs(FASTFETCH_TEXT_MODIFIER_RESET, stdout);
|
||||
if (instance.config.display.brightColor)
|
||||
fputs(FASTFETCH_TEXT_MODIFIER_BOLT, stdout);
|
||||
if(!instance.config.display.pipe)
|
||||
{
|
||||
fputs(FASTFETCH_TEXT_MODIFIER_RESET, stdout);
|
||||
if (instance.config.display.brightColor)
|
||||
fputs(FASTFETCH_TEXT_MODIFIER_BOLT, stdout);
|
||||
|
||||
if(moduleArgs && !(printType & FF_PRINT_TYPE_NO_CUSTOM_KEY_COLOR) && moduleArgs->keyColor.length > 0)
|
||||
ffPrintColor(&moduleArgs->keyColor);
|
||||
if(moduleArgs && !(printType & FF_PRINT_TYPE_NO_CUSTOM_KEY_COLOR) && moduleArgs->keyColor.length > 0)
|
||||
ffPrintColor(&moduleArgs->keyColor);
|
||||
else
|
||||
ffPrintColor(&instance.config.display.colorKeys);
|
||||
}
|
||||
|
||||
//NULL check is required for modules with custom keys, e.g. disk with the folder path
|
||||
if((printType & FF_PRINT_TYPE_NO_CUSTOM_KEY) || !moduleArgs || moduleArgs->key.length == 0)
|
||||
{
|
||||
fputs(moduleName, stdout);
|
||||
|
||||
if(moduleIndex > 0)
|
||||
printf(" %hhu", moduleIndex);
|
||||
}
|
||||
else
|
||||
ffPrintColor(&instance.config.display.colorKeys);
|
||||
}
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY key = ffStrbufCreate();
|
||||
FF_PARSE_FORMAT_STRING_CHECKED(&key, &moduleArgs->key, 1, ((FFformatarg[]){
|
||||
{FF_FORMAT_ARG_TYPE_UINT8, &moduleIndex, "index"},
|
||||
}));
|
||||
ffStrbufWriteTo(&key, stdout);
|
||||
}
|
||||
|
||||
//NULL check is required for modules with custom keys, e.g. disk with the folder path
|
||||
if((printType & FF_PRINT_TYPE_NO_CUSTOM_KEY) || !moduleArgs || moduleArgs->key.length == 0)
|
||||
{
|
||||
fputs(moduleName, stdout);
|
||||
if(!instance.config.display.pipe)
|
||||
{
|
||||
fputs(FASTFETCH_TEXT_MODIFIER_RESET, stdout);
|
||||
ffPrintColor(&instance.config.display.colorSeparator);
|
||||
}
|
||||
|
||||
if(moduleIndex > 0)
|
||||
printf(" %hhu", moduleIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY key = ffStrbufCreate();
|
||||
ffParseFormatString(&key, &moduleArgs->key, 1, (FFformatarg[]){
|
||||
{FF_FORMAT_ARG_TYPE_UINT8, &moduleIndex}
|
||||
});
|
||||
ffStrbufWriteTo(&key, stdout);
|
||||
ffStrbufWriteTo(&instance.config.display.keyValueSeparator, stdout);
|
||||
|
||||
if(!instance.config.display.pipe && instance.config.display.colorSeparator.length)
|
||||
fputs(FASTFETCH_TEXT_MODIFIER_RESET, stdout);
|
||||
|
||||
if (!(printType & FF_PRINT_TYPE_NO_CUSTOM_KEY_WIDTH))
|
||||
{
|
||||
uint32_t keyWidth = moduleArgs && moduleArgs->keyWidth > 0 ? moduleArgs->keyWidth : instance.config.display.keyWidth;
|
||||
if (keyWidth > 0)
|
||||
printf("\e[%uG", (unsigned) (keyWidth + instance.state.logoWidth));
|
||||
}
|
||||
}
|
||||
|
||||
if(!instance.config.display.pipe)
|
||||
fputs(FASTFETCH_TEXT_MODIFIER_RESET, stdout);
|
||||
|
||||
ffStrbufWriteTo(&instance.config.display.keyValueSeparator, stdout);
|
||||
|
||||
if(!instance.config.display.pipe)
|
||||
fputs(FASTFETCH_TEXT_MODIFIER_RESET, stdout);
|
||||
|
||||
|
||||
if (!instance.config.display.pipe && !(printType & FF_PRINT_TYPE_NO_CUSTOM_KEY_WIDTH))
|
||||
{
|
||||
uint32_t keyWidth = moduleArgs && moduleArgs->keyWidth > 0 ? moduleArgs->keyWidth : instance.config.display.keyWidth;
|
||||
if (keyWidth > 0)
|
||||
printf("\e[%uG", (unsigned) (keyWidth + instance.state.logoWidth));
|
||||
fputs(FASTFETCH_TEXT_MODIFIER_RESET, stdout);
|
||||
if (moduleArgs->outputColor.length)
|
||||
ffPrintColor(&moduleArgs->outputColor);
|
||||
else if (instance.config.display.colorOutput.length)
|
||||
ffPrintColor(&instance.config.display.colorOutput);
|
||||
}
|
||||
}
|
||||
|
||||
void ffPrintFormatString(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, uint32_t numArgs, const FFformatarg* arguments)
|
||||
void ffPrintFormat(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, uint32_t numArgs, const FFformatarg* arguments)
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreate();
|
||||
if (moduleArgs)
|
||||
@@ -68,11 +79,8 @@ void ffPrintFormatString(const char* moduleName, uint8_t moduleIndex, const FFMo
|
||||
else
|
||||
ffStrbufAppendS(&buffer, "unknown");
|
||||
|
||||
if(buffer.length > 0)
|
||||
{
|
||||
ffPrintLogoAndKey(moduleName, moduleIndex, moduleArgs, printType);
|
||||
ffStrbufPutTo(&buffer, stdout);
|
||||
}
|
||||
ffPrintLogoAndKey(moduleName, moduleIndex, moduleArgs, printType);
|
||||
ffStrbufPutTo(&buffer, stdout);
|
||||
}
|
||||
|
||||
static void printError(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, const char* message, va_list arguments)
|
||||
@@ -93,7 +101,7 @@ static void printError(const char* moduleName, uint8_t moduleIndex, const FFModu
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
void ffPrintErrorString(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, const char* message, ...)
|
||||
void ffPrintError(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, const char* message, ...)
|
||||
{
|
||||
va_list arguments;
|
||||
va_start(arguments, message);
|
||||
@@ -101,14 +109,6 @@ void ffPrintErrorString(const char* moduleName, uint8_t moduleIndex, const FFMod
|
||||
va_end(arguments);
|
||||
}
|
||||
|
||||
void ffPrintError(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, const char* message, ...)
|
||||
{
|
||||
va_list arguments;
|
||||
va_start(arguments, message);
|
||||
printError(moduleName, moduleIndex, moduleArgs, FF_PRINT_TYPE_DEFAULT, message, arguments);
|
||||
va_end(arguments);
|
||||
}
|
||||
|
||||
void ffPrintColor(const FFstrbuf* colorValue)
|
||||
{
|
||||
//If the color is not set, this would reset in \033[m, which resets everything.
|
||||
|
||||
+10
-7
@@ -12,14 +12,17 @@ typedef enum FFPrintType {
|
||||
} FFPrintType;
|
||||
|
||||
void ffPrintLogoAndKey(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType);
|
||||
void ffPrintFormatString(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, uint32_t numArgs, const FFformatarg* arguments);
|
||||
static inline void ffPrintFormat(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, uint32_t numArgs, const FFformatarg* arguments)
|
||||
{
|
||||
ffPrintFormatString(moduleName, moduleIndex, moduleArgs, FF_PRINT_TYPE_DEFAULT, numArgs, arguments);
|
||||
}
|
||||
FF_C_PRINTF(5, 6) void ffPrintErrorString(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, const char* message, ...);
|
||||
FF_C_PRINTF(4, 5) void ffPrintError(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, const char* message, ...);
|
||||
void ffPrintFormat(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, uint32_t numArgs, const FFformatarg* arguments);
|
||||
#define FF_PRINT_FORMAT_CHECKED(moduleName, moduleIndex, moduleArgs, printType, numArgs, arguments) do {\
|
||||
static_assert(sizeof(arguments) / sizeof(*(arguments)) == (numArgs), "Invalid number of format arguments");\
|
||||
ffPrintFormat((moduleName), (moduleIndex), (moduleArgs), (printType), (numArgs), (arguments));\
|
||||
} while (0)
|
||||
FF_C_PRINTF(5, 6) void ffPrintError(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, const char* message, ...);
|
||||
void ffPrintColor(const FFstrbuf* colorValue);
|
||||
void ffPrintCharTimes(char c, uint32_t times);
|
||||
|
||||
void ffPrintModuleFormatHelp(const char* name, const char* def, uint32_t numArgs, const char* args[]);
|
||||
#define FF_PRINT_MODULE_FORMAT_HELP_CHECKED(moduleName, def, numArgs, args) do {\
|
||||
static_assert(sizeof(args) / sizeof(*(args)) == (numArgs), "Invalid number of format arguments");\
|
||||
ffPrintModuleFormatHelp((moduleName), (def), (numArgs), (args));\
|
||||
} while (0)
|
||||
|
||||
+11
-8
@@ -2,16 +2,15 @@
|
||||
|
||||
#include "util/FFstrbuf.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool useStdErr);
|
||||
|
||||
static inline const char* ffProcessAppendStdOut(FFstrbuf* buffer, char* const argv[])
|
||||
{
|
||||
const char* error = ffProcessAppendOutput(buffer, argv, false);
|
||||
if (!error)
|
||||
{
|
||||
ffStrbufTrimRight(buffer, '\n');
|
||||
ffStrbufTrimRight(buffer, ' ');
|
||||
}
|
||||
ffStrbufTrimRightSpace(buffer);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -19,9 +18,13 @@ static inline const char* ffProcessAppendStdErr(FFstrbuf* buffer, char* const ar
|
||||
{
|
||||
const char* error = ffProcessAppendOutput(buffer, argv, true);
|
||||
if (!error)
|
||||
{
|
||||
ffStrbufTrimRight(buffer, '\n');
|
||||
ffStrbufTrimRight(buffer, ' ');
|
||||
}
|
||||
ffStrbufTrimRightSpace(buffer);
|
||||
return error;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
bool ffProcessGetInfoWindows(uint32_t pid, uint32_t* ppid, FFstrbuf* pname, FFstrbuf* exe, const char** exeName, FFstrbuf* exePath, bool* gui);
|
||||
#else
|
||||
void ffProcessGetInfoLinux(pid_t pid, FFstrbuf* processName, FFstrbuf* exe, const char** exeName, FFstrbuf* exePath);
|
||||
const char* ffProcessGetBasicInfoLinux(pid_t pid, FFstrbuf* name, pid_t* ppid, int32_t* tty);
|
||||
#endif
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
#include "common/processing.h"
|
||||
#include "common/io/io.h"
|
||||
#include "common/time.h"
|
||||
#include "util/stringUtils.h"
|
||||
#include "util/mallocHelper.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
@@ -11,6 +13,15 @@
|
||||
#include <errno.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__APPLE__)
|
||||
#include <sys/types.h>
|
||||
#include <sys/user.h>
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
#include <libproc.h>
|
||||
#endif
|
||||
|
||||
enum { FF_PIPE_BUFSIZ = 8192 };
|
||||
|
||||
static inline int ffPipe2(int *fds, int flags)
|
||||
@@ -68,7 +79,7 @@ const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool use
|
||||
{
|
||||
kill(childPid, SIGTERM);
|
||||
waitpid(childPid, NULL, 0);
|
||||
return "poll(&pollfd, 1, timeout) timeout";
|
||||
return "poll(&pollfd, 1, timeout) timeout (try increasing --processing-timeout)";
|
||||
}
|
||||
else if (pollfd.revents & POLLERR)
|
||||
{
|
||||
@@ -101,3 +112,234 @@ const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool use
|
||||
|
||||
return "read(childPipeFd, str, FF_PIPE_BUFSIZ) failed";
|
||||
}
|
||||
|
||||
void ffProcessGetInfoLinux(pid_t pid, FFstrbuf* processName, FFstrbuf* exe, const char** exeName, FFstrbuf* exePath)
|
||||
{
|
||||
assert(processName->length > 0);
|
||||
ffStrbufClear(exe);
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
char filePath[64];
|
||||
snprintf(filePath, sizeof(filePath), "/proc/%d/cmdline", (int)pid);
|
||||
|
||||
if(ffReadFileBuffer(filePath, exe))
|
||||
{
|
||||
ffStrbufRecalculateLength(exe); //Trim the arguments
|
||||
ffStrbufTrimRightSpace(exe);
|
||||
ffStrbufTrimLeft(exe, '-'); //Login shells start with a dash
|
||||
}
|
||||
|
||||
if (exePath)
|
||||
{
|
||||
snprintf(filePath, sizeof(filePath), "/proc/%d/exe", (int)pid);
|
||||
ffStrbufEnsureFixedLengthFree(exePath, PATH_MAX);
|
||||
ssize_t length = readlink(filePath, exePath->chars, exePath->allocated - 1);
|
||||
if (length > 0) // doesn't contain trailing NUL
|
||||
{
|
||||
exePath->chars[length] = '\0';
|
||||
exePath->length = (uint32_t) length;
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
|
||||
size_t len = 0;
|
||||
int mibs[] = { CTL_KERN, KERN_PROCARGS2, pid };
|
||||
if (sysctl(mibs, sizeof(mibs) / sizeof(*mibs), NULL, &len, NULL, 0) == 0)
|
||||
{// try get arg0
|
||||
#ifndef MAC_OS_X_VERSION_10_15
|
||||
//don't know why if don't let len longer, proArgs2 and len will change during the following sysctl() in old MacOS version.
|
||||
len++;
|
||||
#endif
|
||||
FF_AUTO_FREE char* const procArgs2 = malloc(len);
|
||||
if (sysctl(mibs, sizeof(mibs) / sizeof(*mibs), procArgs2, &len, NULL, 0) == 0)
|
||||
{
|
||||
// https://gist.github.com/nonowarn/770696#file-getargv-c-L46
|
||||
uint32_t argc = *(uint32_t*) procArgs2;
|
||||
const char* realExePath = procArgs2 + sizeof(argc);
|
||||
|
||||
const char* arg0 = memchr(realExePath, '\0', len - (size_t) (realExePath - procArgs2));
|
||||
if (exePath)
|
||||
ffStrbufSetNS(exePath, (uint32_t) (arg0 - realExePath), realExePath);
|
||||
|
||||
do arg0++; while (*arg0 == '\0');
|
||||
assert(arg0 < procArgs2 + len);
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
// #977
|
||||
const char* p = strrchr(arg0, '/');
|
||||
if (p)
|
||||
p++;
|
||||
else
|
||||
p = arg0;
|
||||
if (ffStrStartsWithIgnCase(p, "python")) // /opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/Resources/Python.app/Contents/MacOS/Python /Users/carter/.local/bin/xonsh
|
||||
arg0 = p + strlen(p) + 1;
|
||||
}
|
||||
|
||||
if (*arg0 == '-') arg0++; // Login shells
|
||||
|
||||
ffStrbufSetS(exe, arg0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ffStrbufEnsureFixedLengthFree(exe, PATH_MAX);
|
||||
int length = proc_pidpath(pid, exe->chars, exe->allocated);
|
||||
if (length > 0)
|
||||
{
|
||||
exe->length = (uint32_t) length;
|
||||
if (exePath)
|
||||
ffStrbufSet(exePath, exe);
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined(__FreeBSD__)
|
||||
|
||||
size_t size = ARG_MAX;
|
||||
FF_AUTO_FREE char* args = malloc(size);
|
||||
|
||||
static_assert(ARG_MAX > PATH_MAX, "");
|
||||
|
||||
if(exePath && sysctl(
|
||||
(int[]){CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, pid}, 4,
|
||||
args, &size,
|
||||
NULL, 0
|
||||
) == 0)
|
||||
ffStrbufSetNS(exePath, (uint32_t) (size - 1), args);
|
||||
|
||||
size = ARG_MAX;
|
||||
if(sysctl(
|
||||
(int[]){CTL_KERN, KERN_PROC, KERN_PROC_ARGS, pid}, 4,
|
||||
args, &size,
|
||||
NULL, 0
|
||||
) == 0)
|
||||
{
|
||||
char* arg0 = args;
|
||||
size_t arg0Len = strlen(args);
|
||||
if (size > arg0Len + 1)
|
||||
{
|
||||
char* p = (char*) memrchr(args, '/', arg0Len);
|
||||
if (p)
|
||||
p++;
|
||||
else
|
||||
p = arg0;
|
||||
if (ffStrStartsWith(p, "python")) // /usr/local/bin/python3.9 /home/carter/.local/bin/xonsh
|
||||
{
|
||||
arg0 += arg0Len + 1;
|
||||
}
|
||||
}
|
||||
if (arg0[0] == '-') arg0++;
|
||||
ffStrbufSetS(exe, arg0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if(exe->length == 0)
|
||||
ffStrbufSet(exe, processName);
|
||||
|
||||
assert(exe->length > 0);
|
||||
uint32_t lastSlashIndex = ffStrbufLastIndexC(exe, '/');
|
||||
if(lastSlashIndex < exe->length)
|
||||
*exeName = exe->chars + lastSlashIndex + 1;
|
||||
}
|
||||
|
||||
const char* ffProcessGetBasicInfoLinux(pid_t pid, FFstrbuf* name, pid_t* ppid, int32_t* tty)
|
||||
{
|
||||
if (pid <= 0)
|
||||
return "Invalid pid";
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
char procFilePath[64];
|
||||
if (ppid)
|
||||
{
|
||||
snprintf(procFilePath, sizeof(procFilePath), "/proc/%d/stat", (int)pid);
|
||||
char buf[PROC_FILE_BUFFSIZ];
|
||||
ssize_t nRead = ffReadFileData(procFilePath, sizeof(buf) - 1, buf);
|
||||
if(nRead <= 8)
|
||||
return "ffReadFileData(/proc/pid/stat, PROC_FILE_BUFFSIZ-1, buf) failed";
|
||||
buf[nRead] = '\0';
|
||||
|
||||
*ppid = 0;
|
||||
static_assert(sizeof(*ppid) == sizeof(int), "");
|
||||
|
||||
ffStrbufEnsureFixedLengthFree(name, 255);
|
||||
int tty_;
|
||||
if(
|
||||
sscanf(buf, "%*s (%255[^)]) %*c %d %*d %*d %d", name->chars, ppid, &tty_) < 2 || //stat (comm) state ppid pgrp session tty
|
||||
name->chars[0] == '\0'
|
||||
)
|
||||
return "sscanf(stat) failed";
|
||||
|
||||
ffStrbufRecalculateLength(name);
|
||||
if (tty)
|
||||
*tty = tty_ & 0xFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(procFilePath, sizeof(procFilePath), "/proc/%d/comm", (int)pid);
|
||||
ssize_t nRead = ffReadFileBuffer(procFilePath, name);
|
||||
if(nRead <= 0)
|
||||
return "ffReadFileBuffer(/proc/pid/comm, name) failed";
|
||||
ffStrbufTrimRightSpace(name);
|
||||
}
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
|
||||
struct kinfo_proc proc;
|
||||
size_t size = sizeof(proc);
|
||||
if(sysctl(
|
||||
(int[]){CTL_KERN, KERN_PROC, KERN_PROC_PID, pid}, 4,
|
||||
&proc, &size,
|
||||
NULL, 0
|
||||
))
|
||||
return "sysctl(KERN_PROC_PID) failed";
|
||||
|
||||
ffStrbufSetS(name, proc.kp_proc.p_comm); //trancated to 16 chars
|
||||
if (ppid)
|
||||
*ppid = (pid_t)proc.kp_eproc.e_ppid;
|
||||
if (tty)
|
||||
{
|
||||
*tty = ((proc.kp_eproc.e_tdev >> 24) & 0xFF) == 0x10
|
||||
? proc.kp_eproc.e_tdev & 0xFFFFFF
|
||||
: -1;
|
||||
}
|
||||
|
||||
#elif defined(__FreeBSD__)
|
||||
|
||||
struct kinfo_proc proc;
|
||||
size_t size = sizeof(proc);
|
||||
if(sysctl(
|
||||
(int[]){CTL_KERN, KERN_PROC, KERN_PROC_PID, pid}, 4,
|
||||
&proc, &size,
|
||||
NULL, 0
|
||||
))
|
||||
return "sysctl(KERN_PROC_PID) failed";
|
||||
|
||||
ffStrbufSetS(name, proc.ki_comm);
|
||||
if (ppid)
|
||||
*ppid = (pid_t)proc.ki_ppid;
|
||||
if (tty)
|
||||
{
|
||||
if (proc.ki_tdev != NODEV && proc.ki_flag & P_CONTROLT)
|
||||
{
|
||||
const char* ttyName = devname(proc.ki_tdev, S_IFCHR);
|
||||
if (ffStrStartsWith(ttyName, "pts/"))
|
||||
*tty = (int32_t) strtol(ttyName + strlen("pts/"), NULL, 10);
|
||||
else
|
||||
*tty = -1;
|
||||
}
|
||||
else
|
||||
*tty = -1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
return "Unsupported platform";
|
||||
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#include "common/io/io.h"
|
||||
|
||||
#include <Windows.h>
|
||||
#include <ntstatus.h>
|
||||
#include <winternl.h>
|
||||
|
||||
enum { FF_PIPE_BUFSIZ = 8192 };
|
||||
|
||||
@@ -96,7 +98,7 @@ const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool use
|
||||
{
|
||||
CancelIo(hChildPipeRead);
|
||||
TerminateProcess(hProcess, 1);
|
||||
return "WaitForSingleObject(hChildPipeRead) failed or timeout";
|
||||
return "WaitForSingleObject(hChildPipeRead) failed or timeout (try increasing --processing-timeout)";
|
||||
}
|
||||
|
||||
if (!GetOverlappedResult(hChildPipeRead, &overlapped, &nRead, FALSE))
|
||||
@@ -124,3 +126,46 @@ const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool use
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool ffProcessGetInfoWindows(uint32_t pid, uint32_t* ppid, FFstrbuf* pname, FFstrbuf* exe, const char** exeName, FFstrbuf* exePath, bool* gui)
|
||||
{
|
||||
FF_AUTO_CLOSE_FD HANDLE hProcess = pid == 0
|
||||
? GetCurrentProcess()
|
||||
: OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, pid);
|
||||
|
||||
if (gui)
|
||||
*gui = GetGuiResources(hProcess, GR_GDIOBJECTS) > 0;
|
||||
|
||||
if(ppid)
|
||||
{
|
||||
PROCESS_BASIC_INFORMATION info = {};
|
||||
ULONG size;
|
||||
if(NT_SUCCESS(NtQueryInformationProcess(hProcess, ProcessBasicInformation, &info, sizeof(info), &size)))
|
||||
{
|
||||
assert(size == sizeof(info));
|
||||
*ppid = (uint32_t)info.InheritedFromUniqueProcessId;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
if(exe)
|
||||
{
|
||||
DWORD bufSize = exe->allocated;
|
||||
if(QueryFullProcessImageNameA(hProcess, 0, exe->chars, &bufSize))
|
||||
{
|
||||
// We use full path here
|
||||
// Querying command line of remote processes in Windows requires either WMI or ReadProcessMemory
|
||||
exe->length = bufSize;
|
||||
if (exePath) ffStrbufSet(exePath, exe);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
if(pname && exeName)
|
||||
{
|
||||
*exeName = exe->chars + ffStrbufLastIndexC(exe, '\\') + 1;
|
||||
ffStrbufSetS(pname, *exeName);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
+29
-36
@@ -1,5 +1,7 @@
|
||||
#include "fastfetch.h"
|
||||
#include "common/properties.h"
|
||||
#include "common/io/io.h"
|
||||
#include "util/mallocHelper.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#ifdef _WIN32
|
||||
@@ -95,50 +97,44 @@ bool ffParsePropLines(const char* lines, const char* start, FFstrbuf* buffer)
|
||||
|
||||
bool ffParsePropFileValues(const char* filename, uint32_t numQueries, FFpropquery* queries)
|
||||
{
|
||||
FILE* file = fopen(filename, "r");
|
||||
if(file == NULL)
|
||||
FF_AUTO_CLOSE_FILE FILE* file = fopen(filename, "r");
|
||||
if (file == NULL)
|
||||
return false;
|
||||
|
||||
bool valueStorage[4];
|
||||
bool* unsetValues;
|
||||
bool valueStorage[32];
|
||||
bool* unsetValues = valueStorage;
|
||||
|
||||
if(numQueries > sizeof(valueStorage) / sizeof(valueStorage[0]))
|
||||
if (numQueries > sizeof(valueStorage) / sizeof(valueStorage[0]))
|
||||
unsetValues = malloc(sizeof(bool) * numQueries);
|
||||
else
|
||||
unsetValues = valueStorage;
|
||||
|
||||
bool allSet = true;
|
||||
for(uint32_t i = 0; i < numQueries; i++)
|
||||
for (uint32_t i = 0; i < numQueries; i++)
|
||||
{
|
||||
if((unsetValues[i] = queries[i].buffer->length == 0))
|
||||
unsetValues[i] = queries[i].buffer->length == 0;
|
||||
if (unsetValues[i])
|
||||
allSet = false;
|
||||
}
|
||||
|
||||
if(allSet)
|
||||
goto done;
|
||||
|
||||
char* line = NULL;
|
||||
size_t len = 0;
|
||||
|
||||
while (getline(&line, &len, file) != -1)
|
||||
if (!allSet)
|
||||
{
|
||||
for(uint32_t i = 0; i < numQueries; i++)
|
||||
{
|
||||
if(!unsetValues[i])
|
||||
continue;
|
||||
FF_AUTO_FREE char* line = NULL;
|
||||
size_t len = 0;
|
||||
|
||||
uint32_t currentLength = queries[i].buffer->length;
|
||||
queries[i].buffer->length = 0;
|
||||
if(!ffParsePropLine(line, queries[i].start, queries[i].buffer))
|
||||
queries[i].buffer->length = currentLength;
|
||||
while (getline(&line, &len, file) != -1)
|
||||
{
|
||||
for(uint32_t i = 0; i < numQueries; i++)
|
||||
{
|
||||
if(!unsetValues[i])
|
||||
continue;
|
||||
|
||||
uint32_t currentLength = queries[i].buffer->length;
|
||||
queries[i].buffer->length = 0;
|
||||
if(!ffParsePropLine(line, queries[i].start, queries[i].buffer))
|
||||
queries[i].buffer->length = currentLength;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(line != NULL)
|
||||
free(line);
|
||||
|
||||
done:
|
||||
fclose(file);
|
||||
if(unsetValues != valueStorage)
|
||||
free(unsetValues);
|
||||
return true;
|
||||
@@ -154,16 +150,13 @@ bool ffParsePropFileListValues(const FFlist* list, const char* relativeFile, uin
|
||||
{
|
||||
bool foundAFile = false;
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY baseDir = ffStrbufCreateA(64);
|
||||
|
||||
FF_LIST_FOR_EACH(FFstrbuf, dirPrefix, *list)
|
||||
{
|
||||
//We need to copy the dir each time, because it used by multiple threads, so we can't directly write to it.
|
||||
ffStrbufSet(&baseDir, dirPrefix);
|
||||
ffStrbufAppendS(&baseDir, relativeFile);
|
||||
|
||||
if(ffParsePropFileValues(baseDir.chars, numQueries, queries))
|
||||
const uint32_t dirPrefixLength = dirPrefix->length;
|
||||
ffStrbufAppendS(dirPrefix, relativeFile);
|
||||
if(ffParsePropFileValues(dirPrefix->chars, numQueries, queries))
|
||||
foundAFile = true;
|
||||
ffStrbufSubstrBefore(dirPrefix, dirPrefixLength);
|
||||
|
||||
bool allSet = true;
|
||||
for(uint32_t k = 0; k < numQueries; k++)
|
||||
|
||||
+88
-90
@@ -6,45 +6,6 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
typedef enum FFInitState
|
||||
{
|
||||
FF_INITSTATE_UNINITIALIZED = 0,
|
||||
FF_INITSTATE_SUCCESSFUL = 1,
|
||||
FF_INITSTATE_FAILED = 2
|
||||
} FFInitState;
|
||||
|
||||
#define FF_LIBRARY_DATA_LOAD_INIT(dataObject, userLibraryName, ...) \
|
||||
static dataObject data; \
|
||||
static FFInitState initState = FF_INITSTATE_UNINITIALIZED; \
|
||||
if(initState != FF_INITSTATE_UNINITIALIZED) {\
|
||||
return initState == FF_INITSTATE_SUCCESSFUL ? &data : NULL; \
|
||||
} \
|
||||
initState = FF_INITSTATE_SUCCESSFUL; \
|
||||
void* libraryHandle = ffLibraryLoad(&userLibraryName, __VA_ARGS__, NULL); \
|
||||
if(libraryHandle == NULL) { \
|
||||
initState = FF_INITSTATE_FAILED; \
|
||||
return NULL; \
|
||||
} \
|
||||
|
||||
#define FF_LIBRARY_DATA_LOAD_SYMBOL(symbolName) \
|
||||
data.ff ## symbolName = dlsym(libraryHandle, #symbolName); \
|
||||
if(data.ff ## symbolName == NULL) { \
|
||||
dlclose(libraryHandle); \
|
||||
initState = FF_INITSTATE_FAILED; \
|
||||
return NULL; \
|
||||
}
|
||||
|
||||
#define FF_LIBRARY_DATA_LOAD_RETURN \
|
||||
initState = FF_INITSTATE_SUCCESSFUL; \
|
||||
return &data;
|
||||
|
||||
#define FF_LIBRARY_DATA_LOAD_ERROR \
|
||||
{ \
|
||||
dlclose(libraryHandle); \
|
||||
initState = FF_INITSTATE_FAILED; \
|
||||
return NULL; \
|
||||
}
|
||||
|
||||
#ifdef FF_HAVE_GIO
|
||||
#include <gio/gio.h>
|
||||
|
||||
@@ -88,32 +49,39 @@ typedef struct GSettingsData
|
||||
FF_LIBRARY_SYMBOL(g_settings_schema_source_get_default)
|
||||
GSettingsSchemaSource* schemaSource;
|
||||
GVariantGetters variantGetters;
|
||||
|
||||
bool inited;
|
||||
} GSettingsData;
|
||||
|
||||
static const GSettingsData* getGSettingsData(void)
|
||||
{
|
||||
FF_LIBRARY_DATA_LOAD_INIT(GSettingsData, instance.config.library.libGIO, "libgio-2.0" FF_LIBRARY_EXTENSION, 1);
|
||||
static GSettingsData data;
|
||||
|
||||
FF_LIBRARY_DATA_LOAD_SYMBOL(g_settings_schema_source_lookup)
|
||||
FF_LIBRARY_DATA_LOAD_SYMBOL(g_settings_schema_has_key)
|
||||
FF_LIBRARY_DATA_LOAD_SYMBOL(g_settings_new_full)
|
||||
FF_LIBRARY_DATA_LOAD_SYMBOL(g_settings_get_value)
|
||||
FF_LIBRARY_DATA_LOAD_SYMBOL(g_settings_get_user_value)
|
||||
FF_LIBRARY_DATA_LOAD_SYMBOL(g_settings_get_default_value)
|
||||
FF_LIBRARY_DATA_LOAD_SYMBOL(g_settings_schema_source_get_default)
|
||||
if (!data.inited)
|
||||
{
|
||||
data.inited = true;
|
||||
FF_LIBRARY_LOAD(libgsettings, &instance.config.library.libGIO, NULL, "libgio-2.0" FF_LIBRARY_EXTENSION, 1);
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(libgsettings, data, g_settings_schema_source_lookup, NULL)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(libgsettings, data, g_settings_schema_has_key, NULL)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(libgsettings, data, g_settings_new_full, NULL)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(libgsettings, data, g_settings_get_value, NULL)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(libgsettings, data, g_settings_get_user_value, NULL)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(libgsettings, data, g_settings_get_default_value, NULL)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(libgsettings, data, g_settings_schema_source_get_default, NULL)
|
||||
|
||||
#define data data.variantGetters
|
||||
FF_LIBRARY_DATA_LOAD_SYMBOL(g_variant_dup_string)
|
||||
FF_LIBRARY_DATA_LOAD_SYMBOL(g_variant_get_boolean)
|
||||
FF_LIBRARY_DATA_LOAD_SYMBOL(g_variant_get_int32)
|
||||
FF_LIBRARY_DATA_LOAD_SYMBOL(g_variant_unref);
|
||||
#undef data
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(libgsettings, data.variantGetters, g_variant_dup_string, NULL)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(libgsettings, data.variantGetters, g_variant_get_boolean, NULL)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(libgsettings, data.variantGetters, g_variant_get_int32, NULL)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(libgsettings, data.variantGetters, g_variant_unref, NULL);
|
||||
|
||||
data.schemaSource = data.ffg_settings_schema_source_get_default();
|
||||
if(data.schemaSource == NULL)
|
||||
FF_LIBRARY_DATA_LOAD_ERROR
|
||||
data.schemaSource = data.ffg_settings_schema_source_get_default();
|
||||
if (data.schemaSource)
|
||||
libgsettings = NULL;
|
||||
}
|
||||
if(!data.schemaSource)
|
||||
return NULL;
|
||||
|
||||
FF_LIBRARY_DATA_LOAD_RETURN
|
||||
return &data;
|
||||
}
|
||||
|
||||
FFvariant ffSettingsGetGSettings(const char* schemaName, const char* path, const char* key, FFvarianttype type)
|
||||
@@ -161,27 +129,34 @@ typedef struct DConfData
|
||||
FF_LIBRARY_SYMBOL(dconf_client_new)
|
||||
GVariantGetters variantGetters;
|
||||
DConfClient* client;
|
||||
|
||||
bool inited;
|
||||
} DConfData;
|
||||
|
||||
static const DConfData* getDConfData(void)
|
||||
{
|
||||
FF_LIBRARY_DATA_LOAD_INIT(DConfData, instance.config.library.libDConf, "libdconf" FF_LIBRARY_EXTENSION, 2);
|
||||
static DConfData data;
|
||||
|
||||
FF_LIBRARY_DATA_LOAD_SYMBOL(dconf_client_read_full)
|
||||
FF_LIBRARY_DATA_LOAD_SYMBOL(dconf_client_new)
|
||||
if (!data.inited)
|
||||
{
|
||||
data.inited = true;
|
||||
|
||||
#define data data.variantGetters
|
||||
FF_LIBRARY_DATA_LOAD_SYMBOL(g_variant_dup_string)
|
||||
FF_LIBRARY_DATA_LOAD_SYMBOL(g_variant_get_boolean)
|
||||
FF_LIBRARY_DATA_LOAD_SYMBOL(g_variant_get_int32)
|
||||
FF_LIBRARY_DATA_LOAD_SYMBOL(g_variant_unref)
|
||||
#undef data
|
||||
FF_LIBRARY_LOAD(libdconf, &instance.config.library.libDConf, NULL, "libdconf" FF_LIBRARY_EXTENSION, 2);
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(libdconf, data, dconf_client_read_full, NULL)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(libdconf, data, dconf_client_new, NULL)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(libdconf, data.variantGetters, g_variant_dup_string, NULL)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(libdconf, data.variantGetters, g_variant_get_boolean, NULL)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(libdconf, data.variantGetters, g_variant_get_int32, NULL)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(libdconf, data.variantGetters, g_variant_unref, NULL)
|
||||
|
||||
data.client = data.ffdconf_client_new();
|
||||
if(data.client == NULL)
|
||||
FF_LIBRARY_DATA_LOAD_ERROR
|
||||
data.client = data.ffdconf_client_new();
|
||||
if (data.client)
|
||||
libdconf = NULL;
|
||||
}
|
||||
if(!data.client)
|
||||
return NULL;
|
||||
|
||||
FF_LIBRARY_DATA_LOAD_RETURN
|
||||
return &data;
|
||||
}
|
||||
|
||||
FFvariant ffSettingsGetDConf(const char* key, FFvarianttype type)
|
||||
@@ -232,23 +207,35 @@ typedef struct XFConfData
|
||||
FF_LIBRARY_SYMBOL(xfconf_channel_get_bool)
|
||||
FF_LIBRARY_SYMBOL(xfconf_channel_get_int)
|
||||
FF_LIBRARY_SYMBOL(xfconf_init)
|
||||
|
||||
bool inited;
|
||||
} XFConfData;
|
||||
|
||||
static const XFConfData* getXFConfData(void)
|
||||
{
|
||||
FF_LIBRARY_DATA_LOAD_INIT(XFConfData, instance.config.library.libXFConf, "libxfconf-0" FF_LIBRARY_EXTENSION, 4);
|
||||
static XFConfData data;
|
||||
|
||||
FF_LIBRARY_DATA_LOAD_SYMBOL(xfconf_channel_get)
|
||||
FF_LIBRARY_DATA_LOAD_SYMBOL(xfconf_channel_has_property)
|
||||
FF_LIBRARY_DATA_LOAD_SYMBOL(xfconf_channel_get_string)
|
||||
FF_LIBRARY_DATA_LOAD_SYMBOL(xfconf_channel_get_bool)
|
||||
FF_LIBRARY_DATA_LOAD_SYMBOL(xfconf_channel_get_int)
|
||||
FF_LIBRARY_DATA_LOAD_SYMBOL(xfconf_init)
|
||||
if (!data.inited)
|
||||
{
|
||||
data.inited = true;
|
||||
FF_LIBRARY_LOAD(libxfconf, &instance.config.library.libXFConf, NULL, "libxfconf-0" FF_LIBRARY_EXTENSION, 4);
|
||||
|
||||
if(data.ffxfconf_init(NULL) == false)
|
||||
FF_LIBRARY_DATA_LOAD_ERROR
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(libxfconf, data, xfconf_channel_get, NULL)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(libxfconf, data, xfconf_channel_has_property, NULL)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(libxfconf, data, xfconf_channel_get_string, NULL)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(libxfconf, data, xfconf_channel_get_bool, NULL)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(libxfconf, data, xfconf_channel_get_int, NULL)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(libxfconf, data, xfconf_init, NULL)
|
||||
if(!data.ffxfconf_init(NULL))
|
||||
data.ffxfconf_init = NULL;
|
||||
else
|
||||
libxfconf = NULL;
|
||||
}
|
||||
|
||||
FF_LIBRARY_DATA_LOAD_RETURN
|
||||
if(!data.ffxfconf_init)
|
||||
return NULL;
|
||||
|
||||
return &data;
|
||||
}
|
||||
|
||||
FFvariant ffSettingsGetXFConf(const char* channelName, const char* propertyName, FFvarianttype type)
|
||||
@@ -294,22 +281,33 @@ typedef struct SQLiteData
|
||||
FF_LIBRARY_SYMBOL(sqlite3_column_text)
|
||||
FF_LIBRARY_SYMBOL(sqlite3_finalize)
|
||||
FF_LIBRARY_SYMBOL(sqlite3_close)
|
||||
|
||||
bool inited;
|
||||
} SQLiteData;
|
||||
|
||||
static const SQLiteData* getSQLiteData(void)
|
||||
{
|
||||
FF_LIBRARY_DATA_LOAD_INIT(SQLiteData, instance.config.library.libSQLite3, "libsqlite3" FF_LIBRARY_EXTENSION, 1);
|
||||
static SQLiteData data;
|
||||
|
||||
FF_LIBRARY_DATA_LOAD_SYMBOL(sqlite3_open_v2)
|
||||
FF_LIBRARY_DATA_LOAD_SYMBOL(sqlite3_prepare_v2)
|
||||
FF_LIBRARY_DATA_LOAD_SYMBOL(sqlite3_step)
|
||||
FF_LIBRARY_DATA_LOAD_SYMBOL(sqlite3_data_count)
|
||||
FF_LIBRARY_DATA_LOAD_SYMBOL(sqlite3_column_int)
|
||||
FF_LIBRARY_DATA_LOAD_SYMBOL(sqlite3_column_text)
|
||||
FF_LIBRARY_DATA_LOAD_SYMBOL(sqlite3_finalize)
|
||||
FF_LIBRARY_DATA_LOAD_SYMBOL(sqlite3_close)
|
||||
if (!data.inited)
|
||||
{
|
||||
data.inited = true;
|
||||
FF_LIBRARY_LOAD(libsqlite, &instance.config.library.libSQLite3, NULL, "libsqlite3" FF_LIBRARY_EXTENSION, 1);
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(libsqlite, data, sqlite3_open_v2, NULL)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(libsqlite, data, sqlite3_prepare_v2, NULL)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(libsqlite, data, sqlite3_step, NULL)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(libsqlite, data, sqlite3_data_count, NULL)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(libsqlite, data, sqlite3_column_int, NULL)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(libsqlite, data, sqlite3_column_text, NULL)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(libsqlite, data, sqlite3_finalize, NULL)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(libsqlite, data, sqlite3_close, NULL)
|
||||
libsqlite = NULL;
|
||||
}
|
||||
|
||||
FF_LIBRARY_DATA_LOAD_RETURN
|
||||
if (!data.ffsqlite3_close)
|
||||
return NULL;
|
||||
|
||||
return &data;
|
||||
}
|
||||
|
||||
int ffSettingsGetSQLite3Int(const char* dbPath, const char* query)
|
||||
|
||||
+8
-2
@@ -3,7 +3,7 @@
|
||||
#include "util/textModifier.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
void ffTempsAppendNum(double celsius, FFstrbuf* buffer, FFColorRangeConfig config)
|
||||
void ffTempsAppendNum(double celsius, FFstrbuf* buffer, FFColorRangeConfig config, const FFModuleArgs* module)
|
||||
{
|
||||
if (celsius != celsius) // ignores NaN
|
||||
return;
|
||||
@@ -37,7 +37,7 @@ void ffTempsAppendNum(double celsius, FFstrbuf* buffer, FFColorRangeConfig confi
|
||||
}
|
||||
}
|
||||
|
||||
switch (options->temperatureUnit)
|
||||
switch (options->tempUnit)
|
||||
{
|
||||
case FF_TEMPERATURE_UNIT_CELSIUS:
|
||||
ffStrbufAppendF(buffer, "%.*f°C", options->tempNdigits, celsius);
|
||||
@@ -51,7 +51,13 @@ void ffTempsAppendNum(double celsius, FFstrbuf* buffer, FFColorRangeConfig confi
|
||||
}
|
||||
|
||||
if (!options->pipe)
|
||||
{
|
||||
ffStrbufAppendS(buffer, FASTFETCH_TEXT_MODIFIER_RESET);
|
||||
if (module->outputColor.length)
|
||||
ffStrbufAppendF(buffer, "\e[%sm", module->outputColor.chars);
|
||||
else if (instance.config.display.colorOutput.length)
|
||||
ffStrbufAppendF(buffer, "\e[%sm", instance.config.display.colorOutput.chars);
|
||||
}
|
||||
}
|
||||
|
||||
bool ffTempsParseCommandOptions(const char* key, const char* subkey, const char* value, bool* useTemp, FFColorRangeConfig* config)
|
||||
|
||||
+2
-1
@@ -1,8 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "common/parsing.h"
|
||||
#include "common/option.h"
|
||||
|
||||
void ffTempsAppendNum(double celsius, FFstrbuf* buffer, FFColorRangeConfig config);
|
||||
void ffTempsAppendNum(double celsius, FFstrbuf* buffer, FFColorRangeConfig config, const FFModuleArgs* module);
|
||||
bool ffTempsParseCommandOptions(const char* key, const char* subkey, const char* value, bool* useTemp, FFColorRangeConfig* config);
|
||||
bool ffTempsParseJsonObject(const char* key, yyjson_val* value, bool* useTemp, FFColorRangeConfig* config);
|
||||
void ffTempsGenerateJsonConfig(yyjson_mut_doc* doc, yyjson_mut_val* module, FF_MAYBE_UNUSED bool defaultTemp, FFColorRangeConfig defaultConfig, bool temp, FFColorRangeConfig config);
|
||||
|
||||
+36
-2
@@ -1,12 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
#ifdef _WIN32
|
||||
#include <synchapi.h>
|
||||
#include <profileapi.h>
|
||||
#include <sysinfoapi.h>
|
||||
#else
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
static inline uint64_t ffTimeGetTick() //In msec
|
||||
@@ -45,3 +45,37 @@ static inline void ffTimeSleep(uint32_t msec)
|
||||
nanosleep(&(struct timespec){ msec / 1000, (long) (msec % 1000) * 1000000 }, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat"
|
||||
#endif
|
||||
|
||||
// Not thread-safe
|
||||
static inline const char* ffTimeToFullStr(uint64_t msec)
|
||||
{
|
||||
if (msec == 0) return "";
|
||||
time_t tsec = (time_t) (msec / 1000);
|
||||
const struct tm* tm = localtime(&tsec);
|
||||
|
||||
static char buf[32];
|
||||
strftime(buf, __builtin_strlen("0000-00-00T00:00:00") + 1, "%FT%T", tm);
|
||||
snprintf(buf + __builtin_strlen("0000-00-00T00:00:00"), __builtin_strlen(".000") + 1, ".%03u", (unsigned) (msec % 1000));
|
||||
strftime(buf + __builtin_strlen("0000-00-00T00:00:00.000"), __builtin_strlen("+0000") + 1, "%z", tm);
|
||||
return buf;
|
||||
}
|
||||
|
||||
// Not thread-safe
|
||||
static inline const char* ffTimeToShortStr(uint64_t msec)
|
||||
{
|
||||
if (msec == 0) return "";
|
||||
time_t tsec = (time_t) (msec / 1000);
|
||||
|
||||
static char buf[32];
|
||||
strftime(buf, sizeof(buf), "%F %T", localtime(&tsec));
|
||||
return buf;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
+99
-31
@@ -436,7 +436,7 @@
|
||||
{
|
||||
"long": "color-keys",
|
||||
"desc": "Set the color of the keys",
|
||||
"remark": "See `-h color` for the list of available colors",
|
||||
"remark": "Doesn't affect module Title, Separator and Colors. See `-h color` for the list of available colors",
|
||||
"arg": {
|
||||
"type": "color"
|
||||
}
|
||||
@@ -449,6 +449,22 @@
|
||||
"type": "color"
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "color-output",
|
||||
"desc": "Set the color of module output",
|
||||
"remark": "See `-h color` for the list of available colors",
|
||||
"arg": {
|
||||
"type": "color"
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "color-separator",
|
||||
"desc": "Set the color of the key-value separator",
|
||||
"remark": "See `-h color` for the list of available colors",
|
||||
"arg": {
|
||||
"type": "color"
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "color",
|
||||
"desc": "Set the color of both the keys and title",
|
||||
@@ -481,22 +497,6 @@
|
||||
"default": ": "
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "set",
|
||||
"desc": "Hard set the value of a key",
|
||||
"remark": "Deprecated. Use \"Custom\" module instead",
|
||||
"arg": {
|
||||
"type": "key=value"
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "set-keyless",
|
||||
"desc": "Hard set the value of a key, but don't print the key or the separator",
|
||||
"remark": "Deprecated. Use \"Custom\" module instead",
|
||||
"arg": {
|
||||
"type": "key=value"
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "show-errors",
|
||||
"desc": "Print occurring errors",
|
||||
@@ -521,7 +521,7 @@
|
||||
"arg": {
|
||||
"type": "bool",
|
||||
"optional": true,
|
||||
"default": true
|
||||
"default": false
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -542,10 +542,11 @@
|
||||
"desc": "Set the percentage output type",
|
||||
"remark": [
|
||||
"1 for percentage number",
|
||||
"2 for bar",
|
||||
"2 for multi-color bar",
|
||||
"3 for both",
|
||||
"6 for bar only",
|
||||
"9 for colored number"
|
||||
"9 for colored number",
|
||||
"10 for monochrome bar"
|
||||
],
|
||||
"arg": {
|
||||
"type": "num",
|
||||
@@ -702,6 +703,16 @@
|
||||
"type": "color",
|
||||
"default": "light_red"
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "ts-version",
|
||||
"desc": "Whether to detect and display the version of terminal and shell",
|
||||
"remark": "Mainly for benchmarking",
|
||||
"arg": {
|
||||
"type": "bool",
|
||||
"optional": true,
|
||||
"default": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"Library path": [
|
||||
@@ -928,16 +939,17 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "os-file",
|
||||
"desc": "Set the additional file path which containing OS information",
|
||||
"remark": "Linux only",
|
||||
"long": "separator-output-color",
|
||||
"desc": "Set the color of the separator module",
|
||||
"arg": {
|
||||
"type": "path"
|
||||
"type": "color",
|
||||
"default": "default"
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "disk-folders",
|
||||
"desc": "A colon (semicolon on Windows) separated list of folder paths for the disk output",
|
||||
"desc": "A colon (semicolon on Windows) separated list of folder paths to be detected",
|
||||
"remark": "On Windows, a drive latter must be upper cased and end with \"\\\". \"/\" is used as an alias of the system drive. This option overrides other disk-show-* options",
|
||||
"arg": {
|
||||
"type": "path",
|
||||
"default": "Auto detection using mount-points"
|
||||
@@ -1149,6 +1161,15 @@
|
||||
"default": 2
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "cpu-show-pe-core-count",
|
||||
"desc": "Detect and display CPU frequency of different core types (eg. Pcore and Ecore) if supported",
|
||||
"arg": {
|
||||
"type": "bool",
|
||||
"optional": true,
|
||||
"default": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "cpuusage-separate",
|
||||
"desc": "Display CPU usage per CPU logical core, instead of an average result",
|
||||
@@ -1194,13 +1215,18 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "gpu-force-vulkan",
|
||||
"desc": "Force using vulkan to detect GPUs",
|
||||
"remark": "Vulkan supports video memory usage detection",
|
||||
"long": "gpu-detection-method",
|
||||
"desc": "Force using a specified method to detect GPUs",
|
||||
"remark": "Will fall back to next methods if the specified method fails",
|
||||
"arg": {
|
||||
"type": "bool",
|
||||
"optional": true,
|
||||
"default": false
|
||||
"type": "enum",
|
||||
"enum": {
|
||||
"auto": "Query platform specific graphic APIs. Requires proper GPU drivers installed. Not supported on FreeBSD",
|
||||
"pci": "Search PCI devices, which do not requires GPU driver installed. Not supported on Windows and macOS",
|
||||
"vulkan": "Use Vulkan API. Slow and requires vulkan driver installed. Used for Android",
|
||||
"opengl": "Use OpenGL API. Slow and only detects one GPU"
|
||||
},
|
||||
"default": "auto"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -1225,6 +1251,14 @@
|
||||
"default": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "loadavg-ndigits",
|
||||
"desc": "Set the number of digits to keep after the decimal point when printing load average",
|
||||
"arg": {
|
||||
"type": "num",
|
||||
"default": 2
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "localip-show-ipv4",
|
||||
"desc": "Show IPv4 addresses in local ip module",
|
||||
@@ -1261,6 +1295,15 @@
|
||||
"default": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "localip-show-prefix-len",
|
||||
"desc": "Show network prefix length (/N) in local ip module",
|
||||
"arg": {
|
||||
"type": "bool",
|
||||
"optional": true,
|
||||
"default": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "localip-name-prefix",
|
||||
"desc": "Show interfaces with given interface name prefix only",
|
||||
@@ -1278,6 +1321,15 @@
|
||||
"default": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "localip-show-all-ips",
|
||||
"desc": "Show all IPs bound to the same interface. By default only the first IP is shown",
|
||||
"arg": {
|
||||
"type": "bool",
|
||||
"optional": true,
|
||||
"default": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "localip-compact",
|
||||
"desc": "Show all IPs in one line",
|
||||
@@ -1328,6 +1380,14 @@
|
||||
"type": "str"
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "publicip-ipv6",
|
||||
"desc": "Whether to use IPv6 for public IP detection server",
|
||||
"arg": {
|
||||
"type": "bool",
|
||||
"default": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "weather-location",
|
||||
"desc": "Set the location to be used",
|
||||
@@ -1502,6 +1562,14 @@
|
||||
},
|
||||
"pseudo": true
|
||||
},
|
||||
{
|
||||
"long": "<module>-output-color",
|
||||
"desc": "Override the global \"--color-output\" option for each specific module",
|
||||
"arg": {
|
||||
"type": "color"
|
||||
},
|
||||
"pseudo": true
|
||||
},
|
||||
{
|
||||
"long": "<module>-key-width",
|
||||
"desc": "Override the global \"--key-width\" option for each specific module",
|
||||
|
||||
@@ -3,7 +3,8 @@ 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 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
|
||||
--color 35: sets the color to magenta. `--color magenta` is also supported
|
||||
--color 38;5;38: sets the color to 38th color of ANSI 256 colors
|
||||
--color 4;92: sets the color to bright Green with underline. `--color underline_green` is also supported
|
||||
--color 5;104: blinking text on a blue background
|
||||
If no color is set, the main color of the logo will be used.
|
||||
|
||||
@@ -4,6 +4,10 @@ For example the format string "Values: {1} ({2})", with the values "First" and "
|
||||
The format string can contain placeholders in any order and have multiple occurrences.
|
||||
To include spaces when setting from the command line, surround the whole string with double quotes (").
|
||||
|
||||
In 2.14.0 or newer, the value indices can be meaningful named tags.
|
||||
For example: "--title-format '{user-name-colored}{at-symbol-colored}{host-name-colored}'" is equivalent to "--title-format '{6}{7}{8}'"
|
||||
See "fastfetch -h title-format" for all supported tags.
|
||||
|
||||
If the value index is missing, meaning the placeholder is "{}", an internal counter sets the value index.
|
||||
This means that the format string "Values: {1} ({2})" is equivalent to "Values: {} ({})".
|
||||
Note that this counter only counts empty placeholders, so the format string "{2} {} {}" will contain the second value, then the first, and then the second again.
|
||||
@@ -16,7 +20,7 @@ To only print something if a variable is set, use "{?<index>} ... {?}".
|
||||
For example, to only print a second value if it is set, use "{?2} Second value: {2}{?}".
|
||||
If a "{?}" is found without an opener, it is printed as is.
|
||||
|
||||
To only print something if a variable is not set, do the same as with if, just replace every '?' with a '!'.
|
||||
To only print something if a variable is not set, do the same as with if, just replace every '?' with a '/'.
|
||||
For example to print a fallback for a second value if it is not set, use "{?2}{2}{?}{/2}Second value fallback{/}".
|
||||
|
||||
To stop formatting at any point in the format string, use "{-}".
|
||||
@@ -24,7 +28,7 @@ To stop formatting at any point in the format string, use "{-}".
|
||||
To print something with color, start a placeholder with a '#' and then the linux terminal color encoding.
|
||||
"\033[" at the start, and an 'm' at the end is automatically added, so don't do that.
|
||||
A "{#}" is equivalent to a "{#0}" and resets everything to normal.
|
||||
For example to print something pink and underline, use "{#4;35}...{#}".
|
||||
For example to print something pink and underline, use "{#4;35}...{#}". "{#underline_magenta}" is also supported. See `fastfetch -h color` for detail.
|
||||
Information about what the numbers mean can be found here: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters.
|
||||
Which escape codes are supported and how they look is defined by your terminal.
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ static const char* parseTermuxApi(FFBatteryOptions* options, FFlist* results)
|
||||
ffStrbufInit(&battery->modelName);
|
||||
ffStrbufInit(&battery->status);
|
||||
ffStrbufInit(&battery->technology);
|
||||
ffStrbufInit(&battery->serial);
|
||||
ffStrbufInit(&battery->manufactureDate);
|
||||
|
||||
battery->capacity = yyjson_get_num(yyjson_obj_get(root, "percentage"));
|
||||
@@ -77,6 +78,8 @@ static const char* parseDumpsys(FFBatteryOptions* options, FFlist* results)
|
||||
ffStrbufInit(&battery->modelName);
|
||||
ffStrbufInit(&battery->status);
|
||||
ffStrbufInit(&battery->technology);
|
||||
ffStrbufInit(&battery->serial);
|
||||
ffStrbufInit(&battery->manufactureDate);
|
||||
|
||||
if (ffParsePropLines(start, "AC powered: ", &temp) && ffStrbufEqualS(&temp, "true"))
|
||||
ffStrbufAppendS(&battery->status, "AC powered");
|
||||
|
||||
@@ -170,8 +170,5 @@ const char* ffDetectBattery(FFBatteryOptions* options, FFlist* results)
|
||||
ffStrbufSubstrBefore(&baseDir, baseDirLength);
|
||||
}
|
||||
|
||||
if(results->length == 0)
|
||||
return "\"/sys/class/power_supply/\" doesn't contain any battery folder";
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
#include "battery.h"
|
||||
|
||||
#include "common/io/io.h"
|
||||
#include "util/windows/nt.h"
|
||||
#include "util/windows/unicode.h"
|
||||
#include "util/mallocHelper.h"
|
||||
#include "util/smbiosHelper.h"
|
||||
@@ -10,21 +13,6 @@
|
||||
#include <devguid.h>
|
||||
#include <winternl.h>
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtPowerInformation(
|
||||
IN POWER_INFORMATION_LEVEL InformationLevel,
|
||||
IN PVOID InputBuffer OPTIONAL,
|
||||
IN ULONG InputBufferLength,
|
||||
OUT PVOID OutputBuffer OPTIONAL,
|
||||
IN ULONG OutputBufferLength);
|
||||
|
||||
static inline void wrapCloseHandle(HANDLE* handle)
|
||||
{
|
||||
if(*handle)
|
||||
CloseHandle(*handle);
|
||||
}
|
||||
static inline void wrapSetupDiDestroyDeviceInfoList(HDEVINFO* hdev)
|
||||
{
|
||||
if(*hdev)
|
||||
@@ -52,7 +40,7 @@ static const char* detectWithSetupApi(FFBatteryOptions* options, FFlist* results
|
||||
if(!SetupDiGetDeviceInterfaceDetailW(hdev, &did, pdidd, cbRequired, &cbRequired, NULL))
|
||||
continue;
|
||||
|
||||
HANDLE __attribute__((__cleanup__(wrapCloseHandle))) hBattery =
|
||||
HANDLE FF_AUTO_CLOSE_FD hBattery =
|
||||
CreateFileW(pdidd->DevicePath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
|
||||
if(hBattery == INVALID_HANDLE_VALUE)
|
||||
@@ -157,8 +145,6 @@ static const char* detectWithSetupApi(FFBatteryOptions* options, FFlist* results
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
typedef struct FFSmbiosPortableBattery
|
||||
{
|
||||
FFSmbiosHeader Header;
|
||||
@@ -181,11 +167,18 @@ typedef struct FFSmbiosPortableBattery
|
||||
uint8_t SbdsDeviceChemistry; // string
|
||||
uint8_t DesignCapacityMultiplier; // varies
|
||||
uint16_t OEMSpecific; // varies
|
||||
} FFSmbiosPortableBattery;
|
||||
} __attribute__((__packed__)) FFSmbiosPortableBattery;
|
||||
|
||||
static_assert(offsetof(FFSmbiosPortableBattery, OEMSpecific) == 0x16,
|
||||
"FFSmbiosPortableBattery: Wrong struct alignment");
|
||||
|
||||
const char* detectBySmbios(FFBatteryResult* battery)
|
||||
{
|
||||
const FFSmbiosPortableBattery* data = (const FFSmbiosPortableBattery*) (*ffGetSmbiosHeaderTable())[FF_SMBIOS_TYPE_PORTABLE_BATTERY];
|
||||
const FFSmbiosHeaderTable* smbiosTable = ffGetSmbiosHeaderTable();
|
||||
if (!smbiosTable)
|
||||
return "Failed to get SMBIOS data";
|
||||
|
||||
const FFSmbiosPortableBattery* data = (const FFSmbiosPortableBattery*) (*smbiosTable)[FF_SMBIOS_TYPE_PORTABLE_BATTERY];
|
||||
if (!data)
|
||||
return "Portable battery section is not found in SMBIOS data";
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
const char* ffDetectBios(FFBiosResult* bios)
|
||||
const char *ffDetectBios(FFBiosResult *bios)
|
||||
{
|
||||
ffGetSmbiosValue("/sys/devices/virtual/dmi/id/bios_date", "/sys/class/dmi/id/bios_date", &bios->date);
|
||||
ffGetSmbiosValue("/sys/devices/virtual/dmi/id/bios_release", "/sys/class/dmi/id/bios_release", &bios->release);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "bios.h"
|
||||
#include "util/smbiosHelper.h"
|
||||
#include "util/windows/registry.h"
|
||||
|
||||
#include <ntstatus.h>
|
||||
#include <winternl.h>
|
||||
@@ -35,7 +36,7 @@ typedef struct FFSmbiosBios
|
||||
uint16_t BiosStartingAddressSegment; // varies
|
||||
uint8_t BiosReleaseDate; // string
|
||||
uint8_t BiosRomSize; // string
|
||||
uint32_t BiosCharacteristics; // bit field
|
||||
uint64_t BiosCharacteristics; // bit field
|
||||
|
||||
// 2.4+
|
||||
uint8_t BiosCharacteristicsExtensionBytes[2]; // bit field
|
||||
@@ -46,11 +47,18 @@ typedef struct FFSmbiosBios
|
||||
|
||||
// 3.1+
|
||||
uint16_t ExtendedBiosRomSize; // bit field
|
||||
} FFSmbiosBios;
|
||||
} __attribute__((__packed__)) FFSmbiosBios;
|
||||
|
||||
static_assert(offsetof(FFSmbiosBios, ExtendedBiosRomSize) == 0x18,
|
||||
"FFSmbiosBios: Wrong struct alignment");
|
||||
|
||||
const char* ffDetectBios(FFBiosResult* bios)
|
||||
{
|
||||
const FFSmbiosBios* data = (const FFSmbiosBios*) (*ffGetSmbiosHeaderTable())[FF_SMBIOS_TYPE_BIOS];
|
||||
const FFSmbiosHeaderTable* smbiosTable = ffGetSmbiosHeaderTable();
|
||||
if (!smbiosTable)
|
||||
return "Failed to get SMBIOS data";
|
||||
|
||||
const FFSmbiosBios* data = (const FFSmbiosBios*) (*smbiosTable)[FF_SMBIOS_TYPE_BIOS];
|
||||
if (!data)
|
||||
return "BIOS section is not found in SMBIOS data";
|
||||
|
||||
|
||||
@@ -14,13 +14,20 @@ typedef struct FFSmbiosBaseboard
|
||||
uint8_t LocationInChassis; // string
|
||||
uint16_t ChassisHandle; // varies
|
||||
uint8_t BoardType; // enum
|
||||
uint8_t NumberOfContainedObjectHandle; // varies
|
||||
uint16_t ContainedObjectHandle[]; // varies
|
||||
} FFSmbiosBaseboard;
|
||||
uint8_t NumberOfContainedObjectHandles; // varies
|
||||
uint16_t ContainedObjectHandles[]; // varies
|
||||
} __attribute__((__packed__)) FFSmbiosBaseboard;
|
||||
|
||||
static_assert(offsetof(FFSmbiosBaseboard, ContainedObjectHandles) == 0x0F,
|
||||
"FFSmbiosBaseboard: Wrong struct alignment");
|
||||
|
||||
const char* ffDetectBoard(FFBoardResult* board)
|
||||
{
|
||||
const FFSmbiosBaseboard* data = (const FFSmbiosBaseboard*) (*ffGetSmbiosHeaderTable())[FF_SMBIOS_TYPE_BASEBOARD_INFO];
|
||||
const FFSmbiosHeaderTable* smbiosTable = ffGetSmbiosHeaderTable();
|
||||
if (!smbiosTable)
|
||||
return "Failed to get SMBIOS data";
|
||||
|
||||
const FFSmbiosBaseboard* data = (const FFSmbiosBaseboard*) (*smbiosTable)[FF_SMBIOS_TYPE_BASEBOARD_INFO];
|
||||
if (!data)
|
||||
return "Baseboard information section is not found in SMBIOS data";
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
#include "efi_helper.h"
|
||||
|
||||
static inline uint8_t evBits(uint16_t val, uint8_t mask, uint8_t shift)
|
||||
{
|
||||
return (uint8_t) ((val & (mask << shift)) >> shift);
|
||||
}
|
||||
|
||||
static void ffEfiUcs2ToUtf8(const uint16_t *const chars, FFstrbuf* result)
|
||||
{
|
||||
for (uint32_t i = 0; chars[i]; i++)
|
||||
{
|
||||
if (chars[i] <= 0x007f)
|
||||
ffStrbufAppendC(result, (char) chars[i]);
|
||||
else if (chars[i] > 0x007f && chars[i] <= 0x07ff)
|
||||
{
|
||||
ffStrbufAppendC(result, (char) (0xc0 | evBits(chars[i], 0x1f, 6)));
|
||||
ffStrbufAppendC(result, (char) (0x80 | evBits(chars[i], 0x3f, 0)));
|
||||
}
|
||||
else
|
||||
{
|
||||
ffStrbufAppendC(result, (char) (0xe0 | evBits(chars[i], 0xf, 12)));
|
||||
ffStrbufAppendC(result, (char) (0x80 | evBits(chars[i], 0x3f, 6)));
|
||||
ffStrbufAppendC(result, (char) (0x80 | evBits(chars[i], 0x3f, 0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ffEfiFillLoadOption(const FFEfiLoadOption* efiOption, FFBootmgrResult* result)
|
||||
{
|
||||
uint32_t descLen = 0;
|
||||
while (efiOption->Description[descLen]) ++descLen;
|
||||
|
||||
if (descLen)
|
||||
ffEfiUcs2ToUtf8(efiOption->Description, &result->name);
|
||||
|
||||
for (
|
||||
ffEfiDevicePathProtocol* filePathList = (void*) &efiOption->Description[descLen + 1];
|
||||
filePathList->Type != 0x7F; // End of Hardware Device Path
|
||||
filePathList = (void*) ((uint8_t*) filePathList + filePathList->Length))
|
||||
{
|
||||
if (filePathList->Type == 4 && filePathList->SubType == 4)
|
||||
{
|
||||
// https://uefi.org/specs/UEFI/2.10/10_Protocols_Device_Path_Protocol.html#file-path-media-device-path
|
||||
ffEfiUcs2ToUtf8((uint16_t*) filePathList->SpecificDevicePathData, &result->firmware);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
|
||||
typedef struct FFBootmgrResult
|
||||
{
|
||||
FFstrbuf name;
|
||||
FFstrbuf firmware;
|
||||
bool secureBoot;
|
||||
} FFBootmgrResult;
|
||||
|
||||
const char* ffDetectBootmgr(FFBootmgrResult* bios);
|
||||
@@ -0,0 +1,12 @@
|
||||
#include "bootmgr.h"
|
||||
#include "common/io/io.h"
|
||||
|
||||
const char* ffDetectBootmgr(FFBootmgrResult* result)
|
||||
{
|
||||
if (ffPathExists("/System/Library/CoreServices/boot.efi", FF_PATHTYPE_FILE))
|
||||
ffStrbufSetStatic(&result->firmware, "/System/Library/CoreServices/boot.efi");
|
||||
|
||||
ffStrbufSetStatic(&result->name, "iBoot");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
#include "bootmgr.h"
|
||||
#include "efi_helper.h"
|
||||
#include "common/io/io.h"
|
||||
|
||||
#include <sys/efiio.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
const char* ffDetectBootmgr(FFBootmgrResult* result)
|
||||
{
|
||||
FF_AUTO_CLOSE_FD int efifd = open("/dev/efi", O_RDWR);
|
||||
if (efifd < 0) return "open(/dev/efi) failed";
|
||||
|
||||
uint8_t buffer[2048];
|
||||
struct efi_var_ioc ioc = {
|
||||
.vendor = { 0x8be4df61, 0x93ca, 0x11d2, 0xaa, 0x0d, { 0x00, 0xe0, 0x98, 0x03, 0x2b, 0x8c } },
|
||||
.data = buffer,
|
||||
};
|
||||
|
||||
ioc.datasize = sizeof(buffer);
|
||||
ioc.name = (efi_char[]){ 'B', 'o', 'o', 't', 'C', 'u', 'r', 'r', 'e', 'n', 't', '\0' };
|
||||
ioc.namesize = sizeof("BootCurrent") * 2;
|
||||
if (ioctl(efifd, EFIIOC_VAR_GET, &ioc) < 0 || ioc.datasize != 2)
|
||||
return "ioctl(EFIIOC_VAR_GET, BootCurrent) failed";
|
||||
|
||||
unsigned char hex[5];
|
||||
snprintf((char*) hex, sizeof(hex), "%04X", *(uint16_t*)buffer);
|
||||
ioc.datasize = sizeof(buffer);
|
||||
ioc.name = (efi_char[]){ 'B', 'o', 'o', 't', hex[0], hex[1], hex[2], hex[3], '\0' };
|
||||
ioc.namesize = sizeof("Boot####") * 2;
|
||||
if (ioctl(efifd, EFIIOC_VAR_GET, &ioc) < 0 || ioc.datasize == sizeof(buffer))
|
||||
return "ioctl(EFIIOC_VAR_GET, Boot####) failed";
|
||||
|
||||
ffEfiFillLoadOption((FFEfiLoadOption *)buffer, result);
|
||||
|
||||
ioc.name = (efi_char[]){ 'S', 'e', 'c', 'u', 'r', 'e', 'B', 'o', 'o', 't', '\0' };
|
||||
ioc.namesize = sizeof("SecureBoot") * 2;
|
||||
ioc.datasize = sizeof(buffer);
|
||||
if (ioctl(efifd, EFIIOC_VAR_GET, &ioc) == 0 && ioc.datasize == 1)
|
||||
result->secureBoot = !!buffer[0];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#include "bootmgr.h"
|
||||
#include "common/io/io.h"
|
||||
#include "efi_helper.h"
|
||||
|
||||
#define FF_EFIVARS_PATH_PREFIX "/sys/firmware/efi/efivars/"
|
||||
|
||||
const char* ffDetectBootmgr(FFBootmgrResult* result)
|
||||
{
|
||||
uint8_t buffer[2048];
|
||||
|
||||
if (ffReadFileData(FF_EFIVARS_PATH_PREFIX "BootCurrent-" FF_EFI_GLOBAL_GUID, sizeof(buffer), buffer) != 6)
|
||||
return "Failed to read efivar: BootCurrent";
|
||||
|
||||
uint16_t value = *(uint16_t *)&buffer[4];
|
||||
snprintf((char*) buffer, sizeof(buffer), FF_EFIVARS_PATH_PREFIX "Boot%04X-" FF_EFI_GLOBAL_GUID, value);
|
||||
|
||||
ssize_t size = ffReadFileData((const char*) buffer, sizeof(buffer), buffer);
|
||||
if (size < 5 + (int) sizeof(FFEfiLoadOption) || size == (ssize_t) sizeof(buffer))
|
||||
return "Failed to read efivar: Boot####";
|
||||
|
||||
ffEfiFillLoadOption((FFEfiLoadOption *)&buffer[4], result);
|
||||
|
||||
if (ffReadFileData(FF_EFIVARS_PATH_PREFIX "SecureBoot-" FF_EFI_GLOBAL_GUID, sizeof(buffer), buffer) == 6)
|
||||
result->secureBoot = buffer[4] == 1;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#include "bootmgr.h"
|
||||
|
||||
const char* ffDetectBootmgr(FF_MAYBE_UNUSED FFBootmgrResult* result)
|
||||
{
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
#include "bootmgr.h"
|
||||
#include "efi_helper.h"
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
const char* enablePrivilege(const wchar_t* privilege)
|
||||
{
|
||||
HANDLE token;
|
||||
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &token))
|
||||
return "OpenProcessToken() failed";
|
||||
|
||||
TOKEN_PRIVILEGES tp = {
|
||||
.PrivilegeCount = 1,
|
||||
.Privileges = {
|
||||
(LUID_AND_ATTRIBUTES) { .Attributes = SE_PRIVILEGE_ENABLED }
|
||||
},
|
||||
};
|
||||
if (!LookupPrivilegeValueW(NULL, privilege, &tp.Privileges[0].Luid))
|
||||
return "LookupPrivilegeValue() failed";
|
||||
|
||||
if (!AdjustTokenPrivileges(token, false, &tp, sizeof(tp), NULL, NULL))
|
||||
return "AdjustTokenPrivileges() failed";
|
||||
|
||||
if (GetLastError() == ERROR_NOT_ALL_ASSIGNED)
|
||||
return "The token does not have the specified privilege";
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* ffDetectBootmgr(FFBootmgrResult* result)
|
||||
{
|
||||
if (enablePrivilege(L"SeSystemEnvironmentPrivilege") != NULL)
|
||||
return "Failed to enable SeSystemEnvironmentPrivilege";
|
||||
|
||||
uint16_t value;
|
||||
if (GetFirmwareEnvironmentVariableW(L"BootCurrent", L"{" FF_EFI_GLOBAL_GUID L"}", &value, sizeof(value)) != 2)
|
||||
return "GetFirmwareEnvironmentVariableW(BootCurrent) failed";
|
||||
|
||||
uint8_t buffer[2048];
|
||||
wchar_t key[16];
|
||||
wsprintfW(key, L"Boot%04X", value);
|
||||
uint32_t size = GetFirmwareEnvironmentVariableW(key, L"{" FF_EFI_GLOBAL_GUID L"}", buffer, sizeof(buffer));
|
||||
if (size < sizeof(FFEfiLoadOption) || size == sizeof(buffer))
|
||||
return "GetFirmwareEnvironmentVariableW(Boot####) failed";
|
||||
|
||||
ffEfiFillLoadOption((FFEfiLoadOption *)buffer, result);
|
||||
|
||||
DWORD uefiSecureBootEnabled = 0, bufSize = 0;
|
||||
if (RegGetValueW(HKEY_LOCAL_MACHINE, L"SYSTEM\\ControlSet001\\Control\\SecureBoot\\State", L"UEFISecureBootEnabled", RRF_RT_REG_DWORD, NULL, &uefiSecureBootEnabled, &bufSize) == ERROR_SUCCESS)
|
||||
result->secureBoot = !!uefiSecureBootEnabled;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
#include "bootmgr.h"
|
||||
|
||||
// https://uefi.org/specs/UEFI/2.10/10_Protocols_Device_Path_Protocol.html#generic-device-path-structures
|
||||
typedef struct ffEfiDevicePathProtocol
|
||||
{
|
||||
uint8_t Type;
|
||||
uint8_t SubType;
|
||||
uint16_t Length;
|
||||
uint8_t SpecificDevicePathData[];
|
||||
} ffEfiDevicePathProtocol;
|
||||
|
||||
// https://uefi.org/specs/UEFI/2.10/03_Boot_Manager.html#load-options
|
||||
typedef struct FFEfiLoadOption
|
||||
{
|
||||
uint32_t Attributes;
|
||||
uint16_t FilePathListLength;
|
||||
uint16_t Description[];
|
||||
// ffEfiDevicePathProtocol FilePathList[];
|
||||
// uint8_t OptionalData[];
|
||||
} FFEfiLoadOption;
|
||||
|
||||
bool ffEfiFillLoadOption(const FFEfiLoadOption* efiOption, FFBootmgrResult* result);
|
||||
|
||||
#define FF_EFI_GLOBAL_GUID "8be4df61-93ca-11d2-aa0d-00e098032b8c"
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#include <dirent.h>
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
|
||||
static const char* detectWithBacklight(FFlist* result)
|
||||
@@ -58,14 +57,14 @@ static const char* detectWithBacklight(FFlist* result)
|
||||
{
|
||||
ffStrbufSubstrBeforeLastC(&brightness->name, '/'); // remove "/edid"
|
||||
ffStrbufSubstrAfterLastC(&brightness->name, '/'); // try getting DRM connector name
|
||||
if(isdigit(brightness->name.chars[0]))
|
||||
if(ffCharIsDigit(brightness->name.chars[0]))
|
||||
{
|
||||
// PCI address or some unknown path, give up
|
||||
ffStrbufSetS(&brightness->name, entry->d_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(ffStrbufStartsWithS(&brightness->name, "card") && isdigit(brightness->name.chars[4]))
|
||||
if(ffStrbufStartsWithS(&brightness->name, "card") && ffCharIsDigit(brightness->name.chars[4]))
|
||||
ffStrbufSubstrAfterFirstC(&brightness->name, '-');
|
||||
}
|
||||
}
|
||||
@@ -109,14 +108,19 @@ static const char* detectWithDdcci(FFBrightnessOptions* options, FFlist* result)
|
||||
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libddcutil, ddca_free_any_vcp_value)
|
||||
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libddcutil, ddca_close_display)
|
||||
|
||||
#ifndef FF_DISABLE_DLOPEN
|
||||
__typeof__(&ddca_init) ffddca_init = dlsym(libddcutil, "ddca_init");
|
||||
if (ffddca_init)
|
||||
#else
|
||||
__typeof__(&ddca_init) ffddca_init = ddca_init;
|
||||
#endif
|
||||
{
|
||||
FF_SUPPRESS_IO();
|
||||
// Ref: https://github.com/rockowitz/ddcutil/issues/344
|
||||
if (ffddca_init(NULL, -1 /*DDCA_SYSLOG_NOT_SET*/, 1 /*DDCA_INIT_OPTIONS_DISABLE_CONFIG_FILE*/) < 0)
|
||||
return "ddca_init() failed";
|
||||
}
|
||||
#ifndef FF_DISABLE_DLOPEN
|
||||
else
|
||||
{
|
||||
__typeof__(&ddca_set_default_sleep_multiplier) ffddca_set_default_sleep_multiplier = dlsym(libddcutil, "ddca_set_default_sleep_multiplier");
|
||||
@@ -125,6 +129,7 @@ static const char* detectWithDdcci(FFBrightnessOptions* options, FFlist* result)
|
||||
|
||||
libddcutil = NULL; // Don't dlclose libddcutil. See https://github.com/rockowitz/ddcutil/issues/330
|
||||
}
|
||||
#endif
|
||||
|
||||
FF_AUTO_FREE DDCA_Display_Info_List* infoList = NULL;
|
||||
if (ffddca_get_display_info_list2(false, &infoList) < 0)
|
||||
|
||||
@@ -1,10 +1,32 @@
|
||||
#include "camera.h"
|
||||
#include "common/io/io.h"
|
||||
|
||||
#import <AVFoundation/AVCaptureDevice.h>
|
||||
|
||||
// warning: 'AVCaptureDeviceTypeExternalUnknown' is deprecated
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
const char* ffDetectCamera(FFlist* result)
|
||||
{
|
||||
AVCaptureDeviceDiscoverySession* session = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:@[AVCaptureDeviceTypeBuiltInWideAngleCamera] mediaType:AVMediaTypeVideo position:AVCaptureDevicePositionUnspecified];
|
||||
#ifdef MAC_OS_X_VERSION_10_15
|
||||
FF_SUPPRESS_IO(); // #822
|
||||
|
||||
AVCaptureDeviceType deviceType;
|
||||
|
||||
#ifdef MAC_OS_VERSION_14_0
|
||||
if (@available(macOS 14.0, *))
|
||||
{
|
||||
deviceType = AVCaptureDeviceTypeExternal;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
deviceType = AVCaptureDeviceTypeExternalUnknown;
|
||||
}
|
||||
|
||||
AVCaptureDeviceDiscoverySession* session = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:@[AVCaptureDeviceTypeBuiltInWideAngleCamera, deviceType]
|
||||
mediaType:AVMediaTypeVideo
|
||||
position:AVCaptureDevicePositionUnspecified];
|
||||
if (!session)
|
||||
return "Failed to create AVCaptureDeviceDiscoverySession";
|
||||
|
||||
@@ -26,6 +48,8 @@ const char* ffDetectCamera(FFlist* result)
|
||||
camera->width = size.width < 0 ? 0 : (uint32_t) size.width;
|
||||
camera->height = size.height < 0 ? 0 : (uint32_t) size.height;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
#else
|
||||
return "No support for old MacOS version";
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -25,11 +25,18 @@ typedef struct FFSmbiosSystemEnclosure
|
||||
uint8_t ContainedElementCount; // varies
|
||||
uint8_t ContainedRecordLength; // varies
|
||||
uint8_t ContainedElements[]; // varies
|
||||
} FFSmbiosSystemEnclosure;
|
||||
} __attribute__((__packed__)) FFSmbiosSystemEnclosure;
|
||||
|
||||
static_assert(offsetof(FFSmbiosSystemEnclosure, ContainedElements) == 0x15,
|
||||
"FFSmbiosSystemEnclosure: Wrong struct alignment");
|
||||
|
||||
const char* ffDetectChassis(FFChassisResult* result)
|
||||
{
|
||||
const FFSmbiosSystemEnclosure* data = (const FFSmbiosSystemEnclosure*) (*ffGetSmbiosHeaderTable())[FF_SMBIOS_TYPE_SYSTEM_ENCLOSURE];
|
||||
const FFSmbiosHeaderTable* smbiosTable = ffGetSmbiosHeaderTable();
|
||||
if (!smbiosTable)
|
||||
return "Failed to get SMBIOS data";
|
||||
|
||||
const FFSmbiosSystemEnclosure* data = (const FFSmbiosSystemEnclosure*) (*smbiosTable)[FF_SMBIOS_TYPE_SYSTEM_ENCLOSURE];
|
||||
if (!data)
|
||||
return "System enclosure is not found in SMBIOS data";
|
||||
|
||||
|
||||
@@ -18,3 +18,24 @@ const char* ffDetectCPU(const FFCPUOptions* options, FFCPUResult* cpu)
|
||||
ffStrbufTrimRight(&cpu->name, ' '); //If we removed the @ in previous step there was most likely a space before it
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* ffCPUAppleCodeToName(uint32_t code)
|
||||
{
|
||||
// https://github.com/AsahiLinux/docs/wiki/Codenames
|
||||
switch (code)
|
||||
{
|
||||
case 8103: return "Apple M1";
|
||||
case 6000: return "Apple M1 Pro";
|
||||
case 6001: return "Apple M1 Max";
|
||||
case 6002: return "Apple M1 Ultra";
|
||||
case 8112: return "Apple M2";
|
||||
case 6020: return "Apple M2 Pro";
|
||||
case 6021: return "Apple M2 Max";
|
||||
case 6022: return "Apple M2 Ultra";
|
||||
case 8122: return "Apple M3";
|
||||
case 6030: return "Apple M3 Pro";
|
||||
case 6031:
|
||||
case 6034: return "Apple M3 Max";
|
||||
default: return "Apple Silicon";
|
||||
}
|
||||
}
|
||||
|
||||
+12
-1
@@ -4,6 +4,12 @@
|
||||
|
||||
#define FF_CPU_TEMP_UNSET (0/0.0)
|
||||
|
||||
typedef struct FFCPUCore
|
||||
{
|
||||
uint32_t freq;
|
||||
uint32_t count;
|
||||
} FFCPUCore;
|
||||
|
||||
typedef struct FFCPUResult
|
||||
{
|
||||
FFstrbuf name;
|
||||
@@ -13,10 +19,15 @@ typedef struct FFCPUResult
|
||||
uint16_t coresLogical;
|
||||
uint16_t coresOnline;
|
||||
|
||||
double frequencyMin; // GHz
|
||||
double frequencyBase; // GHz
|
||||
double frequencyMax; // GHz
|
||||
double frequencyMin; // GHz
|
||||
double frequencyBiosLimit; // GHz
|
||||
|
||||
FFCPUCore coreTypes[16]; // number of P cores, E cores, etc.
|
||||
|
||||
double temperature;
|
||||
} FFCPUResult;
|
||||
|
||||
const char* ffDetectCPU(const FFCPUOptions* options, FFCPUResult* cpu);
|
||||
const char* ffCPUAppleCodeToName(uint32_t code);
|
||||
|
||||
@@ -60,29 +60,45 @@ static const char* detectFrequency(FFCPUResult* cpu)
|
||||
ffCfDictGetData(properties, CFSTR("voltage-states5-sram"), pCoreLength - 8, 4, (uint8_t*) &aMax, NULL);
|
||||
cpu->frequencyMax = aMax / (1000.0 * 1000 * 1000);
|
||||
}
|
||||
else
|
||||
cpu->frequencyMax = 0.0;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
static const char* detectFrequency(FFCPUResult* cpu)
|
||||
{
|
||||
cpu->frequencyBase = ffSysctlGetInt64("hw.cpufrequency", 0) / 1000.0 / 1000.0 / 1000.0;
|
||||
cpu->frequencyMin = ffSysctlGetInt64("hw.cpufrequency_min", 0) / 1000.0 / 1000.0 / 1000.0;
|
||||
cpu->frequencyMax = ffSysctlGetInt64("hw.cpufrequency_max", 0);
|
||||
if(cpu->frequencyMax > 0.0)
|
||||
cpu->frequencyMax /= 1000.0 * 1000.0 * 1000.0;
|
||||
else
|
||||
cpu->frequencyMax = ffSysctlGetInt64("hw.cpufrequency_max", 0) / 1000.0 / 1000.0 / 1000.0;
|
||||
if(cpu->frequencyBase != cpu->frequencyBase)
|
||||
{
|
||||
unsigned current = 0;
|
||||
size_t size = sizeof(current);
|
||||
if (sysctl((int[]){ CTL_HW, HW_CPU_FREQ }, 2, ¤t, &size, NULL, 0) == 0)
|
||||
cpu->frequencyMax = (double) current / 1000.0 / 1000.0 / 1000.0;
|
||||
cpu->frequencyBase = (double) current / 1000.0 / 1000.0 / 1000.0;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
static const char* detectCoreCount(FFCPUResult* cpu)
|
||||
{
|
||||
uint32_t nPerfLevels = (uint32_t) ffSysctlGetInt("hw.nperflevels", 0);
|
||||
if (nPerfLevels <= 0) return "sysctl(hw.nperflevels) failed";
|
||||
|
||||
char sysctlKey[] = "hw.perflevelN.logicalcpu";
|
||||
if (nPerfLevels > sizeof(cpu->coreTypes) / sizeof(cpu->coreTypes[0]))
|
||||
nPerfLevels = sizeof(cpu->coreTypes) / sizeof(cpu->coreTypes[0]);
|
||||
for (uint32_t i = 0; i < nPerfLevels; ++i)
|
||||
{
|
||||
sysctlKey[strlen("hw.perflevel")] = (char) ('0' + i);
|
||||
cpu->coreTypes[i] = (FFCPUCore) {
|
||||
.freq = nPerfLevels - i,
|
||||
.count = (uint32_t) ffSysctlGetInt(sysctlKey, 0),
|
||||
};
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
|
||||
{
|
||||
if (ffSysctlGetString("machdep.cpu.brand_string", &cpu->name) != NULL)
|
||||
@@ -105,6 +121,7 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
|
||||
cpu->coresOnline = (uint16_t) ffSysctlGetInt("hw.activecpu", 1);
|
||||
|
||||
detectFrequency(cpu);
|
||||
if (options->showPeCoreCount) detectCoreCount(cpu);
|
||||
|
||||
cpu->temperature = options->temp ? detectCpuTemp(&cpu->name) : FF_CPU_TEMP_UNSET;
|
||||
|
||||
|
||||
@@ -11,8 +11,66 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
|
||||
cpu->coresLogical = cpu->coresPhysical;
|
||||
cpu->coresOnline = cpu->coresPhysical;
|
||||
|
||||
cpu->frequencyMin = ffSysctlGetInt("hw.clockrate", 0) / 1000.0;
|
||||
cpu->frequencyMax = cpu->frequencyMin;
|
||||
FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreate();
|
||||
if (ffSysctlGetString("kern.sched.topology_spec", &buffer) == NULL && buffer.length > 0)
|
||||
{
|
||||
// <groups>
|
||||
// <group level="1" cache-level="3">
|
||||
// <cpu count="4" mask="f,0,0,0">0, 1, 2, 3</cpu>
|
||||
// <children>
|
||||
// <group level="2" cache-level="2">
|
||||
// <cpu count="2" mask="3,0,0,0">0, 1</cpu>
|
||||
// <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
|
||||
// </group>
|
||||
// <group level="2" cache-level="2">
|
||||
// <cpu count="2" mask="c,0,0,0">2, 3</cpu>
|
||||
// <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
|
||||
// </group>
|
||||
// </children>
|
||||
// </group>
|
||||
// </groups>
|
||||
uint32_t i = 0;
|
||||
while (true)
|
||||
{
|
||||
i = ffStrbufNextIndexS(&buffer, i, "<flag name=\"THREAD\">THREAD group</flag>"); // Find physical core with hyper-threading enabled
|
||||
if (i >= buffer.length) break;
|
||||
cpu->coresPhysical--;
|
||||
i += (uint32_t) strlen("<flag name=\"THREAD\">THREAD group</flag>");
|
||||
}
|
||||
}
|
||||
|
||||
for (uint16_t i = 0; i < cpu->coresLogical; ++i)
|
||||
{
|
||||
ffStrbufClear(&buffer);
|
||||
char key[32];
|
||||
snprintf(key, sizeof(key), "dev.cpu.%u.freq_levels", i);
|
||||
if (ffSysctlGetString(key, &buffer) == NULL && buffer.length > 0)
|
||||
{
|
||||
// MHz/Watts pairs like: 2501/32000 2187/27125 2000/24000
|
||||
uint32_t fmax = (uint32_t) strtoul(buffer.chars, NULL, 10);
|
||||
uint32_t fmin = fmax;
|
||||
uint32_t i = ffStrbufLastIndexC(&buffer, ' ');
|
||||
if (i < buffer.length)
|
||||
fmin = (uint32_t) strtoul(buffer.chars + i + 1, NULL, 10);
|
||||
if (!(cpu->frequencyMin <= fmin)) cpu->frequencyMin = fmin; // Counting for NaN
|
||||
if (!(cpu->frequencyMax >= fmax)) cpu->frequencyMax = fmax;
|
||||
|
||||
if (options->showPeCoreCount)
|
||||
{
|
||||
uint32_t ifreq = 0;
|
||||
while (cpu->coreTypes[ifreq].freq != fmax && cpu->coreTypes[ifreq].freq > 0)
|
||||
++ifreq;
|
||||
if (cpu->coreTypes[ifreq].freq == 0)
|
||||
cpu->coreTypes[ifreq].freq = fmax;
|
||||
cpu->coreTypes[ifreq].count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
cpu->frequencyMin /= 1000;
|
||||
cpu->frequencyMax /= 1000;
|
||||
|
||||
int clockRate = ffSysctlGetInt("hw.clockrate", 0);
|
||||
cpu->frequencyBase = clockRate <= 0 ? 0.0/0.0 : clockRate / 1000.0;
|
||||
cpu->temperature = FF_CPU_TEMP_UNSET;
|
||||
|
||||
if (options->temp)
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include <sys/sysinfo.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include "common/settings.h"
|
||||
@@ -17,7 +16,10 @@
|
||||
static void detectAndroid(FFCPUResult* cpu)
|
||||
{
|
||||
if (cpu->name.length == 0)
|
||||
{
|
||||
ffSettingsGetAndroidProperty("ro.soc.model", &cpu->name);
|
||||
ffStrbufClear(&cpu->vendor); // We usually detect the vendor of CPU core as ARM, but instead we want the vendor of SOC
|
||||
}
|
||||
if (cpu->vendor.length == 0)
|
||||
{
|
||||
if (!ffSettingsGetAndroidProperty("ro.soc.manufacturer", &cpu->vendor))
|
||||
@@ -85,58 +87,111 @@ static const char* parseCpuInfo(FFCPUResult* cpu, FFstrbuf* physicalCoresBuffer,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static double getFrequency(FFstrbuf* basePath, const char* cpuinfoFileName, const char* scalingFileName, FFstrbuf* buffer)
|
||||
static uint32_t getFrequency(FFstrbuf* basePath, const char* cpuinfoFileName, const char* scalingFileName, FFstrbuf* buffer)
|
||||
{
|
||||
uint32_t baseLen = basePath->length;
|
||||
ffStrbufAppendS(basePath, cpuinfoFileName);
|
||||
bool ok = ffReadFileBuffer(basePath->chars, buffer);
|
||||
ffStrbufSubstrBefore(basePath, baseLen);
|
||||
if (ok)
|
||||
return ffStrbufToDouble(buffer) / 1e6;
|
||||
return (uint32_t) ffStrbufToUInt(buffer, 0);
|
||||
|
||||
ffStrbufAppendS(basePath, scalingFileName);
|
||||
if (scalingFileName)
|
||||
{
|
||||
ffStrbufAppendS(basePath, scalingFileName);
|
||||
ok = ffReadFileBuffer(basePath->chars, buffer);
|
||||
ffStrbufSubstrBefore(basePath, baseLen);
|
||||
if (ok)
|
||||
return (uint32_t) ffStrbufToUInt(buffer, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint8_t getNumCores(FFstrbuf* basePath, FFstrbuf* buffer)
|
||||
{
|
||||
uint32_t baseLen = basePath->length;
|
||||
ffStrbufAppendS(basePath, "/affected_cpus");
|
||||
bool ok = ffReadFileBuffer(basePath->chars, buffer);
|
||||
ffStrbufSubstrBefore(basePath, baseLen);
|
||||
if (ok)
|
||||
return (uint8_t) ffStrbufCountC(buffer, ' ') + 1;
|
||||
|
||||
ffStrbufAppendS(basePath, "/related_cpus");
|
||||
ok = ffReadFileBuffer(basePath->chars, buffer);
|
||||
ffStrbufSubstrBefore(basePath, baseLen);
|
||||
if (ok)
|
||||
return ffStrbufToDouble(buffer) / 1e6;
|
||||
return (uint8_t) ffStrbufCountC(buffer, ' ') + 1;
|
||||
|
||||
return 0.0/0.0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool detectFrequency(FFCPUResult* cpu)
|
||||
static bool detectFrequency(FFCPUResult* cpu, const FFCPUOptions* options)
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY path = ffStrbufCreateS("/sys/devices/system/cpu/cpufreq/");
|
||||
FF_AUTO_CLOSE_DIR DIR* dir = opendir(path.chars);
|
||||
if (!dir) return false;
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreate();
|
||||
uint32_t baseLen = path.length;
|
||||
bool flag = false;
|
||||
|
||||
struct dirent* entry;
|
||||
while((entry = readdir(dir)) != NULL)
|
||||
while ((entry = readdir(dir)) != NULL)
|
||||
{
|
||||
if (ffStrStartsWith(entry->d_name, "policy") && isdigit(entry->d_name[strlen("policy")]))
|
||||
if (ffStrStartsWith(entry->d_name, "policy") && ffCharIsDigit(entry->d_name[strlen("policy")]))
|
||||
{
|
||||
ffStrbufAppendS(&path, entry->d_name);
|
||||
double fmin = getFrequency(&path, "/cpuinfo_min_freq", "/scaling_min_freq", &buffer);
|
||||
if (fmin != fmin) continue;
|
||||
double fmax = getFrequency(&path, "/cpuinfo_max_freq", "/scaling_max_freq", &buffer);
|
||||
if (fmax != fmax) continue;
|
||||
|
||||
if (flag)
|
||||
uint32_t fbase = getFrequency(&path, "/base_frequency", NULL, &buffer);
|
||||
if (fbase > 0)
|
||||
{
|
||||
cpu->frequencyMin = cpu->frequencyMin < fmin ? cpu->frequencyMin : fmin;
|
||||
cpu->frequencyMax = cpu->frequencyMax > fmax ? cpu->frequencyMax : fmax;
|
||||
if (cpu->frequencyBase == cpu->frequencyBase)
|
||||
cpu->frequencyBase = cpu->frequencyBase > fbase ? cpu->frequencyBase : fbase;
|
||||
else
|
||||
cpu->frequencyBase = fbase;
|
||||
}
|
||||
else
|
||||
uint32_t fbioslimit = getFrequency(&path, "/bios_limit", NULL, &buffer);
|
||||
if (fbioslimit > 0)
|
||||
{
|
||||
cpu->frequencyMin = fmin;
|
||||
cpu->frequencyMax = fmax;
|
||||
flag = true;
|
||||
if (cpu->frequencyBiosLimit == cpu->frequencyBiosLimit)
|
||||
cpu->frequencyBiosLimit = cpu->frequencyBiosLimit > fbioslimit ? cpu->frequencyBiosLimit : fbioslimit;
|
||||
else
|
||||
cpu->frequencyBiosLimit = fbioslimit;
|
||||
}
|
||||
uint32_t fmax = getFrequency(&path, "/cpuinfo_max_freq", "/scaling_max_freq", &buffer);
|
||||
if (fmax > 0)
|
||||
{
|
||||
if (cpu->frequencyMax == cpu->frequencyMax)
|
||||
cpu->frequencyMax = cpu->frequencyMax > fmax ? cpu->frequencyMax : fmax;
|
||||
else
|
||||
cpu->frequencyMax = fmax;
|
||||
}
|
||||
uint32_t fmin = getFrequency(&path, "/cpuinfo_min_freq", "/scaling_min_freq", &buffer);
|
||||
if (fmin > 0)
|
||||
{
|
||||
if (cpu->frequencyMin == cpu->frequencyMin)
|
||||
cpu->frequencyMin = cpu->frequencyMin < fmin ? cpu->frequencyMin : fmin;
|
||||
else
|
||||
cpu->frequencyMin = fmin;
|
||||
}
|
||||
|
||||
if (options->showPeCoreCount)
|
||||
{
|
||||
uint32_t freq = fbase == 0 ? fmax : fbase; // seems base frequencies are more stable
|
||||
uint32_t ifreq = 0;
|
||||
while (cpu->coreTypes[ifreq].freq != freq && cpu->coreTypes[ifreq].freq > 0)
|
||||
++ifreq;
|
||||
if (cpu->coreTypes[ifreq].freq == 0)
|
||||
cpu->coreTypes[ifreq].freq = freq;
|
||||
cpu->coreTypes[ifreq].count += getNumCores(&path, &buffer);
|
||||
}
|
||||
ffStrbufSubstrBefore(&path, baseLen);
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
cpu->frequencyBase /= 1e6;
|
||||
cpu->frequencyMax /= 1e6;
|
||||
cpu->frequencyMin /= 1e6;
|
||||
cpu->frequencyBiosLimit /= 1e6;
|
||||
return true;
|
||||
}
|
||||
|
||||
static double detectCPUTemp(void)
|
||||
@@ -195,23 +250,8 @@ void detectAsahi(FFCPUResult* cpu)
|
||||
char* modelName = memchr(content, '\0', (size_t) length) + 1;
|
||||
if (modelName - content < length && ffStrStartsWith(modelName, "apple,t"))
|
||||
{
|
||||
// https://github.com/AsahiLinux/docs/wiki/Codenames
|
||||
switch (strtoul(modelName + strlen("apple,t"), NULL, 10))
|
||||
{
|
||||
case 8103: ffStrbufSetStatic(&cpu->name, "Apple M1"); break;
|
||||
case 6000: ffStrbufSetStatic(&cpu->name, "Apple M1 Pro"); break;
|
||||
case 6001: ffStrbufSetStatic(&cpu->name, "Apple M1 Max"); break;
|
||||
case 6002: ffStrbufSetStatic(&cpu->name, "Apple M1 Ultra"); break;
|
||||
case 8112: ffStrbufSetStatic(&cpu->name, "Apple M2"); break;
|
||||
case 6020: ffStrbufSetStatic(&cpu->name, "Apple M2 Pro"); break;
|
||||
case 6021: ffStrbufSetStatic(&cpu->name, "Apple M2 Max"); break;
|
||||
case 6022: ffStrbufSetStatic(&cpu->name, "Apple M2 Ultra"); break;
|
||||
case 8122: ffStrbufSetStatic(&cpu->name, "Apple M3"); break;
|
||||
case 6030: ffStrbufSetStatic(&cpu->name, "Apple M3 Pro"); break;
|
||||
case 6031:
|
||||
case 6034: ffStrbufSetStatic(&cpu->name, "Apple M3 Max"); break;
|
||||
default: ffStrbufSetStatic(&cpu->name, "Apple Silicon"); break;
|
||||
}
|
||||
uint32_t deviceId = (uint32_t) strtoul(modelName + strlen("apple,t"), NULL, 10);
|
||||
ffStrbufSetStatic(&cpu->name, ffCPUAppleCodeToName(deviceId));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -232,8 +272,8 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
|
||||
cpu->coresOnline = (uint16_t) get_nprocs();
|
||||
cpu->coresPhysical = (uint16_t) ffStrbufToUInt(&physicalCoresBuffer, cpu->coresLogical);
|
||||
|
||||
if (!detectFrequency(cpu))
|
||||
cpu->frequencyMin = cpu->frequencyMax = ffStrbufToDouble(&cpuMHz) / 1000;
|
||||
if (!detectFrequency(cpu, options) || cpu->frequencyBase != cpu->frequencyBase)
|
||||
cpu->frequencyBase = ffStrbufToDouble(&cpuMHz) / 1000;
|
||||
|
||||
if(cpuUarch.length > 0)
|
||||
{
|
||||
|
||||
+109
-41
@@ -1,6 +1,7 @@
|
||||
#include "cpu.h"
|
||||
#include "detection/temps/temps_windows.h"
|
||||
#include "util/windows/registry.h"
|
||||
#include "util/windows/nt.h"
|
||||
#include "util/mallocHelper.h"
|
||||
#include "util/smbiosHelper.h"
|
||||
|
||||
@@ -48,11 +49,43 @@ typedef struct FFSmbiosProcessorInfo
|
||||
|
||||
// 3.6+
|
||||
uint16_t ThreadEnabled; // varies
|
||||
} FFSmbiosProcessorInfo;
|
||||
} __attribute__((__packed__)) FFSmbiosProcessorInfo;
|
||||
|
||||
static_assert(offsetof(FFSmbiosProcessorInfo, ThreadEnabled) == 0x30,
|
||||
"FFSmbiosProcessorInfo: Wrong struct alignment");
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
|
||||
#include <cpuid.h>
|
||||
|
||||
inline static const char* detectSpeedByCpuid(FFCPUResult* cpu)
|
||||
{
|
||||
uint32_t base = 0, max = 0, bus = 0, unused = 0;
|
||||
if (!__get_cpuid(0x16, &base, &max, &bus, &unused))
|
||||
return "Unsupported instruction";
|
||||
|
||||
// cpuid returns 0 MHz when hyper-v is enabled
|
||||
if (base) cpu->frequencyBase = base / 1000.0;
|
||||
if (max) cpu->frequencyMax = max / 1000.0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
inline static const char* detectSpeedByCpuid(FF_MAYBE_UNUSED FFCPUResult* cpu)
|
||||
{
|
||||
return "Unsupported platform";
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static const char* detectMaxSpeedBySmbios(FFCPUResult* cpu)
|
||||
{
|
||||
const FFSmbiosProcessorInfo* data = (const FFSmbiosProcessorInfo*) (*ffGetSmbiosHeaderTable())[FF_SMBIOS_TYPE_PROCESSOR_INFO];
|
||||
const FFSmbiosHeaderTable* smbiosTable = ffGetSmbiosHeaderTable();
|
||||
if (!smbiosTable)
|
||||
return "Failed to get SMBIOS data";
|
||||
|
||||
const FFSmbiosProcessorInfo* data = (const FFSmbiosProcessorInfo*) (*smbiosTable)[FF_SMBIOS_TYPE_PROCESSOR_INFO];
|
||||
|
||||
if (!data)
|
||||
return "Processor information is not found in SMBIOS data";
|
||||
@@ -64,75 +97,110 @@ static const char* detectMaxSpeedBySmbios(FFCPUResult* cpu)
|
||||
return "No active CPU is found in SMBIOS data";
|
||||
}
|
||||
|
||||
double speed;
|
||||
if (data->MaxSpeed > 0 && data->MaxSpeed < 30000) // VMware reports weird values
|
||||
speed = data->MaxSpeed / 1000.0;
|
||||
else
|
||||
speed = data->CurrentSpeed / 1000.0;
|
||||
double speed = data->MaxSpeed / 1000.0;
|
||||
// Sometimes SMBIOS reports invalid value. We assume that max speed is small than 2x of base
|
||||
if (speed < cpu->frequencyBase || speed > cpu->frequencyBase * 2)
|
||||
return "Possible invalid CPU max speed in SMBIOS data. See #800";
|
||||
|
||||
if (cpu->frequencyMax < speed)
|
||||
cpu->frequencyMax = speed;
|
||||
cpu->frequencyMax = speed;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char* detectByOS(FFCPUResult* cpu)
|
||||
static const char* detectNCores(FFCPUResult* cpu)
|
||||
{
|
||||
DWORD length = 0;
|
||||
GetLogicalProcessorInformationEx(RelationAll, NULL, &length);
|
||||
if (length == 0)
|
||||
return "GetLogicalProcessorInformationEx(RelationAll, NULL, &length) failed";
|
||||
|
||||
SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX* FF_AUTO_FREE
|
||||
pProcessorInfo = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*)malloc(length);
|
||||
|
||||
if (!pProcessorInfo || !GetLogicalProcessorInformationEx(RelationAll, pProcessorInfo, &length))
|
||||
return "GetLogicalProcessorInformationEx(RelationAll, pProcessorInfo, &length) failed";
|
||||
|
||||
for(
|
||||
SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX* ptr = pProcessorInfo;
|
||||
(uint8_t*)ptr < ((uint8_t*)pProcessorInfo) + length;
|
||||
ptr = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*)(((uint8_t*)ptr) + ptr->Size)
|
||||
)
|
||||
{
|
||||
DWORD length = 0;
|
||||
GetLogicalProcessorInformationEx(RelationAll, NULL, &length);
|
||||
if (length == 0)
|
||||
return "GetLogicalProcessorInformationEx(RelationAll, NULL, &length) failed";
|
||||
|
||||
SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX* FF_AUTO_FREE
|
||||
pProcessorInfo = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*)malloc(length);
|
||||
|
||||
if (pProcessorInfo && GetLogicalProcessorInformationEx(RelationAll, pProcessorInfo, &length))
|
||||
if(ptr->Relationship == RelationProcessorCore)
|
||||
++cpu->coresPhysical;
|
||||
else if(ptr->Relationship == RelationGroup)
|
||||
{
|
||||
for(
|
||||
SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX* ptr = pProcessorInfo;
|
||||
(uint8_t*)ptr < ((uint8_t*)pProcessorInfo) + length;
|
||||
ptr = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*)(((uint8_t*)ptr) + ptr->Size)
|
||||
)
|
||||
for (uint32_t index = 0; index < ptr->Group.ActiveGroupCount; ++index)
|
||||
{
|
||||
if(ptr->Relationship == RelationProcessorCore)
|
||||
++cpu->coresPhysical;
|
||||
else if(ptr->Relationship == RelationGroup)
|
||||
{
|
||||
cpu->coresOnline += ptr->Group.GroupInfo->ActiveProcessorCount;
|
||||
cpu->coresLogical += ptr->Group.GroupInfo->MaximumProcessorCount;
|
||||
}
|
||||
cpu->coresOnline += ptr->Group.GroupInfo[index].ActiveProcessorCount;
|
||||
cpu->coresLogical += ptr->Group.GroupInfo[index].MaximumProcessorCount;
|
||||
}
|
||||
}
|
||||
else
|
||||
return "GetLogicalProcessorInformationEx(RelationAll, pProcessorInfo, &length) failed";
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char* detectByRegistry(FFCPUResult* cpu)
|
||||
{
|
||||
FF_HKEY_AUTO_DESTROY hKey = NULL;
|
||||
if(!ffRegOpenKeyForRead(HKEY_LOCAL_MACHINE, L"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", &hKey, NULL))
|
||||
return "ffRegOpenKeyForRead(HKEY_LOCAL_MACHINE, L\"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0\", &hKey, NULL) failed";
|
||||
|
||||
{
|
||||
uint32_t mhz;
|
||||
if(ffRegReadUint(hKey, L"~MHz", &mhz, NULL))
|
||||
cpu->frequencyMin = cpu->frequencyMax = mhz / 1000.0;
|
||||
}
|
||||
|
||||
ffRegReadStrbuf(hKey, L"ProcessorNameString", &cpu->name, NULL);
|
||||
ffRegReadStrbuf(hKey, L"VendorIdentifier", &cpu->vendor, NULL);
|
||||
|
||||
if (cpu->coresLogical == 0)
|
||||
{
|
||||
DWORD cores;
|
||||
if (RegQueryInfoKeyW(HKEY_LOCAL_MACHINE, L"HARDWARE\\DESCRIPTION\\System\\CentralProcessor", NULL, NULL, &cores, NULL, NULL, NULL, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
|
||||
cpu->coresOnline = cpu->coresPhysical = cpu->coresLogical = (uint16_t) cores;
|
||||
}
|
||||
|
||||
uint32_t mhz;
|
||||
if(ffRegReadUint(hKey, L"~MHz", &mhz, NULL))
|
||||
cpu->frequencyBase = mhz / 1000.0;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char* detectCoreTypes(FFCPUResult* cpu)
|
||||
{
|
||||
FF_AUTO_FREE PROCESSOR_POWER_INFORMATION* pinfo = calloc(cpu->coresLogical, sizeof(PROCESSOR_POWER_INFORMATION));
|
||||
if (!NT_SUCCESS(NtPowerInformation(ProcessorInformation, NULL, 0, pinfo, (ULONG) sizeof(PROCESSOR_POWER_INFORMATION) * cpu->coresLogical)))
|
||||
return "NtPowerInformation(ProcessorInformation, NULL, 0, pinfo, size) failed";
|
||||
|
||||
for (uint32_t icore = 0; icore < cpu->coresLogical && pinfo[icore].MhzLimit; ++icore)
|
||||
{
|
||||
uint32_t ifreq = 0;
|
||||
while (cpu->coreTypes[ifreq].freq != pinfo[icore].MhzLimit && cpu->coreTypes[ifreq].freq > 0)
|
||||
++ifreq;
|
||||
if (cpu->coreTypes[ifreq].freq == 0)
|
||||
cpu->coreTypes[ifreq].freq = pinfo[icore].MhzLimit;
|
||||
++cpu->coreTypes[ifreq].count;
|
||||
}
|
||||
|
||||
if (cpu->frequencyBase != cpu->frequencyBase)
|
||||
cpu->frequencyBase = pinfo->MaxMhz / 1000.0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
|
||||
{
|
||||
const char* error = detectByOS(cpu);
|
||||
detectNCores(cpu);
|
||||
|
||||
const char* error = detectByRegistry(cpu);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
detectSpeedByCpuid(cpu);
|
||||
if (options->showPeCoreCount) detectCoreTypes(cpu);
|
||||
|
||||
if (cpu->frequencyMax != cpu->frequencyMax)
|
||||
detectMaxSpeedBySmbios(cpu);
|
||||
|
||||
if(options->temp)
|
||||
ffDetectSmbiosTemp(&cpu->temperature, NULL);
|
||||
|
||||
detectMaxSpeedBySmbios(cpu);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -68,18 +68,33 @@ static bool detectCursorFromEnv(FFCursorResult* result)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool detectCursorHyprcursor(FFCursorResult* result)
|
||||
{
|
||||
const char* hyprcursor_theme = getenv("HYPRCURSOR_THEME");
|
||||
|
||||
if(!ffStrSet(hyprcursor_theme))
|
||||
return false;
|
||||
|
||||
ffStrbufAppendS(&result->theme, hyprcursor_theme);
|
||||
ffStrbufAppendS(&result->size, getenv("HYPRCURSOR_SIZE"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ffDetectCursor(FFCursorResult* result)
|
||||
{
|
||||
const FFDisplayServerResult* wmde = ffConnectDisplayServer();
|
||||
|
||||
if(ffStrbufCompS(&wmde->wmPrettyName, FF_WM_PRETTY_WSLG) == 0)
|
||||
if(ffStrbufEqualS(&wmde->wmPrettyName, FF_WM_PRETTY_WSLG))
|
||||
ffStrbufAppendS(&result->error, "WSLg uses native windows cursor");
|
||||
else if(ffStrbufIgnCaseCompS(&wmde->wmProtocolName, FF_WM_PROTOCOL_TTY) == 0)
|
||||
else if(ffStrbufIgnCaseEqualS(&wmde->wmProtocolName, FF_WM_PROTOCOL_TTY))
|
||||
ffStrbufAppendS(&result->error, "Cursor isn't supported in TTY");
|
||||
else if(ffStrbufIgnCaseCompS(&wmde->dePrettyName, FF_DE_PRETTY_PLASMA) == 0)
|
||||
else if(ffStrbufIgnCaseEqualS(&wmde->dePrettyName, FF_DE_PRETTY_PLASMA))
|
||||
detectCursorFromConfigFile("kcminputrc", "cursorTheme =", "Breeze", "cursorSize =", "24", result);
|
||||
else if(ffStrbufStartsWithIgnCaseS(&wmde->dePrettyName, FF_DE_PRETTY_LXQT))
|
||||
else if(ffStrbufIgnCaseEqualS(&wmde->dePrettyName, FF_DE_PRETTY_LXQT))
|
||||
detectCursorFromConfigFile("lxqt/session.conf", "cursor_theme =", "Adwaita", "cursor_size =", "24", result);
|
||||
else if(ffStrbufIgnCaseEqualS(&wmde->wmPrettyName, FF_WM_PRETTY_HYPRLAND) && detectCursorHyprcursor(result))
|
||||
return;
|
||||
else if(
|
||||
!detectCursorGTK(result) &&
|
||||
!detectCursorFromEnv(result) &&
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "de.h"
|
||||
|
||||
#include "common/dbus.h"
|
||||
#include "common/io/io.h"
|
||||
#include "common/library.h"
|
||||
#include "common/parsing.h"
|
||||
@@ -12,19 +13,20 @@
|
||||
|
||||
static void getKDE(FFstrbuf* result, FFDEOptions* options)
|
||||
{
|
||||
ffParsePropFileValues(FASTFETCH_TARGET_DIR_USR "/share/xsessions/plasmax11.desktop", 1, (FFpropquery[]) {
|
||||
ffParsePropFileValues(FASTFETCH_TARGET_DIR_USR "/share/wayland-sessions/plasma.desktop", 1, (FFpropquery[]) {
|
||||
{"X-KDE-PluginInfo-Version =", result}
|
||||
});
|
||||
if(result->length == 0)
|
||||
{
|
||||
ffParsePropFileValues(FASTFETCH_TARGET_DIR_USR "/share/xsessions/plasmax11.desktop", 1, (FFpropquery[]) {
|
||||
{"X-KDE-PluginInfo-Version =", result}
|
||||
});
|
||||
}
|
||||
if(result->length == 0)
|
||||
ffParsePropFileData("xsessions/plasma.desktop", "X-KDE-PluginInfo-Version =", result);
|
||||
if(result->length == 0)
|
||||
ffParsePropFileData("xsessions/plasma5.desktop", "X-KDE-PluginInfo-Version =", result);
|
||||
if(result->length == 0)
|
||||
{
|
||||
ffParsePropFileValues(FASTFETCH_TARGET_DIR_USR "/share/wayland-sessions/plasma.desktop", 1, (FFpropquery[]) {
|
||||
{"X-KDE-PluginInfo-Version =", result}
|
||||
});
|
||||
}
|
||||
|
||||
if(result->length == 0)
|
||||
ffParsePropFileData("wayland-sessions/plasmawayland.desktop", "X-KDE-PluginInfo-Version =", result);
|
||||
if(result->length == 0)
|
||||
@@ -41,11 +43,25 @@ static void getKDE(FFstrbuf* result, FFDEOptions* options)
|
||||
}
|
||||
}
|
||||
|
||||
static const char* getGnomeByDbus(FF_MAYBE_UNUSED FFstrbuf* result)
|
||||
{
|
||||
#ifdef FF_HAVE_DBUS
|
||||
FFDBusData dbus;
|
||||
if (ffDBusLoadData(DBUS_BUS_SESSION, &dbus) != NULL)
|
||||
return "ffDBusLoadData() failed";
|
||||
|
||||
ffDBusGetPropertyString(&dbus, "org.gnome.Shell", "/org/gnome/Shell", "org.gnome.Shell", "ShellVersion", result);
|
||||
return NULL;
|
||||
#else // FF_HAVE_DBUS
|
||||
return "ffDBusLoadData() failed: dbus support not compiled in";
|
||||
#endif // FF_HAVE_DBUS
|
||||
}
|
||||
|
||||
static void getGnome(FFstrbuf* result, FF_MAYBE_UNUSED FFDEOptions* options)
|
||||
{
|
||||
ffParsePropFileData("gnome-shell/org.gnome.Extensions", "version :", result);
|
||||
getGnomeByDbus(result);
|
||||
|
||||
if (result->length == 0)
|
||||
if (result->length == 0 && options->slowVersionDetection)
|
||||
{
|
||||
if (ffProcessAppendStdOut(result, (char* const[]){
|
||||
"gnome-shell",
|
||||
@@ -90,11 +106,16 @@ static void getMate(FFstrbuf* result, FFDEOptions* options)
|
||||
|
||||
static const char* getXfce4ByLib(FFstrbuf* result)
|
||||
{
|
||||
#ifndef FF_DISABLE_DLOPEN
|
||||
const char* xfce_version_string(void); // from `xfce4/libxfce4util/xfce-misutils.h
|
||||
FF_LIBRARY_LOAD(xfce4util, NULL, "dlopen libxfce4util" FF_LIBRARY_EXTENSION "failed", "libxfce4util" FF_LIBRARY_EXTENSION, 7);
|
||||
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(xfce4util, xfce_version_string);
|
||||
ffStrbufSetS(result, ffxfce_version_string());
|
||||
return NULL;
|
||||
#else
|
||||
FF_UNUSED(result);
|
||||
return "dlopen is disabled";
|
||||
#endif
|
||||
}
|
||||
|
||||
static void getXFCE4(FFstrbuf* result, FFDEOptions* options)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user