Compare commits

...

171 Commits

Author SHA1 Message Date
Carter Li cec38b9501 Merge pull request #1069 from fastfetch-cli/dev
Release: v2.17.2
2024-07-04 08:33:15 +08:00
李通洲 3453b72f0c Release: v2.17.2 2024-07-03 20:03:06 +08:00
李通洲 060544b899 Packages (Linux): detect flatpak-app only
The runtime packages detection was inaccurate. The official `flatpak
list` ignores some packages (notablily *.Locale) but the logic is
currently unknown.
2024-07-03 20:01:27 +08:00
李通洲 14c6b6d7e2 Doc: update changelog 2024-07-03 16:42:55 +08:00
李通洲 9df394bba3 Revert "OS (Linux): prioritize prettyName over name"
This reverts commit ecd69370ab.
2024-07-03 16:37:51 +08:00
李通洲 b25ffda90b PhysicalDisk: silence compiler warnings 2024-07-03 16:24:17 +08:00
李通洲 db9cf4ef29 CMake: add option ENABLE_LTO 2024-07-03 16:10:34 +08:00
李通洲 7b2d4b7a0d Wifi: silence compiler warnings 2024-07-03 15:27:06 +08:00
李通洲 64cdb3f058 LocalIP: silence compiler warnings 2024-07-03 15:26:53 +08:00
李通洲 66e7924fa3 Logo (Image): fix building on SunOS 2024-07-03 15:12:48 +08:00
李通洲 84540250f7 Editor: make --ts-version false disable version detection 2024-07-03 13:59:39 +08:00
李通洲 96e7f65902 DE (Linux): fix silly bug 2024-07-03 13:56:35 +08:00
Carter Li 321d3e5574 CMake: don't error out if we fail to detect glibc version 2024-07-03 09:54:48 +08:00
Carter Li 2bba2eaa16 WM: minor code cleanup 2024-07-03 09:54:48 +08:00
Carter Li 58ebde422a WMTheme: support cinnamon-wayland 2024-07-03 09:54:48 +08:00
Carter Li 06f3b9a96d DE (Linux): improve Cinnamon version detection
Fix #1068
2024-07-03 09:54:21 +08:00
李通洲 fa5aaa692f Doc: update copyright [ci skip] 2024-07-02 15:12:28 +08:00
李通洲 9d2c4f52d2 CI: clean up 2024-07-02 15:00:39 +08:00
李通洲 9946a5d758 CI: add stale.yml [ci skip] 2024-07-02 14:14:16 +08:00
Carter Li a749014e7c Kernel: code refactor 2024-07-02 10:47:14 +08:00
LinuxOnTheDesktop 2cd421fc2e Doc: correct various errors of English (#1065)
Including but not limited to: number agreement; punctuation
2024-07-02 10:45:36 +08:00
李通洲 4db6aebcc9 TerminalFont (Linux): support Ptyxis 2024-07-01 23:56:53 +08:00
李通洲 3b156e819b Terminal (Linux): support ptyxis version detection 2024-07-01 23:56:19 +08:00
Diego Viola 7ffed9e911 DE: Fix spelling of LXQt (#1063)
Signed-off-by: Diego Viola <diego.viola@gmail.com>
2024-07-01 16:00:35 +08:00
李通洲 9042950ee8 Color: if value is already an ANSI escape code, use it 2024-07-01 15:04:51 +08:00
Diego Viola 7aad0dc32f Theme: Fix spelling of Qt (#1062)
Signed-off-by: Diego Viola <diego.viola@gmail.com>
2024-07-01 14:38:29 +08:00
李通洲 01d04a8fa2 PhysicalMemory: remove an unused variable 2024-07-01 13:54:57 +08:00
Carter Li d3e50fe595 Packaging: update debian stuff [ci skip] 2024-07-01 13:34:28 +08:00
Carter Li ecd69370ab OS (Linux): prioritize prettyName over name 2024-07-01 08:56:00 +08:00
李通洲 abd2522268 JsonSchema: add formattion keys for CpuUsage module
Fix #1060
2024-06-30 20:01:57 +08:00
李通洲 2e1261bc21 PhysicalMemory: fix incorrect size value for large memory sticks
Fix #1061 (integer overflow)
2024-06-30 19:13:58 +08:00
李通洲 0e597a2ded Battery: fix index format with multiple batteries 2024-06-29 21:59:57 +08:00
scarf 2781a0ab93 docs: document --logo none (#1059) 2024-06-29 19:32:36 +08:00
李通洲 02d7f2693b Doc: fix document of --pipe [ci skip]
Fix #1058
2024-06-29 18:53:52 +08:00
Carter Li b001ea409b Merge pull request #1056 from fastfetch-cli/dev
Release: v2.17.1
2024-06-29 08:20:39 +08:00
李通洲 f97a9fdfc0 GPU: don't print 16 EiB 2024-06-29 07:55:01 +08:00
李通洲 2c8d5292d7 Release: v2.17.1 2024-06-29 07:29:53 +08:00
李通洲 88e4579f1e Fastfetch: fix segfaults with --show-errors and an invalid module
Fix #1055
2024-06-29 07:16:35 +08:00
Carlos & 8f97e61f67 Theme (QT): ignore QVariant format (#1054)
Closes: #1053

---------

Co-authored-by: Carter Li <CarterLi@users.noreply.github.com>
2024-06-29 07:14:36 +08:00
李通洲 0b943bb25e GPU: print formatted size when --gpu-format is used
Fix #1052
2024-06-28 22:24:02 +08:00
李通洲 19590003e1 GPU: guard GPU frequency behind driverSpecific 2024-06-28 22:17:37 +08:00
李通洲 27a1d9f8c6 Logo (Image): fix building on Windows 2024-06-28 18:08:16 +08:00
李通洲 d50ebc86c7 CMake (Windows): don't generate libffwinrt.dll.a 2024-06-28 15:15:49 +08:00
Carter Li 74616c79f5 Merge pull request #1050 from fastfetch-cli/dev
Release: v2.17.0
2024-06-28 11:31:00 +08:00
Carter Li 0c1462898b TerminalShell / TerminalFont: fix CodeQL warnings 2024-06-28 10:50:37 +08:00
Carter Li b94a322dfc Release: v2.17.0 2024-06-28 10:34:42 +08:00
Carter Li adb6dc537c Doc: update readme & changelog 2024-06-28 10:33:18 +08:00
Carter Li debcc3ca7f Logo (Image): improve performance when image is cached 2024-06-28 10:28:43 +08:00
Carter Li 3d7d02b5c5 Logo (Image): support --logo-position right 2024-06-28 10:28:43 +08:00
Carter Li 3f0ae13505 JsonConfig: clarify the breaking change 2024-06-28 10:28:43 +08:00
李通洲 4370c0944b Format: trim white spaces after truncation 2024-06-27 23:20:31 +08:00
李通洲 a9df048d49 Logo (Image): support --logo-position right for iterm and kitty-direct 2024-06-27 20:49:56 +08:00
Carlos Eduardo 09782d67e5 QT: add qt[56]ct support 2024-06-27 17:55:48 +08:00
Carlos Eduardo 165aa93fd3 QT: import kvantum theme name 2024-06-27 17:55:48 +08:00
李通洲 d979f55c8e Modules: fix custom key not working if the key is formatted outside
Fix #1049
2024-06-27 17:51:57 +08:00
李通洲 4f261509a0 Logo (Builtin): support --logo-position right
Fix #1034
2024-06-27 17:51:16 +08:00
李通洲 6413656cea Logo: rename --logo-separate to --logo-position 2024-06-27 13:49:35 +08:00
Jack Nolddor a334b805fd CMake: Use Coordinated Universal Time rather than timezone-varying local date (#1046) 2024-06-26 21:08:47 +08:00
李通洲 f940ef0592 Doc: fix typo [ci skip] 2024-06-26 21:07:39 +08:00
Jack Nolddor 963b5c6c4e Doc: Make format description more clear at json_schema.json (#1045) [ci skip] 2024-06-26 20:17:09 +08:00
李通洲 4a74f69c96 Doc: clearify that we don't support truncate multi-byte chars [ci skip] 2024-06-26 16:24:06 +08:00
李通洲 18d36c5054 Format: support argument truncation
Fix #1043
2024-06-26 16:15:26 +08:00
李通洲 a4614ec412 IO (Windows): implement ffSuppressIO 2024-06-26 13:50:42 +08:00
李通洲 e257f876ae TerminalSize (Windows): make it work when stdin or stdout is redirected 2024-06-26 10:51:44 +08:00
李通洲 e9031171c0 Doc: update changelog [ci skip] 2024-06-26 10:14:03 +08:00
李通洲 47a9cf0450 IO: enable terminal query in --pipe mode 2024-06-26 10:01:36 +08:00
李通洲 1704dc62e0 Doc: add debian in README [ci skip] 2024-06-25 18:15:14 +08:00
李通洲 abf6c403d4 Fastfetch: add JSON config general.preRun 2024-06-25 16:15:35 +08:00
李通洲 0606cde061 TerminalFont (Linux): fix XTGETTCAP response is printed in console when query kitty term font 2024-06-25 16:10:54 +08:00
李通洲 0bc9149a23 IO: improve ffGetTerminalResponse 2024-06-25 16:09:19 +08:00
李通洲 071be4794f Builtin (Asahi): fix logo color 2024-06-25 10:03:19 +08:00
李通洲 b5e199d2b2 IO (Linux): make sure stdin and stdout are tty when querying terminal 2024-06-25 09:43:31 +08:00
李通洲 a210128592 OS (macOS): correctly set pretty name 2024-06-25 08:41:44 +08:00
李通洲 63a28cc8f4 CI (Windows): bundle amd_ags dlls 2024-06-24 16:57:10 +08:00
李通洲 a6c006221d GPU (AMD): fix use-after-free crashes
Ref: https://github.com/fastfetch-cli/fastfetch/issues/1032
2024-06-23 09:14:00 +08:00
李通洲 42b84161d9 GPU (Windows): don't assume revId is not 0 2024-06-23 08:57:06 +08:00
李通洲 88e075ad9d CMake: remove option ENABLE_PROPRIETARY_GPU_DRIVER_API 2024-06-22 22:03:28 +08:00
李通洲 e37ad26729 GPU (Nvidia): fix definition of nvmlMemory_v2 2024-06-22 21:52:20 +08:00
李通洲 b500e9c09b Terminal: add fast path of version and font detection for kitty
Ref: https://github.com/fastfetch-cli/fastfetch/discussions/1030#discussioncomment-9845233
2024-06-22 15:43:25 +08:00
李通洲 77fbfd3fbd GPU (Windows): detect GPU type with AMD driver
Ref: #1032
2024-06-22 08:10:52 +08:00
Carter Li 63cdc47d18 GPU (SunOS): fix detection 2024-06-21 23:29:08 +08:00
Carter Li edf24d9820 CPUCache: add detection by SMBIOS 2024-06-21 23:07:07 +08:00
李通洲 becd9b7f26 LM (Linux): fix invalid path
Fix #1031
2024-06-21 20:28:06 +08:00
李通洲 672604081a Doc: update json_schema [ci skip] 2024-06-21 10:49:29 +08:00
李通洲 3185969974 CMake (Windows): install libffwinrt.dll 2024-06-21 09:43:18 +08:00
李通洲 ddbafd1cca OpenCL: use the newest supported OpenCL version 2024-06-21 09:18:08 +08:00
李通洲 16d70eed03 GPU: report deviceId in JSON output 2024-06-21 08:57:08 +08:00
李通洲 bf15adf57a OpenCL (Linux): fix crashing on AlpineLinux 2024-06-21 08:45:21 +08:00
李通洲 dbd1f96353 OpenCL: don't use NULL as platform id 2024-06-20 19:44:08 +08:00
李通洲 8b3cff33da OpenCL: use strong typing 2024-06-20 15:54:08 +08:00
李通洲 146c9b2bc6 OpenCL: fix building when OpenCL is disabled 2024-06-20 15:34:09 +08:00
李通洲 3c7cb339e2 OpenCL: fix building on non-apple platforms 2024-06-20 15:14:52 +08:00
李通洲 6318668d0b GPU: support detect gpu devices with OpenCL 2024-06-20 15:14:52 +08:00
李通洲 6737896038 CMake: enable OpenCL detection on Android
doesn't work on my smartphone
2024-06-20 15:14:52 +08:00
李通洲 96fc1db85e OpenCL: detect GPU info 2024-06-20 15:14:52 +08:00
李通洲 03e6b47eda CMake: remove unused dependencies 2024-06-20 15:14:52 +08:00
李通洲 067396d3a0 CI (Windows): add missing opencl headers 2024-06-20 15:14:52 +08:00
Robin Candau a8c3979696 Add the missing '--users-myself-only' option in bash completions (#1027)
undefined
2024-06-19 15:35:40 +08:00
Carter Li 786b23ef52 Packaging: update debian stuff [ci skip] 2024-06-19 14:55:57 +08:00
Carter Li ca6e889a63 Merge pull request #1026 from fastfetch-cli/dev
Release: v2.16.0
2024-06-19 14:38:23 +08:00
李通洲 439ed07660 Doc: update readme; fix typo [ci skip] 2024-06-19 14:35:51 +08:00
李通洲 d435ef6a77 Release: v2.16.0 2024-06-19 14:07:12 +08:00
李通洲 e7e5e89207 Presets: add Inspired by [ci skip] 2024-06-19 13:54:39 +08:00
李通洲 eb1f378a6e Presets: add a new example 2024-06-19 13:48:53 +08:00
Carter Li e2ce06dda2 Doc: update changelog [ci skip] 2024-06-19 13:24:49 +08:00
Carter Li e9bc312b38 LocalIP: support MTU in localip-format 2024-06-19 10:58:05 +08:00
Carter Li 9351c48d57 OS (Windows): set idLike to Windows 2024-06-19 10:14:38 +08:00
Carter Li 07b3cf325b Logo (Builtin): update arch3 2024-06-19 09:59:26 +08:00
Princess-Sunset-Shimmer 616c99a05d Logo: Create arch3.txt (#1022)
the third /\rch logo
2024-06-19 09:55:51 +08:00
Carter Li e554ff6e4f SunOS: remove unused files [ci skip] 2024-06-19 09:55:10 +08:00
李通洲 f013a60cf5 CI: add SunOS 2024-06-18 23:00:06 +08:00
李通洲 bb1586e9a2 CMake (SunOS): enable more things 2024-06-18 22:10:22 +08:00
李通洲 edba2492e1 OS (SunOS): don't parse unstructured text 2024-06-18 22:06:40 +08:00
李通洲 57b3c3951e CPU (SunOS): remove trailing \0 2024-06-18 22:06:40 +08:00
李通洲 cd2a6e0906 GPU (SunOS): parse scanpci -v, which doesn't require root permission 2024-06-18 21:52:25 +08:00
Carter Li c180ddab28 SunOS: improve WM detection 2024-06-18 10:51:26 +08:00
Carter Li 77ab00a4f4 SunOS: support NetIO detection 2024-06-18 10:18:12 +08:00
李通洲 4e5c93315a OpenGL: print used ogl library 2024-06-17 23:55:32 +08:00
Carter Li 935bea962f SunOS: support DiskIO 2024-06-17 23:41:53 +08:00
Carter Li 1b29f5b3a5 SunOS: support CPUUsage detection 2024-06-17 22:51:40 +08:00
Carter Li d296e53213 CPUUsage (BSD): fix totalAll calculation 2024-06-17 22:51:02 +08:00
Carter Li 5926c259ed SunOS: support MTU & MAC addr detection 2024-06-17 22:29:18 +08:00
Carter Li 2a19067ce7 SunOS: detect default route, so that LocalIP module works 2024-06-17 21:30:56 +08:00
Carter Li 06aaf0f3fd SunOS: support disk detection; fix a small bug 2024-06-17 19:32:54 +08:00
Carter Li 1d6a48e49a SunOS: support swap & opengl detection 2024-06-17 16:43:52 +08:00
Carter Li 72d332772d SunOS: support memory usage detection 2024-06-17 15:52:45 +08:00
Carter Li 255c6a09ac CPU (SunOS): optimise ncpu detection 2024-06-17 15:49:59 +08:00
Carter Li 74a364e3f2 SunOS: support loadavg detection 2024-06-17 15:23:35 +08:00
Carter Li 76b8446d15 InitSystem (SunOS): fix crashes 2024-06-17 15:18:02 +08:00
Carter Li 94fb7eabfd SunOS: enable a lot of features 2024-06-17 15:13:26 +08:00
Carter Li 6473db86a3 SunOS: support shell & terminal detection 2024-06-17 14:47:47 +08:00
Carter Li 804c61b7c1 Platform (Linux): fix invalid call to realpath(3) 2024-06-17 14:47:47 +08:00
Carter Li 898bf1edd9 SunOS: support InitSystem 2024-06-17 14:47:47 +08:00
Carter Li 507caa7b49 Editor: detect version of pluma 2024-06-17 14:47:47 +08:00
Carter Li d05b6a25c3 SunOS: support GPU detection 2024-06-17 14:47:47 +08:00
李通洲 a11f99cce5 Android: fix build 2024-06-17 01:20:04 +08:00
Carter Li 1841e1a99d SunOS: support CPU & packages detection 2024-06-17 01:01:21 +08:00
Carter Li d727547b1c SunOS: make SMBIOS related modules work 2024-06-16 22:25:16 +08:00
Carter Li d35490aeef Fastfetch: make it compile on SunOS 2024-06-16 01:02:48 +08:00
李通洲 5539fecb99 LocalIP: detect MTU 2024-06-14 18:23:04 +08:00
Антон cff2a18466 Logo: Added logos (standard and small) for RedOS (#1015)
* Add logo files

* Add RedOS logos to `builtin.c`
2024-06-13 19:31:58 +08:00
Gabry 8a923835ad Logo: Add support for Manjaro ARM to logo detection (#1013) 2024-06-13 19:20:41 +08:00
李通洲 2bd507c890 Presets: add a new example [ci skip]
Ref: https://www.reddit.com/r/fastfetch/comments/1dditqj/how_can_i_config_fastfetch_like_this/
2024-06-12 22:46:11 +08:00
李通洲 19690656a2 Presets: update examples/20 2024-06-12 21:26:04 +08:00
李通洲 36dc3c7263 Loadavg: add option --loadavg-compact and --loadavg-percent-<color> 2024-06-12 21:26:04 +08:00
李通洲 b38eb705f9 Users: add config gen for myselfOnly 2024-06-12 20:48:41 +08:00
李通洲 0a899e1e80 DNS: add option --dns-show-type 2024-06-12 20:48:41 +08:00
李通洲 218c553841 Presets: dont show empty mac addrs 2024-06-12 17:22:44 +08:00
李通洲 e284fee4aa Presets: print DNS info in examples/20; optimise 2024-06-12 16:41:47 +08:00
李通洲 124823e643 DNS: print IPv4 first 2024-06-12 16:39:09 +08:00
李通洲 dafc4ed3fb DNS (Windows): add support
Currently reports IPv4 addrs only
2024-06-12 16:33:13 +08:00
李通洲 1c05e65bc0 DNS (Linux): parse /etc/resolv.conf directly 2024-06-12 15:52:09 +08:00
Carter Li e0910777af DNS: add new module 2024-06-12 15:52:09 +08:00
李通洲 df0fb93542 Media (macOS): optimise 2024-06-12 15:52:09 +08:00
李通洲 30135570c7 OS (macOS): add code name of Sequoia 2024-06-12 15:52:09 +08:00
Carter Li 20cef09c73 Presets: add a new example 2024-06-12 15:52:09 +08:00
Carter Li 5bb4dabaec Users: add new option --users-myself-only 2024-06-12 15:52:09 +08:00
Carter Li ebfcd7195e Fastfetch: fix display.bar.border{Left,Right} doesn't work in JSON config 2024-06-12 13:40:06 +08:00
李通洲 671f5e2cec Media (Windows): fix compiling for GCC 2024-06-11 19:48:25 +08:00
李通洲 cf4ed9d9dc Media (Windows): finalize Windows support 2024-06-11 16:41:57 +08:00
李通洲 c4751eb834 Media (Windows): build winrt stuff statically 2024-06-11 15:46:30 +08:00
李通洲 ff3ddc774e Media (Windows): detect with external DLL
For backup only
2024-06-11 15:24:33 +08:00
李通洲 9104db0d21 Builtin (Logo): add tuxdeo
Fix #1000
2024-06-09 11:42:44 +08:00
李通洲 7eb86b4e95 OS (Linux): don't priortitize lsb-release over os-release 2024-06-09 11:33:42 +08:00
李通洲 06fa6033f0 Sound (Linux): trim white spaces in device name
Fix #1005
2024-06-08 18:45:34 +08:00
李通洲 f058d70d89 Logo (Mauna): add new logo 2024-06-08 09:15:45 +08:00
李通洲 58f7d6fed4 CPUCache (Linux): report error if cache size is unavailable (Android) 2024-06-07 20:43:26 +08:00
李通洲 95f8eccebb CPUCache: silence warnings 2024-06-07 19:28:35 +08:00
李通洲 e1245fe2e5 CI: add riscv64 build 2024-06-07 15:56:36 +08:00
李通洲 4332b09c8c Presets: add one more example [ci skip]
Ref: https://github.com/fastfetch-cli/fastfetch/issues/728#issuecomment-2154162576
2024-06-07 15:07:22 +08:00
Carter Li 13b488a33c Packaging: update debian stuff [ci skip] 2024-06-07 13:55:00 +08:00
178 changed files with 3813 additions and 749 deletions
+21
View File
@@ -0,0 +1,21 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 60
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- keepalive
# Label to use when marking an issue as stale
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
+82 -6
View File
@@ -197,6 +197,41 @@ jobs:
name: fastfetch-linux-armv7
path: ./fastfetch-*.*
linux-riscv64:
name: Linux-riscv64
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: riscv64
distro: ubuntu22.04
githubToken: ${{ github.token }}
run: |
uname -a
apt-get update && apt-get install -y cmake make g++ libvulkan-dev libwayland-dev libxrandr-dev libxcb-randr0-dev libdconf-dev libdbus-1-dev libmagickcore-dev libxfconf-0-dev libsqlite3-dev librpm-dev libegl-dev libglx-dev libosmesa6-dev ocl-icd-opencl-dev libnm-dev libpulse-dev libdrm-dev libddcutil-dev libchafa-dev directx-headers-dev rpm
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_INSTALL_PREFIX=/usr .
cmake --build . --target package --verbose -j4
./fastfetch --list-features
time ./fastfetch -c presets/ci.jsonc
time ./fastfetch -c presets/ci.jsonc --format json
time ./flashfetch
ldd fastfetch
ctest
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: fastfetch-linux-riscv64
path: ./fastfetch-*.*
musl-amd64:
name: Musl-amd64
runs-on: ubuntu-latest
@@ -333,6 +368,39 @@ jobs:
name: fastfetch-macos-universal
path: ./fastfetch-*.*
sunos-amd64:
runs-on: ubuntu-latest
name: SunOS-amd64
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: run VM
uses: vmactions/omnios-vm@v1
with:
usesh: true
prepare: |
uname -a
pkg update --accept
pkg install gcc13 cmake git pkg-config glib2 dbus sqlite-3 imagemagick
run: |
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On .
cmake --build . --target package --verbose -j4
./fastfetch --list-features
time ./fastfetch
time ./fastfetch --format json
time ./flashfetch
ldd fastfetch
ctest
cpack
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: fastfetch-sunos-amd64
path: ./fastfetch-*.*
freebsd-amd64:
name: FreeBSD-amd64
runs-on: ubuntu-latest
@@ -425,7 +493,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-vulkan-headers 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 mingw-w64-clang-x86_64-opencl-headers mingw-w64-clang-x86_64-cppwinrt
- name: print msys version
run: uname -a
@@ -439,6 +507,9 @@ jobs:
- name: copy necessary dlls
run: cp /clang64/bin/{OpenCL,vulkan-1}.dll .
- name: download amd_ags
run: curl -LO https://github.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/raw/master/ags_lib/lib/amd_ags_x64.dll
- name: list features
run: ./fastfetch --list-features
@@ -458,10 +529,10 @@ jobs:
run: ctest
- name: create zip archive
run: 7z a -tzip -mx9 -bd -y fastfetch-windows-amd64.zip *.dll fastfetch.exe flashfetch.exe presets
run: 7z a -tzip -mx9 -bd -y fastfetch-windows-amd64.zip LICENSE *.dll fastfetch.exe flashfetch.exe presets
- name: create 7z archive
run: 7z a -t7z -mx9 -bd -y fastfetch-windows-amd64.7z *.dll fastfetch.exe flashfetch.exe presets
run: 7z a -t7z -mx9 -bd -y fastfetch-windows-amd64.7z LICENSE *.dll fastfetch.exe flashfetch.exe presets
- name: upload artifacts
uses: actions/upload-artifact@v4
@@ -487,7 +558,7 @@ jobs:
with:
msystem: CLANG32
update: true
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
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 mingw-w64-clang-i686-opencl-headers
- name: print msys version
run: uname -a
@@ -509,6 +580,9 @@ jobs:
- name: copy necessary dlls
run: cp /clang32/bin/{OpenCL,vulkan-1}.dll .
- name: download amd_ags
run: curl -LO https://github.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/raw/master/ags_lib/lib/amd_ags_x86.dll
- name: run fastfetch
run: time ./fastfetch -c presets/ci.jsonc
@@ -525,10 +599,10 @@ jobs:
run: ctest
- name: create zip archive
run: 7z a -tzip -mx9 -bd -y fastfetch-windows-i686.zip *.dll fastfetch.exe flashfetch.exe presets
run: 7z a -tzip -mx9 -bd -y fastfetch-windows-i686.zip LICENSE *.dll fastfetch.exe flashfetch.exe presets
- name: create 7z archive
run: 7z a -t7z -mx9 -bd -y fastfetch-windows-i686.7z *.dll fastfetch.exe flashfetch.exe presets
run: 7z a -t7z -mx9 -bd -y fastfetch-windows-i686.7z LICENSE *.dll fastfetch.exe flashfetch.exe presets
- name: upload artifacts
uses: actions/upload-artifact@v4
@@ -544,11 +618,13 @@ jobs:
- linux-amd64
- linux-aarch64
- linux-armv7
- linux-riscv64
- musl-amd64
- musl-aarch64
- macos-universal
- freebsd-amd64
- freebsd-aarch64
- sunos-amd64
- windows-amd64
- windows-i686
permissions:
+111 -3
View File
@@ -1,3 +1,111 @@
# 2.17.2
Changes:
* Flatpak package count no longer takes runtime packages into account (Packages, Linux)
Bugfixes:
* Fix formattion with multiple batteries (Battery)
* Fix incorrect size value for large memory sticks (PhysicalMemory)
* Fix spelling of `Qt` and `LXQt`
* Fix building on SunOS if imagemagick support is enabled (Logo, SunOS)
* Fix typos
Features:
* Support Ptyxis terminal version and font detection (Terminal / TerminalFont, Linux)
* Improve Cinnamon version detection (DE)
* Support `cinnamon-wayland` (WMTheme)
* `--ts-version false` will disable editor version detection (Editor)
# 2.17.1
Hotfix for a regression that breaks Qt font detection
Bugfixes:
* Don't generate and install `libffwinrt.dll.a` on MinGW (Windows)
* Fix building on Windows when imagemagick support is enabled (Logo, Windows)
* Don't print GPU frequency with `--gpu-temp` for Nvidia cards (#1052, GPU)
* `--gpu-driver-specific` needs to be specified
* Print formatted size when `--gpu-format` is used (#1052, GPU)
* Ignore QVariant format; fix unreadable Qt font (#1053, Theme, Linux)
* Fix segfaults with `--show-errors` and an invalid module (#1055)
# 2.17.0
Changes:
* CMake option `ENABLE_PROPRIETARY_GPU_DRIVER_API` is removed. The GPU driver APIs are now enabled by default.
* The option was introduced to reduce the license concerns. Since all non MIT proprietary code has been rewritten manually from scratch, it is no longer necessary.
* See <https://github.com/fastfetch-cli/fastfetch/issues/533#issuecomment-2122830958> for detail
* Option `--logo-separate true` is changed to `--logo-position top` for better readability
* Builtin ascii logos can be positioned on the right side now with`--logo-position right`
Features:
* Add support for `--gpu-detection-method opencl` which uses OpenCL to detect GPUs.
* Support detecting CPU cache size by using SMBIOS as fallback (CPUCache)
* Support GPU detection (SunOS)
* Support GPU type detection with AMD GPU driver (GPU, Windows)
* Add fast path of version and font detection for kitty (Terminal / TerminalFont)
* Make sure `stdin` and `stdout` are TTYs when querying terminal
* So modules like `TerminalSize` should work when `stdin` or `stdout` is redirected
* Support argument truncation in `--<module>-format` (#1043)
* See `fastfetch --help format` for detail
* Improve Qt theme detection (#1047, Theme, Linux)
* Add new JSON config option `general.preRun`, which is executed before fastfetch prints output.
* It can be used to generate a temp logo file. For example
```jsonc
{
"general": {
"preRun": "kitten icat --align=left /path/to/image > /tmp/logo.kitty"
},
"logo": {
"source": "/tmp/logo.kitty",
"type": "raw"
}
}
```
Bugfixes:
* Fix invalid path (#1031, LM, Linux)
* Fix VMEM detection for Nvidia GPU (requires `--gpu-driver-specific`) (GPU)
* Fix AMD `--gpu-driver-specific` for AMD cards (#1032, GPU, Windows)
* Use Coordinated Universal Time rather than timezone-varying local date (#1046)
Logo:
* Fix colors of Asahi Linux
# 2.16.0
This release added basic support for SunOS (Solaris, illumos). The binaries provided in the release lack a few useful features (such as Display detection). People who use SunOS should consider building fastfetch themselves.
Changes:
* Fastfetch now prefers `/etc/os-release` over `/etc/lsb-release` when detecting distro info.
* This may break some distros (notably some debian based distros). File a bug with the content of `os-release` and `lsb-release` if it breaks your distro.
Features:
* Support Media detection in Windows (Media / Player, Windows)
* Requires Windows 10 and later
* Add new option `--users-myself-only` to display current login user only (Users)
* Add code name of macOS Sequoia (OS, macOS)
* Add new module `DNS` to show active DNS servers (DNS)
* Add new option `--loadavg-compact`. Defaults to true (Loadavg)
* Use `--loadavg-compact false` to display load averages in different lines
* Detect MTU size (LocalIP)
* Support version detection of pluma, which is the default editor of OpenIndiana (Editor)
* Print used OGL library, eg EGL, GLX or OSMesa (OpenGL)
Bugfixes:
* Report error if cache size is unavailable (CPUCache, Android)
* Trim white spaces in device name (Sound, Linux, #1005)
* Fix `display.bar.border{Left,Right}` doesn't work in JSON config files (Config)
* Fix invalid call to `realpath(3)` (Platform, Linux)
* Fix result calculation (CPUUsage, FreeBSD)
Logos:
* Add Mauna
* Add Tuxdeo
* Add Manjaro ARM
* Add RedOS
* Add Arch3
# 2.15.0
Changes:
@@ -971,7 +1079,7 @@ Bugfixes:
This release backports some changes from dev branch, and fixes 2 crashing issues
Features:
* Support KDE / LXQT / MATE / Cinnamon wallpaper detection (Wallpaper, Linux)
* Support KDE / LXQt / MATE / Cinnamon wallpaper detection (Wallpaper, Linux)
* Support QTerminal version & terminal font detection
* Support MATE Terminal version & terminal font detection
* Set `--pipe true` automatically if stdout is not a tty
@@ -1017,7 +1125,7 @@ Bugfixes:
* Fix Windows drives detection in WSL (Disk)
Changes:
* In order to make Icons module consistent between different platforms, `--icons-format` no longer supports individual GTK / QT icon params.
* In order to make Icons module consistent between different platforms, `--icons-format` no longer supports individual GTK / Qt icon params.
* `--theme-format` no longer supports individual GTK / plasma theme params.
* `--local-ip-*` and `--public-ip-*` have been changed to `--localip-*` and `--publicip-*`
* `--localip-compact-type` is no longer supported. Fastfetch now display IPs as `--localip-compat-type multiline` by default, with `--local-compact true` can be set as an alias of `--localip-compact-type oneline`
@@ -1391,7 +1499,7 @@ Fixes build on android (#205)
# 1.6.0
Features:
* Detect QT on more DEs than just KDE Plasma. The [Plasma] category was therefore renamed to [QT]
* Detect Qt on more DEs than just KDE Plasma. The [Plasma] category was therefore renamed to [Qt]
* Alacritty font detection
* Load `/etc/fastfetch/config.conf` before user config
* Disk: print one decimal point if size < 100GB
+153 -44
View File
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url
project(fastfetch
VERSION 2.15.0
VERSION 2.17.2
LANGUAGES C
DESCRIPTION "Fast neofetch-like system information tool"
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
@@ -18,6 +18,8 @@ elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
set(LINUX TRUE CACHE BOOL "..." FORCE) # LINUX means GNU/Linux, not just the kernel
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
set(BSD TRUE CACHE BOOL "..." FORCE)
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS")
set(SunOS TRUE CACHE BOOL "..." FORCE)
elseif(NOT APPLE AND NOT WIN32)
message(FATAL_ERROR "Unsupported platform: ${CMAKE_SYSTEM_NAME}")
endif()
@@ -42,37 +44,37 @@ include(CheckIncludeFile)
include(CMakeDependentOption)
cmake_dependent_option(ENABLE_VULKAN "Enable vulkan" ON "LINUX OR APPLE OR BSD OR WIN32 OR ANDROID" OFF)
cmake_dependent_option(ENABLE_VULKAN "Enable vulkan" ON "LINUX OR APPLE OR BSD OR WIN32 OR ANDROID OR SunOS" OFF)
cmake_dependent_option(ENABLE_WAYLAND "Enable wayland-client" ON "LINUX OR BSD" OFF)
cmake_dependent_option(ENABLE_XCB_RANDR "Enable xcb-randr" ON "LINUX OR BSD" OFF)
cmake_dependent_option(ENABLE_XCB "Enable xcb" ON "LINUX OR BSD" OFF)
cmake_dependent_option(ENABLE_XRANDR "Enable xrandr" ON "LINUX OR BSD" OFF)
cmake_dependent_option(ENABLE_X11 "Enable x11" ON "LINUX OR BSD" OFF)
cmake_dependent_option(ENABLE_DRM "Enable libdrm" ON "LINUX OR BSD" OFF)
cmake_dependent_option(ENABLE_GIO "Enable gio-2.0" ON "LINUX OR BSD" OFF)
cmake_dependent_option(ENABLE_DCONF "Enable dconf" ON "LINUX OR BSD" OFF)
cmake_dependent_option(ENABLE_DBUS "Enable dbus-1" ON "LINUX OR BSD" OFF)
cmake_dependent_option(ENABLE_XFCONF "Enable libxfconf-0" ON "LINUX OR BSD" OFF)
cmake_dependent_option(ENABLE_SQLITE3 "Enable sqlite3" ON "LINUX OR BSD OR APPLE" OFF)
cmake_dependent_option(ENABLE_XCB_RANDR "Enable xcb-randr" ON "LINUX OR BSD OR SunOS" OFF)
cmake_dependent_option(ENABLE_XCB "Enable xcb" ON "LINUX OR BSD OR SunOS" OFF)
cmake_dependent_option(ENABLE_XRANDR "Enable xrandr" ON "LINUX OR BSD OR SunOS" OFF)
cmake_dependent_option(ENABLE_X11 "Enable x11" ON "LINUX OR BSD OR SunOS" OFF)
cmake_dependent_option(ENABLE_DRM "Enable libdrm" ON "LINUX OR BSD OR SunOS" OFF)
cmake_dependent_option(ENABLE_GIO "Enable gio-2.0" ON "LINUX OR BSD OR SunOS" OFF)
cmake_dependent_option(ENABLE_DCONF "Enable dconf" ON "LINUX OR BSD OR SunOS" OFF)
cmake_dependent_option(ENABLE_DBUS "Enable dbus-1" ON "LINUX OR BSD OR SunOS" OFF)
cmake_dependent_option(ENABLE_XFCONF "Enable libxfconf-0" ON "LINUX OR BSD OR SunOS" OFF)
cmake_dependent_option(ENABLE_SQLITE3 "Enable sqlite3" ON "LINUX OR BSD OR APPLE OR SunOS" OFF)
cmake_dependent_option(ENABLE_RPM "Enable rpm" ON "LINUX" OFF)
cmake_dependent_option(ENABLE_IMAGEMAGICK7 "Enable imagemagick 7" ON "LINUX OR BSD OR APPLE OR WIN32" OFF)
cmake_dependent_option(ENABLE_IMAGEMAGICK6 "Enable imagemagick 6" ON "LINUX OR BSD OR APPLE" OFF)
cmake_dependent_option(ENABLE_IMAGEMAGICK7 "Enable imagemagick 7" ON "LINUX OR BSD OR APPLE OR WIN32 OR SunOS" OFF)
cmake_dependent_option(ENABLE_IMAGEMAGICK6 "Enable imagemagick 6" ON "LINUX OR BSD OR APPLE OR SunOS" OFF)
cmake_dependent_option(ENABLE_CHAFA "Enable chafa" ON "ENABLE_IMAGEMAGICK6 OR ENABLE_IMAGEMAGICK7" OFF)
cmake_dependent_option(ENABLE_ZLIB "Enable zlib" ON "ENABLE_IMAGEMAGICK6 OR ENABLE_IMAGEMAGICK7" OFF)
cmake_dependent_option(ENABLE_EGL "Enable egl" ON "LINUX OR BSD" OFF)
cmake_dependent_option(ENABLE_GLX "Enable glx" ON "LINUX OR BSD" OFF)
cmake_dependent_option(ENABLE_OSMESA "Enable osmesa" ON "LINUX OR BSD" OFF)
cmake_dependent_option(ENABLE_OPENCL "Enable opencl" ON "LINUX OR BSD OR WIN32" OFF)
cmake_dependent_option(ENABLE_EGL "Enable egl" ON "LINUX OR BSD OR SunOS" OFF)
cmake_dependent_option(ENABLE_GLX "Enable glx" ON "LINUX OR BSD OR SunOS" OFF)
cmake_dependent_option(ENABLE_OSMESA "Enable osmesa" ON "LINUX OR BSD OR SunOS" OFF)
cmake_dependent_option(ENABLE_OPENCL "Enable opencl" ON "LINUX OR BSD OR WIN32 OR ANDROID OR SunOS" OFF)
cmake_dependent_option(ENABLE_LIBNM "Enable libnm" ON "LINUX" OFF)
cmake_dependent_option(ENABLE_FREETYPE "Enable freetype" ON "ANDROID" OFF)
cmake_dependent_option(ENABLE_PULSE "Enable pulse" ON "LINUX" OFF)
cmake_dependent_option(ENABLE_PULSE "Enable pulse" ON "LINUX OR SunOS" OFF)
cmake_dependent_option(ENABLE_DDCUTIL "Enable ddcutil" ON "LINUX" OFF)
cmake_dependent_option(ENABLE_DIRECTX_HEADERS "Enable DirectX headers for WSL" ON "LINUX" OFF)
cmake_dependent_option(ENABLE_THREADS "Enable multithreading" ON "Threads_FOUND" OFF)
option(ENABLE_SYSTEM_YYJSON "Use system provided (instead of fastfetch embedded) yyjson library" OFF)
option(ENABLE_ASAN "Build fastfetch with ASAN (address sanitizer)" OFF)
option(ENABLE_PROPRIETARY_GPU_DRIVER_API "Enable proprietary GPU driver API (NVML, IGCL and AGS)" ON)
option(ENABLE_LTO "Enable link-time optimization in release mode if supported" 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
@@ -118,7 +120,7 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS} -Werror=incompatible-pointe
if(WIN32 OR ENABLE_DIRECTX_HEADERS)
enable_language(CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS} -fno-exceptions -fno-rtti")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS}")
endif()
if(WIN32)
@@ -138,7 +140,7 @@ if(NOT WIN32)
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -rdynamic")
endif()
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
if(ENABLE_LTO AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
message(STATUS "Enabling LTO")
include(CheckIPOSupported)
check_ipo_supported(RESULT IPO_SUPPORTED)
@@ -254,7 +256,7 @@ if(APPLE)
configure_file(src/util/apple/Info.plist.in Info.plist @ONLY)
endif()
string(TIMESTAMP FASTFETCH_BUILD_DATE "%d %B %Y")
string(TIMESTAMP FASTFETCH_BUILD_DATE "%d %B %Y" UTC)
configure_file(doc/fastfetch.1.in fastfetch.1 @ONLY)
####################
@@ -340,6 +342,7 @@ set(LIBFASTFETCH_SRC
src/modules/de/de.c
src/modules/disk/disk.c
src/modules/diskio/diskio.c
src/modules/dns/dns.c
src/modules/editor/editor.c
src/modules/font/font.c
src/modules/gpu/gpu.c
@@ -417,6 +420,7 @@ if(LINUX)
src/detection/cursor/cursor_linux.c
src/detection/bluetooth/bluetooth_linux.c
src/detection/disk/disk_linux.c
src/detection/dns/dns_linux.c
src/detection/physicaldisk/physicaldisk_linux.c
src/detection/physicalmemory/physicalmemory_linux.c
src/detection/diskio/diskio_linux.c
@@ -487,6 +491,7 @@ elseif(ANDROID)
src/detection/cursor/cursor_nosupport.c
src/detection/cpuusage/cpuusage_linux.c
src/detection/disk/disk_linux.c
src/detection/dns/dns_linux.c
src/detection/physicaldisk/physicaldisk_linux.c
src/detection/physicalmemory/physicalmemory_nosupport.c
src/detection/diskio/diskio_linux.c
@@ -544,10 +549,11 @@ elseif(BSD)
src/detection/brightness/brightness_bsd.c
src/detection/chassis/chassis_bsd.c
src/detection/cpu/cpu_bsd.c
src/detection/cpucache/cpucache_nosupport.c
src/detection/cpucache/cpucache_shared.c
src/detection/cpuusage/cpuusage_bsd.c
src/detection/cursor/cursor_linux.c
src/detection/disk/disk_bsd.c
src/detection/dns/dns_linux.c
src/detection/physicaldisk/physicaldisk_bsd.c
src/detection/physicalmemory/physicalmemory_linux.c
src/detection/diskio/diskio_bsd.c
@@ -619,6 +625,7 @@ elseif(APPLE)
src/detection/cpuusage/cpuusage_apple.c
src/detection/cursor/cursor_apple.m
src/detection/disk/disk_bsd.c
src/detection/dns/dns_linux.c
src/detection/physicaldisk/physicaldisk_apple.c
src/detection/physicalmemory/physicalmemory_apple.m
src/detection/diskio/diskio_apple.c
@@ -684,6 +691,7 @@ elseif(WIN32)
src/detection/physicaldisk/physicaldisk_windows.c
src/detection/diskio/diskio_windows.c
src/detection/displayserver/displayserver_windows.c
src/detection/dns/dns_windows.c
src/detection/font/font_windows.c
src/detection/gpu/gpu_windows.c
src/detection/host/host_windows.c
@@ -695,7 +703,7 @@ elseif(WIN32)
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/media/media_windows.c
src/detection/memory/memory_windows.c
src/detection/physicalmemory/physicalmemory_linux.c
src/detection/monitor/monitor_windows.c
@@ -727,6 +735,77 @@ elseif(WIN32)
src/util/windows/wmi.cpp
src/util/platform/FFPlatform_windows.c
)
elseif(SunOS)
list(APPEND LIBFASTFETCH_SRC
src/common/dbus.c
src/common/io/io_unix.c
src/common/netif/netif_bsd.c
src/common/networking_linux.c
src/common/processing_linux.c
src/detection/battery/battery_nosupport.c
src/detection/bios/bios_windows.c
src/detection/board/board_windows.c
src/detection/bootmgr/bootmgr_nosupport.c
src/detection/brightness/brightness_nosupport.c
src/detection/chassis/chassis_windows.c
src/detection/cpu/cpu_sunos.c
src/detection/cpucache/cpucache_shared.c
src/detection/cpuusage/cpuusage_sunos.c
src/detection/cursor/cursor_linux.c
src/detection/bluetooth/bluetooth_nosupport.c
src/detection/disk/disk_sunos.c
src/detection/dns/dns_linux.c
src/detection/physicaldisk/physicaldisk_nosupport.c
src/detection/physicalmemory/physicalmemory_linux.c
src/detection/diskio/diskio_sunos.c
src/detection/displayserver/linux/displayserver_linux.c
src/detection/displayserver/linux/drm.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
src/detection/font/font_linux.c
src/detection/gpu/gpu_sunos.c
src/detection/gpu/gpu_pci.c
src/detection/gtk_qt/gtk.c
src/detection/host/host_windows.c
src/detection/icons/icons_linux.c
src/detection/initsystem/initsystem_linux.c
src/detection/libc/libc_nosupport.c
src/detection/lm/lm_nosupport.c
src/detection/loadavg/loadavg_sunos.c
src/detection/locale/locale_linux.c
src/detection/localip/localip_linux.c
src/detection/gamepad/gamepad_nosupport.c
src/detection/media/media_linux.c
src/detection/memory/memory_sunos.c
src/detection/monitor/monitor_nosupport.c
src/detection/netio/netio_sunos.c
src/detection/opengl/opengl_linux.c
src/detection/os/os_sunos.c
src/detection/packages/packages_sunos.c
src/detection/poweradapter/poweradapter_nosupport.c
src/detection/processes/processes_linux.c
src/detection/gtk_qt/qt.c
src/detection/sound/sound_linux.c
src/detection/swap/swap_sunos.c
src/detection/terminalfont/terminalfont_linux.c
src/detection/terminalshell/terminalshell_linux.c
src/detection/terminalsize/terminalsize_linux.c
src/detection/theme/theme_linux.c
src/detection/uptime/uptime_sunos.c
src/detection/users/users_linux.c
src/detection/wallpaper/wallpaper_linux.c
src/detection/wifi/wifi_nosupport.c
src/detection/wm/wm_nosupport.c
src/detection/de/de_linux.c
src/detection/wmtheme/wmtheme_linux.c
src/detection/camera/camera_nosupport.c
src/util/platform/FFPlatform_unix.c
)
endif()
if(ENABLE_DIRECTX_HEADERS)
@@ -734,15 +813,13 @@ if(ENABLE_DIRECTX_HEADERS)
list(APPEND LIBFASTFETCH_SRC src/detection/gpu/gpu_wsl.cpp)
endif()
if(ENABLE_PROPRIETARY_GPU_DRIVER_API AND (LINUX OR BSD OR WIN32))
message(STATUS "Enabling proprietary GPU driver API")
if(LINUX OR BSD OR WIN32)
list(APPEND LIBFASTFETCH_SRC src/detection/gpu/gpu_nvidia.c)
endif()
if(WIN32)
list(APPEND LIBFASTFETCH_SRC src/detection/gpu/gpu_intel.c)
list(APPEND LIBFASTFETCH_SRC src/detection/gpu/gpu_amd.c)
endif()
# Proprietary GPU driver APIs
if(LINUX OR BSD OR WIN32)
list(APPEND LIBFASTFETCH_SRC src/detection/gpu/gpu_nvidia.c)
endif()
if(WIN32)
list(APPEND LIBFASTFETCH_SRC src/detection/gpu/gpu_intel.c)
list(APPEND LIBFASTFETCH_SRC src/detection/gpu/gpu_amd.c)
endif()
include(CheckFunctionExists)
@@ -771,10 +848,6 @@ add_library(libfastfetch OBJECT
${LIBFASTFETCH_SRC}
)
if(ENABLE_PROPRIETARY_GPU_DRIVER_API AND (LINUX OR BSD OR WIN32))
target_compile_definitions(libfastfetch PRIVATE FF_USE_PROPRIETARY_GPU_DRIVER_API)
endif()
if(yyjson_FOUND)
target_compile_definitions(libfastfetch PRIVATE FF_USE_SYSTEM_YYJSON)
target_link_libraries(libfastfetch PRIVATE yyjson::yyjson)
@@ -814,6 +887,8 @@ if(WIN32)
target_compile_definitions(libfastfetch PUBLIC WIN32_LEAN_AND_MEAN=1)
elseif(APPLE)
target_compile_definitions(libfastfetch PUBLIC _DARWIN_C_SOURCE)
elseif(SunOS)
target_compile_definitions(libfastfetch PUBLIC __EXTENSIONS__ _POSIX_C_SOURCE=1)
endif()
if(HAVE_STATX)
@@ -1042,6 +1117,13 @@ elseif(BSD)
PRIVATE "usbhid"
PRIVATE "geom"
)
elseif(SunOS)
target_link_libraries(libfastfetch
PRIVATE "m"
PRIVATE "socket"
PRIVATE "kstat"
PRIVATE "proc"
)
elseif(ANDROID)
CHECK_LIBRARY_EXISTS(-l:libandroid-wordexp.a wordexp "" HAVE_LIBANDROID_WORDEXP_STATIC)
if(HAVE_LIBANDROID_WORDEXP_STATIC)
@@ -1067,6 +1149,24 @@ target_link_libraries(libfastfetch
PRIVATE ${CMAKE_DL_LIBS}
)
target_compile_options(libfastfetch PRIVATE
$<$<COMPILE_LANGUAGE:CXX>:-fno-exceptions -fno-rtti>)
if(WIN32)
set(CMAKE_CXX_STANDARD 20)
include(CheckIncludeFileCXX)
CHECK_INCLUDE_FILE_CXX("winrt/Windows.Foundation.h" HAVE_WINRT)
if(HAVE_WINRT)
add_library(ffwinrt MODULE src/detection/media/media_windows.dll.cpp)
target_link_libraries(ffwinrt PRIVATE "RuntimeObject")
target_compile_definitions(ffwinrt PRIVATE WIN32_LEAN_AND_MEAN=1 WINRT_LEAN_AND_MEAN=1)
target_link_options(ffwinrt
PRIVATE "-static" # stdc++, winpthread, gcc_s, etc.
)
endif()
set(CMAKE_CXX_STANDARD 17)
endif()
######################
# Executable targets #
######################
@@ -1105,12 +1205,9 @@ if(yyjson_FOUND)
endif()
if(WIN32)
set(TARGET_NAME fastfetch)
target_sources(fastfetch
PRIVATE src/util/windows/version.rc
)
set(TARGET_NAME flashfetch)
target_sources(flashfetch
PRIVATE src/util/windows/version.rc
)
@@ -1163,6 +1260,13 @@ install(
DESTINATION "${CMAKE_INSTALL_BINDIR}"
)
if (TARGET ffwinrt)
install(
TARGETS ffwinrt
DESTINATION "${CMAKE_INSTALL_BINDIR}"
)
endif()
install(
FILES "${CMAKE_SOURCE_DIR}/completions/${CMAKE_PROJECT_NAME}.bash"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/bash-completion/completions"
@@ -1219,12 +1323,17 @@ if(LINUX)
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
if(NOT IS_MUSL)
EXECUTE_PROCESS (
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})")
if(GLIBC_VERSION)
STRING(REPLACE "glibc " "" GLIBC_VERSION ${GLIBC_VERSION})
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= ${GLIBC_VERSION})")
message(STATUS "found glibc ${GLIBC_VERSION}")
else()
message(WARNING "Could not determine glibc version. If `musl` is used, `-DIS_MUSL=ON` should be set")
endif()
endif()
endif()
+2 -1
View File
@@ -1,6 +1,7 @@
MIT License
Copyright (c) 2021 Linus Dierheimer
Copyright (c) 2021-2023 Linus Dierheimer
Copyright (c) 2022-2024 Carter Li
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+15 -14
View File
@@ -11,7 +11,7 @@
[![latest packaged version(s)](https://repology.org/badge/latest-versions/fastfetch.svg)](https://repology.org/project/fastfetch/versions)
[![Packaging status](https://repology.org/badge/tiny-repos/fastfetch.svg)](https://repology.org/project/fastfetch/versions)
Fastfetch is a [neofetch](https://github.com/dylanaraps/neofetch)-like tool for fetching system information and displaying them in a pretty way. It is written mainly in C, with performance and customizability in mind. Currently, Linux, Android, FreeBSD, MacOS and Windows 7+ are supported.
Fastfetch is a [neofetch](https://github.com/dylanaraps/neofetch)-like tool for fetching system information and displaying it prettily. It is written mainly in C, with performance and customizability in mind. Currently, Linux, Android, FreeBSD, macOS, SunOS and Windows 7+ are supported.
<img src="screenshots/example1.png" width="49%" align="left" />
<img src="https://upload.wikimedia.org/wikipedia/commons/2/24/Transparent_Square_Tiles_Texture.png" width="49%" height="16px" align="left" />
@@ -21,15 +21,16 @@ Fastfetch is a [neofetch](https://github.com/dylanaraps/neofetch)-like tool for
<img src="screenshots/example3.png" width="48%" align="top" />
<img src="screenshots/example5.png" height="15%" align="top" />
There are [screenshots on different platforms](https://github.com/fastfetch-cli/fastfetch/wiki)
There are [screenshots on different platforms](https://github.com/fastfetch-cli/fastfetch/wiki).
## Installation
### Linux
Some distros packaged an outdated fastfetch version. Older version is not supported, please always ensure that the latest version is used.
Some distros packaged an outdated fastfetch version. Older version receive no support, so please try always to use the latest version.
* Ubuntu: [`ppa:zhangsongcui3371/fastfetch`](https://launchpad.net/~zhangsongcui3371/+archive/ubuntu/fastfetch) (for Ubuntu 22.04 or newer)
* Debian: `sudo apt install fastfetch` (for Debian 13 or newer)
* Debian / Ubuntu: Download `fastfetch-linux-<proper architecture>.deb` from [Github release page](https://github.com/fastfetch-cli/fastfetch/releases/latest) and double-click it (for Ubuntu 20.04 or newer and Debian 11 or newer).
* Arch Linux: `sudo pacman -S fastfetch`
* Fedora: `sudo dnf install fastfetch`
@@ -56,7 +57,7 @@ If fastfetch is not packaged for your distro or an outdated version is packaged,
* [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.
You may also download the program directly from [the GitHub releases page](https://github.com/fastfetch-cli/fastfetch/releases/latest) in the form of an archive file.
### FreeBSD
@@ -80,7 +81,7 @@ See Wiki: https://github.com/fastfetch-cli/fastfetch/wiki/Building
## Customization
Fastfetch uses the JSONC (or JSON with comments) for configuration. [See Wiki for detail](https://github.com/fastfetch-cli/fastfetch/wiki/Configuration). There are some premade config files in [`presets`](presets), including the ones used for the screenshots above. You can load them using `-c <filename>`. They may also serve as a good example for format arguments.
Fastfetch uses the JSONC (or JSON with comments) for configuration. [See Wiki for detail](https://github.com/fastfetch-cli/fastfetch/wiki/Configuration). There are some premade config files in [`presets`](presets), including the ones used for the screenshots above. You can load them using `-c <filename>`. Those files can serve as examples of the configuration syntax.
Logos can be heavily customized too; see the [logo documentation](https://github.com/fastfetch-cli/fastfetch/wiki/Logo-options) for more information.
@@ -102,10 +103,10 @@ Logos can be heavily customized too; see the [logo documentation](https://github
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).
3. Fastfetch has a greater number of features, though by default fastfetch only has a few modules enabled; use `fastfetch -c all` to find what you want.
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, whereas fastfetch prints `555.00 MiB` and `22.97 GiB` respectively.
6. Fastfetch is more accurate. For example, [neofetch never actually supports the Wayland protocol](https://github.com/dylanaraps/neofetch/pull/2395).
### Q: Fastfetch shows my local IP address. It leaks my privacy!
@@ -117,7 +118,7 @@ If you really don't like it, you can disable the `Local IP` module in `config.js
### 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).
`Fastfetch` does not generate config file automatically. You can use `fastfetch --gen-config` to generate one. The config file will be saved in `~/.config/fastfetch/config.jsonc` by default. See [Wiki for detail](https://github.com/fastfetch-cli/fastfetch/wiki/Configuration).
### Q: The configuration is so complex. Where is the documentation?
@@ -131,7 +132,7 @@ Alternatively, you can refer to the presets in [`presets` directory](https://git
### 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
Fastfetch uses `format` to generate output. For example, to make the `GPU` module show only the GPU name (leaving other information undisplayed), you can use
```jsonc
{
@@ -144,15 +145,15 @@ Fastfetch uses `format` to generate output. For example to make `GPU` module sho
}
```
which is equivalent to `fastfetch -s gpu --gpu-format '{2}'`
. . 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`
See `fastfetch -h format` for information on 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)
If you just want to display distro name in [FIGlet text](https://github.com/pwaller/pyfiglet):
```bash
# install pyfiglet and jq first
+1
View File
@@ -347,6 +347,7 @@ __fastfetch_completion()
"--users-key"
"--users-format"
"--users-key-color"
"--users-myself-only"
"--bluetooth-key"
"--bluetooth-format"
"--bluetooth-key-color"
+30
View File
@@ -1,3 +1,33 @@
fastfetch (2.17.1) jammy; urgency=medium
* Update to 2.17.1
-- Carter Li <zhangsongcui@live.cn> Mon, 01 Jul 2024 08:56:29 +0800
fastfetch (2.17.0) jammy; urgency=medium
* Update to 2.17.0
-- Carter Li <zhangsongcui@live.cn> Fri, 28 Jun 2024 13:43:18 +0800
fastfetch (2.16.0) jammy; urgency=medium
* Update to 2.16.0
-- Carter Li <zhangsongcui@live.cn> Wed, 19 Jun 2024 14:53:43 +0800
fastfetch (2.15.0) jammy; urgency=medium
* Update to 2.15.0
-- Carter Li <zhangsongcui@live.cn> Fri, 07 Jun 2024 13:52:43 +0800
fastfetch (2.14.0) jammy; urgency=medium
* Update to 2.14.0
-- Carter Li <zhangsongcui@live.cn> Thu, 30 May 2024 14:27:54 +0800
fastfetch (2.13.2) jammy; urgency=medium
* Update to 2.13.2
+1 -1
View File
@@ -1 +1 @@
fastfetch_2.13.2_source.buildinfo universe/utils optional
fastfetch_2.17.1_source.buildinfo universe/utils optional
+115 -11
View File
@@ -23,7 +23,7 @@
"default": 0
},
"format": {
"description": "Output format of the module. See `-h &lt;module&gt;-format` for detail",
"description": "Output format of the module. See `-h <module>-format` for detail. I.e: fastfetch -h disk-format",
"type": "string"
},
"outputColor": {
@@ -89,10 +89,12 @@
"default": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json"
},
"logo": {
"description": "Fastfetch logo configurations\nSee also https://github.com/fastfetch-cli/fastfetch/wiki/Logo-options",
"oneOf": [
{
"description": "Disable logo",
"type": "null"
"type": "null",
"const": null
},
{
"description": "Set the source file of the logo",
@@ -217,10 +219,15 @@
"description": "If true, regenerate image logo cache",
"default": false
},
"separate": {
"type": "boolean",
"description": "If true, print modules at bottom of the logo",
"default": false
"position": {
"type": "string",
"description": "Set the position of the logo should be displayed",
"enum": [
"left",
"top",
"right"
],
"default": "left"
},
"chafa": {
"type": "object",
@@ -327,6 +334,11 @@
"type": "integer",
"description": "Set the timeout (ms) when waiting for child processes, `-1` for no timeout",
"default": 1000
},
"preRun": {
"type": "string",
"description": "Set the command to be executed before printing logos",
"default": ""
}
}
},
@@ -564,7 +576,7 @@
},
"tsVersion": {
"type": "boolean",
"description": "Whether to detect and display the version of terminal and shell. Mainly for benchmarking",
"description": "Whether to detect and display the version of terminal, shell and editor. Mainly for benchmarking",
"default": true
}
}
@@ -705,6 +717,7 @@
"disk",
"diskio",
"de",
"dns",
"editor",
"font",
"gamepad",
@@ -903,10 +916,6 @@
"const": "uptime",
"description": "Print how long system has been running"
},
{
"const": "users",
"description": "Print users currently logged in"
},
{
"const": "version",
"description": "Print Fastfetch version"
@@ -1136,6 +1145,21 @@
"type": "boolean",
"description": "Display CPU usage per CPU logical core, instead of an average result",
"default": false
},
"key": {
"$ref": "#/$defs/key"
},
"keyColor": {
"$ref": "#/$defs/keyColor"
},
"outputColor": {
"$ref": "#/$defs/outputColor"
},
"keyWidth": {
"$ref": "#/$defs/keyWidth"
},
"format": {
"$ref": "#/$defs/format"
}
}
},
@@ -1438,6 +1462,41 @@
}
}
},
{
"title": "DNS",
"type": "object",
"additionalProperties": false,
"properties": {
"type": {
"const": "dns",
"description": "Print DNS servers"
},
"showType": {
"enum": [
"ipv4",
"ipv6",
"both"
],
"default": "both",
"description": "Specify the type of DNS servers should be detected"
},
"key": {
"$ref": "#/$defs/key"
},
"keyColor": {
"$ref": "#/$defs/keyColor"
},
"outputColor": {
"$ref": "#/$defs/outputColor"
},
"keyWidth": {
"$ref": "#/$defs/keyWidth"
},
"format": {
"$ref": "#/$defs/format"
}
}
},
{
"title": "Gamepad",
"type": "object",
@@ -1491,6 +1550,7 @@
"auto",
"pci",
"vulkan",
"opencl",
"opengl"
],
"default": "auto"
@@ -1636,6 +1696,14 @@
"maximum": 9,
"default": 2
},
"compact": {
"type": "boolean",
"description": "Show values in one line",
"default": true
},
"percent": {
"$ref": "#/$defs/percent"
},
"key": {
"$ref": "#/$defs/key"
},
@@ -1999,6 +2067,42 @@
}
}
},
{
"title": "Users",
"type": "object",
"additionalProperties": false,
"properties": {
"type": {
"const": "users",
"description": "Print users currently logged in"
},
"compact": {
"type": "boolean",
"description": "Show all active users in one line",
"default": false
},
"myselfOnly": {
"type": "boolean",
"description": "Show only the current user",
"default": false
},
"key": {
"$ref": "#/$defs/key"
},
"keyColor": {
"$ref": "#/$defs/keyColor"
},
"outputColor": {
"$ref": "#/$defs/outputColor"
},
"keyWidth": {
"$ref": "#/$defs/keyWidth"
},
"format": {
"$ref": "#/$defs/format"
}
}
},
{
"title": "Weather",
"type": "object",
+1
View File
@@ -1,3 +1,4 @@
// Inspired by Catnap
{
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
"logo": {
+1
View File
@@ -1,3 +1,4 @@
// Inspired by Catnap
{
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
"logo": {
+1
View File
@@ -1,3 +1,4 @@
// Inspired by Catnap
{
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
"logo": {
+1
View File
@@ -1,3 +1,4 @@
// Inspired by Catnap
{
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
"logo": {
+188
View File
@@ -0,0 +1,188 @@
// _____ _____ _____ _____ _____ _____ _____ _____ _____
// | __| _ | __|_ _| __| __|_ _| | | |
// | __| |__ | | | | __| __| | | | --| |
// |__| |__|__|_____| |_| |__| |_____| |_| |_____|__|__|
//
// By CarterLi - https://github.com/CarterLi
// Homepage - https://github.com/fastfetch-cli/fastfetch
// config.jsonc - ニリ @niri-san
// pokemon-colorscripts - https://gitlab.com/phoneybadger/pokemon-colorscripts
{
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
"logo": {
"source": " _____ _____ _____ _____ _____ _____ _____ _____ _____\n| __| _ | __|_ _| __| __|_ _| | | |\n| __| |__ | | | | __| __| | | | --| |\n|__| |__|__|_____| |_| |__| |_____| |_| |_____|__|__|",
"type": "data",
"separate": true,
"padding": {
"right": 2
}
},
"display": {
"separator": " - "
},
"modules": [
{
"type": "custom", // HardwareInfo
"format": "• {#green}SYSTEM INFORMATION"
},
{
"type": "host",
"key": "HOST",
"format": "{name}{?vendor} ({vendor}){?}",
"keyColor": "green"
},
{
"type": "chassis",
"key": "COMPUTER TYPE",
"keyColor": "green"
},
{
"type": "cpu",
"key": "CPU",
"keyColor": "green"
},
{
"type": "gpu",
"key": "GPU",
"keyColor": "green"
},
{
"type": "memory",
"key": "MEMORY USED",
"keyColor": "green"
},
{
"type": "swap",
"key": "SWAP USED",
"keyColor": "green"
},
{
"type": "disk",
"key": "DISK",
"folders": "/",
"keyColor": "green"
},
{
"type": "custom", // SoftwareInfo
"format": "• {#red}SOFTWARE INFORMATION"
},
{
"type": "os",
"key": "DISTRO",
"keyColor": "red"
},
{
"type": "disk",
"folders": "/", // Use "/System/Volumes/VM" or something else on macOS
"format": "{create-time}",
"key": "INSTALLED DATE",
"keyColor": "red"
},
{
"type": "kernel",
"key": "KERNEL",
"keyColor": "red"
},
{
"type": "packages",
"key": "PACKAGES",
"keyColor": "red"
},
{
"type": "uptime",
"key": "UPTIME",
"keyColor": "red"
},
{
"type": "custom", // DisplayInfo
"format": "• {#blue}DISPLAY INFORMATION"
},
{
"type": "de",
"key": "DESKTOP ENVIRONMENT",
"keyColor": "blue"
},
{
"type": "lm",
"key": "LOGIN MANAGER",
"format": "{type}",
"keyColor": "blue"
},
{
"type": "wm",
"key": "WM",
"keyColor": "blue"
},
{
"type": "wmtheme",
"key": "WM THEME",
"keyColor": "blue"
},
{
"type": "monitor",
"key": "MONITOR ({name})",
"keyColor": "blue"
},
{
"type": "custom", // DesignInfo
"format": "• {#yellow}DESIGN INFORMATION"
},
{
"type": "wallpaper",
"key": "WALLPAPER",
"keyColor": "yellow"
},
{
"type": "theme",
"key": "KDE THEME",
"format": "{1}",
"keyColor": "yellow"
},
{
"type": "icons",
"key": "ICON THEME",
"format": "{1}",
"keyColor": "yellow"
},
{
"type": "font",
"key": "FONT",
"format": "{?1}{1} [Qt]{?}{/1}Unknown", // Remove "[Qt]" if not using Qt
"keyColor": "yellow"
},
{
"type": "terminalfont",
"key": "TERMINAL FONT",
"keyColor": "yellow"
},
{
"type": "cursor",
"key": "CURSOR",
"keyColor": "yellow"
},
{
"type": "custom", // OtherInfo
"format": "• {#cyan}VARIOUS INFORMATION"
},
{
"type": "media",
"key": "NOW PLAYING",
"format": "{?artist}{artist} - {?}{title}",
"keyColor": "cyan"
},
{
"type": "weather",
"key": "WEATHER",
"timeout": 1000,
"keyColor": "cyan"
},
{
"type": "version",
"key": "INFO",
"keyColor": "cyan"
},
"break",
"colors",
"break"
]
}
+160
View File
@@ -0,0 +1,160 @@
// Inspired by https://github.com/usgraphics/TR-100
{
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
"logo": null,
"display": {
"pipe": true,
"keyWidth": 16,
"separator": "│ ",
"percent": {
"type": 6
},
"bar": {
"borderLeft": "",
"borderRight": "",
"charElapsed": "█",
"charTotal": "░",
"width": 40
}
},
"modules": [
{
"type": "custom",
"format": "┌┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┐"
},
{
"type": "custom",
"format": "├┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┤"
},
{
"type": "version",
"key": " ",
"format": "│ FASTFETCH v{version} │"
},
{
"type": "custom",
"format": "│ TR-100 MACHINE REPORT │"
},
{
"type": "custom",
"format": "├────────────┬──────────────────────────────────────────┤"
},
{
"type": "os",
"key": "│ OS │\u001b[42C"
},
{
"type": "kernel",
"key": "│ KERNEL │\u001b[42C"
},
{
"type": "custom",
"format": "├────────────┼──────────────────────────────────────────┤"
},
{
"type": "title",
"key": "│ HOSTNAME │\u001b[42C",
"format": "{host-name}"
},
{
"type": "localip",
"key": "│ CLIENT IP │\u001b[42C",
"format": "{ipv4}"
},
{
"type": "localip",
"key": "│ MAC ADDR │\u001b[42C",
"format": "{mac} ({ifname})",
"showIPv4": false,
"showMac": true
},
{
"type": "dns",
"key": "│ DNS │\u001b[42C",
"showType": "ipv4"
},
{
"type": "title",
"key": "│ USER │\u001b[42C",
"format": "{user-name}"
},
{
"type": "host",
"key": "│ MACHINE │\u001b[42C",
"format": "{name}"
},
{
"type": "custom",
"format": "├────────────┼──────────────────────────────────────────┤"
},
{
"type": "cpu",
"key": "│ PROCESSOR │\u001b[42C",
"format": "{name}"
},
{
"type": "cpu",
"key": "│ CORES │\u001b[42C",
"format": "{cores-physical} PHYSICAL CORES / {cores-logical} THREADS",
"showPeCoreCount": false
},
{
"type": "cpu",
"key": "│ CPU FREQ │\u001b[42C",
"format": "{freq-max}{/freq-max}{freq-base}{/} GHz"
},
{
"type": "loadavg",
"compact": false,
// {duration} is not fixed length, hack it
"key": "│ LOAD \u001b[s{duration}m\u001b[u\u001b[6C│\u001b[42C"
},
{
"type": "custom",
"format": "├────────────┼──────────────────────────────────────────┤"
},
{
"type": "memory",
"key": "│ MEMORY │\u001b[42C",
"format": "{used} / {total} [{percentage}]"
},
{
"type": "memory",
"key": "│ USAGE │\u001b[42C",
"format": ""
},
{
"type": "custom",
"format": "├────────────┼──────────────────────────────────────────┤"
},
{
"type": "disk",
"key": "│ VOLUME │\u001b[42C",
"format": "{size-used} / {size-total} [{size-percentage}]",
"folders": "/"
},
{
"type": "disk",
"key": "│ DISK USAGE │\u001b[42C",
"format": ""
},
{
"type": "custom",
"format": "├────────────┼──────────────────────────────────────────┤"
},
{
"type": "users",
"key": "│ LAST LOGIN │\u001b[42C",
"format": "{login-time}{?client-ip} ({client-ip})",
"myselfOnly": true
},
{
"type": "uptime",
"key": "│ UPTIME │\u001b[42C"
},
{
"type": "custom",
"format": "└────────────┴──────────────────────────────────────────┘"
}
]
}
+43
View File
@@ -0,0 +1,43 @@
{
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
"logo": {
"type": "small"
},
"modules": [
{
"key": "██ Distro",
"keyColor": "38;5;210",
"type": "os"
},
{
"key": "██ Kernel",
"keyColor": "38;5;84",
"type": "kernel"
},
{
"key": "██ Shell",
"keyColor": "38;5;147",
"type": "shell"
},
{
"key": "██ Packages",
"keyColor": "38;5;200",
"type": "packages"
},
{
"key": "██ WM",
"keyColor": "38;5;44",
"type": "wm"
},
{
"key": "██ CPU",
"keyColor": "38;5;75",
"type": "cpu"
},
{
"key": "██ Memory",
"keyColor": "38;5;123",
"type": "memory"
}
]
}
+109
View File
@@ -0,0 +1,109 @@
// Modified from: https://github.com/fastfetch-cli/fastfetch/pull/1025#issuecomment-2177566138
{
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
"logo": {
"source": "arch3",
"color": {
"1": "red",
"2": "yellow"
}
},
"display": {
"color": {
"separator": "blue"
},
"separator": " | "
},
"modules": [
{
"type": "kernel",
"key": " /\\rch Linux",
"keyColor": "magenta"
},
{
"type": "custom",
"format": ">-----------<+>------------------------------------------<",
"outputColor": "separator"
},
{
"type": "uptime",
"key": " Uptime ",
"keyColor": "green"
},
{
"type": "shell",
"key": " Shell ",
"keyColor": "green"
},
{
"type": "terminal",
"key": " Terminal ",
"keyColor": "green"
},
{
"type": "terminalfont",
"key": " Font ",
"keyColor": "green"
},
{
"type": "packages",
"key": " Packages ",
"keyColor": "green"
},
{
"type": "localip",
"key": " Local IP ",
"keyColor": "green"
},
{
"type": "custom",
"format": ">-----------<+>------------------------------------------<",
"outputColor": "separator"
},
{
"type": "display",
"key": " Display ",
"keyColor": "cyan"
},
{
"type": "cpu",
"key": " CPU ",
"keyColor": "cyan"
},
{
"type": "gpu",
"key": " GPU ",
"keyColor": "cyan"
},
{
"type": "memory",
"key": " RAM ",
"keyColor": "cyan"
},
{
"type": "swap",
"key": " SWAP ",
"keyColor": "cyan"
},
{
"type": "disk",
"key": " Disk ",
"keyColor": "cyan"
},
{
"type": "battery",
"key": " Battery ",
"keyColor": "cyan"
},
{
"type": "custom",
"format": ">-----------<+>------------------------------------------<",
"outputColor": "separator"
},
"break",
{
"type": "colors",
"paddingLeft": 15
}
]
}
+47 -34
View File
@@ -52,24 +52,28 @@ void ffFormatAppendFormatArg(FFstrbuf* buffer, const FFformatarg* formatarg)
* @param placeholderValue the string to parse
* @return uint32_t the parsed value
*/
static uint32_t getArgumentIndex(const FFstrbuf* placeholderValue, uint32_t numArgs, const FFformatarg* arguments)
static uint32_t getArgumentIndex(const char* placeholderValue, uint32_t numArgs, const FFformatarg* arguments)
{
char firstChar = placeholderValue->chars[0];
char firstChar = placeholderValue[0];
if (firstChar == '\0')
return 0; // use arg counter
if(firstChar >= '1' && firstChar <= '9')
if (firstChar >= '0' && firstChar <= '9')
{
char* pEnd = NULL;
unsigned long result = strtoul(placeholderValue->chars, &pEnd, 10);
if (pEnd != placeholderValue->chars + placeholderValue->length || result > numArgs)
uint32_t result = (uint32_t) strtoul(placeholderValue, &pEnd, 10);
if (result > numArgs)
return UINT32_MAX;
return (uint32_t) result;
if (*pEnd != '\0')
return UINT32_MAX;
return 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))
if (arg->name && strcasecmp(placeholderValue, arg->name) == 0)
return i + 1;
}
}
@@ -86,16 +90,6 @@ static inline void appendInvalidPlaceholder(FFstrbuf* buffer, const char* start,
ffStrbufAppendC(buffer, '}');
}
static inline void appendEmptyPlaceholder(FFstrbuf* buffer, const char* placeholder, uint32_t* argCounter, uint32_t numArgs, const FFformatarg* arguments)
{
if(*argCounter >= numArgs)
ffStrbufAppendS(buffer, placeholder);
else
ffFormatAppendFormatArg(buffer, arguments + *argCounter);
(*argCounter)++;
}
static inline bool formatArgSet(const FFformatarg* arg)
{
return arg->value != NULL && (
@@ -128,13 +122,6 @@ void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t n
continue;
}
// if we have an { at the end handle it as {}
if(i == formatstr->length - 1)
{
appendEmptyPlaceholder(buffer, "{", &argCounter, numArgs, arguments);
continue;
}
// jump to next char, the start of the placeholder value
++i;
@@ -145,13 +132,6 @@ void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t n
continue;
}
// placeholder is {}
if(formatstr->chars[i] == '}')
{
appendEmptyPlaceholder(buffer, "{}", &argCounter, numArgs, arguments);
continue;
}
ffStrbufClear(&placeholderValue);
{
@@ -205,7 +185,7 @@ void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t n
{
ffStrbufSubstrAfter(&placeholderValue, 0);
uint32_t index = getArgumentIndex(&placeholderValue, numArgs, arguments);
uint32_t index = getArgumentIndex(placeholderValue.chars, numArgs, arguments);
// testing for an invalid index
if (index > numArgs)
@@ -231,7 +211,7 @@ void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t n
{
ffStrbufSubstrAfter(&placeholderValue, 0);
uint32_t index = getArgumentIndex(&placeholderValue, numArgs, arguments);
uint32_t index = getArgumentIndex(placeholderValue.chars, numArgs, arguments);
// testing for an invalid index
if (index > numArgs)
@@ -264,16 +244,49 @@ void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t n
continue;
}
uint32_t index = getArgumentIndex(&placeholderValue, numArgs, arguments);
int32_t truncLength = INT32_MAX;
char* pColon = memchr(placeholderValue.chars, ':', placeholderValue.length);
if (pColon != NULL)
{
char* pEnd = NULL;
truncLength = (int32_t) strtol(pColon + 1, &pEnd, 10);
if (*pEnd != '\0')
{
appendInvalidPlaceholder(buffer, "{", &placeholderValue, i, formatstr->length);
continue;
}
*pColon = '\0';
}
uint32_t index = getArgumentIndex(placeholderValue.chars, numArgs, arguments);
// test for invalid index
if (index == 0)
index = ++argCounter;
if (index > numArgs)
{
if (pColon) *pColon = ':';
appendInvalidPlaceholder(buffer, "{", &placeholderValue, i, formatstr->length);
continue;
}
bool ellipsis = false;
if (truncLength < 0)
{
ellipsis = true;
truncLength = -truncLength;
}
uint32_t oldLength = buffer->length;
ffFormatAppendFormatArg(buffer, &arguments[index - 1]);
if (buffer->length - oldLength > (uint32_t) truncLength)
{
ffStrbufSubstrBefore(buffer, oldLength + (uint32_t) truncLength);
ffStrbufTrimRightSpace(buffer);
if (ellipsis)
ffStrbufAppendS(buffer, "");
}
}
if (!instance.config.display.pipe)
-3
View File
@@ -254,9 +254,6 @@ void ffListFeatures(void)
#ifdef FF_HAVE_DIRECTX_HEADERS
"Directx Headers\n"
#endif
#ifdef FF_USE_PROPRIETARY_GPU_DRIVER_API
"Proprietary GPU driver API\n"
#endif
#ifdef FF_USE_SYSTEM_YYJSON
"System yyjson\n"
#endif
+2
View File
@@ -8,11 +8,13 @@
#include <handleapi.h>
#include <io.h>
typedef HANDLE FFNativeFD;
#define FF_INVALID_FD INVALID_HANDLE_VALUE
#else
#include <unistd.h>
#include <dirent.h>
#include <sys/stat.h>
typedef int FFNativeFD;
#define FF_INVALID_FD (-1)
// procfs's file can be changed between read calls such as /proc/meminfo and /proc/uptime.
// one safe way to read correct data is reading the whole file in a single read syscall
// 8192 comes from procps-ng: https://gitlab.com/procps-ng/procps/-/blob/master/library/meminfo.c?ref_type=heads#L39
+46 -16
View File
@@ -133,32 +133,44 @@ 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";
int fin = STDIN_FILENO, fout = STDOUT_FILENO;
FF_AUTO_CLOSE_FD int ftty = -1;
struct termios oldTerm, newTerm;
if(tcgetattr(STDIN_FILENO, &oldTerm) == -1)
if (!isatty(STDIN_FILENO))
{
if (ftty < 0)
ftty = open("/dev/tty", O_RDWR | O_NOCTTY | O_CLOEXEC);
fin = ftty;
}
if (!isatty(STDOUT_FILENO))
{
if (ftty < 0)
ftty = open("/dev/tty", O_RDWR | O_NOCTTY | O_CLOEXEC);
fout = ftty;
}
struct termios oldTerm;
if(tcgetattr(fin, &oldTerm) == -1)
return "tcgetattr(STDIN_FILENO, &oldTerm) failed";
newTerm = oldTerm;
struct termios newTerm = oldTerm;
newTerm.c_lflag &= (tcflag_t) ~(ICANON | ECHO);
if(tcsetattr(STDIN_FILENO, TCSANOW, &newTerm) == -1)
return "tcsetattr(STDIN_FILENO, TCSANOW, &newTerm)";
if(tcsetattr(fin, TCSAFLUSH, &newTerm) == -1)
return "tcsetattr(STDIN_FILENO, TCSAFLUSH, &newTerm)";
fputs(request, stdout);
fflush(stdout);
ffWriteFDData(fout, strlen(request), request);
//Give the terminal 35ms to respond
if(poll(&(struct pollfd) { .fd = STDIN_FILENO, .events = POLLIN }, 1, FF_IO_TERM_RESP_WAIT_MS) <= 0)
//Give the terminal some time to respond
if(poll(&(struct pollfd) { .fd = fin, .events = POLLIN }, 1, FF_IO_TERM_RESP_WAIT_MS) <= 0)
{
tcsetattr(STDIN_FILENO, TCSANOW, &oldTerm);
tcsetattr(fin, TCSANOW, &oldTerm);
return "poll() timeout or failed";
}
char buffer[512];
ssize_t bytesRead = read(STDIN_FILENO, buffer, sizeof(buffer) - 1);
ssize_t bytesRead = read(fin, buffer, sizeof(buffer) - 1);
tcsetattr(STDIN_FILENO, TCSANOW, &oldTerm);
tcsetattr(fin, TCSANOW, &oldTerm);
if(bytesRead <= 0)
return "read(STDIN_FILENO, buffer, sizeof(buffer) - 1) failed";
@@ -204,7 +216,11 @@ bool ffSuppressIO(bool suppress)
void listFilesRecursively(uint32_t baseLength, FFstrbuf* folder, uint8_t indentation, const char* folderName, bool pretty)
{
DIR* dir = opendir(folder->chars);
FF_AUTO_CLOSE_FD int dfd = open(folder->chars, O_RDONLY);
if (dfd < 0)
return;
DIR* dir = fdopendir(dfd);
if(dir == NULL)
return;
@@ -221,7 +237,21 @@ void listFilesRecursively(uint32_t baseLength, FFstrbuf* folder, uint8_t indenta
while((entry = readdir(dir)) != NULL)
{
if(entry->d_type == DT_DIR)
bool isDir = false;
#ifdef _DIRENT_HAVE_D_TYPE
if(entry->d_type != DT_UNKNOWN && entry->d_type != DT_LNK)
isDir = entry->d_type == DT_DIR;
else
#else
{
struct stat stbuf;
if (fstatat(dfd, entry->d_name, &stbuf, 0) < 0)
isDir = false;
else
isDir = S_ISDIR(stbuf.st_mode);
}
#endif
if (isDir)
{
if(ffStrEquals(entry->d_name, ".") || ffStrEquals(entry->d_name, ".."))
continue;
+57 -12
View File
@@ -114,8 +114,40 @@ bool ffPathExpandEnv(const char* in, FFstrbuf* out)
bool ffSuppressIO(bool suppress)
{
(void) suppress; //Not implemented.
return false;
static bool init = false;
static HANDLE hOrigOut = INVALID_HANDLE_VALUE;
static HANDLE hOrigErr = INVALID_HANDLE_VALUE;
static HANDLE hNullFile = INVALID_HANDLE_VALUE;
static int fOrigOut = -1;
static int fOrigErr = -1;
static int fNullFile = -1;
if (!init)
{
if(!suppress)
return true;
hOrigOut = GetStdHandle(STD_OUTPUT_HANDLE);
hOrigErr = GetStdHandle(STD_ERROR_HANDLE);
hNullFile = CreateFileW(L"NUL", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, NULL);
fOrigOut = _dup(STDOUT_FILENO);
fOrigErr = _dup(STDERR_FILENO);
fNullFile = _open_osfhandle((intptr_t) hNullFile, 0);
init = true;
}
if (hNullFile == INVALID_HANDLE_VALUE || fNullFile == -1)
return false;
fflush(stdout);
fflush(stderr);
SetStdHandle(STD_OUTPUT_HANDLE, suppress ? hNullFile : hOrigOut);
SetStdHandle(STD_ERROR_HANDLE, suppress ? hNullFile : hOrigErr);
_dup2(suppress ? fNullFile : fOrigOut, STDOUT_FILENO);
_dup2(suppress ? fNullFile : fOrigErr, STDERR_FILENO);
return true;
}
void listFilesRecursively(uint32_t baseLength, FFstrbuf* folder, uint8_t indentation, const char* folderName, bool pretty)
@@ -175,24 +207,37 @@ 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);
FF_AUTO_CLOSE_FD HANDLE hConin = INVALID_HANDLE_VALUE;
DWORD inputMode;
if (!GetConsoleMode(hInput, &inputMode))
{
hConin = CreateFileW(L"CONIN$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, NULL);
hInput = hConin;
}
SetConsoleMode(hInput, 0);
FlushConsoleInputBuffer(hInput);
DWORD bytes = 0;
WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), request, (DWORD) strlen(request), &bytes, NULL);
{
DWORD bytes = 0;
HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
FF_AUTO_CLOSE_FD HANDLE hConout = INVALID_HANDLE_VALUE;
DWORD outputMode;
if (!GetConsoleMode(hOutput, &outputMode))
{
hConout = CreateFileW(L"CONOUT$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, NULL);
hOutput = hConout;
}
WriteFile(hOutput, "TEST\n", 5, &bytes, NULL);
WriteFile(hOutput, request, (DWORD) strlen(request), &bytes, NULL);
}
while (true)
{
if (WaitForSingleObjectEx(hInput, FF_IO_TERM_RESP_WAIT_MS, TRUE) != WAIT_OBJECT_0)
{
SetConsoleMode(hInput, prev_mode);
SetConsoleMode(hInput, inputMode);
return "WaitForSingleObject() failed or timeout";
}
@@ -213,10 +258,10 @@ const char* ffGetTerminalResponse(const char* request, const char* format, ...)
}
char buffer[512];
bytes = 0;
DWORD bytes = 0;
ReadFile(hInput, buffer, sizeof(buffer) - 1, &bytes, NULL);
SetConsoleMode(hInput, prev_mode);
SetConsoleMode(hInput, inputMode);
if(bytes <= 0)
return "ReadFile() failed";
+1
View File
@@ -34,6 +34,7 @@ static FFModuleBaseInfo* D[] = {
(void*) &instance.config.modules.display,
(void*) &instance.config.modules.disk,
(void*) &instance.config.modules.diskIo,
(void*) &instance.config.modules.dns,
NULL,
};
+9 -1
View File
@@ -18,6 +18,8 @@
# define ROUNDUP(a) ROUNDUP2((a), sizeof(int))
#elif defined(__OpenBSD__)
# define ROUNDUP(a) ROUNDUP2((a), sizeof(int))
#elif defined(__sun)
# define ROUNDUP(a) ROUNDUP2((a), _SS_ALIGNSIZE)
#else
# error unknown platform
#endif
@@ -31,9 +33,13 @@ get_rt_address(struct rt_msghdr *rtm, int desired)
{
if (rtm->rtm_addrs & (1 << i))
{
if ((1 <<i ) == desired)
if ((1 << i) == desired)
return sa;
#ifdef __sun
sa = (struct sockaddr *)(ROUNDUP(sizeof(struct sockaddr)) + (char *)sa);
#else
sa = (struct sockaddr *)(ROUNDUP(sa->sa_len) + (char *)sa);
#endif
}
}
return NULL;
@@ -71,7 +77,9 @@ bool ffNetifGetDefaultRouteImpl(char iface[IF_NAMESIZE + 1], uint32_t* ifIndex)
},
.dst = {
.sin_family = AF_INET,
#ifndef __sun
.sin_len = sizeof(rtmsg.dst),
#endif
},
};
+8
View File
@@ -148,6 +148,14 @@ bool ffOptionParseBoolean(const char* str)
void ffOptionParseColorNoClear(const char* value, FFstrbuf* buffer)
{
// If value is already an ANSI escape code, use it
if (value[0] == '\e' && value[1] == '[')
{
ffStrbufAppendS(buffer, value + 2);
ffStrbufTrimRight(buffer, 'm');
return;
}
ffStrbufEnsureFree(buffer, 63);
while(*value != '\0')
+1 -1
View File
@@ -64,7 +64,7 @@ void ffPrintLogoAndKey(const char* moduleName, uint8_t moduleIndex, const FFModu
if(!instance.config.display.pipe)
{
fputs(FASTFETCH_TEXT_MODIFIER_RESET, stdout);
if (moduleArgs->outputColor.length)
if (moduleArgs && moduleArgs->outputColor.length)
ffPrintColor(&moduleArgs->outputColor);
else if (instance.config.display.colorOutput.length)
ffPrintColor(&instance.config.display.colorOutput);
+1 -1
View File
@@ -5,7 +5,7 @@
typedef enum FFPrintType {
FF_PRINT_TYPE_DEFAULT = 0,
FF_PRINT_TYPE_NO_CUSTOM_KEY = 1 << 0,
FF_PRINT_TYPE_NO_CUSTOM_KEY = 1 << 0, // key has been formatted outside
FF_PRINT_TYPE_NO_CUSTOM_KEY_COLOR = 1 << 1,
FF_PRINT_TYPE_NO_CUSTOM_KEY_WIDTH = 1 << 2,
FF_PRINT_TYPE_NO_CUSTOM_OUTPUT_FORMAT = 1 << 3, // reserved
+39 -1
View File
@@ -18,8 +18,10 @@
#include <sys/user.h>
#include <sys/sysctl.h>
#endif
#ifdef __APPLE__
#if defined(__APPLE__)
#include <libproc.h>
#elif defined(__sun)
#include <procfs.h>
#endif
enum { FF_PIPE_BUFSIZ = 8192 };
@@ -234,6 +236,29 @@ void ffProcessGetInfoLinux(pid_t pid, FFstrbuf* processName, FFstrbuf* exe, cons
ffStrbufSetS(exe, arg0);
}
#elif defined(__sun)
char filePath[PATH_MAX];
snprintf(filePath, sizeof(filePath), "/proc/%d/psinfo", (int) pid);
psinfo_t proc;
if (ffReadFileData(filePath, sizeof(proc), &proc) == sizeof(proc))
{
ffStrbufSetS(exe, proc.pr_psargs);
ffStrbufSubstrBeforeFirstC(exe, ' ');
}
if (exePath)
{
snprintf(filePath, sizeof(filePath), "/proc/%d/path/a.out", (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;
}
}
#endif
if(exe->length == 0)
@@ -335,6 +360,19 @@ const char* ffProcessGetBasicInfoLinux(pid_t pid, FFstrbuf* name, pid_t* ppid, i
*tty = -1;
}
#elif defined(__sun)
char path[128];
snprintf(path, sizeof(path), "/proc/%d/psinfo", (int) pid);
psinfo_t proc;
if (ffReadFileData(path, sizeof(proc), &proc) != sizeof(proc))
return "ffReadFileData(psinfo) failed";
ffStrbufSetS(name, proc.pr_fname);
if (ppid)
*ppid = proc.pr_ppid;
if (tty)
*tty = (int) proc.pr_ttydev;
#else
return "Unsupported platform";
+53 -9
View File
@@ -154,7 +154,7 @@
{
"short": "l",
"long": "logo",
"desc": "Set the logo source",
"desc": "Set the logo source. Use \"none\" to disable the logo",
"remark": "Should be the name of a builtin logo, or a path to an image file. See also https://github.com/fastfetch-cli/fastfetch/wiki/Logo-options",
"arg": {
"type": "logo"
@@ -257,12 +257,15 @@
}
},
{
"long": "logo-separate",
"desc": "If true, print modules at bottom of the logo",
"long": "logo-position",
"desc": "Set the position of the logo should be displayed",
"arg": {
"type": "bool",
"optional": true,
"default": false
"type": "enum",
"enum": {
"left": "Left",
"top": "Top",
"right": "Right"
}
}
},
{
@@ -438,7 +441,7 @@
},
{
"long": "pipe",
"desc": "Disable logo and all escape sequences",
"desc": "Disable colors",
"remark": "Auto detection based on isatty(1)",
"arg": {
"type": "bool",
@@ -725,7 +728,7 @@
},
{
"long": "ts-version",
"desc": "Whether to detect and display the version of terminal and shell",
"desc": "Whether to detect and display the version of terminal, shell and editor",
"remark": "Mainly for benchmarking",
"arg": {
"type": "bool",
@@ -1251,7 +1254,8 @@
"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",
"vulkan": "Use Vulkan API. Slow and requires proper vulkan driver installed. Used for Android",
"opencl": "Use OpenCL API. Slow and requires proper OpenCL driver installed",
"opengl": "Use OpenGL API. Slow and only detects one GPU"
},
"default": "auto"
@@ -1287,6 +1291,15 @@
"default": 2
}
},
{
"long": "loadavg-compact",
"desc": "Show load average values in one line",
"arg": {
"type": "bool",
"optional": true,
"default": true
}
},
{
"long": "localip-show-ipv4",
"desc": "Show IPv4 addresses in local ip module",
@@ -1367,6 +1380,19 @@
"default": false
}
},
{
"long": "dns-show-type",
"desc": "Specify the type of DNS servers should be detected",
"arg": {
"type": "enum",
"enum": {
"ipv4": "Show IPv4 addresses only",
"ipv6": "Show IPv6 addresses only",
"both": "Show both IPv4 and IPv6 addresses"
},
"default": "both"
}
},
{
"long": "netio-name-prefix",
"desc": "Show interfaces with given name prefix only",
@@ -1450,6 +1476,24 @@
"default": false
}
},
{
"long": "users-compact",
"desc": "Show all active users in one line",
"arg": {
"type": "bool",
"optional": true,
"default": false
}
},
{
"long": "users-myself-only",
"desc": "Show only current user",
"arg": {
"type": "bool",
"optional": true,
"default": false
}
},
{
"long": "player-name",
"desc": "The name of the player to use for module Media and Player",
+5
View File
@@ -8,6 +8,11 @@ In 2.14.0 or newer, the value indices can be meaningful named tags.
For example: "--title-format '{user-name-colored}{at-symbol-colored}{host-name-colored}'" is equivalent to "--title-format '{6}{7}{8}'"
See "fastfetch -h title-format" for all supported tags.
In 2.17.0 or newer, a truncation length can be specified using syntax '<arg>:<trunc-length>`
For example: "--title-format '{user-name:5}'" will truncate user name into 5-length string.
If '<trunc-length>' is negative, an ellipsis … will be appended at the end when the original string is truncated.
Note: The string length is counted in raw bytes. Multi-byte unicode characters and ANSI escape codes are not taken into account.
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.
+1 -1
View File
@@ -172,7 +172,7 @@ typedef struct FFSmbiosPortableBattery
static_assert(offsetof(FFSmbiosPortableBattery, OEMSpecific) == 0x16,
"FFSmbiosPortableBattery: Wrong struct alignment");
const char* detectBySmbios(FFBatteryResult* battery)
static const char* detectBySmbios(FFBatteryResult* battery)
{
const FFSmbiosHeaderTable* smbiosTable = ffGetSmbiosHeaderTable();
if (!smbiosTable)
+6
View File
@@ -0,0 +1,6 @@
#include "bios.h"
const char* ffDetectBios(FFBiosResult* bios)
{
return "Not supported on this platform";
}
+5 -1
View File
@@ -1,5 +1,7 @@
#include "bios.h"
#include "util/smbiosHelper.h"
#ifdef _WIN32
#include "util/windows/registry.h"
#include <ntstatus.h>
@@ -25,7 +27,7 @@ typedef struct _SYSTEM_BOOT_ENVIRONMENT_INFORMATION
};
};
} SYSTEM_BOOT_ENVIRONMENT_INFORMATION;
#endif
typedef struct FFSmbiosBios
{
@@ -74,6 +76,7 @@ const char* ffDetectBios(FFBiosResult* bios)
if (data->Header.Length > offsetof(FFSmbiosBios, SystemBiosMajorRelease))
ffStrbufSetF(&bios->release, "%u.%u", data->SystemBiosMajorRelease, data->SystemBiosMinorRelease);
#ifdef _WIN32
// Same as GetFirmwareType, but support (?) Windows 7
// https://ntdoc.m417z.com/system_information_class
SYSTEM_BOOT_ENVIRONMENT_INFORMATION sbei;
@@ -86,6 +89,7 @@ const char* ffDetectBios(FFBiosResult* bios)
default: break;
}
}
#endif
return NULL;
}
+6
View File
@@ -0,0 +1,6 @@
#include "camera.h"
const char* ffDetectCamera(FF_MAYBE_UNUSED FFlist* result)
{
return "Not support on this platform";
}
+6
View File
@@ -0,0 +1,6 @@
#include "cpu.h"
const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
{
return "Not supported on this platform";
}
+45
View File
@@ -0,0 +1,45 @@
#include "cpu.h"
#include <kstat.h>
static inline void kstatFreeWrap(kstat_ctl_t** pkc)
{
assert(pkc);
if (*pkc)
kstat_close(*pkc);
}
const char* ffDetectCPUImpl(FF_MAYBE_UNUSED const FFCPUOptions* options, FFCPUResult* cpu)
{
__attribute__((__cleanup__(kstatFreeWrap))) kstat_ctl_t* kc = kstat_open();
if (!kc)
return "kstat_open() failed";
kstat_t* ks = kstat_lookup(kc, "cpu_info", -1, NULL);
if (!ks)
return "kstat_lookup() failed";
if (kstat_read(kc, ks, NULL) < 0)
return "kstat_read() failed";
{
kstat_named_t* kn = kstat_data_lookup(ks, "brand");
ffStrbufSetNS(&cpu->name, KSTAT_NAMED_STR_BUFLEN(kn) - 1, KSTAT_NAMED_STR_PTR(kn));
}
{
kstat_named_t* kn = kstat_data_lookup(ks, "vendor_id");
ffStrbufSetNS(&cpu->vendor, KSTAT_NAMED_STR_BUFLEN(kn) - 1, KSTAT_NAMED_STR_PTR(kn));
}
{
kstat_named_t* kn = kstat_data_lookup(ks, "clock_MHz");
cpu->frequencyBase = kn->value.ui32 / 1000.;
}
ks = kstat_lookup(kc, "unix", -1, "system_misc");
if (ks && kstat_read(kc, ks, NULL) >= 0)
{
kstat_named_t* kn = kstat_data_lookup(ks, "ncpus");
cpu->coresLogical = cpu->coresPhysical = cpu->coresOnline = (uint16_t) kn->value.ui32;
}
return NULL;
}
+5 -3
View File
@@ -50,7 +50,7 @@ static const char* parseCpuCacheIndex(FFstrbuf* path, FFCPUCacheResult* result,
// deduplicate shared caches
ffStrbufAppendF(buffer, "_%u_%u_%u_%u\n", level, sizeKb, lineSize, cacheType);
if (ffStrbufContain(added, buffer)) return "cache already added";
if (ffStrbufContain(added, buffer)) return NULL;
ffStrbufAppend(added, buffer);
ffCPUCacheAddItem(result, level, sizeKb * 1024, lineSize, cacheType);
return NULL;
@@ -71,7 +71,8 @@ static const char* parseCpuCache(FFstrbuf* path, FFCPUCacheResult* result, FFstr
|| !ffCharIsDigit(pathCacheEntry->d_name[strlen("index")])) continue;
ffStrbufAppendS(path, pathCacheEntry->d_name);
parseCpuCacheIndex(path, result, buffer, added);
const char* error = parseCpuCacheIndex(path, result, buffer, added);
if (error) return error;
ffStrbufSubstrBefore(path, baseLen);
}
@@ -97,7 +98,8 @@ const char* ffDetectCPUCache(FFCPUCacheResult* result)
!ffCharIsDigit(pathCpuEntry->d_name[strlen("cpu")])) continue;
ffStrbufAppendS(&path, pathCpuEntry->d_name);
parseCpuCache(&path, result, &buffer, &added);
const char* error = parseCpuCache(&path, result, &buffer, &added);
if (error) return error;
ffStrbufSubstrBefore(&path, baseLen);
}
return NULL;
@@ -1,5 +1,4 @@
#include "cpucache.h"
#include "common/sysctl.h"
const char* ffDetectCPUCache(FF_MAYBE_UNUSED FFCPUCacheResult* result)
{
+75
View File
@@ -0,0 +1,75 @@
#include "cpucache.h"
#include "util/smbiosHelper.h"
#include "util/stringUtils.h"
typedef struct FFSmbiosCacheInfo
{
FFSmbiosHeader Header;
uint8_t SocketDesignation; // string
uint16_t CacheConfiguration; // varies
uint16_t MaximumCacheSize; // varies
uint16_t InstalledSize; // varies
uint16_t SupportedSramType; // bit field
uint16_t CurrentSramType; // bit field
// 2.1+
uint8_t CacheSpeed; // varies
uint8_t ErrorCorrectionType; // enum
uint8_t SystemCacheType; // enum
uint8_t Associativity; // enum
// 3.1+
uint32_t MaximumCacheSize2; // bit field
uint32_t InstalledCacheSize2; // bit field
} __attribute__((__packed__)) FFSmbiosCacheInfo;
static_assert(offsetof(FFSmbiosCacheInfo, InstalledCacheSize2) == 0x17,
"FFSmbiosCacheInfo: Wrong struct alignment");
const char* ffDetectCPUCache(FFCPUCacheResult* result)
{
const FFSmbiosHeaderTable* smbiosTable = ffGetSmbiosHeaderTable();
if (!smbiosTable)
return "Failed to get SMBIOS data";
const FFSmbiosCacheInfo* data = (const FFSmbiosCacheInfo*) (*smbiosTable)[FF_SMBIOS_TYPE_CACHE_INFO];
if (!data)
return "Cache information is not found in SMBIOS data";
for (; data->Header.Type == FF_SMBIOS_TYPE_CACHE_INFO;
data = (const FFSmbiosCacheInfo*) ffSmbiosNextEntry(&data->Header))
{
bool enabled = !!(data->CacheConfiguration & (1 << 7));
if (!enabled)
continue;
uint32_t size = data->InstalledSize;
if (size == 0)
continue;
if (data->InstalledSize != 0xFFFF)
{
size *= (size >> 15 ? 64 : 1) * 1024u;
}
else if (data->Header.Length > offsetof(FFSmbiosCacheInfo, InstalledCacheSize2))
{
size = data->InstalledCacheSize2;
size *= (size >> 31 ? 64 : 1) * 1024u;
}
uint32_t level = (data->CacheConfiguration & 0b111u) + 1;
FFCPUCacheType type;
switch (data->SystemCacheType)
{
case 3: type = FF_CPU_CACHE_TYPE_INSTRUCTION; break;
case 4: type = FF_CPU_CACHE_TYPE_DATA; break;
default: type = FF_CPU_CACHE_TYPE_UNIFIED; break;
}
ffCPUCacheAddItem(result, level, size, 0, type);
}
return NULL;
}
+3 -3
View File
@@ -23,12 +23,12 @@ const char* ffGetCpuUsageInfo(FFlist* cpuTimes)
{
uint64_t* cpTime = cpTimes[i];
uint64_t inUse = cpTime[CP_USER] + cpTime[CP_NICE] + cpTime[CP_SYS];
uint64_t total = cpTime[CP_INTR] + cpTime[CP_IDLE];
uint64_t total = inUse + cpTime[CP_INTR] + cpTime[CP_IDLE];
FFCpuUsageInfo* info = (FFCpuUsageInfo*) ffListAdd(cpuTimes);
*info = (FFCpuUsageInfo) {
.inUseAll = (uint64_t)inUse,
.totalAll = (uint64_t)total,
.inUseAll = inUse,
.totalAll = total,
};
}
+2 -2
View File
@@ -36,8 +36,8 @@ const char* ffGetCpuUsageInfo(FFlist* cpuTimes)
FFCpuUsageInfo* info = (FFCpuUsageInfo*) ffListAdd(cpuTimes);
*info = (FFCpuUsageInfo) {
.inUseAll = (uint64_t)inUse,
.totalAll = (uint64_t)total,
.inUseAll = inUse,
.totalAll = total,
};
}
else
@@ -0,0 +1,7 @@
#include "fastfetch.h"
#include "detection/cpuusage/cpuusage.h"
const char* ffGetCpuUsageInfo(FFlist* cpuTimes)
{
return "Not support on this platform";
}
+38
View File
@@ -0,0 +1,38 @@
#include "fastfetch.h"
#include "detection/cpuusage/cpuusage.h"
#include <kstat.h>
#include <sys/sysinfo.h>
static inline void kstatFreeWrap(kstat_ctl_t** pkc)
{
assert(pkc);
if (*pkc)
kstat_close(*pkc);
}
const char* ffGetCpuUsageInfo(FFlist* cpuTimes)
{
__attribute__((__cleanup__(kstatFreeWrap))) kstat_ctl_t* kc = kstat_open();
if (!kc)
return "kstat_open() failed";
for (int i = 0;; ++i)
{
kstat_t* ks = kstat_lookup(kc, "cpu_stat", i, NULL);
cpu_stat_t cs;
if (!ks || kstat_read(kc, ks, &cs) < 0)
break;
uint64_t inUse = cs.cpu_sysinfo.cpu[CPU_USER] + cs.cpu_sysinfo.cpu[CPU_KERNEL];
uint64_t total = inUse + cs.cpu_sysinfo.cpu[CPU_IDLE] + cs.cpu_sysinfo.cpu[CPU_WAIT];
FFCpuUsageInfo* info = (FFCpuUsageInfo*) ffListAdd(cpuTimes);
*info = (FFCpuUsageInfo) {
.inUseAll = inUse,
.totalAll = total,
};
}
return NULL;
}
+2 -2
View File
@@ -31,8 +31,8 @@ const char* ffGetCpuUsageInfo(FFlist* cpuTimes)
FFCpuUsageInfo* info = (FFCpuUsageInfo*) ffListAdd(cpuTimes);
*info = (FFCpuUsageInfo) {
.inUseAll = (uint64_t)inUse,
.totalAll = (uint64_t)total,
.inUseAll = inUse,
.totalAll = total,
};
}
+14 -1
View File
@@ -74,7 +74,20 @@ static void getGnome(FFstrbuf* result, FF_MAYBE_UNUSED FFDEOptions* options)
static void getCinnamon(FFstrbuf* result, FF_MAYBE_UNUSED FFDEOptions* options)
{
ffParsePropFileData("applications/cinnamon.desktop", "X-GNOME-Bugzilla-Version =", result);
ffStrbufSetS(result, getenv("CINNAMON_VERSION"));
if (result->length == 0)
ffParsePropFileData("applications/cinnamon.desktop", "X-GNOME-Bugzilla-Version =", result);
if (result->length == 0 && options->slowVersionDetection)
{
if (ffProcessAppendStdOut(result, (char* const[]){
"cinnamon",
"--version",
NULL
}) == NULL) // Cinnamon 6.2.2
ffStrbufSubstrAfterLastC(result, ' ');
}
}
static void getMate(FFstrbuf* result, FFDEOptions* options)
+6
View File
@@ -0,0 +1,6 @@
#include "disk.h"
const char* ffDetectDisksImpl(FFDiskOptions* options, FFlist* disks)
{
return "Not supported on this platform";
}
+138
View File
@@ -0,0 +1,138 @@
#include "disk.h"
#include "common/io/io.h"
#include "util/stringUtils.h"
#include <sys/mntent.h>
#include <sys/stat.h>
#include <sys/statvfs.h>
#include <sys/mount.h>
#include <sys/mnttab.h>
static bool isPhysicalDevice(const struct mnttab* device)
{
//Always show the root path
if(ffStrEquals(device->mnt_mountp, "/"))
return true;
if(ffStrEquals(device->mnt_special, "none"))
return false;
//ZFS pool
if(ffStrEquals(device->mnt_fstype, "zfs"))
return true;
//Pseudo filesystems don't have a device in /dev
if(!ffStrStartsWith(device->mnt_special, "/dev/"))
return false;
struct stat deviceStat;
if(stat(device->mnt_special, &deviceStat) != 0)
return false;
//Ignore all devices that are not block devices
if(!S_ISBLK(deviceStat.st_mode))
return false;
return true;
}
static bool isSubvolume(const FFlist* disks, FFDisk* currentDisk)
{
if(ffStrbufEqualS(&currentDisk->filesystem, "zfs"))
{
//ZFS subvolumes
uint32_t index = ffStrbufFirstIndexC(&currentDisk->mountFrom, '/');
if (index == currentDisk->mountFrom.length)
return false;
FF_STRBUF_AUTO_DESTROY zpoolName = ffStrbufCreateNS(index, currentDisk->mountFrom.chars);
for(uint32_t i = 0; i < disks->length - 1; i++)
{
const FFDisk* otherDevice = ffListGet(disks, i);
if(ffStrbufEqualS(&otherDevice->filesystem, "zfs") && ffStrbufStartsWith(&otherDevice->mountFrom, &zpoolName))
return true;
}
return false;
}
else
{
//Filter all disks which device was already found. This catches BTRFS subvolumes.
for(uint32_t i = 0; i < disks->length - 1; i++)
{
const FFDisk* otherDevice = ffListGet(disks, i);
if(ffStrbufEqual(&currentDisk->mountFrom, &otherDevice->mountFrom))
return true;
}
}
return false;
}
static void detectType(const FFlist* disks, FFDisk* currentDisk, struct mnttab* device)
{
if(ffStrContains(device->mnt_mntopts, MNTOPT_NOBROWSE))
currentDisk->type = FF_DISK_VOLUME_TYPE_HIDDEN_BIT;
else if(isSubvolume(disks, currentDisk))
currentDisk->type = FF_DISK_VOLUME_TYPE_SUBVOLUME_BIT;
else
currentDisk->type = FF_DISK_VOLUME_TYPE_REGULAR_BIT;
}
static void detectStats(FFDisk* disk)
{
struct statvfs fs;
if(statvfs(disk->mountpoint.chars, &fs) != 0)
memset(&fs, 0, sizeof(struct statvfs));
disk->bytesTotal = fs.f_blocks * fs.f_frsize;
disk->bytesFree = fs.f_bfree * fs.f_frsize;
disk->bytesAvailable = fs.f_bavail * fs.f_frsize;
disk->bytesUsed = 0; // To be filled in ./disk.c
disk->filesTotal = (uint32_t) fs.f_files;
disk->filesUsed = (uint32_t) (disk->filesTotal - fs.f_ffree);
if(fs.f_flag & ST_RDONLY)
disk->type |= FF_DISK_VOLUME_TYPE_READONLY_BIT;
ffStrbufSetS(&disk->name, fs.f_fstr);
disk->createTime = 0;
struct stat deviceStat;
if(stat(disk->mountpoint.chars, &deviceStat) == 0)
disk->createTime = (uint64_t) deviceStat.st_ctim.tv_sec * 1000 + (uint64_t) deviceStat.st_ctim.tv_nsec / 1000000000;
}
const char* ffDetectDisksImpl(FFDiskOptions* options, FFlist* disks)
{
FF_AUTO_CLOSE_FILE FILE* mountsFile = fopen(MNTTAB, "r");
if(mountsFile == NULL)
return "fopen(\"" MNTTAB "\", \"r\") == NULL";
struct mnttab device;
while (getmntent(mountsFile, &device) == 0)
{
if (__builtin_expect(options->folders.length, 0))
{
if (!ffDiskMatchMountpoint(options, device.mnt_mountp))
continue;
}
else if(!isPhysicalDevice(&device))
continue;
//We have a valid device, add it to the list
FFDisk* disk = ffListAdd(disks);
disk->type = FF_DISK_VOLUME_TYPE_NONE;
ffStrbufInitS(&disk->mountFrom, device.mnt_special);
ffStrbufInitS(&disk->mountpoint, device.mnt_mountp);
ffStrbufInitS(&disk->filesystem, device.mnt_fstype);
ffStrbufInit(&disk->name);
detectType(disks, disk, &device);
detectStats(disk);
}
return NULL;
}
+6
View File
@@ -0,0 +1,6 @@
#include "diskio.h"
const char* ffDiskIOGetIoCounters(FFlist* result, FFDiskIOOptions* options)
{
return "Not supported on this platform";
}
+39
View File
@@ -0,0 +1,39 @@
#include "diskio.h"
#include "util/stringUtils.h"
#include <kstat.h>
static inline void kstatFreeWrap(kstat_ctl_t** pkc)
{
assert(pkc);
if (*pkc)
kstat_close(*pkc);
}
const char* ffDiskIOGetIoCounters(FFlist* result, FFDiskIOOptions* options)
{
__attribute__((__cleanup__(kstatFreeWrap))) kstat_ctl_t* kc = kstat_open();
if (!kc)
return "kstat_open() failed";
for (kstat_t* ks = kc->kc_chain; ks; ks = ks->ks_next)
{
if (ks->ks_type != KSTAT_TYPE_IO || !ffStrEquals(ks->ks_class, "disk")) continue;
if (options->namePrefix.length && strncmp(ks->ks_name, options->namePrefix.chars, options->namePrefix.length) != 0)
continue;
kstat_io_t kio;
if (kstat_read(kc, ks, &kio) < 0)
continue;
FFDiskIOResult* device = (FFDiskIOResult*) ffListAdd(result);
ffStrbufInitS(&device->devPath, ks->ks_name);
device->bytesRead = kio.nread;
device->readCount = kio.reads;
device->bytesWritten = kio.nwritten;
device->writeCount = kio.writes;
ffStrbufInitS(&device->name, ks->ks_name);
}
return NULL;
}
+1 -1
View File
@@ -9,7 +9,7 @@
#define FF_DE_PRETTY_CINNAMON "Cinnamon"
#define FF_DE_PRETTY_MATE "Mate"
#define FF_DE_PRETTY_LXDE "LXDE"
#define FF_DE_PRETTY_LXQT "LXQT"
#define FF_DE_PRETTY_LXQT "LXQt"
#define FF_DE_PRETTY_BUDGIE "Budgie"
#define FF_DE_PRETTY_CDE "CDE"
#define FF_DE_PRETTY_UNITY "Unity"
+4
View File
@@ -3,6 +3,7 @@
#include "util/edidHelper.h"
#include "util/stringUtils.h"
#ifdef __linux__
#include <dirent.h>
static const char* drmParseSysfs(FFDisplayServerResult* result)
@@ -85,6 +86,7 @@ static const char* drmParseSysfs(FFDisplayServerResult* result)
return NULL;
}
#endif
#ifdef FF_HAVE_DRM
@@ -369,5 +371,7 @@ void ffdsConnectDrm(FFDisplayServerResult* result)
}
#endif
#ifdef __linux__
drmParseSysfs(result);
#endif
}
@@ -23,7 +23,6 @@ static void waylandDetectWM(int fd, FFDisplayServerResult* result)
FF_STRBUF_AUTO_DESTROY procPath = ffStrbufCreate();
ffStrbufAppendF(&procPath, "/proc/%d/cmdline", ucred.pid); //We check the cmdline for the process name, because it is not trimmed.
ffReadFileBuffer(procPath.chars, &result->wmProcessName);
ffStrbufTrimRightSpace(&result->wmProcessName);
ffStrbufSubstrBeforeFirstC(&result->wmProcessName, '\0'); //Trim the arguments
ffStrbufSubstrAfterLastC(&result->wmProcessName, '/'); //Trim the path
}
+43 -8
View File
@@ -1,4 +1,5 @@
#include "displayserver_linux.h"
#include "common/io/io.h"
#include "common/properties.h"
#include "util/stringUtils.h"
#include "util/mallocHelper.h"
@@ -11,8 +12,8 @@
#include <sys/sysctl.h>
#include <sys/types.h>
#include <sys/user.h>
#else
#include "common/io/io.h"
#elif defined(__sun)
#include <procfs.h>
#endif
static const char* parseEnv(void)
@@ -70,11 +71,8 @@ static void applyPrettyNameIfWM(FFDisplayServerResult* result, const char* name)
return;
if(
ffStrEqualsIgnCase(name, "kwin_wayland") ||
ffStrEqualsIgnCase(name, "kwin_wayland_wrapper") ||
ffStrEqualsIgnCase(name, "kwin_x11") ||
ffStrEqualsIgnCase(name, "kwin_x11_wrapper") ||
ffStrEqualsIgnCase(name, "kwin") ||
ffStrStartsWithIgnCase(name, "kwin_") ||
ffStrEndsWithIgnCase(name, "-kwin_wayland") ||
ffStrEndsWithIgnCase(name, "-kwin_x11")
) ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_KWIN);
@@ -85,7 +83,8 @@ static void applyPrettyNameIfWM(FFDisplayServerResult* result, const char* name)
ffStrEqualsIgnCase(name, "Mutter")
) ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_MUTTER);
else if(
ffStrEqualsIgnCase(name, "cinnamon-session") ||
ffStrEqualsIgnCase(name, "cinnamon") ||
ffStrStartsWithIgnCase(name, "cinnamon-") ||
ffStrEqualsIgnCase(name, "Muffin") ||
ffStrEqualsIgnCase(name, "Mutter (Muffin)")
) ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_MUFFIN);
@@ -206,7 +205,7 @@ static void applyPrettyNameIfDE(FFDisplayServerResult* result, const char* name)
else if(
ffStrEqualsIgnCase(name, "LXQt") ||
ffStrEqualsIgnCase(name, "X-LXQT") ||
ffStrEqualsIgnCase(name, "X-LXQt") ||
ffStrEqualsIgnCase(name, "lxqt-session")
) {
ffStrbufSetS(&result->deProcessName, "lxqt-session");
@@ -302,6 +301,42 @@ static const char* getFromProcesses(FFDisplayServerResult* result)
if(result->dePrettyName.length > 0 && result->wmPrettyName.length > 0)
break;
}
#elif defined(__sun)
FF_AUTO_CLOSE_DIR DIR* procdir = opendir("/proc");
if(procdir == NULL)
return "opendir(\"/proc\") failed";
FF_STRBUF_AUTO_DESTROY procPath = ffStrbufCreateA(64);
ffStrbufAppendS(&procPath, "/proc/");
uint32_t procPathLength = procPath.length;
struct dirent* dirent;
while((dirent = readdir(procdir)) != NULL)
{
if (!ffCharIsDigit(dirent->d_name[0]))
continue;
ffStrbufAppendS(&procPath, dirent->d_name);
ffStrbufAppendS(&procPath, "/psinfo");
psinfo_t proc;
if (ffReadFileData(procPath.chars, sizeof(proc), &proc) == sizeof(proc))
{
ffStrbufSubstrBefore(&procPath, procPathLength);
if (proc.pr_uid != userId)
continue;
if(result->dePrettyName.length == 0)
applyPrettyNameIfDE(result, proc.pr_fname);
if(result->wmPrettyName.length == 0)
applyNameIfWM(result, proc.pr_fname);
if(result->dePrettyName.length > 0 && result->wmPrettyName.length > 0)
break;
}
}
#else
FF_AUTO_CLOSE_DIR DIR* procdir = opendir("/proc");
if(procdir == NULL)
+5
View File
@@ -0,0 +1,5 @@
#pragma once
#include "fastfetch.h"
const char* ffDetectDNS(FFDNSOptions* options, FFlist* results /* list of FFstrbuf */);
+35
View File
@@ -0,0 +1,35 @@
#include "detection/dns/dns.h"
#include "common/io/io.h"
#include "util/mallocHelper.h"
#include "util/stringUtils.h"
const char* ffDetectDNS(FFDNSOptions* options, FFlist* results)
{
FF_AUTO_CLOSE_FILE FILE* file = fopen(FASTFETCH_TARGET_DIR_ROOT "/etc/resolv.conf", "r");
if (!file)
return "fopen (" FASTFETCH_TARGET_DIR_ROOT "/etc/resolv.conf) failed";
FF_AUTO_FREE char* line = NULL;
size_t len = 0;
while (getline(&line, &len, file) != -1)
{
if (ffStrStartsWith(line, "nameserver"))
{
const char* nameserver = line + strlen("nameserver");
while (*nameserver == ' ' || *nameserver == '\t')
nameserver++;
if (*nameserver == '\0') continue;
if ((ffStrContainsC(nameserver, ':') && !(options->showType & FF_DNS_TYPE_IPV6_BIT)) ||
(ffStrContainsC(nameserver, '.') && !(options->showType & FF_DNS_TYPE_IPV4_BIT)))
continue;
FFstrbuf* item = (FFstrbuf*) ffListAdd(results);
ffStrbufInitS(item, nameserver);
ffStrbufTrimRightSpace(item);
}
}
return NULL;
}
+67
View File
@@ -0,0 +1,67 @@
#include "detection/dns/dns.h"
#include "common/netif/netif.h"
#include "util/mallocHelper.h"
#include <ws2tcpip.h>
#include <iphlpapi.h>
const char* ffDetectDNS(FFDNSOptions* options, FFlist* results)
{
IP_ADAPTER_ADDRESSES* FF_AUTO_FREE adapter_addresses = NULL;
// Multiple attempts in case interfaces change while
// we are in the middle of querying them.
DWORD adapter_addresses_buffer_size = 0;
for (int attempts = 0;; ++attempts)
{
if (adapter_addresses_buffer_size)
{
adapter_addresses = (IP_ADAPTER_ADDRESSES*)realloc(adapter_addresses, adapter_addresses_buffer_size);
assert(adapter_addresses);
}
DWORD error = GetAdaptersAddresses(
options->showType & FF_DNS_TYPE_IPV4_BIT
? options->showType & FF_DNS_TYPE_IPV6_BIT ? AF_UNSPEC : AF_INET
: AF_INET6,
GAA_FLAG_SKIP_UNICAST | GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_FRIENDLY_NAME,
NULL,
adapter_addresses,
&adapter_addresses_buffer_size);
if (error == ERROR_SUCCESS)
break;
else if (ERROR_BUFFER_OVERFLOW == error && attempts < 4)
continue;
else
return "GetAdaptersAddresses() failed";
}
uint32_t defaultRouteIfIndex = ffNetifGetDefaultRouteIfIndex();
// Iterate through all of the adapters
for (IP_ADAPTER_ADDRESSES* adapter = adapter_addresses; adapter; adapter = adapter->Next)
{
if (adapter->IfIndex != defaultRouteIfIndex) continue;
if (adapter->OperStatus != IfOperStatusUp) continue;
for (IP_ADAPTER_DNS_SERVER_ADDRESS_XP * ifa = adapter->FirstDnsServerAddress; ifa; ifa = ifa->Next)
{
FFstrbuf* item = (FFstrbuf*) ffListAdd(results);
if (ifa->Address.lpSockaddr->sa_family == AF_INET)
{
SOCKADDR_IN* ipv4 = (SOCKADDR_IN*) ifa->Address.lpSockaddr;
ffStrbufInitA(item, INET_ADDRSTRLEN);
inet_ntop(AF_INET, &ipv4->sin_addr, item->chars, item->allocated);
}
else if (ifa->Address.lpSockaddr->sa_family == AF_INET6)
{
SOCKADDR_IN6* ipv6 = (SOCKADDR_IN6*) ifa->Address.lpSockaddr;
ffStrbufInitA(item, INET6_ADDRSTRLEN);
inet_ntop(AF_INET6, &ipv6->sin6_addr, item->chars, item->allocated);
}
ffStrbufRecalculateLength(item);
}
break;
}
return NULL;
}
+3
View File
@@ -26,6 +26,8 @@ const char* ffDetectEditor(FFEditorResult* result)
return "$VISUAL or $EDITOR not set";
}
if (!instance.config.display.tsVersion) return NULL;
#ifndef _WIN32
if (result->name.chars[0] != '/')
{
@@ -90,6 +92,7 @@ const char* ffDetectEditor(FFEditorResult* result)
ffStrbufStartsWithS(&result->exe, "emacs-") || // emacs-29.3
ffStrbufEqualS(&result->exe, "hx") ||
ffStrbufEqualS(&result->exe, "code") ||
ffStrbufEqualS(&result->exe, "pluma") ||
ffStrbufEqualS(&result->exe, "sublime_text")
) param = "--version";
else if (
+1 -1
View File
@@ -7,7 +7,7 @@
typedef struct FFFontResult
{
/**
* Linux / BSD: QT, GTK2, GTK3, GTK4
* Linux / BSD: Qt, GTK2, GTK3, GTK4
* MacOS: System, User, System Mono, User Mono
* Windows: Caption, Menu, Message, Status
* Other: Unset, Unset, Unset, Unset
+1 -1
View File
@@ -9,7 +9,7 @@ static void generateString(FFFontResult* font)
if(font->fonts[0].length > 0)
{
ffStrbufAppend(&font->display, &font->fonts[0]);
ffStrbufAppendS(&font->display, " [QT]");
ffStrbufAppendS(&font->display, " [Qt]");
for(uint8_t i = 1; i < sizeof(font->fonts) / sizeof(font->fonts[0]); i++)
{
+11
View File
@@ -1,5 +1,6 @@
#include "gpu.h"
#include "detection/vulkan/vulkan.h"
#include "detection/opencl/opencl.h"
#include "detection/opengl/opengl.h"
const char* FF_GPU_VENDOR_NAME_APPLE = "Apple";
@@ -94,6 +95,16 @@ const char* ffDetectGPU(const FFGPUOptions* options, FFlist* result)
return NULL;
}
}
if (options->detectionMethod <= FF_GPU_DETECTION_METHOD_OPENCL)
{
FFOpenCLResult* opencl = ffDetectOpenCL();
if (!opencl->error && opencl->gpus.length > 0)
{
ffListDestroy(result);
ffListInitMove(result, &opencl->gpus);
return NULL;
}
}
if (options->detectionMethod <= FF_GPU_DETECTION_METHOD_OPENGL)
{
if (detectByOpenGL(result) == NULL)
+1 -1
View File
@@ -43,6 +43,6 @@ const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus);
const char* ffGetGPUVendorString(unsigned vendorId);
#if defined(__linux__) || defined(__FreeBSD__)
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun)
void ffGPUParsePciIds(FFstrbuf* content, uint8_t subclass, uint16_t vendor, uint16_t device, FFGPUResult* gpu);
#endif
+4 -2
View File
@@ -19,13 +19,12 @@ const char* ffDetectAmdGpuInfo(const FFGpuDriverCondition* cond, FFGpuDriverResu
inited = true;
FF_LIBRARY_LOAD(libags, NULL, "dlopen amd_ags failed", soName , 1);
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libags, agsInitialize)
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libags, agsDeInitialize)
struct AGSContext* apiHandle;
if (ffagsInitialize(AGS_CURRENT_VERSION, NULL, &apiHandle, &gpuInfo) != AGS_SUCCESS)
return "loading ags library failed";
ffagsDeInitialize(apiHandle);
// agsDeInitialize will free pointers allocated in gpuInfo. Just leak them.
}
if (gpuInfo.numDevices == 0)
@@ -63,5 +62,8 @@ const char* ffDetectAmdGpuInfo(const FFGpuDriverCondition* cond, FFGpuDriverResu
if (result.frequency)
*result.frequency = device->coreClock / 1000.; // Maximum frequency
if (result.type)
*result.type = device->isAPU ? FF_GPU_TYPE_INTEGRATED : FF_GPU_TYPE_DISCRETE;
return NULL;
}
-2
View File
@@ -76,7 +76,6 @@ const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus)
ffGPUParsePciIds(&pciids, pc->pc_subclass, pc->pc_vendor, pc->pc_device, gpu);
}
#ifdef FF_USE_PROPRIETARY_GPU_DRIVER_API
if (gpu->vendor.chars == FF_GPU_VENDOR_NAME_NVIDIA && (options->temp || options->driverSpecific))
{
ffDetectNvidiaGpuInfo(&(FFGpuDriverCondition) {
@@ -98,7 +97,6 @@ const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus)
if (gpu->dedicated.total != FF_GPU_VMEM_SIZE_UNSET)
gpu->type = gpu->dedicated.total > (uint64_t)1024 * 1024 * 1024 ? FF_GPU_TYPE_DISCRETE : FF_GPU_TYPE_INTEGRATED;
}
#endif // FF_USE_PROPRIETARY_GPU_DRIVER_API
}
return NULL;
+2 -7
View File
@@ -2,14 +2,11 @@
#include "detection/vulkan/vulkan.h"
#include "detection/temps/temps_linux.h"
#include "detection/cpu/cpu.h"
#include "detection/gpu/gpu_driver_specific.h"
#include "common/io/io.h"
#include "common/properties.h"
#include "util/stringUtils.h"
#ifdef FF_USE_PROPRIETARY_GPU_DRIVER_API
#include "detection/gpu/gpu_driver_specific.h"
#endif
#define FF_STR_INDIR(x) #x
#define FF_STR(x) FF_STR_INDIR(x)
@@ -261,7 +258,6 @@ static const char* detectPci(const FFGPUOptions* options, FFlist* gpus, FFstrbuf
}
else if (gpu->vendor.chars == FF_GPU_VENDOR_NAME_NVIDIA)
{
#ifdef FF_USE_PROPRIETARY_GPU_DRIVER_API
if (options->temp || options->driverSpecific)
{
ffDetectNvidiaGpuInfo(&(FFGpuDriverCondition) {
@@ -277,10 +273,9 @@ static const char* detectPci(const FFGPUOptions* options, FFlist* gpus, FFstrbuf
.memory = options->driverSpecific ? &gpu->dedicated : NULL,
.coreCount = options->driverSpecific ? (uint32_t*) &gpu->coreCount : NULL,
.type = &gpu->type,
.frequency = &gpu->frequency,
.frequency = options->driverSpecific ? &gpu->frequency : NULL,
}, "libnvidia-ml.so");
}
#endif // FF_USE_PROPRIETARY_GPU_DRIVER_API
if (gpu->type == FF_GPU_TYPE_UNKNOWN)
{
+83
View File
@@ -0,0 +1,83 @@
#include "gpu.h"
#include "common/properties.h"
#include "common/io/io.h"
#include "common/processing.h"
const char* ffDetectGPUImpl(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist* gpus)
{
// SunOS requires root permission to query PCI device list, except `/usr/bin/scanpci`
// Same behavior can be observed with `cp $(which scanpci) /tmp/ && /tmp/scanpci`
FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreate();
const char* error = ffProcessAppendStdOut(&buffer, (char* const[]) {
"scanpci",
"-v",
NULL,
});
if (error)
return error;
if (!ffStrbufStartsWithS(&buffer, "\npci "))
return "Invalid scanpci result";
FF_STRBUF_AUTO_DESTROY pciids = ffStrbufCreate();
// pci bus 0x0000 cardnum 0x00 function 0x00: vendor 0x1414 device 0x008e
// Device unknown
// CardVendor 0x0000 card 0x0000 (Card unknown)
// STATUS 0x0010 COMMAND 0x0007
// CLASS 0x03 0x02 0x00 REVISION 0x00
// BIST 0x00 HEADER 0x00 LATENCY 0x00 CACHE 0x00
// MAX_LAT 0x00 MIN_GNT 0x00 INT_PIN 0x00 INT_LINE 0x00
for (
const char* pclass = strstr(buffer.chars, "\n CLASS 0x03 ");
pclass;
pclass = strstr(pclass, "\n CLASS 0x03 ")
)
{
// find the start of device entry
const char* pstart = memrchr(buffer.chars, '\n', (size_t) (pclass - buffer.chars));
while (pstart[1] != 'p')
pstart = memrchr(buffer.chars, '\n', (size_t) (pstart - buffer.chars - 1));
++pstart;
uint32_t vendorId, deviceId;
if (sscanf(pstart, "pci %*[^:]: vendor %x device %x",
&vendorId, &deviceId) != 2)
return "PCI info not found, invalid scanpci result";
pclass += strlen("\n CLASS 0x03 ");
uint32_t subclass = (uint32_t) strtoul(pclass, NULL, 16);
pclass += strlen("0x02 0x00 REVISION ");
uint32_t revision = (uint32_t) strtoul(pclass, NULL, 16);
FFGPUResult* gpu = (FFGPUResult*)ffListAdd(gpus);
ffStrbufInitStatic(&gpu->vendor, ffGetGPUVendorString(vendorId));
ffStrbufInit(&gpu->name);
ffStrbufInit(&gpu->driver);
ffStrbufInit(&gpu->platformApi);
gpu->temperature = FF_GPU_TEMP_UNSET;
gpu->coreCount = FF_GPU_CORE_COUNT_UNSET;
gpu->type = FF_GPU_TYPE_UNKNOWN;
gpu->dedicated.total = gpu->dedicated.used = gpu->shared.total = gpu->shared.used = FF_GPU_VMEM_SIZE_UNSET;
gpu->deviceId = 0;
gpu->frequency = FF_GPU_FREQUENCY_UNSET;
if (gpu->vendor.chars == FF_GPU_VENDOR_NAME_AMD)
{
char query[32];
snprintf(query, sizeof(query), "%X,\t%X,", (unsigned) deviceId, (unsigned) revision);
ffParsePropFileData("libdrm/amdgpu.ids", query, &gpu->name);
}
if (gpu->name.length == 0)
{
if (pciids.length == 0)
ffReadFileBuffer(FASTFETCH_TARGET_DIR_ROOT "/usr/share/hwdata/pci.ids", &pciids);
ffGPUParsePciIds(&pciids, (uint8_t) subclass, (uint16_t) vendorId, (uint16_t) deviceId, gpu);
}
}
return NULL;
}
+3 -10
View File
@@ -1,11 +1,8 @@
#include "gpu.h"
#include "detection/gpu/gpu_driver_specific.h"
#include "util/windows/unicode.h"
#include "util/windows/registry.h"
#ifdef FF_USE_PROPRIETARY_GPU_DRIVER_API
#include "detection/gpu/gpu_driver_specific.h"
#endif
#include <inttypes.h>
static int isGpuNameEqual(const FFGPUResult* gpu, const FFstrbuf* name)
@@ -13,7 +10,6 @@ static int isGpuNameEqual(const FFGPUResult* gpu, const FFstrbuf* name)
return ffStrbufEqual(&gpu->name, name);
}
#ifdef FF_USE_PROPRIETARY_GPU_DRIVER_API
static inline bool getDriverSpecificDetectionFn(const char* vendor, __typeof__(&ffDetectNvidiaGpuInfo)* pDetectFn, const char** pDllName)
{
if (vendor == FF_GPU_VENDOR_NAME_NVIDIA)
@@ -48,7 +44,6 @@ static inline bool getDriverSpecificDetectionFn(const char* vendor, __typeof__(&
return true;
}
#endif // FF_USE_PROPRIETARY_GPU_DRIVER_API
const char* ffDetectGPUImpl(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist* gpus)
{
@@ -144,13 +139,12 @@ const char* ffDetectGPUImpl(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist*
}
}
#ifdef FF_USE_PROPRIETARY_GPU_DRIVER_API
__typeof__(&ffDetectNvidiaGpuInfo) detectFn;
const char* dllName;
if (getDriverSpecificDetectionFn(gpu->vendor.chars, &detectFn, &dllName) && (options->temp || options->driverSpecific))
{
if (vendorId && deviceId && subSystemId && revId)
if (vendorId && deviceId && subSystemId)
{
detectFn(
&(FFGpuDriverCondition) {
@@ -168,13 +162,12 @@ const char* ffDetectGPUImpl(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist*
.memory = options->driverSpecific ? &gpu->dedicated : NULL,
.coreCount = options->driverSpecific ? (uint32_t*) &gpu->coreCount : NULL,
.type = &gpu->type,
.frequency = &gpu->frequency,
.frequency = options->driverSpecific ? &gpu->frequency : NULL,
},
dllName
);
}
}
#endif // FF_USE_PROPRIETARY_GPU_DRIVER_API
}
return NULL;
+1 -3
View File
@@ -104,7 +104,6 @@ const char* ffGPUDetectByDirectX(FF_MAYBE_UNUSED const FFGPUOptions* options, FF
const char* vendorStr = ffGetGPUVendorString((unsigned) hardwareId.vendorID);
ffStrbufSetStatic(&gpu->vendor, vendorStr);
#ifdef FF_USE_PROPRIETARY_GPU_DRIVER_API
if (vendorStr == FF_GPU_VENDOR_NAME_NVIDIA && (options->driverSpecific || options->temp))
{
FFGpuDriverCondition cond = {
@@ -121,10 +120,9 @@ const char* ffGPUDetectByDirectX(FF_MAYBE_UNUSED const FFGPUOptions* options, FF
.memory = options->driverSpecific ? &gpu->dedicated : NULL,
.coreCount = options->driverSpecific ? (uint32_t*) &gpu->coreCount : NULL,
.type = &gpu->type,
.frequency = &gpu->frequency,
.frequency = options->driverSpecific ? &gpu->frequency : NULL,
}, "/usr/lib/wsl/lib/libnvidia-ml.so");
}
#endif
}
}
+2 -1
View File
@@ -52,7 +52,8 @@ typedef struct {
// Allocated device memory (in bytes)
unsigned long long used;
} nvmlMemory_v2_t;
enum { nvmlMemory_v2 = 2 };
// https://github.com/NVIDIA/nvidia-settings/issues/78#issuecomment-1012837988
enum { nvmlMemory_v2 = (unsigned int)(sizeof(nvmlMemory_v2_t) | (2 << 24U)) };
// https://docs.nvidia.com/deploy/nvml-api/group__nvmlDeviceEnumvs.html#group__nvmlDeviceEnumvs_1g805c0647be9996589fc5e3f6ff680c64
// Clock types
+37
View File
@@ -135,6 +135,34 @@ static void detectLXQt(FFQtResult* result)
ffParsePropFileConfig("pcmanfm-qt/lxqt/settings.conf", "Wallpaper=", &result->wallpaper);
}
static void detectQtCt(char qver, FFQtResult* result)
{
// qt5ct and qt6ct are technically separate applications, but they're both
// by the same author and qt6ct understands qt5ct in qt6 applications as well.
char file[] = "qtXct/qtXct.conf";
file[2] = file[8] = qver;
ffParsePropFileConfigValues(file, 3, (FFpropquery[]) {
{"style=", &result->widgetStyle},
{"icon_theme=", &result->icons},
{"general=", &result->font}
});
if (ffStrbufStartsWithC(&result->font, '@'))
{
// See QVariant notes on https://doc.qt.io/qt-5/qsettings.html and
// https://github.com/fastfetch-cli/fastfetch/issues/1053#issuecomment-2197254769
// Thankfully, newer versions use the more common font encoding.
ffStrbufSetNS(&result->font, 5, file);
}
}
static void detectKvantum(FFQtResult* result)
{
ffParsePropFileConfigValues("Kvantum/kvantum.kvconfig", 1, (FFpropquery[]) {
{"theme=", &result->widgetStyle},
});
}
const FFQtResult* ffDetectQt(void)
{
static FFQtResult result;
@@ -151,11 +179,20 @@ const FFQtResult* ffDetectQt(void)
ffStrbufInit(&result.wallpaper);
const FFDisplayServerResult* wmde = ffConnectDisplayServer();
const char *qplatformtheme = getenv("QT_QPA_PLATFORMTHEME");
if(ffStrbufIgnCaseEqualS(&wmde->dePrettyName, FF_DE_PRETTY_PLASMA))
detectPlasma(&result);
else if(ffStrbufIgnCaseEqualS(&wmde->dePrettyName, FF_DE_PRETTY_LXQT))
detectLXQt(&result);
else if(ffStrSet(qplatformtheme) && (ffStrEquals(qplatformtheme, "qt5ct") || ffStrEquals(qplatformtheme, "qt6ct")))
detectQtCt(qplatformtheme[2], &result);
if(ffStrbufEqualS(&result.widgetStyle, "kvantum") || ffStrbufEqualS(&result.widgetStyle, "kvantum-dark"))
{
ffStrbufClear(&result.widgetStyle);
detectKvantum(&result);
}
return &result;
}
+6
View File
@@ -0,0 +1,6 @@
#include "host.h"
const char* ffDetectHost(FFHostResult* host)
{
return "Not supported on this platform";
}
+1 -1
View File
@@ -23,7 +23,7 @@ const char* ffDetectIcons(FFIconsResult* result)
if(plasma->length > 0)
{
ffStrbufAppend(&result->icons1, plasma);
ffStrbufAppendS(&result->icons1, " [QT]");
ffStrbufAppendS(&result->icons1, " [Qt]");
}
return NULL;
+8
View File
@@ -0,0 +1,8 @@
#include "libc.h"
const char* ffDetectLibc(FFLibcResult* result)
{
result->name = "Unknown";
result->version = NULL;
return NULL;
}
+4 -5
View File
@@ -6,7 +6,7 @@
#include <unistd.h>
#define FF_SYSTEMD_SESSIONS_PATH "/var/run/systemd/sessions/"
#define FF_SYSTEMD_SESSIONS_PATH "/run/systemd/sessions/"
#define FF_SYSTEMD_USERS_PATH "/run/systemd/users/"
static const char* getGdmVersion(FFstrbuf* version)
@@ -143,7 +143,7 @@ const char* ffDetectLM(FFLMResult* result)
{
// On some incorrectly configured systems, $XDG_SESSION_ID is not set. Try finding it ourself
// WARNING: This is private data. Do not parse
ffStrbufAppendF(&path, "/run/systemd/users/%d", getuid());
ffStrbufSetF(&path, FF_SYSTEMD_USERS_PATH "%d", getuid());
// This is actually buggy, and assumes current user is using DE
// `sd_pid_get_session` can be a better option, but we need to find a pid to use
@@ -151,10 +151,9 @@ const char* ffDetectLM(FFLMResult* result)
{"DISPLAY=", &sessionId},
}))
return "Failed to get $XDG_SESSION_ID";
ffStrbufClear(&path);
}
ffStrbufAppendS(&path, "/var/run/systemd/sessions/");
ffStrbufSetS(&path, FF_SYSTEMD_SESSIONS_PATH);
ffStrbufAppend(&path, &sessionId);
// WARNING: This is private data. Do not parse
@@ -162,7 +161,7 @@ const char* ffDetectLM(FFLMResult* result)
{"SERVICE=", &result->service},
{"TYPE=", &result->type},
}))
return "Failed to parse /run/systemd/sessions/$XDG_SESSION_ID";
return "Failed to parse " FF_SYSTEMD_SESSIONS_PATH "$XDG_SESSION_ID";
if (ffStrbufStartsWithS(&result->service, "gdm"))
getGdmVersion(&result->version);
+8
View File
@@ -0,0 +1,8 @@
#include "detection/loadavg/loadavg.h"
#include <sys/loadavg.h>
const char* ffDetectLoadavg(double result[3])
{
return getloadavg(result, 3) == 3 ? NULL : "getloadavg() failed";
}
+1
View File
@@ -8,6 +8,7 @@ typedef struct FFLocalIpResult
FFstrbuf ipv4;
FFstrbuf ipv6;
FFstrbuf mac;
int32_t mtu;
bool defaultRoute;
} FFLocalIpResult;
+30 -4
View File
@@ -10,12 +10,16 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <sys/ioctl.h>
#if defined(__FreeBSD__) || defined(__APPLE__)
#include <net/if_dl.h>
#else
#include <netpacket/packet.h>
#endif
#ifdef __sun
#include <sys/sockio.h>
#endif
static void addNewIp(FFlist* list, const char* name, const char* addr, int type, bool defaultRoute, bool firstOnly)
{
@@ -35,6 +39,7 @@ static void addNewIp(FFlist* list, const char* name, const char* addr, int type,
ffStrbufInit(&ip->ipv6);
ffStrbufInit(&ip->mac);
ip->defaultRoute = defaultRoute;
ip->mtu = -1;
}
switch (type)
@@ -90,7 +95,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
continue;
struct sockaddr_in* ipv4 = (struct sockaddr_in*) ifa->ifa_addr;
char addressBuffer[INET_ADDRSTRLEN + 4];
char addressBuffer[INET_ADDRSTRLEN + 16];
inet_ntop(AF_INET, &ipv4->sin_addr, addressBuffer, INET_ADDRSTRLEN);
if (options->showType & FF_LOCALIP_TYPE_PREFIX_LEN_BIT)
@@ -100,7 +105,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
if (cidr != 0)
{
size_t len = strlen(addressBuffer);
snprintf(addressBuffer + len, 4, "/%d", cidr);
snprintf(addressBuffer + len, 16, "/%d", cidr);
}
}
@@ -112,7 +117,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
continue;
struct sockaddr_in6* ipv6 = (struct sockaddr_in6 *)ifa->ifa_addr;
char addressBuffer[INET6_ADDRSTRLEN + 4];
char addressBuffer[INET6_ADDRSTRLEN + 16];
inet_ntop(AF_INET6, &ipv6->sin6_addr, addressBuffer, INET6_ADDRSTRLEN);
if (options->showType & FF_LOCALIP_TYPE_PREFIX_LEN_BIT)
@@ -125,7 +130,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
if (cidr != 0)
{
size_t len = strlen(addressBuffer);
snprintf(addressBuffer + len, 4, "/%d", cidr);
snprintf(addressBuffer + len, 16, "/%d", cidr);
}
}
@@ -160,5 +165,26 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
if (ifAddrStruct) freeifaddrs(ifAddrStruct);
FF_AUTO_CLOSE_FD int sockfd = socket(AF_INET, SOCK_DGRAM, 0);
if (sockfd > 0)
{
FF_LIST_FOR_EACH(FFLocalIpResult, iface, *results)
{
struct ifreq ifr;
strncpy(ifr.ifr_name, iface->name.chars, IFNAMSIZ - 1);
if (ioctl(sockfd, SIOCGIFMTU, &ifr) == 0)
iface->mtu = (int32_t) ifr.ifr_mtu;
#ifdef __sun
if ((options->showType & FF_LOCALIP_TYPE_MAC_BIT) && ioctl(sockfd, SIOCGIFHWADDR, &ifr) == 0)
{
const uint8_t* ptr = (uint8_t*) ifr.ifr_addr.sa_data; // NOT ifr_enaddr
ffStrbufSetF(&iface->mac, "%02x:%02x:%02x:%02x:%02x:%02x",
ptr[0], ptr[1], ptr[2], ptr[3], ptr[4], ptr[5]);
}
#endif
}
}
return NULL;
}
+5 -1
View File
@@ -18,10 +18,11 @@ static void addNewIp(FFlist* list, const char* name, const char* addr, int type,
ffStrbufInit(&ip->ipv6);
ffStrbufInit(&ip->mac);
ip->defaultRoute = defaultRoute;
ip->mtu = -1;
}
else
{
ip = ffListGet(list, list->length - 1);
ip = FF_LIST_GET(FFLocalIpResult, *list, list->length - 1);
}
switch (type)
@@ -147,6 +148,9 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
if (typesToAdd == 0) break;
}
}
if (!newIp)
FF_LIST_GET(FFLocalIpResult, *results, results->length - 1)->mtu = (int32_t) adapter->Mtu;
}
return NULL;
+4
View File
@@ -20,6 +20,10 @@ const FFMediaResult* ffDetectMedia(void)
if(result.song.length == 0 && result.error.length == 0)
ffStrbufAppendS(&result.error, "No media found");
ffStrbufTrimRightSpace(&result.song);
ffStrbufTrimRightSpace(&result.artist);
ffStrbufTrimRightSpace(&result.album);
ffStrbufTrimRightSpace(&result.player);
}
return &result;
+1 -1
View File
@@ -27,7 +27,7 @@ static const char* getMedia(FFMediaResult* result)
dispatch_group_enter(group);
MRMediaRemoteGetNowPlayingApplicationIsPlaying(queue, ^(BOOL playing) {
ffStrbufAppendS(&result->status, playing ? "Playing" : "Paused");
ffStrbufSetStatic(&result->status, playing ? "Playing" : "Paused");
dispatch_group_leave(group);
});
+38
View File
@@ -0,0 +1,38 @@
#include "common/library.h"
#include "util/windows/unicode.h"
#include "media.h"
#include "media_windows.dll.h"
static const char* getMedia(FFMediaResult* media)
{
FF_LIBRARY_LOAD(libffwinrt, NULL, "dlopen libffwinrt" FF_LIBRARY_EXTENSION " failed", "libffwinrt" FF_LIBRARY_EXTENSION, 0)
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libffwinrt, ffWinrtDetectMedia)
libffwinrt = NULL; // Don't close libffwinrt or it may crash
FFWinrtMediaResult result = {};
const char* error = ffffWinrtDetectMedia(&result);
if (error)
{
ffStrbufSetStatic(&media->error, error);
return NULL;
}
ffStrbufSetWS(&media->playerId, result.playerId);
ffStrbufSet(&media->player, &media->playerId);
if (ffStrbufEndsWithIgnCaseS(&media->player, ".exe"))
ffStrbufSubstrBefore(&media->player, media->player.length - 4);
else
ffStrbufSubstrAfterFirstC(&media->player, '!'); // UWP ID
ffStrbufSetWS(&media->song, result.song);
ffStrbufSetWS(&media->artist, result.artist);
ffStrbufSetWS(&media->album, result.album);
ffStrbufSetStatic(&media->status, result.status);
return NULL;
}
void ffDetectMediaImpl(FFMediaResult* media)
{
const char* error = getMedia(media);
ffStrbufAppendS(&media->error, error);
}
+60
View File
@@ -0,0 +1,60 @@
#include <winrt/Windows.Foundation.h>
#include <winrt/Windows.Media.Control.h>
#include <wchar.h>
extern "C"
{
#include "media_windows.dll.h"
const char* ffWinrtDetectMedia(FFWinrtMediaResult* result)
{
// C++/WinRT requires Windows 8.1+ and C++ runtime (std::string, exceptions and other stuff)
// Make it a separate dll in order not to break Windows 7 support
using namespace winrt::Windows::Media::Control;
try
{
auto manager = GlobalSystemMediaTransportControlsSessionManager::RequestAsync().get();
if (!manager)
return "winrt: GlobalSystemMediaTransportControlsSessionManager::RequestAsync() failed";
auto session = manager.GetCurrentSession();
if (!session)
return "winrt: GetCurrentSession() failed";
auto mediaProps = session
.TryGetMediaPropertiesAsync()
.get();
if (!mediaProps)
return "winrt: TryGetMediaPropertiesAsync() failed";
if (auto playbackInfo = session.GetPlaybackInfo())
{
switch (playbackInfo.PlaybackStatus())
{
#define FF_MEDIA_SET_STATUS(status_code) \
case GlobalSystemMediaTransportControlsSessionPlaybackStatus::status_code: result->status = #status_code; break
FF_MEDIA_SET_STATUS(Closed);
FF_MEDIA_SET_STATUS(Opened);
FF_MEDIA_SET_STATUS(Changing);
FF_MEDIA_SET_STATUS(Stopped);
FF_MEDIA_SET_STATUS(Playing);
FF_MEDIA_SET_STATUS(Paused);
#undef FF_MEDIA_SET_STATUS
}
}
::wcsncpy(result->playerId, session.SourceAppUserModelId().data(), FF_MEDIA_WIN_RESULT_BUFLEN);
::wcsncpy(result->song, mediaProps.Title().data(), FF_MEDIA_WIN_RESULT_BUFLEN);
::wcsncpy(result->artist, mediaProps.Artist().data(), FF_MEDIA_WIN_RESULT_BUFLEN);
::wcsncpy(result->album, mediaProps.AlbumTitle().data(), FF_MEDIA_WIN_RESULT_BUFLEN);
return NULL;
}
catch (...)
{
return "A C++ exception is thrown";
}
}
} // extern "C"
+15
View File
@@ -0,0 +1,15 @@
#pragma once
#define FF_MEDIA_WIN_RESULT_BUFLEN 256
typedef struct FFWinrtMediaResult
{
wchar_t playerId[FF_MEDIA_WIN_RESULT_BUFLEN];
wchar_t song[FF_MEDIA_WIN_RESULT_BUFLEN];
wchar_t artist[FF_MEDIA_WIN_RESULT_BUFLEN];
wchar_t album[FF_MEDIA_WIN_RESULT_BUFLEN];
const char* status;
} FFWinrtMediaResult;
__attribute__((__dllexport__))
const char* ffWinrtDetectMedia(FFWinrtMediaResult* result);
+1 -1
View File
@@ -25,7 +25,7 @@ const char* ffDetectMemory(FFMemoryResult* ram)
+ vmstat.compressor_page_count
- vmstat.purgeable_count
- vmstat.external_page_count
) * instance.state.platform.pageSize;
) * instance.state.platform.sysinfo.pageSize;
return NULL;
}
+1 -1
View File
@@ -12,7 +12,7 @@ const char* ffDetectMemory(FFMemoryResult* ram)
+ ffSysctlGetInt("vm.stats.vm.v_inactive_count", 0)
+ ffSysctlGetInt("vm.stats.vm.v_cache_count", 0);
ram->bytesUsed = ram->bytesTotal - (uint64_t) pagesFree * instance.state.platform.pageSize;
ram->bytesUsed = ram->bytesTotal - (uint64_t) pagesFree * instance.state.platform.sysinfo.pageSize;
return NULL;
}
+6
View File
@@ -0,0 +1,6 @@
#include "memory.h"
const char* ffDetectMemory(FFMemoryResult* ram)
{
return "Not supported on this platform";
}
+34
View File
@@ -0,0 +1,34 @@
#include "memory.h"
#include <kstat.h>
static inline void kstatFreeWrap(kstat_ctl_t** pkc)
{
assert(pkc);
if (*pkc)
kstat_close(*pkc);
}
const char* ffDetectMemory(FFMemoryResult* ram)
{
__attribute__((__cleanup__(kstatFreeWrap))) kstat_ctl_t* kc = kstat_open();
if (!kc)
return "kstat_open() failed";
kstat_t* ks = kstat_lookup(kc, "unix", -1, "system_pages");
if (!ks)
return "kstat_lookup() failed";
if (kstat_read(kc, ks, NULL) < 0)
return "kstat_read() failed";
{
kstat_named_t* kn = kstat_data_lookup(ks, "pagestotal");
ram->bytesTotal = kn->value.ui64 * instance.state.platform.sysinfo.pageSize;
}
{
kstat_named_t* kn = kstat_data_lookup(ks, "pagesfree");
ram->bytesUsed = ram->bytesTotal - kn->value.ui64 * instance.state.platform.sysinfo.pageSize;
}
return NULL;
}
+6
View File
@@ -0,0 +1,6 @@
#include "netio.h"
const char* ffNetIOGetIoCounters(FFlist* result, FFNetIOOptions* options)
{
return "Not supported on this platform";
}
+62
View File
@@ -0,0 +1,62 @@
#include "netio.h"
#include "common/netif/netif.h"
#include "util/stringUtils.h"
#include <kstat.h>
static inline void kstatFreeWrap(kstat_ctl_t** pkc)
{
assert(pkc);
if (*pkc)
kstat_close(*pkc);
}
const char* ffNetIOGetIoCounters(FFlist* result, FFNetIOOptions* options)
{
__attribute__((__cleanup__(kstatFreeWrap))) kstat_ctl_t* kc = kstat_open();
if (!kc)
return "kstat_open() failed";
const char* defaultRoute = ffNetifGetDefaultRouteIfName();
for (kstat_t* ks = kc->kc_chain; ks; ks = ks->ks_next)
{
if (!ffStrEquals(ks->ks_class, "net") || !ffStrEquals(ks->ks_module, "link")) continue;
if (options->namePrefix.length && strncmp(ks->ks_name, options->namePrefix.chars, options->namePrefix.length) != 0)
continue;
bool isDefaultRoute = ffStrEquals(ks->ks_name, defaultRoute);
if (options->defaultRouteOnly && !isDefaultRoute)
continue;
if (kstat_read(kc, ks, NULL) < 0)
continue;
FFNetIOResult* counters = (FFNetIOResult*) ffListAdd(result);
kstat_named_t* wbytes = (kstat_named_t*) kstat_data_lookup(ks, "obytes64");
kstat_named_t* rbytes = (kstat_named_t*) kstat_data_lookup(ks, "rbytes64");
kstat_named_t* wpkts = (kstat_named_t*) kstat_data_lookup(ks, "opackets64");
kstat_named_t* rpkts = (kstat_named_t*) kstat_data_lookup(ks, "ipackets64");
kstat_named_t* werrs = (kstat_named_t*) kstat_data_lookup(ks, "oerrors");
kstat_named_t* rerrs = (kstat_named_t*) kstat_data_lookup(ks, "ierrors");
*counters = (FFNetIOResult) {
.name = ffStrbufCreateS(ks->ks_name),
.txBytes = wbytes->value.ui64,
.rxBytes = rbytes->value.ui64,
.txPackets = wpkts->value.ui64,
.rxPackets = rpkts->value.ui64,
.txErrors = werrs->value.ui64,
.rxErrors = rerrs->value.ui64,
.txDrops = 0, // unsupported
.rxDrops = 0,
.defaultRoute = isDefaultRoute,
};
if (options->defaultRouteOnly)
break;
}
return NULL;
}
+137 -50
View File
@@ -1,21 +1,19 @@
#include "detection/opencl/opencl.h"
#include "detection/gpu/gpu.h"
#ifdef __APPLE__
#include <AvailabilityMacros.h>
#if (MAC_OS_X_VERSION_MIN_REQUIRED > 1050) && !defined(__ppc__)
#define MACOS_HAS_OPENCL
#endif
#if !defined(FF_HAVE_OPENCL) && defined(__APPLE__) && defined(MAC_OS_X_VERSION_10_15)
#define FF_HAVE_OPENCL 1
#endif
#if defined(FF_HAVE_OPENCL) || defined(MACOS_HAS_OPENCL)
#ifdef FF_HAVE_OPENCL
#include "common/library.h"
#include "common/parsing.h"
#include "util/stringUtils.h"
#include <string.h>
#define CL_TARGET_OPENCL_VERSION 100
#ifdef FF_HAVE_OPENCL
#define CL_TARGET_OPENCL_VERSION 110
#ifndef __APPLE__
#include <CL/cl.h>
#else
#include <OpenCL/cl.h>
@@ -24,86 +22,175 @@
typedef struct OpenCLData
{
FF_LIBRARY_SYMBOL(clGetPlatformIDs)
FF_LIBRARY_SYMBOL(clGetDeviceIDs)
FF_LIBRARY_SYMBOL(clGetPlatformInfo)
FF_LIBRARY_SYMBOL(clGetDeviceInfo)
FF_LIBRARY_SYMBOL(clGetDeviceIDs)
} OpenCLData;
static const char* openCLHandleData(OpenCLData* data, FFOpenCLResult* result)
{
cl_platform_id platformID = NULL;
cl_platform_id platforms[32];
cl_uint numPlatforms = 0;
data->ffclGetPlatformIDs(1, &platformID, &numPlatforms);
if (data->ffclGetPlatformIDs(sizeof(platforms) / sizeof(platforms[0]), platforms, &numPlatforms) != CL_SUCCESS)
return "clGetPlatformIDs() failed";
if(numPlatforms == 0)
if (numPlatforms == 0)
return "clGetPlatformIDs returned 0 platforms";
cl_device_id deviceID = NULL;
cl_uint numDevices = 0;
data->ffclGetDeviceIDs(platformID, CL_DEVICE_TYPE_GPU, 1, &deviceID, &numDevices);
char buffer[1024];
for (cl_uint iplat = 0; iplat < numPlatforms; ++iplat)
{
if (data->ffclGetPlatformInfo(platforms[iplat], CL_PLATFORM_VERSION, sizeof(buffer), buffer, NULL) != CL_SUCCESS)
return "clGetPlatformInfo() failed";
if(numDevices == 0)
data->ffclGetDeviceIDs(platformID, CL_DEVICE_TYPE_ALL, 1, &deviceID, &numDevices);
// Use the newest supported OpenCL version
if (ffStrbufCompS(&result->version, buffer) < 0)
{
const char* versionPretty = buffer;
if(ffStrStartsWithIgnCase(buffer, "OpenCL "))
versionPretty = buffer + strlen("OpenCL ");
ffStrbufSetS(&result->version, versionPretty);
ffStrbufTrim(&result->version, ' ');
if(numDevices == 0)
return "clGetDeviceIDs returned 0 devices";
if (data->ffclGetPlatformInfo(platforms[iplat], CL_PLATFORM_NAME, sizeof(buffer), buffer, NULL) == CL_SUCCESS)
ffStrbufSetS(&result->name, buffer);
char version[64] = "";
data->ffclGetDeviceInfo(deviceID, CL_DEVICE_VERSION, sizeof(version), version, NULL);
if(!ffStrSet(version))
return "clGetDeviceInfo returned NULL or empty string";
if (data->ffclGetPlatformInfo(platforms[iplat], CL_PLATFORM_VENDOR, sizeof(buffer), buffer, NULL) == CL_SUCCESS)
ffStrbufSetS(&result->vendor, buffer);
}
const char* versionPretty = version;
if(ffStrStartsWithIgnCase(version, "OpenCL "))
versionPretty = version + strlen("OpenCL ");
ffStrbufSetS(&result->version, versionPretty);
ffStrbufTrim(&result->version, ' ');
cl_device_id deviceIDs[32];
cl_uint numDevices = (cl_uint) (sizeof(deviceIDs) / sizeof(deviceIDs[0]));
if (data->ffclGetDeviceIDs(platforms[iplat], CL_DEVICE_TYPE_GPU, numDevices, deviceIDs, &numDevices) != CL_SUCCESS)
continue;
ffStrbufEnsureFree(&result->device, 128);
data->ffclGetDeviceInfo(deviceID, CL_DEVICE_NAME, result->device.allocated, result->device.chars, NULL);
ffStrbufRecalculateLength(&result->device);
ffStrbufTrim(&result->device, ' ');
for (cl_uint idev = 0; idev < numDevices; ++idev)
{
cl_device_id deviceID = deviceIDs[idev];
if (data->ffclGetDeviceInfo(deviceID, CL_DEVICE_NAME, sizeof(buffer), buffer, NULL) != CL_SUCCESS)
continue;
ffStrbufEnsureFree(&result->vendor, 32);
data->ffclGetDeviceInfo(deviceID, CL_DEVICE_VENDOR, result->vendor.allocated, result->vendor.chars, NULL);
ffStrbufRecalculateLength(&result->vendor);
ffStrbufTrim(&result->vendor, ' ');
FFGPUResult* gpu = ffListAdd(&result->gpus);
ffStrbufInitS(&gpu->name, buffer);
ffStrbufInit(&gpu->vendor);
ffStrbufInit(&gpu->driver);
ffStrbufInit(&gpu->platformApi);
gpu->temperature = FF_GPU_TEMP_UNSET;
gpu->coreCount = FF_GPU_CORE_COUNT_UNSET;
gpu->type = FF_GPU_TYPE_UNKNOWN;
gpu->dedicated.total = gpu->dedicated.used = gpu->shared.total = gpu->shared.used = FF_GPU_VMEM_SIZE_UNSET;
gpu->deviceId = (size_t) deviceID;
gpu->frequency = FF_GPU_FREQUENCY_UNSET;
if (data->ffclGetDeviceInfo(deviceID, CL_DEVICE_VERSION, sizeof(buffer), buffer, NULL) == CL_SUCCESS)
{
ffStrbufSetS(&gpu->platformApi, buffer);
ffStrbufTrimRight(&gpu->platformApi, ' ');
}
else
ffStrbufSetStatic(&gpu->platformApi, "OpenCL");
{
cl_uint vendorId;
if (data->ffclGetDeviceInfo(deviceID, CL_DEVICE_VENDOR_ID, sizeof(vendorId), &vendorId, NULL) == CL_SUCCESS)
ffStrbufSetStatic(&gpu->vendor, ffGetGPUVendorString(vendorId));
if (gpu->vendor.length == 0 && data->ffclGetDeviceInfo(deviceID, CL_DEVICE_VENDOR, sizeof(buffer), buffer, NULL) == CL_SUCCESS)
ffStrbufSetS(&gpu->vendor, buffer);
}
if (data->ffclGetDeviceInfo(deviceID, CL_DRIVER_VERSION, sizeof(buffer), buffer, NULL) == CL_SUCCESS)
{
const char* versionPretty = strchr(buffer, ' ');
if (versionPretty && *versionPretty)
ffStrbufSetS(&gpu->driver, versionPretty + 1);
else
ffStrbufSetS(&gpu->driver, buffer);
}
{
cl_uint value;
if (data->ffclGetDeviceInfo(deviceID, CL_DEVICE_MAX_COMPUTE_UNITS, sizeof(value), &value, NULL) == CL_SUCCESS)
gpu->coreCount = (int32_t) value;
}
{
cl_uint value;
if (data->ffclGetDeviceInfo(deviceID, CL_DEVICE_MAX_CLOCK_FREQUENCY, sizeof(value), &value, NULL) == CL_SUCCESS)
gpu->frequency = value / 1000.;
}
{
cl_bool value;
if (data->ffclGetDeviceInfo(deviceID, CL_DEVICE_HOST_UNIFIED_MEMORY, sizeof(value), &value, NULL) == CL_SUCCESS)
{
gpu->type = value ? FF_GPU_TYPE_INTEGRATED : FF_GPU_TYPE_DISCRETE;
cl_ulong memSize;
if (data->ffclGetDeviceInfo(deviceID, CL_DEVICE_GLOBAL_MEM_SIZE, sizeof(memSize), &memSize, NULL) == CL_SUCCESS)
{
if (gpu->type == FF_GPU_TYPE_INTEGRATED)
gpu->shared.total = memSize;
else
gpu->dedicated.total = memSize;
}
}
}
}
}
return NULL;
}
#endif // defined(FF_HAVE_OPENCL) || defined(MACOS_HAS_OPENCL)
const char* ffDetectOpenCL(FFOpenCLResult* result)
static const char* detectOpenCL(FFOpenCLResult* result)
{
#ifdef FF_HAVE_OPENCL
OpenCLData data;
FF_LIBRARY_LOAD(opencl, &instance.config.library.libOpenCL, "dlopen libOpenCL"FF_LIBRARY_EXTENSION" failed",
#ifndef __APPLE__
FF_LIBRARY_LOAD(opencl, &instance.config.library.libOpenCL, "dlopen libOpenCL" FF_LIBRARY_EXTENSION" failed",
#ifdef _WIN32
"OpenCL"FF_LIBRARY_EXTENSION, -1,
#endif
"libOpenCL"FF_LIBRARY_EXTENSION, 1
);
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(opencl, data, clGetPlatformIDs);
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(opencl, data, clGetPlatformInfo);
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(opencl, data, clGetDeviceIDs);
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(opencl, data, clGetDeviceInfo);
return openCLHandleData(&data, result);
#elif defined(MACOS_HAS_OPENCL) // FF_HAVE_OPENCL
#else
OpenCLData data;
data.ffclGetPlatformIDs = clGetPlatformIDs;
data.ffclGetPlatformInfo = clGetPlatformInfo;
data.ffclGetDeviceIDs = clGetDeviceIDs;
data.ffclGetDeviceInfo = clGetDeviceInfo;
return openCLHandleData(&data, result);
#else
FF_UNUSED(result);
return "Fastfetch was build without OpenCL support";
#endif // FF_HAVE_OPENCL
#endif
}
#endif // defined(FF_HAVE_OPENCL)
FFOpenCLResult* ffDetectOpenCL(void)
{
static FFOpenCLResult result;
if (result.gpus.elementSize == 0)
{
ffStrbufInit(&result.version);
ffStrbufInit(&result.name);
ffStrbufInit(&result.vendor);
ffListInit(&result.gpus, sizeof(FFGPUResult));
#ifdef FF_HAVE_OPENCL
result.error = detectOpenCL(&result);
#else
result.error = "fastfetch was compiled without OpenCL support";
#endif
}
return &result;
}
+4 -2
View File
@@ -5,8 +5,10 @@
typedef struct FFOpenCLResult
{
FFstrbuf version;
FFstrbuf device;
FFstrbuf name;
FFstrbuf vendor;
FFlist gpus; //List of FFGPUResult, see detection/gpu/gpu.h
const char* error;
} FFOpenCLResult;
const char* ffDetectOpenCL(FFOpenCLResult* result);
FFOpenCLResult* ffDetectOpenCL();
+1
View File
@@ -8,6 +8,7 @@ typedef struct FFOpenGLResult
FFstrbuf renderer;
FFstrbuf vendor;
FFstrbuf slv;
const char* library;
} FFOpenGLResult;
const char* ffDetectOpenGL(FFOpenGLOptions* options, FFOpenGLResult* result);
+1
View File
@@ -12,6 +12,7 @@ static const char* glHandleResult(FFOpenGLResult* result)
ffStrbufAppendS(&result->renderer, (const char*) glGetString(GL_RENDERER));
ffStrbufAppendS(&result->vendor, (const char*) glGetString(GL_VENDOR));
ffStrbufAppendS(&result->slv, (const char*) glGetString(GL_SHADING_LANGUAGE_VERSION));
result->library = "CGL";
return NULL;
}
+10 -5
View File
@@ -18,12 +18,13 @@ typedef struct GLData
FF_LIBRARY_SYMBOL(glGetString)
} GLData;
static const char* glHandleResult(FFOpenGLResult* result, const GLData* data)
static const char* glHandleResult(FFOpenGLResult* result, const GLData* data, const char* library)
{
ffStrbufAppendS(&result->version, (const char*) data->ffglGetString(GL_VERSION));
ffStrbufAppendS(&result->renderer, (const char*) data->ffglGetString(GL_RENDERER));
ffStrbufAppendS(&result->vendor, (const char*) data->ffglGetString(GL_VENDOR));
ffStrbufAppendS(&result->slv, (const char*) data->ffglGetString(GL_SHADING_LANGUAGE_VERSION));
result->library = library;
return NULL;
}
@@ -61,7 +62,7 @@ static const char* eglHandleContext(FFOpenGLResult* result, EGLData* data)
if(data->ffeglMakeCurrent(data->display, data->surface, data->surface, data->context) != EGL_TRUE)
return "eglMakeCurrent returned EGL_FALSE";
return glHandleResult(result, &data->glData);
return glHandleResult(result, &data->glData, "EGL");
}
static const char* eglHandleSurface(FFOpenGLResult* result, EGLData* data)
@@ -173,7 +174,7 @@ static const char* glxHandleContext(FFOpenGLResult* result, GLXData* data)
if(data->ffglXMakeCurrent(data->display, data->glxPixmap, data->context) != True)
return "glXMakeCurrent returned False";
return glHandleResult(result, &data->glData);
return glHandleResult(result, &data->glData, "GLX");
}
static const char* glxHandleGLXPixmap(FFOpenGLResult* result, GLXData* data)
@@ -259,7 +260,11 @@ static const char* glxPrint(FFOpenGLResult* result)
#endif //FF_HAVE_GLX
#ifdef FF_HAVE_OSMESA
#include <GL/osmesa.h>
#if __has_include(<GL/osmesa.h>)
#include <GL/osmesa.h>
#else
#include <mesa/osmesa.h> // for sunos
#endif
typedef struct OSMesaData
{
@@ -280,7 +285,7 @@ static const char* osMesaHandleContext(FFOpenGLResult* result, OSMesaData* data)
if(data->ffOSMesaMakeCurrent(data->context, buffer, GL_UNSIGNED_BYTE, FF_OPENGL_BUFFER_WIDTH, FF_OPENGL_BUFFER_HEIGHT) != GL_TRUE)
return "OSMesaMakeCurrent returned GL_FALSE";
return glHandleResult(result, &data->glData);
return glHandleResult(result, &data->glData, "OSMesa");
}
static const char* osMesaHandleData(FFOpenGLResult* result, OSMesaData* data)
+1
View File
@@ -25,6 +25,7 @@ static const char* glHandleResult(WGLData* wglData)
ffStrbufAppendS(&wglData->result->renderer, (const char*) wglData->ffglGetString(GL_RENDERER));
ffStrbufAppendS(&wglData->result->vendor, (const char*) wglData->ffglGetString(GL_VENDOR));
ffStrbufAppendS(&wglData->result->slv, (const char*) wglData->ffglGetString(GL_SHADING_LANGUAGE_VERSION));
wglData->result->library = "WGL";
return NULL;
}
+15 -13
View File
@@ -37,6 +37,7 @@ static bool detectOSCodeName(FFOSResult* os)
switch (num)
{
case 15: ffStrbufSetStatic(&os->codename, "Sequoia"); return true;
case 14: ffStrbufSetStatic(&os->codename, "Sonoma"); return true;
case 13: ffStrbufSetStatic(&os->codename, "Ventura"); return true;
case 12: ffStrbufSetStatic(&os->codename, "Monterey"); return true;
@@ -53,18 +54,18 @@ static bool detectOSCodeName(FFOSResult* os)
case 14: ffStrbufSetStatic(&os->codename, "Mojave"); return true;
case 13: ffStrbufSetStatic(&os->codename, "High Sierra"); return true;
case 12: ffStrbufSetStatic(&os->codename, "Sierra"); return true;
case 11: ffStrbufSetStatic(&os->codename, "El Capitan"); return true;
case 10: ffStrbufSetStatic(&os->codename, "Yosemite"); return true;
case 9: ffStrbufSetStatic(&os->codename, "Mavericks"); return true;
case 8: ffStrbufSetStatic(&os->codename, "Mountain Lion"); return true;
case 7: ffStrbufSetStatic(&os->codename, "Lion"); return true;
case 6: ffStrbufSetStatic(&os->codename, "Snow Leopard"); return true;
case 5: ffStrbufSetStatic(&os->codename, "Leopard"); return true;
case 4: ffStrbufSetStatic(&os->codename, "Tiger"); return true;
case 3: ffStrbufSetStatic(&os->codename, "Panther"); return true;
case 2: ffStrbufSetStatic(&os->codename, "Jaguar"); return true;
case 1: ffStrbufSetStatic(&os->codename, "Puma"); return true;
case 0: ffStrbufSetStatic(&os->codename, "Cheetah"); return true;
case 11: ffStrbufSetStatic(&os->codename, "El Capitan"); ffStrbufSetStatic(&os->prettyName, "OS X"); return true;
case 10: ffStrbufSetStatic(&os->codename, "Yosemite"); ffStrbufSetStatic(&os->prettyName, "OS X"); return true;
case 9: ffStrbufSetStatic(&os->codename, "Mavericks"); ffStrbufSetStatic(&os->prettyName, "OS X"); return true;
case 8: ffStrbufSetStatic(&os->codename, "Mountain Lion"); ffStrbufSetStatic(&os->prettyName, "OS X"); return true;
case 7: ffStrbufSetStatic(&os->codename, "Lion"); ffStrbufSetStatic(&os->prettyName, "Mac OS X"); return true;
case 6: ffStrbufSetStatic(&os->codename, "Snow Leopard"); ffStrbufSetStatic(&os->prettyName, "Mac OS X"); return true;
case 5: ffStrbufSetStatic(&os->codename, "Leopard"); ffStrbufSetStatic(&os->prettyName, "Mac OS X"); return true;
case 4: ffStrbufSetStatic(&os->codename, "Tiger"); ffStrbufSetStatic(&os->prettyName, "Mac OS X"); return true;
case 3: ffStrbufSetStatic(&os->codename, "Panther"); ffStrbufSetStatic(&os->prettyName, "Mac OS X"); return true;
case 2: ffStrbufSetStatic(&os->codename, "Jaguar"); ffStrbufSetStatic(&os->prettyName, "Mac OS X"); return true;
case 1: ffStrbufSetStatic(&os->codename, "Puma"); ffStrbufSetStatic(&os->prettyName, "Mac OS X"); return true;
case 0: ffStrbufSetStatic(&os->codename, "Cheetah"); ffStrbufSetStatic(&os->prettyName, "Mac OS X"); return true;
}
}
}
@@ -105,7 +106,8 @@ void ffDetectOSImpl(FFOSResult* os)
if(os->buildID.length == 0)
ffSysctlGetString("kern.osversion", &os->buildID);
ffStrbufAppend(&os->prettyName, &os->name);
if(os->prettyName.length == 0)
ffStrbufSetStatic(&os->prettyName, "macOS");
ffStrbufAppend(&os->versionID, &os->version);
if(!detectOSCodeName(os))
+25 -16
View File
@@ -180,6 +180,28 @@ static bool detectDebianDerived(FFOSResult* result)
ffStrbufSetF(&result->prettyName, "Proxmox VE %s", result->versionID.chars);
return true;
}
else
{
// Hack for MX Linux. See #847
FF_STRBUF_AUTO_DESTROY lsbRelease = ffStrbufCreate();
if (ffAppendFileBuffer("/etc/lsb-release", &lsbRelease) && ffStrbufContainS(&lsbRelease, "DISTRIB_ID=MX"))
{
ffStrbufSetS(&result->id, "mx");
ffStrbufSetS(&result->idLike, "debian");
ffStrbufSetS(&result->name, "MX");
ffStrbufClear(&result->version);
ffParsePropLines(lsbRelease.chars, "DISTRIB_RELEASE=", &result->version);
ffStrbufSet(&result->versionID, &result->version);
ffStrbufClear(&result->codename);
ffParsePropLines(lsbRelease.chars, "DISTRIB_CODENAME=", &result->codename);
ffStrbufClear(&result->prettyName);
ffParsePropLines(lsbRelease.chars, "DISTRIB_DESCRIPTION=", &result->prettyName);
return true;
}
}
return false;
}
@@ -208,22 +230,9 @@ static void detectOS(FFOSResult* os)
// Refer: https://gist.github.com/natefoo/814c5bf936922dad97ff
// Hack for MX Linux. See #847
if(parseLsbRelease(FASTFETCH_TARGET_DIR_ETC "/lsb-release", os))
{
if (ffStrbufEqualS(&os->id, "MX"))
{
ffStrbufSetStatic(&os->name, "MX");
ffStrbufSetStatic(&os->idLike, "debian");
return;
}
// For archlinux
if (ffStrbufEqualS(&os->version, "rolling"))
ffStrbufClear(&os->version);
}
if(parseOsRelease(FASTFETCH_TARGET_DIR_ETC "/os-release", os) && allRelevantValuesSet(os))
if((parseOsRelease(FASTFETCH_TARGET_DIR_ETC "/os-release", os) ||
parseLsbRelease(FASTFETCH_TARGET_DIR_ETC "/lsb-release", os)) &&
allRelevantValuesSet(os))
return;
parseOsRelease(FASTFETCH_TARGET_DIR_USR "/lib/os-release", os);
+17
View File
@@ -0,0 +1,17 @@
#include "os.h"
#include "common/io/io.h"
void ffDetectOSImpl(FFOSResult* os)
{
if (!ffReadFileBuffer("/etc/release", &os->prettyName))
return;
ffStrbufSubstrBeforeFirstC(&os->prettyName, '\n');
ffStrbufSubstrBeforeLastC(&os->prettyName, '(');
ffStrbufTrim(&os->prettyName, ' ');
// OpenIndiana Hipster 2024.04
uint32_t idx = ffStrbufFirstIndexC(&os->prettyName, ' ');
ffStrbufSetNS(&os->id, idx, os->prettyName.chars);
ffStrbufSetStatic(&os->idLike, "sunos");
}
+1
View File
@@ -90,4 +90,5 @@ void ffDetectOSImpl(FFOSResult* os)
}
ffStrbufAppendF(&os->id, "%*s %*s", os->prettyName.length, os->prettyName.chars, os->version.length, os->version.chars);
ffStrbufSetStatic(&os->idLike, "Windows");
}
+2 -15
View File
@@ -313,19 +313,6 @@ static uint32_t getSnap(FFstrbuf* baseDir)
return result > 0 ? result - 1 : 0;
}
static uint32_t getFlatpak(FFstrbuf* baseDir, const char* dirname)
{
uint32_t baseDirLength = baseDir->length;
ffStrbufAppendS(baseDir, dirname);
uint32_t result =
getNumElements(baseDir, "/app", DT_DIR) +
getNumElements(baseDir, "/runtime", DT_DIR);
ffStrbufSubstrBefore(baseDir, baseDirLength);
return result;
}
#ifdef FF_HAVE_RPM
#include "common/library.h"
#include <rpm/rpmlib.h>
@@ -459,7 +446,7 @@ static void getPackageCounts(FFstrbuf* baseDir, FFPackagesResult* packageCounts,
if (!(options->disabled & FF_PACKAGES_FLAG_LPKG_BIT)) packageCounts->lpkg += getNumStrings(baseDir, "/opt/Loc-OS-LPKG/installed-lpkg/Listinstalled-lpkg.list", "\n");
if (!(options->disabled & FF_PACKAGES_FLAG_EMERGE_BIT)) packageCounts->emerge += countFilesRecursive(baseDir, "/var/db/pkg", "SIZE");
if (!(options->disabled & FF_PACKAGES_FLAG_EOPKG_BIT)) packageCounts->eopkg += getNumElements(baseDir, "/var/lib/eopkg/package", DT_DIR);
if (!(options->disabled & FF_PACKAGES_FLAG_FLATPAK_BIT)) packageCounts->flatpakSystem += getFlatpak(baseDir, "/var/lib/flatpak");
if (!(options->disabled & FF_PACKAGES_FLAG_FLATPAK_BIT)) packageCounts->flatpakSystem += getNumElements(baseDir, "/var/lib/flatpak/app", DT_DIR);
if (!(options->disabled & FF_PACKAGES_FLAG_NIX_BIT))
{
packageCounts->nixDefault += getNixPackages(baseDir, "/nix/var/nix/profiles/default");
@@ -587,5 +574,5 @@ void ffDetectPackagesImpl(FFPackagesResult* result, FFPackagesOptions* options)
}
if (!(options->disabled & FF_PACKAGES_FLAG_FLATPAK_BIT))
result->flatpakUser = getFlatpak(&baseDir, "/.local/share/flatpak");
result->flatpakUser = getNumElements(&baseDir, "/.local/share/flatpak/app", DT_DIR);
}

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