mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
Compare commits
43 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cec38b9501 | |||
| 3453b72f0c | |||
| 060544b899 | |||
| 14c6b6d7e2 | |||
| 9df394bba3 | |||
| b25ffda90b | |||
| db9cf4ef29 | |||
| 7b2d4b7a0d | |||
| 64cdb3f058 | |||
| 66e7924fa3 | |||
| 84540250f7 | |||
| 96e7f65902 | |||
| 321d3e5574 | |||
| 2bba2eaa16 | |||
| 58ebde422a | |||
| 06f3b9a96d | |||
| fa5aaa692f | |||
| 9d2c4f52d2 | |||
| 9946a5d758 | |||
| a749014e7c | |||
| 2cd421fc2e | |||
| 4db6aebcc9 | |||
| 3b156e819b | |||
| 7ffed9e911 | |||
| 9042950ee8 | |||
| 7aad0dc32f | |||
| 01d04a8fa2 | |||
| d3e50fe595 | |||
| ecd69370ab | |||
| abd2522268 | |||
| 2e1261bc21 | |||
| 0e597a2ded | |||
| 2781a0ab93 | |||
| 02d7f2693b | |||
| b001ea409b | |||
| f97a9fdfc0 | |||
| 2c8d5292d7 | |||
| 88e4579f1e | |||
| 8f97e61f67 | |||
| 0b943bb25e | |||
| 19590003e1 | |||
| 27a1d9f8c6 | |||
| d50ebc86c7 |
@@ -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
|
||||||
@@ -375,7 +375,6 @@ jobs:
|
|||||||
- name: checkout repository
|
- name: checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: run VM
|
- name: run VM
|
||||||
uses: vmactions/omnios-vm@v1
|
uses: vmactions/omnios-vm@v1
|
||||||
with:
|
with:
|
||||||
|
|||||||
+34
-3
@@ -1,3 +1,34 @@
|
|||||||
|
# 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
|
# 2.17.0
|
||||||
|
|
||||||
Changes:
|
Changes:
|
||||||
@@ -1048,7 +1079,7 @@ Bugfixes:
|
|||||||
This release backports some changes from dev branch, and fixes 2 crashing issues
|
This release backports some changes from dev branch, and fixes 2 crashing issues
|
||||||
|
|
||||||
Features:
|
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 QTerminal version & terminal font detection
|
||||||
* Support MATE Terminal version & terminal font detection
|
* Support MATE Terminal version & terminal font detection
|
||||||
* Set `--pipe true` automatically if stdout is not a tty
|
* Set `--pipe true` automatically if stdout is not a tty
|
||||||
@@ -1094,7 +1125,7 @@ Bugfixes:
|
|||||||
* Fix Windows drives detection in WSL (Disk)
|
* Fix Windows drives detection in WSL (Disk)
|
||||||
|
|
||||||
Changes:
|
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.
|
* `--theme-format` no longer supports individual GTK / plasma theme params.
|
||||||
* `--local-ip-*` and `--public-ip-*` have been changed to `--localip-*` and `--publicip-*`
|
* `--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`
|
* `--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`
|
||||||
@@ -1468,7 +1499,7 @@ Fixes build on android (#205)
|
|||||||
# 1.6.0
|
# 1.6.0
|
||||||
|
|
||||||
Features:
|
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
|
* Alacritty font detection
|
||||||
* Load `/etc/fastfetch/config.conf` before user config
|
* Load `/etc/fastfetch/config.conf` before user config
|
||||||
* Disk: print one decimal point if size < 100GB
|
* Disk: print one decimal point if size < 100GB
|
||||||
|
|||||||
+12
-6
@@ -1,7 +1,7 @@
|
|||||||
cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url
|
cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url
|
||||||
|
|
||||||
project(fastfetch
|
project(fastfetch
|
||||||
VERSION 2.17.0
|
VERSION 2.17.2
|
||||||
LANGUAGES C
|
LANGUAGES C
|
||||||
DESCRIPTION "Fast neofetch-like system information tool"
|
DESCRIPTION "Fast neofetch-like system information tool"
|
||||||
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
|
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
|
||||||
@@ -74,6 +74,7 @@ cmake_dependent_option(ENABLE_THREADS "Enable multithreading" ON "Threads_FOUND"
|
|||||||
|
|
||||||
option(ENABLE_SYSTEM_YYJSON "Use system provided (instead of fastfetch embedded) yyjson library" OFF)
|
option(ENABLE_SYSTEM_YYJSON "Use system provided (instead of fastfetch embedded) yyjson library" OFF)
|
||||||
option(ENABLE_ASAN "Build fastfetch with ASAN (address sanitizer)" OFF)
|
option(ENABLE_ASAN "Build fastfetch with ASAN (address sanitizer)" OFF)
|
||||||
|
option(ENABLE_LTO "Enable link-time optimization in release mode if supported" ON)
|
||||||
option(BUILD_TESTS "Build tests" OFF) # Also create test executables
|
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(SET_TWEAK "Add tweak to project version" ON) # This is set to off by github actions for release builds
|
||||||
option(IS_MUSL "Build with musl libc" OFF) # Used by Github Actions
|
option(IS_MUSL "Build with musl libc" OFF) # Used by Github Actions
|
||||||
@@ -139,7 +140,7 @@ if(NOT WIN32)
|
|||||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -rdynamic")
|
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -rdynamic")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
if(ENABLE_LTO AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
message(STATUS "Enabling LTO")
|
message(STATUS "Enabling LTO")
|
||||||
include(CheckIPOSupported)
|
include(CheckIPOSupported)
|
||||||
check_ipo_supported(RESULT IPO_SUPPORTED)
|
check_ipo_supported(RESULT IPO_SUPPORTED)
|
||||||
@@ -1156,7 +1157,7 @@ if(WIN32)
|
|||||||
include(CheckIncludeFileCXX)
|
include(CheckIncludeFileCXX)
|
||||||
CHECK_INCLUDE_FILE_CXX("winrt/Windows.Foundation.h" HAVE_WINRT)
|
CHECK_INCLUDE_FILE_CXX("winrt/Windows.Foundation.h" HAVE_WINRT)
|
||||||
if(HAVE_WINRT)
|
if(HAVE_WINRT)
|
||||||
add_library(ffwinrt SHARED src/detection/media/media_windows.dll.cpp)
|
add_library(ffwinrt MODULE src/detection/media/media_windows.dll.cpp)
|
||||||
target_link_libraries(ffwinrt PRIVATE "RuntimeObject")
|
target_link_libraries(ffwinrt PRIVATE "RuntimeObject")
|
||||||
target_compile_definitions(ffwinrt PRIVATE WIN32_LEAN_AND_MEAN=1 WINRT_LEAN_AND_MEAN=1)
|
target_compile_definitions(ffwinrt PRIVATE WIN32_LEAN_AND_MEAN=1 WINRT_LEAN_AND_MEAN=1)
|
||||||
target_link_options(ffwinrt
|
target_link_options(ffwinrt
|
||||||
@@ -1322,12 +1323,17 @@ if(LINUX)
|
|||||||
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
|
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
|
||||||
|
|
||||||
if(NOT IS_MUSL)
|
if(NOT IS_MUSL)
|
||||||
EXECUTE_PROCESS (
|
EXECUTE_PROCESS(
|
||||||
COMMAND getconf GNU_LIBC_VERSION
|
COMMAND getconf GNU_LIBC_VERSION
|
||||||
OUTPUT_VARIABLE GLIBC_VERSION
|
OUTPUT_VARIABLE GLIBC_VERSION
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
STRING (REPLACE "glibc " "" GLIBC_VERSION ${GLIBC_VERSION})
|
if(GLIBC_VERSION)
|
||||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= ${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()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
MIT License
|
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
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
[](https://repology.org/project/fastfetch/versions)
|
[](https://repology.org/project/fastfetch/versions)
|
||||||
[](https://repology.org/project/fastfetch/versions)
|
[](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, SunOS 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="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" />
|
<img src="https://upload.wikimedia.org/wikipedia/commons/2/24/Transparent_Square_Tiles_Texture.png" width="49%" height="16px" align="left" />
|
||||||
@@ -21,13 +21,13 @@ Fastfetch is a [neofetch](https://github.com/dylanaraps/neofetch)-like tool for
|
|||||||
<img src="screenshots/example3.png" width="48%" align="top" />
|
<img src="screenshots/example3.png" width="48%" align="top" />
|
||||||
<img src="screenshots/example5.png" height="15%" 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
|
## Installation
|
||||||
|
|
||||||
### Linux
|
### 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)
|
* 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: `sudo apt install fastfetch` (for Debian 13 or newer)
|
||||||
@@ -57,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`
|
* [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`
|
* [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
|
### FreeBSD
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ See Wiki: https://github.com/fastfetch-cli/fastfetch/wiki/Building
|
|||||||
|
|
||||||
## Customization
|
## 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.
|
Logos can be heavily customized too; see the [logo documentation](https://github.com/fastfetch-cli/fastfetch/wiki/Logo-options) for more information.
|
||||||
|
|
||||||
@@ -103,10 +103,10 @@ Logos can be heavily customized too; see the [logo documentation](https://github
|
|||||||
|
|
||||||
1. Fastfetch is actively maintained.
|
1. Fastfetch is actively maintained.
|
||||||
2. Fastfetch is faster. As the name suggests.
|
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.
|
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>
|
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.
|
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 Wayland protocol](https://github.com/dylanaraps/neofetch/pull/2395).
|
6. Fastfetch is more accurate. For example, [neofetch never actually supports the Wayland protocol](https://github.com/dylanaraps/neofetch/pull/2395).
|
||||||
|
|
||||||
### Q: Fastfetch shows my local IP address. It leaks my privacy!
|
### Q: Fastfetch shows my local IP address. It leaks my privacy!
|
||||||
|
|
||||||
@@ -118,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.
|
### 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?
|
### Q: The configuration is so complex. Where is the documentation?
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ Alternatively, you can refer to the presets in [`presets` directory](https://git
|
|||||||
|
|
||||||
### Q: How can I customize the module output?
|
### 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
|
```jsonc
|
||||||
{
|
{
|
||||||
@@ -145,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?
|
### Q: I have my own ascii-art / image file. How can I show it with fastfetch?
|
||||||
|
|
||||||
Try `fastfetch -l /path/to/logo`. See [logo documentation](https://github.com/fastfetch-cli/fastfetch/wiki/Logo-options) for detail.
|
Try `fastfetch -l /path/to/logo`. See [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
|
```bash
|
||||||
# install pyfiglet and jq first
|
# install pyfiglet and jq first
|
||||||
|
|||||||
Vendored
+12
@@ -1,3 +1,15 @@
|
|||||||
|
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
|
fastfetch (2.16.0) jammy; urgency=medium
|
||||||
|
|
||||||
* Update to 2.16.0
|
* Update to 2.16.0
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
fastfetch_2.16.0_source.buildinfo universe/utils optional
|
fastfetch_2.17.1_source.buildinfo universe/utils optional
|
||||||
|
|||||||
+16
-1
@@ -576,7 +576,7 @@
|
|||||||
},
|
},
|
||||||
"tsVersion": {
|
"tsVersion": {
|
||||||
"type": "boolean",
|
"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
|
"default": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1145,6 +1145,21 @@
|
|||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "Display CPU usage per CPU logical core, instead of an average result",
|
"description": "Display CPU usage per CPU logical core, instead of an average result",
|
||||||
"default": false
|
"default": false
|
||||||
|
},
|
||||||
|
"key": {
|
||||||
|
"$ref": "#/$defs/key"
|
||||||
|
},
|
||||||
|
"keyColor": {
|
||||||
|
"$ref": "#/$defs/keyColor"
|
||||||
|
},
|
||||||
|
"outputColor": {
|
||||||
|
"$ref": "#/$defs/outputColor"
|
||||||
|
},
|
||||||
|
"keyWidth": {
|
||||||
|
"$ref": "#/$defs/keyWidth"
|
||||||
|
},
|
||||||
|
"format": {
|
||||||
|
"$ref": "#/$defs/format"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -147,7 +147,7 @@
|
|||||||
{
|
{
|
||||||
"type": "font",
|
"type": "font",
|
||||||
"key": "FONT",
|
"key": "FONT",
|
||||||
"format": "{?1}{1} [QT]{?}{/1}Unknown", // Remove "[QT]" if not using Qt
|
"format": "{?1}{1} [Qt]{?}{/1}Unknown", // Remove "[Qt]" if not using Qt
|
||||||
"keyColor": "yellow"
|
"keyColor": "yellow"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,11 +8,13 @@
|
|||||||
#include <handleapi.h>
|
#include <handleapi.h>
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
typedef HANDLE FFNativeFD;
|
typedef HANDLE FFNativeFD;
|
||||||
|
#define FF_INVALID_FD INVALID_HANDLE_VALUE
|
||||||
#else
|
#else
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
typedef int FFNativeFD;
|
typedef int FFNativeFD;
|
||||||
|
#define FF_INVALID_FD (-1)
|
||||||
// procfs's file can be changed between read calls such as /proc/meminfo and /proc/uptime.
|
// 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
|
// 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
|
// 8192 comes from procps-ng: https://gitlab.com/procps-ng/procps/-/blob/master/library/meminfo.c?ref_type=heads#L39
|
||||||
|
|||||||
@@ -148,6 +148,14 @@ bool ffOptionParseBoolean(const char* str)
|
|||||||
|
|
||||||
void ffOptionParseColorNoClear(const char* value, FFstrbuf* buffer)
|
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);
|
ffStrbufEnsureFree(buffer, 63);
|
||||||
|
|
||||||
while(*value != '\0')
|
while(*value != '\0')
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ void ffPrintLogoAndKey(const char* moduleName, uint8_t moduleIndex, const FFModu
|
|||||||
if(!instance.config.display.pipe)
|
if(!instance.config.display.pipe)
|
||||||
{
|
{
|
||||||
fputs(FASTFETCH_TEXT_MODIFIER_RESET, stdout);
|
fputs(FASTFETCH_TEXT_MODIFIER_RESET, stdout);
|
||||||
if (moduleArgs->outputColor.length)
|
if (moduleArgs && moduleArgs->outputColor.length)
|
||||||
ffPrintColor(&moduleArgs->outputColor);
|
ffPrintColor(&moduleArgs->outputColor);
|
||||||
else if (instance.config.display.colorOutput.length)
|
else if (instance.config.display.colorOutput.length)
|
||||||
ffPrintColor(&instance.config.display.colorOutput);
|
ffPrintColor(&instance.config.display.colorOutput);
|
||||||
|
|||||||
+3
-3
@@ -154,7 +154,7 @@
|
|||||||
{
|
{
|
||||||
"short": "l",
|
"short": "l",
|
||||||
"long": "logo",
|
"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",
|
"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": {
|
"arg": {
|
||||||
"type": "logo"
|
"type": "logo"
|
||||||
@@ -441,7 +441,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"long": "pipe",
|
"long": "pipe",
|
||||||
"desc": "Disable logo and all escape sequences",
|
"desc": "Disable colors",
|
||||||
"remark": "Auto detection based on isatty(1)",
|
"remark": "Auto detection based on isatty(1)",
|
||||||
"arg": {
|
"arg": {
|
||||||
"type": "bool",
|
"type": "bool",
|
||||||
@@ -728,7 +728,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"long": "ts-version",
|
"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",
|
"remark": "Mainly for benchmarking",
|
||||||
"arg": {
|
"arg": {
|
||||||
"type": "bool",
|
"type": "bool",
|
||||||
|
|||||||
@@ -74,7 +74,20 @@ static void getGnome(FFstrbuf* result, FF_MAYBE_UNUSED FFDEOptions* options)
|
|||||||
|
|
||||||
static void getCinnamon(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)
|
static void getMate(FFstrbuf* result, FFDEOptions* options)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#define FF_DE_PRETTY_CINNAMON "Cinnamon"
|
#define FF_DE_PRETTY_CINNAMON "Cinnamon"
|
||||||
#define FF_DE_PRETTY_MATE "Mate"
|
#define FF_DE_PRETTY_MATE "Mate"
|
||||||
#define FF_DE_PRETTY_LXDE "LXDE"
|
#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_BUDGIE "Budgie"
|
||||||
#define FF_DE_PRETTY_CDE "CDE"
|
#define FF_DE_PRETTY_CDE "CDE"
|
||||||
#define FF_DE_PRETTY_UNITY "Unity"
|
#define FF_DE_PRETTY_UNITY "Unity"
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ static void waylandDetectWM(int fd, FFDisplayServerResult* result)
|
|||||||
FF_STRBUF_AUTO_DESTROY procPath = ffStrbufCreate();
|
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.
|
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);
|
ffReadFileBuffer(procPath.chars, &result->wmProcessName);
|
||||||
ffStrbufTrimRightSpace(&result->wmProcessName);
|
|
||||||
ffStrbufSubstrBeforeFirstC(&result->wmProcessName, '\0'); //Trim the arguments
|
ffStrbufSubstrBeforeFirstC(&result->wmProcessName, '\0'); //Trim the arguments
|
||||||
ffStrbufSubstrAfterLastC(&result->wmProcessName, '/'); //Trim the path
|
ffStrbufSubstrAfterLastC(&result->wmProcessName, '/'); //Trim the path
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,11 +71,8 @@ static void applyPrettyNameIfWM(FFDisplayServerResult* result, const char* name)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if(
|
if(
|
||||||
ffStrEqualsIgnCase(name, "kwin_wayland") ||
|
|
||||||
ffStrEqualsIgnCase(name, "kwin_wayland_wrapper") ||
|
|
||||||
ffStrEqualsIgnCase(name, "kwin_x11") ||
|
|
||||||
ffStrEqualsIgnCase(name, "kwin_x11_wrapper") ||
|
|
||||||
ffStrEqualsIgnCase(name, "kwin") ||
|
ffStrEqualsIgnCase(name, "kwin") ||
|
||||||
|
ffStrStartsWithIgnCase(name, "kwin_") ||
|
||||||
ffStrEndsWithIgnCase(name, "-kwin_wayland") ||
|
ffStrEndsWithIgnCase(name, "-kwin_wayland") ||
|
||||||
ffStrEndsWithIgnCase(name, "-kwin_x11")
|
ffStrEndsWithIgnCase(name, "-kwin_x11")
|
||||||
) ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_KWIN);
|
) ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_KWIN);
|
||||||
@@ -86,7 +83,8 @@ static void applyPrettyNameIfWM(FFDisplayServerResult* result, const char* name)
|
|||||||
ffStrEqualsIgnCase(name, "Mutter")
|
ffStrEqualsIgnCase(name, "Mutter")
|
||||||
) ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_MUTTER);
|
) ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_MUTTER);
|
||||||
else if(
|
else if(
|
||||||
ffStrEqualsIgnCase(name, "cinnamon-session") ||
|
ffStrEqualsIgnCase(name, "cinnamon") ||
|
||||||
|
ffStrStartsWithIgnCase(name, "cinnamon-") ||
|
||||||
ffStrEqualsIgnCase(name, "Muffin") ||
|
ffStrEqualsIgnCase(name, "Muffin") ||
|
||||||
ffStrEqualsIgnCase(name, "Mutter (Muffin)")
|
ffStrEqualsIgnCase(name, "Mutter (Muffin)")
|
||||||
) ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_MUFFIN);
|
) ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_MUFFIN);
|
||||||
@@ -207,7 +205,7 @@ static void applyPrettyNameIfDE(FFDisplayServerResult* result, const char* name)
|
|||||||
|
|
||||||
else if(
|
else if(
|
||||||
ffStrEqualsIgnCase(name, "LXQt") ||
|
ffStrEqualsIgnCase(name, "LXQt") ||
|
||||||
ffStrEqualsIgnCase(name, "X-LXQT") ||
|
ffStrEqualsIgnCase(name, "X-LXQt") ||
|
||||||
ffStrEqualsIgnCase(name, "lxqt-session")
|
ffStrEqualsIgnCase(name, "lxqt-session")
|
||||||
) {
|
) {
|
||||||
ffStrbufSetS(&result->deProcessName, "lxqt-session");
|
ffStrbufSetS(&result->deProcessName, "lxqt-session");
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ const char* ffDetectEditor(FFEditorResult* result)
|
|||||||
return "$VISUAL or $EDITOR not set";
|
return "$VISUAL or $EDITOR not set";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!instance.config.display.tsVersion) return NULL;
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
if (result->name.chars[0] != '/')
|
if (result->name.chars[0] != '/')
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
typedef struct FFFontResult
|
typedef struct FFFontResult
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Linux / BSD: QT, GTK2, GTK3, GTK4
|
* Linux / BSD: Qt, GTK2, GTK3, GTK4
|
||||||
* MacOS: System, User, System Mono, User Mono
|
* MacOS: System, User, System Mono, User Mono
|
||||||
* Windows: Caption, Menu, Message, Status
|
* Windows: Caption, Menu, Message, Status
|
||||||
* Other: Unset, Unset, Unset, Unset
|
* Other: Unset, Unset, Unset, Unset
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ static void generateString(FFFontResult* font)
|
|||||||
if(font->fonts[0].length > 0)
|
if(font->fonts[0].length > 0)
|
||||||
{
|
{
|
||||||
ffStrbufAppend(&font->display, &font->fonts[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++)
|
for(uint8_t i = 1; i < sizeof(font->fonts) / sizeof(font->fonts[0]); i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -273,7 +273,7 @@ static const char* detectPci(const FFGPUOptions* options, FFlist* gpus, FFstrbuf
|
|||||||
.memory = options->driverSpecific ? &gpu->dedicated : NULL,
|
.memory = options->driverSpecific ? &gpu->dedicated : NULL,
|
||||||
.coreCount = options->driverSpecific ? (uint32_t*) &gpu->coreCount : NULL,
|
.coreCount = options->driverSpecific ? (uint32_t*) &gpu->coreCount : NULL,
|
||||||
.type = &gpu->type,
|
.type = &gpu->type,
|
||||||
.frequency = &gpu->frequency,
|
.frequency = options->driverSpecific ? &gpu->frequency : NULL,
|
||||||
}, "libnvidia-ml.so");
|
}, "libnvidia-ml.so");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ const char* ffDetectGPUImpl(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist*
|
|||||||
.memory = options->driverSpecific ? &gpu->dedicated : NULL,
|
.memory = options->driverSpecific ? &gpu->dedicated : NULL,
|
||||||
.coreCount = options->driverSpecific ? (uint32_t*) &gpu->coreCount : NULL,
|
.coreCount = options->driverSpecific ? (uint32_t*) &gpu->coreCount : NULL,
|
||||||
.type = &gpu->type,
|
.type = &gpu->type,
|
||||||
.frequency = &gpu->frequency,
|
.frequency = options->driverSpecific ? &gpu->frequency : NULL,
|
||||||
},
|
},
|
||||||
dllName
|
dllName
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ const char* ffGPUDetectByDirectX(FF_MAYBE_UNUSED const FFGPUOptions* options, FF
|
|||||||
.memory = options->driverSpecific ? &gpu->dedicated : NULL,
|
.memory = options->driverSpecific ? &gpu->dedicated : NULL,
|
||||||
.coreCount = options->driverSpecific ? (uint32_t*) &gpu->coreCount : NULL,
|
.coreCount = options->driverSpecific ? (uint32_t*) &gpu->coreCount : NULL,
|
||||||
.type = &gpu->type,
|
.type = &gpu->type,
|
||||||
.frequency = &gpu->frequency,
|
.frequency = options->driverSpecific ? &gpu->frequency : NULL,
|
||||||
}, "/usr/lib/wsl/lib/libnvidia-ml.so");
|
}, "/usr/lib/wsl/lib/libnvidia-ml.so");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,11 +144,16 @@ static void detectQtCt(char qver, FFQtResult* result)
|
|||||||
ffParsePropFileConfigValues(file, 3, (FFpropquery[]) {
|
ffParsePropFileConfigValues(file, 3, (FFpropquery[]) {
|
||||||
{"style=", &result->widgetStyle},
|
{"style=", &result->widgetStyle},
|
||||||
{"icon_theme=", &result->icons},
|
{"icon_theme=", &result->icons},
|
||||||
// FIXME: on older versions this was hex-encoded binary format
|
|
||||||
// (See QVariant notes on https://doc.qt.io/qt-5/qsettings.html)
|
|
||||||
// Thankfully, newer versions use the more common font encoding.
|
|
||||||
{"general=", &result->font}
|
{"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)
|
static void detectKvantum(FFQtResult* result)
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ const char* ffDetectIcons(FFIconsResult* result)
|
|||||||
if(plasma->length > 0)
|
if(plasma->length > 0)
|
||||||
{
|
{
|
||||||
ffStrbufAppend(&result->icons1, plasma);
|
ffStrbufAppend(&result->icons1, plasma);
|
||||||
ffStrbufAppendS(&result->icons1, " [QT]");
|
ffStrbufAppendS(&result->icons1, " [Qt]");
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
struct sockaddr_in* ipv4 = (struct sockaddr_in*) ifa->ifa_addr;
|
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);
|
inet_ntop(AF_INET, &ipv4->sin_addr, addressBuffer, INET_ADDRSTRLEN);
|
||||||
|
|
||||||
if (options->showType & FF_LOCALIP_TYPE_PREFIX_LEN_BIT)
|
if (options->showType & FF_LOCALIP_TYPE_PREFIX_LEN_BIT)
|
||||||
@@ -105,7 +105,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
|
|||||||
if (cidr != 0)
|
if (cidr != 0)
|
||||||
{
|
{
|
||||||
size_t len = strlen(addressBuffer);
|
size_t len = strlen(addressBuffer);
|
||||||
snprintf(addressBuffer + len, 4, "/%d", cidr);
|
snprintf(addressBuffer + len, 16, "/%d", cidr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
struct sockaddr_in6* ipv6 = (struct sockaddr_in6 *)ifa->ifa_addr;
|
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);
|
inet_ntop(AF_INET6, &ipv6->sin6_addr, addressBuffer, INET6_ADDRSTRLEN);
|
||||||
|
|
||||||
if (options->showType & FF_LOCALIP_TYPE_PREFIX_LEN_BIT)
|
if (options->showType & FF_LOCALIP_TYPE_PREFIX_LEN_BIT)
|
||||||
@@ -130,7 +130,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
|
|||||||
if (cidr != 0)
|
if (cidr != 0)
|
||||||
{
|
{
|
||||||
size_t len = strlen(addressBuffer);
|
size_t len = strlen(addressBuffer);
|
||||||
snprintf(addressBuffer + len, 4, "/%d", cidr);
|
snprintf(addressBuffer + len, 16, "/%d", cidr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ const char* ffDetectMemory(FFMemoryResult* ram)
|
|||||||
+ vmstat.compressor_page_count
|
+ vmstat.compressor_page_count
|
||||||
- vmstat.purgeable_count
|
- vmstat.purgeable_count
|
||||||
- vmstat.external_page_count
|
- vmstat.external_page_count
|
||||||
) * instance.state.platform.pageSize;
|
) * instance.state.platform.sysinfo.pageSize;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ const char* ffDetectMemory(FFMemoryResult* ram)
|
|||||||
+ ffSysctlGetInt("vm.stats.vm.v_inactive_count", 0)
|
+ ffSysctlGetInt("vm.stats.vm.v_inactive_count", 0)
|
||||||
+ ffSysctlGetInt("vm.stats.vm.v_cache_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;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,11 +23,11 @@ const char* ffDetectMemory(FFMemoryResult* ram)
|
|||||||
|
|
||||||
{
|
{
|
||||||
kstat_named_t* kn = kstat_data_lookup(ks, "pagestotal");
|
kstat_named_t* kn = kstat_data_lookup(ks, "pagestotal");
|
||||||
ram->bytesTotal = kn->value.ui64 * instance.state.platform.pageSize;
|
ram->bytesTotal = kn->value.ui64 * instance.state.platform.sysinfo.pageSize;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
kstat_named_t* kn = kstat_data_lookup(ks, "pagesfree");
|
kstat_named_t* kn = kstat_data_lookup(ks, "pagesfree");
|
||||||
ram->bytesUsed = ram->bytesTotal - kn->value.ui64 * instance.state.platform.pageSize;
|
ram->bytesUsed = ram->bytesTotal - kn->value.ui64 * instance.state.platform.sysinfo.pageSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -313,19 +313,6 @@ static uint32_t getSnap(FFstrbuf* baseDir)
|
|||||||
return result > 0 ? result - 1 : 0;
|
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
|
#ifdef FF_HAVE_RPM
|
||||||
#include "common/library.h"
|
#include "common/library.h"
|
||||||
#include <rpm/rpmlib.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_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_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_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))
|
if (!(options->disabled & FF_PACKAGES_FLAG_NIX_BIT))
|
||||||
{
|
{
|
||||||
packageCounts->nixDefault += getNixPackages(baseDir, "/nix/var/nix/profiles/default");
|
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))
|
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "physicaldisk.h"
|
#include "physicaldisk.h"
|
||||||
|
|
||||||
const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options)
|
const char* ffDetectPhysicalDisk(FF_MAYBE_UNUSED FFlist* result, FF_MAYBE_UNUSED FFPhysicalDiskOptions* options)
|
||||||
{
|
{
|
||||||
return "Not supported on this platform";
|
return "Not supported on this platform";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,11 +100,11 @@ const char* ffDetectPhysicalMemory(FFlist* result)
|
|||||||
if (data->Size != 0xFFFF)
|
if (data->Size != 0xFFFF)
|
||||||
{
|
{
|
||||||
if (data->Size == 0x7FFF)
|
if (data->Size == 0x7FFF)
|
||||||
device->size = (data->ExtendedSize & ~(1 << 31)) * 1024 * 1024;
|
device->size = (data->ExtendedSize & ~(1ULL << 31)) * 1024ULL * 1024ULL;
|
||||||
else if (data->Size & (1 << 15))
|
else if (data->Size & (1 << 15))
|
||||||
{
|
{
|
||||||
// in kB
|
// in kB
|
||||||
device->size = (data->Size & ~(1u << 15)) * 1024ULL;
|
device->size = (data->Size & ~(1ULL << 15)) * 1024ULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ const char* ffDetectSwap(FFSwapResult* swap)
|
|||||||
swap->bytesTotal += (uint64_t) xsw.xsw_nblks;
|
swap->bytesTotal += (uint64_t) xsw.xsw_nblks;
|
||||||
}
|
}
|
||||||
|
|
||||||
swap->bytesUsed *= instance.state.platform.pageSize;
|
swap->bytesUsed *= instance.state.platform.sysinfo.pageSize;
|
||||||
swap->bytesTotal *= instance.state.platform.pageSize;
|
swap->bytesTotal *= instance.state.platform.sysinfo.pageSize;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ const char* ffDetectSwap(FFSwapResult* swap)
|
|||||||
swap->bytesUsed += (uint64_t) table->swt_ent[i].ste_free;
|
swap->bytesUsed += (uint64_t) table->swt_ent[i].ste_free;
|
||||||
}
|
}
|
||||||
swap->bytesUsed = swap->bytesTotal - swap->bytesUsed;
|
swap->bytesUsed = swap->bytesTotal - swap->bytesUsed;
|
||||||
swap->bytesTotal *= instance.state.platform.pageSize;
|
swap->bytesTotal *= instance.state.platform.sysinfo.pageSize;
|
||||||
swap->bytesUsed *= instance.state.platform.pageSize;
|
swap->bytesUsed *= instance.state.platform.sysinfo.pageSize;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ const char* ffDetectSwap(FFSwapResult* swap)
|
|||||||
if(!NT_SUCCESS(NtQuerySystemInformation(SystemPagefileInformation, pstart, size, &size)))
|
if(!NT_SUCCESS(NtQuerySystemInformation(SystemPagefileInformation, pstart, size, &size)))
|
||||||
return "NtQuerySystemInformation(SystemPagefileInformation, size) failed";
|
return "NtQuerySystemInformation(SystemPagefileInformation, size) failed";
|
||||||
|
|
||||||
uint32_t pageSize = instance.state.platform.pageSize;
|
uint32_t pageSize = instance.state.platform.sysinfo.pageSize;
|
||||||
swap->bytesUsed = (uint64_t)pstart->TotalUsed * pageSize;
|
swap->bytesUsed = (uint64_t)pstart->TotalUsed * pageSize;
|
||||||
swap->bytesTotal = (uint64_t)pstart->CurrentSize * pageSize;
|
swap->bytesTotal = (uint64_t)pstart->CurrentSize * pageSize;
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,26 @@ static void detectKgx(FFTerminalFontResult* terminalFont)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void detectPtyxis(FFTerminalFontResult* terminalFont)
|
||||||
|
{
|
||||||
|
if(!ffSettingsGet("/org/gnome/Ptyxis/use-system-font", "org.gnome.Ptyxis", NULL, "use-system-font", FF_VARIANT_TYPE_BOOL).boolValue)
|
||||||
|
{
|
||||||
|
FF_AUTO_FREE const char* fontName = ffSettingsGet("/org/gnome/Ptyxis/font-name", "org.gnome.Ptyxis", NULL, "font-name", FF_VARIANT_TYPE_STRING).strValue;
|
||||||
|
if(ffStrSet(fontName))
|
||||||
|
ffFontInitPango(&terminalFont->font, fontName);
|
||||||
|
else
|
||||||
|
ffStrbufAppendF(&terminalFont->error, "Couldn't get terminal font from GSettings (org.gnome.Ptyxis::font-name)");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FF_AUTO_FREE const char* fontName = getSystemMonospaceFont();
|
||||||
|
if(ffStrSet(fontName))
|
||||||
|
ffFontInitPango(&terminalFont->font, fontName);
|
||||||
|
else
|
||||||
|
ffStrbufAppendS(&terminalFont->error, "Couldn't get system monospace font name from GSettings / DConf");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void detectFromGSettings(const char* profilePath, const char* profileList, const char* profile, const char* defaultProfileKey, FFTerminalFontResult* terminalFont)
|
static void detectFromGSettings(const char* profilePath, const char* profileList, const char* profile, const char* defaultProfileKey, FFTerminalFontResult* terminalFont)
|
||||||
{
|
{
|
||||||
FF_AUTO_FREE const char* defaultProfile = ffSettingsGetGSettings(profileList, NULL, defaultProfileKey, FF_VARIANT_TYPE_STRING).strValue;
|
FF_AUTO_FREE const char* defaultProfile = ffSettingsGetGSettings(profileList, NULL, defaultProfileKey, FF_VARIANT_TYPE_STRING).strValue;
|
||||||
@@ -386,6 +406,8 @@ void ffDetectTerminalFontPlatform(const FFTerminalResult* terminal, FFTerminalFo
|
|||||||
detectFromGSettings("/com/gexperts/Tilix/profiles/", "com.gexperts.Tilix.ProfilesList", "com.gexperts.Tilix.Profile", "default", terminalFont);
|
detectFromGSettings("/com/gexperts/Tilix/profiles/", "com.gexperts.Tilix.ProfilesList", "com.gexperts.Tilix.Profile", "default", terminalFont);
|
||||||
else if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "gnome-terminal"))
|
else if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "gnome-terminal"))
|
||||||
detectFromGSettings("/org/gnome/terminal/legacy/profiles:/:", "org.gnome.Terminal.ProfilesList", "org.gnome.Terminal.Legacy.Profile", "default", terminalFont);
|
detectFromGSettings("/org/gnome/terminal/legacy/profiles:/:", "org.gnome.Terminal.ProfilesList", "org.gnome.Terminal.Legacy.Profile", "default", terminalFont);
|
||||||
|
else if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "ptyxis-agent"))
|
||||||
|
detectPtyxis(terminalFont);
|
||||||
else if(ffStrbufIgnCaseEqualS(&terminal->processName, "kgx"))
|
else if(ffStrbufIgnCaseEqualS(&terminal->processName, "kgx"))
|
||||||
detectKgx(terminalFont);
|
detectKgx(terminalFont);
|
||||||
else if(ffStrbufIgnCaseEqualS(&terminal->processName, "mate-terminal"))
|
else if(ffStrbufIgnCaseEqualS(&terminal->processName, "mate-terminal"))
|
||||||
|
|||||||
@@ -499,6 +499,20 @@ static bool getTerminalVersionKitty(FFstrbuf* exe, FFstrbuf* version)
|
|||||||
//kitty 0.21.2 created by Kovid Goyal
|
//kitty 0.21.2 created by Kovid Goyal
|
||||||
return getExeVersionGeneral(exe, version);
|
return getExeVersionGeneral(exe, version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FF_MAYBE_UNUSED static bool getTerminalVersionPtyxis(FF_MAYBE_UNUSED FFstrbuf* exe, FFstrbuf* version)
|
||||||
|
{
|
||||||
|
if(ffProcessAppendStdOut(version, (char* const[]) {
|
||||||
|
"ptyxis",
|
||||||
|
"--version",
|
||||||
|
NULL
|
||||||
|
}) != NULL)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
ffStrbufSubstrBeforeFirstC(version, '\n');
|
||||||
|
ffStrbufSubstrAfterFirstC(version, ' ');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@@ -595,6 +609,9 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe
|
|||||||
)
|
)
|
||||||
return getTerminalVersionUrxvt(exe, version);
|
return getTerminalVersionUrxvt(exe, version);
|
||||||
|
|
||||||
|
if(ffStrbufIgnCaseEqualS(processName, "ptyxis-agent"))
|
||||||
|
return getTerminalVersionPtyxis(exe, version);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|||||||
@@ -331,6 +331,8 @@ static void setTerminalInfoDetails(FFTerminalResult* result)
|
|||||||
ffStrbufEqualS(&result->processName, "rxvt")
|
ffStrbufEqualS(&result->processName, "rxvt")
|
||||||
)
|
)
|
||||||
ffStrbufInitStatic(&result->prettyName, "rxvt-unicode");
|
ffStrbufInitStatic(&result->prettyName, "rxvt-unicode");
|
||||||
|
else if(ffStrbufStartsWithS(&result->processName, "ptyxis-agent"))
|
||||||
|
ffStrbufInitStatic(&result->prettyName, "Ptyxis");
|
||||||
|
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ const char* ffDetectTheme(FFThemeResult* result)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(plasma->widgetStyle.length > 0 || plasma->colorScheme.length > 0)
|
if(plasma->widgetStyle.length > 0 || plasma->colorScheme.length > 0)
|
||||||
ffStrbufAppendS(&result->theme1, " [QT]");
|
ffStrbufAppendS(&result->theme1, " [Qt]");
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,43 +20,61 @@
|
|||||||
#define FF_ARCHITECTURE "unknown"
|
#define FF_ARCHITECTURE "unknown"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(__linux__)
|
||||||
|
#define FF_SYSNAME "Linux"
|
||||||
|
#elif defined(__FreeBSD__)
|
||||||
|
#define FF_SYSNAME "FreeBSD"
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
#define FF_SYSNAME "Darwin"
|
||||||
|
#elif defined(_WIN32)
|
||||||
|
#define FF_SYSNAME "WIN32"
|
||||||
|
#elif defined(__sun)
|
||||||
|
#define FF_SYSNAME "SunOS"
|
||||||
|
#else
|
||||||
|
#define FF_SYSNAME "unknown"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define FF_STR_INDIR(x) #x
|
#define FF_STR_INDIR(x) #x
|
||||||
#define FF_STR(x) FF_STR_INDIR(x)
|
#define FF_STR(x) FF_STR_INDIR(x)
|
||||||
|
|
||||||
void ffDetectVersion(FFVersionResult* version)
|
FFVersionResult ffVersionResult = {
|
||||||
{
|
.projectName = FASTFETCH_PROJECT_NAME,
|
||||||
version->projectName = FASTFETCH_PROJECT_NAME;
|
.sysName = FF_SYSNAME,
|
||||||
version->architecture = FF_ARCHITECTURE;
|
.architecture = FF_ARCHITECTURE,
|
||||||
version->version = FASTFETCH_PROJECT_VERSION;
|
.version = FASTFETCH_PROJECT_VERSION,
|
||||||
version->versionTweak = FASTFETCH_PROJECT_VERSION_TWEAK;
|
.versionTweak = FASTFETCH_PROJECT_VERSION_TWEAK,
|
||||||
version->cmakeBuiltType = FASTFETCH_PROJECT_CMAKE_BUILD_TYPE;
|
.cmakeBuiltType = FASTFETCH_PROJECT_CMAKE_BUILD_TYPE,
|
||||||
version->compileTime = __DATE__ ", " __TIME__;
|
.compileTime = __DATE__ ", " __TIME__,
|
||||||
|
.compiler =
|
||||||
|
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
version->compiler =
|
#ifdef _MSC_VER
|
||||||
#ifdef _MSC_VER
|
"clang-cl " ;
|
||||||
"clang-cl " ;
|
#elif defined(__APPLE__) && defined(__apple_build_version__)
|
||||||
#elif defined(__APPLE__) && defined(__apple_build_version__)
|
"Apple clang "
|
||||||
"Apple clang "
|
#else
|
||||||
#else
|
"clang "
|
||||||
"clang "
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
FF_STR(__clang_major__) "." FF_STR(__clang_minor__) "." FF_STR(__clang_patchlevel__)
|
FF_STR(__clang_major__) "." FF_STR(__clang_minor__) "." FF_STR(__clang_patchlevel__)
|
||||||
|
|
||||||
#if defined(__APPLE__) && defined(__apple_build_version__)
|
#if defined(__APPLE__) && defined(__apple_build_version__)
|
||||||
" (" FF_STR(__apple_build_version__) ")"
|
" (" FF_STR(__apple_build_version__) ")"
|
||||||
#endif
|
#endif
|
||||||
;
|
,
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
version->compiler = "gcc " FF_STR(__GNUC__) "." FF_STR(__GNUC_MINOR__) "." FF_STR(__GNUC_PATCHLEVEL__);
|
"gcc " FF_STR(__GNUC__) "." FF_STR(__GNUC_MINOR__) "." FF_STR(__GNUC_PATCHLEVEL__),
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(_MSC_VER)
|
||||||
version->compiler = "msvc " FF_STR(_MSC_VER);
|
"msvc " FF_STR(_MSC_VER),
|
||||||
#else
|
#else
|
||||||
version->compiler = "unknown";
|
"unknown",
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
.debugMode =
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
version->debugMode = true;
|
true,
|
||||||
#else
|
#else
|
||||||
version->debugMode = false;
|
false,
|
||||||
#endif
|
#endif
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
typedef struct FFVersionResult
|
typedef struct FFVersionResult
|
||||||
{
|
{
|
||||||
const char* projectName;
|
const char* projectName;
|
||||||
|
const char* sysName;
|
||||||
const char* architecture;
|
const char* architecture;
|
||||||
const char* version;
|
const char* version;
|
||||||
const char* versionTweak;
|
const char* versionTweak;
|
||||||
@@ -14,4 +15,4 @@ typedef struct FFVersionResult
|
|||||||
bool debugMode;
|
bool debugMode;
|
||||||
} FFVersionResult;
|
} FFVersionResult;
|
||||||
|
|
||||||
void ffDetectVersion(FFVersionResult* version);
|
extern FFVersionResult ffVersionResult;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "wifi.h"
|
#include "wifi.h"
|
||||||
|
|
||||||
const char* ffDetectWifi(FFlist* result)
|
const char* ffDetectWifi(FF_MAYBE_UNUSED FFlist* result)
|
||||||
{
|
{
|
||||||
return "Not support on this platform";
|
return "Not support on this platform";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ static bool detectOpenbox(const FFstrbuf* dePrettyName, FFstrbuf* themeOrError)
|
|||||||
{
|
{
|
||||||
FF_STRBUF_AUTO_DESTROY absolutePath = ffStrbufCreateA(64);
|
FF_STRBUF_AUTO_DESTROY absolutePath = ffStrbufCreateA(64);
|
||||||
const char *configFileSubpath = "openbox/rc.xml";
|
const char *configFileSubpath = "openbox/rc.xml";
|
||||||
if (ffStrbufIgnCaseCompS(dePrettyName, "LXQT") == 0)
|
if (ffStrbufIgnCaseCompS(dePrettyName, "LXQt") == 0)
|
||||||
configFileSubpath = "openbox/lxqt-rc.xml";
|
configFileSubpath = "openbox/lxqt-rc.xml";
|
||||||
else if (ffStrbufIgnCaseCompS(dePrettyName, "LXDE") == 0)
|
else if (ffStrbufIgnCaseCompS(dePrettyName, "LXDE") == 0)
|
||||||
configFileSubpath = "openbox/lxde-rc.xml";
|
configFileSubpath = "openbox/lxde-rc.xml";
|
||||||
|
|||||||
+2
-3
@@ -501,9 +501,8 @@ static void optionParseConfigFile(FFdata* data, const char* key, const char* val
|
|||||||
|
|
||||||
static void printVersion()
|
static void printVersion()
|
||||||
{
|
{
|
||||||
FFVersionResult result = {};
|
FFVersionResult* result = &ffVersionResult;
|
||||||
ffDetectVersion(&result);
|
printf("%s %s%s%s (%s)\n", result->projectName, result->version, result->versionTweak, result->debugMode ? "-debug" : "", result->architecture);
|
||||||
printf("%s %s%s%s (%s)\n", result.projectName, result.version, result.versionTweak, result.debugMode ? "-debug" : "", result.architecture);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void parseCommand(FFdata* data, char* key, char* value)
|
static void parseCommand(FFdata* data, char* key, char* value)
|
||||||
|
|||||||
+12
-5
@@ -12,6 +12,8 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#elif __linux__
|
#elif __linux__
|
||||||
#include <sys/sendfile.h>
|
#include <sys/sendfile.h>
|
||||||
|
#elif __sun
|
||||||
|
#include <sys/termios.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// https://github.com/kostya/benchmarks/blob/master/base64/test-nolib.c#L145
|
// https://github.com/kostya/benchmarks/blob/master/base64/test-nolib.c#L145
|
||||||
@@ -670,15 +672,20 @@ FFLogoImageResult ffLogoPrintImageImpl(FFLogoRequestData* requestData, const FFI
|
|||||||
return printSuccessful ? FF_LOGO_IMAGE_RESULT_SUCCESS : FF_LOGO_IMAGE_RESULT_RUN_ERROR;
|
return printSuccessful ? FF_LOGO_IMAGE_RESULT_SUCCESS : FF_LOGO_IMAGE_RESULT_RUN_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int getCacheFD(FFLogoRequestData* requestData, const char* fileName)
|
static FFNativeFD getCacheFD(FFLogoRequestData* requestData, const char* fileName)
|
||||||
{
|
{
|
||||||
uint32_t cacheDirLength = requestData->cacheDir.length;
|
uint32_t cacheDirLength = requestData->cacheDir.length;
|
||||||
ffStrbufAppendS(&requestData->cacheDir, fileName);
|
ffStrbufAppendS(&requestData->cacheDir, fileName);
|
||||||
|
#ifndef _WIN32
|
||||||
int fd = open(requestData->cacheDir.chars, O_RDONLY
|
int fd = open(requestData->cacheDir.chars, O_RDONLY
|
||||||
#ifdef O_CLOEXEC
|
#ifdef O_CLOEXEC
|
||||||
| O_CLOEXEC
|
| O_CLOEXEC
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
|
#else
|
||||||
|
HANDLE fd = CreateFileA(requestData->cacheDir.chars, GENERIC_READ,
|
||||||
|
FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
|
#endif
|
||||||
ffStrbufSubstrBefore(&requestData->cacheDir, cacheDirLength);
|
ffStrbufSubstrBefore(&requestData->cacheDir, cacheDirLength);
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
@@ -740,17 +747,17 @@ static bool printCachedPixel(FFLogoRequestData* requestData)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
FF_AUTO_CLOSE_FD int fd = -1;
|
FF_AUTO_CLOSE_FD FFNativeFD fd = FF_INVALID_FD;
|
||||||
if(requestData->type == FF_LOGO_TYPE_IMAGE_KITTY)
|
if(requestData->type == FF_LOGO_TYPE_IMAGE_KITTY)
|
||||||
{
|
{
|
||||||
fd = getCacheFD(requestData, FF_CACHE_FILE_KITTY_COMPRESSED);
|
fd = getCacheFD(requestData, FF_CACHE_FILE_KITTY_COMPRESSED);
|
||||||
if(fd == -1)
|
if(fd == FF_INVALID_FD)
|
||||||
fd = getCacheFD(requestData, FF_CACHE_FILE_KITTY_UNCOMPRESSED);
|
fd = getCacheFD(requestData, FF_CACHE_FILE_KITTY_UNCOMPRESSED);
|
||||||
}
|
}
|
||||||
else if(requestData->type == FF_LOGO_TYPE_IMAGE_SIXEL)
|
else if(requestData->type == FF_LOGO_TYPE_IMAGE_SIXEL)
|
||||||
fd = getCacheFD(requestData, FF_CACHE_FILE_SIXEL);
|
fd = getCacheFD(requestData, FF_CACHE_FILE_SIXEL);
|
||||||
|
|
||||||
if(fd == -1)
|
if(fd == FF_INVALID_FD)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ffPrintCharTimes('\n', options->paddingTop);
|
ffPrintCharTimes('\n', options->paddingTop);
|
||||||
@@ -783,7 +790,7 @@ static bool printCachedPixel(FFLogoRequestData* requestData)
|
|||||||
{
|
{
|
||||||
char buffer[32768];
|
char buffer[32768];
|
||||||
ssize_t readBytes;
|
ssize_t readBytes;
|
||||||
while((readBytes = ffReadFDData(FFUnixFD2NativeFD(fd), sizeof(buffer), buffer)) > 0)
|
while((readBytes = ffReadFDData(fd, sizeof(buffer), buffer)) > 0)
|
||||||
ffWriteFDData(FFUnixFD2NativeFD(STDOUT_FILENO), (size_t) readBytes, buffer);
|
ffWriteFDData(FFUnixFD2NativeFD(STDOUT_FILENO), (size_t) readBytes, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -340,7 +340,7 @@ static const FFlogo* logoGetBuiltinDetected(FFLogoSize size)
|
|||||||
if(logo != NULL)
|
if(logo != NULL)
|
||||||
return logo;
|
return logo;
|
||||||
|
|
||||||
logo = logoGetBuiltin(&instance.state.platform.systemName, size);
|
logo = logoGetBuiltin(&instance.state.platform.sysinfo.name, size);
|
||||||
if(logo != NULL)
|
if(logo != NULL)
|
||||||
return logo;
|
return logo;
|
||||||
|
|
||||||
|
|||||||
@@ -94,8 +94,8 @@ void ffPrintBattery(FFBatteryOptions* options)
|
|||||||
|
|
||||||
for(uint32_t i = 0; i < results.length; i++)
|
for(uint32_t i = 0; i < results.length; i++)
|
||||||
{
|
{
|
||||||
FFBatteryResult* result = ffListGet(&results, i);
|
FFBatteryResult* result = FF_LIST_GET(FFBatteryResult, results, i);
|
||||||
printBattery(options, result, (uint8_t) i);
|
printBattery(options, result, results.length == 1 ? 0 : (uint8_t) (i + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
FF_LIST_FOR_EACH(FFBatteryResult, result, results)
|
FF_LIST_FOR_EACH(FFBatteryResult, result, results)
|
||||||
|
|||||||
+13
-4
@@ -75,6 +75,15 @@ static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResu
|
|||||||
{
|
{
|
||||||
FF_STRBUF_AUTO_DESTROY tempStr = ffStrbufCreate();
|
FF_STRBUF_AUTO_DESTROY tempStr = ffStrbufCreate();
|
||||||
ffTempsAppendNum(gpu->temperature, &tempStr, options->tempConfig, &options->moduleArgs);
|
ffTempsAppendNum(gpu->temperature, &tempStr, options->tempConfig, &options->moduleArgs);
|
||||||
|
FF_STRBUF_AUTO_DESTROY dTotal = ffStrbufCreate();
|
||||||
|
FF_STRBUF_AUTO_DESTROY dUsed = ffStrbufCreate();
|
||||||
|
FF_STRBUF_AUTO_DESTROY sTotal = ffStrbufCreate();
|
||||||
|
FF_STRBUF_AUTO_DESTROY sUsed = ffStrbufCreate();
|
||||||
|
if (gpu->dedicated.total != FF_GPU_VMEM_SIZE_UNSET) ffParseSize(gpu->dedicated.total, &dTotal);
|
||||||
|
if (gpu->dedicated.used != FF_GPU_VMEM_SIZE_UNSET) ffParseSize(gpu->dedicated.used, &dUsed);
|
||||||
|
if (gpu->shared.total != FF_GPU_VMEM_SIZE_UNSET) ffParseSize(gpu->shared.total, &sTotal);
|
||||||
|
if (gpu->shared.used != FF_GPU_VMEM_SIZE_UNSET) ffParseSize(gpu->shared.used, &sUsed);
|
||||||
|
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_GPU_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_GPU_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
FF_PRINT_FORMAT_CHECKED(FF_GPU_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_GPU_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
||||||
{FF_FORMAT_ARG_TYPE_STRBUF, &gpu->vendor, "vendor"},
|
{FF_FORMAT_ARG_TYPE_STRBUF, &gpu->vendor, "vendor"},
|
||||||
{FF_FORMAT_ARG_TYPE_STRBUF, &gpu->name, "name"},
|
{FF_FORMAT_ARG_TYPE_STRBUF, &gpu->name, "name"},
|
||||||
@@ -82,10 +91,10 @@ static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResu
|
|||||||
{FF_FORMAT_ARG_TYPE_STRBUF, &tempStr, "temperature"},
|
{FF_FORMAT_ARG_TYPE_STRBUF, &tempStr, "temperature"},
|
||||||
{FF_FORMAT_ARG_TYPE_INT, &gpu->coreCount, "core-count"},
|
{FF_FORMAT_ARG_TYPE_INT, &gpu->coreCount, "core-count"},
|
||||||
{FF_FORMAT_ARG_TYPE_STRING, type, "type"},
|
{FF_FORMAT_ARG_TYPE_STRING, type, "type"},
|
||||||
{FF_FORMAT_ARG_TYPE_UINT64, &gpu->dedicated.total, "dedicated-total"},
|
{FF_FORMAT_ARG_TYPE_STRBUF, &dTotal, "dedicated-total"},
|
||||||
{FF_FORMAT_ARG_TYPE_UINT64, &gpu->dedicated.used, "dedicated-used"},
|
{FF_FORMAT_ARG_TYPE_STRBUF, &dUsed, "dedicated-used"},
|
||||||
{FF_FORMAT_ARG_TYPE_UINT64, &gpu->shared.total, "shared-total"},
|
{FF_FORMAT_ARG_TYPE_STRBUF, &sTotal, "shared-total"},
|
||||||
{FF_FORMAT_ARG_TYPE_UINT64, &gpu->shared.used, "shared-used"},
|
{FF_FORMAT_ARG_TYPE_STRBUF, &sUsed, "shared-used"},
|
||||||
{FF_FORMAT_ARG_TYPE_STRBUF, &gpu->platformApi, "platform-api"},
|
{FF_FORMAT_ARG_TYPE_STRBUF, &gpu->platformApi, "platform-api"},
|
||||||
{FF_FORMAT_ARG_TYPE_DOUBLE, &gpu->frequency, "frequency"},
|
{FF_FORMAT_ARG_TYPE_DOUBLE, &gpu->frequency, "frequency"},
|
||||||
}));
|
}));
|
||||||
|
|||||||
+22
-15
@@ -3,29 +3,32 @@
|
|||||||
#include "modules/kernel/kernel.h"
|
#include "modules/kernel/kernel.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_KERNEL_NUM_FORMAT_ARGS 5
|
#define FF_KERNEL_NUM_FORMAT_ARGS 6
|
||||||
|
|
||||||
void ffPrintKernel(FFKernelOptions* options)
|
void ffPrintKernel(FFKernelOptions* options)
|
||||||
{
|
{
|
||||||
const FFPlatform* platform = &instance.state.platform;
|
const FFPlatformSysinfo* info = &instance.state.platform.sysinfo;
|
||||||
if(options->moduleArgs.outputFormat.length == 0)
|
if(options->moduleArgs.outputFormat.length == 0)
|
||||||
{
|
{
|
||||||
ffPrintLogoAndKey(FF_KERNEL_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT);
|
ffPrintLogoAndKey(FF_KERNEL_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT);
|
||||||
printf("%s %s", platform->systemName.chars, platform->systemRelease.chars);
|
printf("%s %s", info->name.chars, info->release.chars);
|
||||||
|
|
||||||
if(platform->systemDisplayVersion.length > 0)
|
if(info->displayVersion.length > 0)
|
||||||
printf(" (%s)\n", platform->systemDisplayVersion.chars);
|
printf(" (%s)\n", info->displayVersion.chars);
|
||||||
else
|
else
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
FF_STRBUF_AUTO_DESTROY str = ffStrbufCreate();
|
||||||
|
ffParseSize(info->pageSize, &str);
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_KERNEL_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_KERNEL_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
FF_PRINT_FORMAT_CHECKED(FF_KERNEL_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_KERNEL_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
||||||
{FF_FORMAT_ARG_TYPE_STRBUF, &platform->systemName, "sysname"},
|
{FF_FORMAT_ARG_TYPE_STRBUF, &info->name, "sysname"},
|
||||||
{FF_FORMAT_ARG_TYPE_STRBUF, &platform->systemRelease, "release"},
|
{FF_FORMAT_ARG_TYPE_STRBUF, &info->release, "release"},
|
||||||
{FF_FORMAT_ARG_TYPE_STRBUF, &platform->systemVersion, "version"},
|
{FF_FORMAT_ARG_TYPE_STRBUF, &info->version, "version"},
|
||||||
{FF_FORMAT_ARG_TYPE_STRBUF, &platform->systemArchitecture, "arch"},
|
{FF_FORMAT_ARG_TYPE_STRBUF, &info->architecture, "arch"},
|
||||||
{FF_FORMAT_ARG_TYPE_STRBUF, &platform->systemDisplayVersion, "display-version"},
|
{FF_FORMAT_ARG_TYPE_STRBUF, &info->displayVersion, "display-version"},
|
||||||
|
{FF_FORMAT_ARG_TYPE_STRBUF, &str, "page-size"},
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -67,12 +70,15 @@ void ffGenerateKernelJsonConfig(FFKernelOptions* options, yyjson_mut_doc* doc, y
|
|||||||
|
|
||||||
void ffGenerateKernelJsonResult(FF_MAYBE_UNUSED FFKernelOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
|
void ffGenerateKernelJsonResult(FF_MAYBE_UNUSED FFKernelOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
|
||||||
{
|
{
|
||||||
|
const FFPlatformSysinfo* info = &instance.state.platform.sysinfo;
|
||||||
|
|
||||||
yyjson_mut_val* obj = yyjson_mut_obj_add_obj(doc, module, "result");
|
yyjson_mut_val* obj = yyjson_mut_obj_add_obj(doc, module, "result");
|
||||||
yyjson_mut_obj_add_strbuf(doc, obj, "architecture", &instance.state.platform.systemArchitecture);
|
yyjson_mut_obj_add_strbuf(doc, obj, "architecture", &info->architecture);
|
||||||
yyjson_mut_obj_add_strbuf(doc, obj, "name", &instance.state.platform.systemName);
|
yyjson_mut_obj_add_strbuf(doc, obj, "name", &info->name);
|
||||||
yyjson_mut_obj_add_strbuf(doc, obj, "release", &instance.state.platform.systemRelease);
|
yyjson_mut_obj_add_strbuf(doc, obj, "release", &info->release);
|
||||||
yyjson_mut_obj_add_strbuf(doc, obj, "version", &instance.state.platform.systemVersion);
|
yyjson_mut_obj_add_strbuf(doc, obj, "version", &info->version);
|
||||||
yyjson_mut_obj_add_strbuf(doc, obj, "displayVersion", &instance.state.platform.systemDisplayVersion);
|
yyjson_mut_obj_add_strbuf(doc, obj, "displayVersion", &info->displayVersion);
|
||||||
|
yyjson_mut_obj_add_uint(doc, obj, "pageSize", info->pageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintKernelHelpFormat(void)
|
void ffPrintKernelHelpFormat(void)
|
||||||
@@ -83,6 +89,7 @@ void ffPrintKernelHelpFormat(void)
|
|||||||
"Version - version",
|
"Version - version",
|
||||||
"Architecture - arch",
|
"Architecture - arch",
|
||||||
"Display version - display-version",
|
"Display version - display-version",
|
||||||
|
"Page size - page-size",
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-7
@@ -19,7 +19,7 @@ static void buildOutputDefault(const FFOSResult* os, FFstrbuf* result)
|
|||||||
else if(os->id.length > 0)
|
else if(os->id.length > 0)
|
||||||
ffStrbufAppend(result, &os->id);
|
ffStrbufAppend(result, &os->id);
|
||||||
else
|
else
|
||||||
ffStrbufAppend(result, &instance.state.platform.systemName);
|
ffStrbufAppend(result, &instance.state.platform.sysinfo.name);
|
||||||
|
|
||||||
//Append code name if it is missing
|
//Append code name if it is missing
|
||||||
if(os->codename.length > 0 && !ffStrbufContainIgnCase(result, &os->codename))
|
if(os->codename.length > 0 && !ffStrbufContainIgnCase(result, &os->codename))
|
||||||
@@ -55,10 +55,10 @@ static void buildOutputDefault(const FFOSResult* os, FFstrbuf* result)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Append architecture if it is missing
|
//Append architecture if it is missing
|
||||||
if(!ffStrbufContainIgnCase(result, &instance.state.platform.systemArchitecture))
|
if(!ffStrbufContainIgnCase(result, &instance.state.platform.sysinfo.architecture))
|
||||||
{
|
{
|
||||||
ffStrbufAppendC(result, ' ');
|
ffStrbufAppendC(result, ' ');
|
||||||
ffStrbufAppend(result, &instance.state.platform.systemArchitecture);
|
ffStrbufAppend(result, &instance.state.platform.sysinfo.architecture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,10 +80,10 @@ static void buildOutputNixOS(const FFOSResult* os, FFstrbuf* result)
|
|||||||
ffStrbufAppendC(result, ')');
|
ffStrbufAppendC(result, ')');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(instance.state.platform.systemArchitecture.length > 0)
|
if(instance.state.platform.sysinfo.architecture.length > 0)
|
||||||
{
|
{
|
||||||
ffStrbufAppendC(result, ' ');
|
ffStrbufAppendC(result, ' ');
|
||||||
ffStrbufAppend(result, &instance.state.platform.systemArchitecture);
|
ffStrbufAppend(result, &instance.state.platform.sysinfo.architecture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ void ffPrintOS(FFOSOptions* options)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_OS_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_OS_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
FF_PRINT_FORMAT_CHECKED(FF_OS_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_OS_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
||||||
{FF_FORMAT_ARG_TYPE_STRBUF, &instance.state.platform.systemName, "sysname"},
|
{FF_FORMAT_ARG_TYPE_STRBUF, &instance.state.platform.sysinfo.name, "sysname"},
|
||||||
{FF_FORMAT_ARG_TYPE_STRBUF, &os->name, "name"},
|
{FF_FORMAT_ARG_TYPE_STRBUF, &os->name, "name"},
|
||||||
{FF_FORMAT_ARG_TYPE_STRBUF, &os->prettyName, "pretty-name"},
|
{FF_FORMAT_ARG_TYPE_STRBUF, &os->prettyName, "pretty-name"},
|
||||||
{FF_FORMAT_ARG_TYPE_STRBUF, &os->id, "id"},
|
{FF_FORMAT_ARG_TYPE_STRBUF, &os->id, "id"},
|
||||||
@@ -123,7 +123,7 @@ void ffPrintOS(FFOSOptions* options)
|
|||||||
{FF_FORMAT_ARG_TYPE_STRBUF, &os->versionID, "version-id"},
|
{FF_FORMAT_ARG_TYPE_STRBUF, &os->versionID, "version-id"},
|
||||||
{FF_FORMAT_ARG_TYPE_STRBUF, &os->codename, "codename"},
|
{FF_FORMAT_ARG_TYPE_STRBUF, &os->codename, "codename"},
|
||||||
{FF_FORMAT_ARG_TYPE_STRBUF, &os->buildID, "build-id"},
|
{FF_FORMAT_ARG_TYPE_STRBUF, &os->buildID, "build-id"},
|
||||||
{FF_FORMAT_ARG_TYPE_STRBUF, &instance.state.platform.systemArchitecture, "arch"}
|
{FF_FORMAT_ARG_TYPE_STRBUF, &instance.state.platform.sysinfo.architecture, "arch"}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -425,8 +425,8 @@ void ffPrintPackagesHelpFormat(void)
|
|||||||
"Number of nix-default packages - nix-default",
|
"Number of nix-default packages - nix-default",
|
||||||
"Number of apk packages - apk",
|
"Number of apk packages - apk",
|
||||||
"Number of pkg packages - pkg",
|
"Number of pkg packages - pkg",
|
||||||
"Number of flatpak-system packages - flatpak-system",
|
"Number of flatpak-system app packages - flatpak-system",
|
||||||
"Number of flatpak-user packages - flatpak-user",
|
"Number of flatpak-user app packages - flatpak-user",
|
||||||
"Number of snap packages - snap",
|
"Number of snap packages - snap",
|
||||||
"Number of brew packages - brew",
|
"Number of brew packages - brew",
|
||||||
"Number of brew-cask packages - brew-cask",
|
"Number of brew-cask packages - brew-cask",
|
||||||
@@ -445,7 +445,7 @@ void ffPrintPackagesHelpFormat(void)
|
|||||||
"Number of guix-user packages - guix-user",
|
"Number of guix-user packages - guix-user",
|
||||||
"Number of guix-home packages - guix-home",
|
"Number of guix-home packages - guix-home",
|
||||||
"Total number of all nix packages - nix-all",
|
"Total number of all nix packages - nix-all",
|
||||||
"Total number of all flatpak packages - flatpak-all",
|
"Total number of all flatpak app packages - flatpak-all",
|
||||||
"Total number of all brew packages - brew-all",
|
"Total number of all brew packages - brew-all",
|
||||||
"Total number of all guix packages - guix-all",
|
"Total number of all guix packages - guix-all",
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ void ffPrintPhysicalMemory(FFPhysicalMemoryOptions* options)
|
|||||||
}
|
}
|
||||||
|
|
||||||
FF_STRBUF_AUTO_DESTROY prettySize = ffStrbufCreate();
|
FF_STRBUF_AUTO_DESTROY prettySize = ffStrbufCreate();
|
||||||
FF_STRBUF_AUTO_DESTROY key = ffStrbufCreate();
|
|
||||||
|
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
FF_LIST_FOR_EACH(FFPhysicalMemoryResult, device, result)
|
FF_LIST_FOR_EACH(FFPhysicalMemoryResult, device, result)
|
||||||
|
|||||||
@@ -176,7 +176,6 @@ void ffGenerateTitleJsonResult(FF_MAYBE_UNUSED FFTitleOptions* options, yyjson_m
|
|||||||
yyjson_mut_obj_add_strbuf(doc, obj, "homeDir", &instance.state.platform.homeDir);
|
yyjson_mut_obj_add_strbuf(doc, obj, "homeDir", &instance.state.platform.homeDir);
|
||||||
yyjson_mut_obj_add_strbuf(doc, obj, "exePath", &instance.state.platform.exePath);
|
yyjson_mut_obj_add_strbuf(doc, obj, "exePath", &instance.state.platform.exePath);
|
||||||
yyjson_mut_obj_add_strbuf(doc, obj, "userShell", &instance.state.platform.userShell);
|
yyjson_mut_obj_add_strbuf(doc, obj, "userShell", &instance.state.platform.userShell);
|
||||||
yyjson_mut_obj_add_uint(doc, obj, "pageSize", instance.state.platform.pageSize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintTitleHelpFormat(void)
|
void ffPrintTitleHelpFormat(void)
|
||||||
|
|||||||
@@ -5,17 +5,16 @@
|
|||||||
#include "modules/version/version.h"
|
#include "modules/version/version.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_VERSION_NUM_FORMAT_ARGS 9
|
#define FF_VERSION_NUM_FORMAT_ARGS 10
|
||||||
|
|
||||||
void ffPrintVersion(FFVersionOptions* options)
|
void ffPrintVersion(FFVersionOptions* options)
|
||||||
{
|
{
|
||||||
FFVersionResult result;
|
FFVersionResult* result = &ffVersionResult;
|
||||||
ffDetectVersion(&result);
|
|
||||||
|
|
||||||
if(options->moduleArgs.outputFormat.length == 0)
|
if(options->moduleArgs.outputFormat.length == 0)
|
||||||
{
|
{
|
||||||
ffPrintLogoAndKey(FF_VERSION_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT);
|
ffPrintLogoAndKey(FF_VERSION_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT);
|
||||||
printf("%s %s%s%s (%s)\n", result.projectName, result.version, result.versionTweak, result.debugMode ? "-debug" : "", result.architecture);
|
printf("%s %s%s%s (%s)\n", result->projectName, result->version, result->versionTweak, result->debugMode ? "-debug" : "", result->architecture);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -32,14 +31,15 @@ void ffPrintVersion(FFVersionOptions* options)
|
|||||||
}
|
}
|
||||||
|
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_VERSION_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_VERSION_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
FF_PRINT_FORMAT_CHECKED(FF_VERSION_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_VERSION_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
||||||
{FF_FORMAT_ARG_TYPE_STRING, result.projectName, "project-name"},
|
{FF_FORMAT_ARG_TYPE_STRING, result->projectName, "project-name"},
|
||||||
{FF_FORMAT_ARG_TYPE_STRING, result.version, "version"},
|
{FF_FORMAT_ARG_TYPE_STRING, result->version, "version"},
|
||||||
{FF_FORMAT_ARG_TYPE_STRING, result.versionTweak, "version-tweak"},
|
{FF_FORMAT_ARG_TYPE_STRING, result->versionTweak, "version-tweak"},
|
||||||
{FF_FORMAT_ARG_TYPE_STRING, result.debugMode ? "debug" : "release", "build-type"},
|
{FF_FORMAT_ARG_TYPE_STRING, result->debugMode ? "debug" : "release", "build-type"},
|
||||||
{FF_FORMAT_ARG_TYPE_STRING, result.architecture, "arch"},
|
{FF_FORMAT_ARG_TYPE_STRING, result->sysName, "sysname"},
|
||||||
{FF_FORMAT_ARG_TYPE_STRING, result.cmakeBuiltType, "cmake-built-type"},
|
{FF_FORMAT_ARG_TYPE_STRING, result->architecture, "arch"},
|
||||||
{FF_FORMAT_ARG_TYPE_STRING, result.compileTime, "compile-time"},
|
{FF_FORMAT_ARG_TYPE_STRING, result->cmakeBuiltType, "cmake-built-type"},
|
||||||
{FF_FORMAT_ARG_TYPE_STRING, result.compiler, "compiler"},
|
{FF_FORMAT_ARG_TYPE_STRING, result->compileTime, "compile-time"},
|
||||||
|
{FF_FORMAT_ARG_TYPE_STRING, result->compiler, "compiler"},
|
||||||
{FF_FORMAT_ARG_TYPE_STRBUF, &buf, "libc-used"},
|
{FF_FORMAT_ARG_TYPE_STRBUF, &buf, "libc-used"},
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@@ -82,18 +82,18 @@ void ffGenerateVersionJsonConfig(FFVersionOptions* options, yyjson_mut_doc* doc,
|
|||||||
|
|
||||||
void ffGenerateVersionJsonResult(FF_MAYBE_UNUSED FFVersionOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
|
void ffGenerateVersionJsonResult(FF_MAYBE_UNUSED FFVersionOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
|
||||||
{
|
{
|
||||||
FFVersionResult result;
|
FFVersionResult* result = &ffVersionResult;
|
||||||
ffDetectVersion(&result);
|
|
||||||
|
|
||||||
yyjson_mut_val* obj = yyjson_mut_obj_add_obj(doc, module, "result");
|
yyjson_mut_val* obj = yyjson_mut_obj_add_obj(doc, module, "result");
|
||||||
yyjson_mut_obj_add_str(doc, obj, "projectName", result.projectName);
|
yyjson_mut_obj_add_str(doc, obj, "projectName", result->projectName);
|
||||||
yyjson_mut_obj_add_str(doc, obj, "architecture", result.architecture);
|
yyjson_mut_obj_add_str(doc, obj, "sysName", result->sysName);
|
||||||
yyjson_mut_obj_add_str(doc, obj, "version", result.version);
|
yyjson_mut_obj_add_str(doc, obj, "architecture", result->architecture);
|
||||||
yyjson_mut_obj_add_str(doc, obj, "versionTweak", result.versionTweak);
|
yyjson_mut_obj_add_str(doc, obj, "version", result->version);
|
||||||
yyjson_mut_obj_add_str(doc, obj, "cmakeBuiltType", result.cmakeBuiltType);
|
yyjson_mut_obj_add_str(doc, obj, "versionTweak", result->versionTweak);
|
||||||
yyjson_mut_obj_add_str(doc, obj, "compileTime", result.compileTime);
|
yyjson_mut_obj_add_str(doc, obj, "cmakeBuiltType", result->cmakeBuiltType);
|
||||||
yyjson_mut_obj_add_str(doc, obj, "compiler", result.compiler);
|
yyjson_mut_obj_add_str(doc, obj, "compileTime", result->compileTime);
|
||||||
yyjson_mut_obj_add_bool(doc, obj, "debugMode", result.debugMode);
|
yyjson_mut_obj_add_str(doc, obj, "compiler", result->compiler);
|
||||||
|
yyjson_mut_obj_add_bool(doc, obj, "debugMode", result->debugMode);
|
||||||
|
|
||||||
FFLibcResult libcResult;
|
FFLibcResult libcResult;
|
||||||
if (ffDetectLibc(&libcResult))
|
if (ffDetectLibc(&libcResult))
|
||||||
@@ -119,6 +119,7 @@ void ffPrintVersionHelpFormat(void)
|
|||||||
"Version - version",
|
"Version - version",
|
||||||
"Version tweak - version-tweak",
|
"Version tweak - version-tweak",
|
||||||
"Build type (debug or release) - build-type",
|
"Build type (debug or release) - build-type",
|
||||||
|
"System name - sysname",
|
||||||
"Architecture - arch",
|
"Architecture - arch",
|
||||||
"CMake build type when compiling (Debug, Release, RelWithDebInfo, MinSizeRel) - cmake-built-type",
|
"CMake build type when compiling (Debug, Release, RelWithDebInfo, MinSizeRel) - cmake-built-type",
|
||||||
"Date time when compiling - compile-time",
|
"Date time when compiling - compile-time",
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "FFPlatform_private.h"
|
#include "FFPlatform_private.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
#include "common/io/io.h"
|
#include "common/io/io.h"
|
||||||
|
#include "detection/version/version.h"
|
||||||
|
|
||||||
void ffPlatformInit(FFPlatform* platform)
|
void ffPlatformInit(FFPlatform* platform)
|
||||||
{
|
{
|
||||||
@@ -14,30 +15,20 @@ void ffPlatformInit(FFPlatform* platform)
|
|||||||
ffStrbufInit(&platform->hostName);
|
ffStrbufInit(&platform->hostName);
|
||||||
ffStrbufInit(&platform->userShell);
|
ffStrbufInit(&platform->userShell);
|
||||||
|
|
||||||
ffStrbufInit(&platform->systemName);
|
FFPlatformSysinfo* info = &platform->sysinfo;
|
||||||
ffStrbufInit(&platform->systemRelease);
|
|
||||||
ffStrbufInit(&platform->systemVersion);
|
ffStrbufInit(&info->name);
|
||||||
ffStrbufInit(&platform->systemArchitecture);
|
ffStrbufInit(&info->release);
|
||||||
|
ffStrbufInit(&info->version);
|
||||||
|
ffStrbufInit(&info->architecture);
|
||||||
|
|
||||||
ffPlatformInitImpl(platform);
|
ffPlatformInitImpl(platform);
|
||||||
|
|
||||||
if(platform->systemName.length == 0)
|
if(info->name.length == 0)
|
||||||
{
|
ffStrbufSetStatic(&info->name, ffVersionResult.sysName);
|
||||||
#if defined(__linux__)
|
|
||||||
ffStrbufAppendS(&platform->systemName, "Linux");
|
|
||||||
#elif defined(__FreeBSD__)
|
|
||||||
ffStrbufAppendS(&platform->systemName, "FreeBSD");
|
|
||||||
#elif defined(__APPLE__)
|
|
||||||
ffStrbufAppendS(&platform->systemName, "Darwin");
|
|
||||||
#elif defined(_WIN32)
|
|
||||||
ffStrbufAppendS(&platform->systemName, "Windows_NT");
|
|
||||||
#else
|
|
||||||
ffStrbufAppendS(&platform->systemName, "Unknown");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if(platform->systemArchitecture.length == 0)
|
if(info->architecture.length == 0)
|
||||||
ffStrbufAppendS(&platform->systemArchitecture, "Unknown");
|
ffStrbufSetStatic(&info->architecture, ffVersionResult.architecture);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPlatformDestroy(FFPlatform* platform)
|
void ffPlatformDestroy(FFPlatform* platform)
|
||||||
@@ -58,11 +49,12 @@ void ffPlatformDestroy(FFPlatform* platform)
|
|||||||
ffStrbufDestroy(&platform->hostName);
|
ffStrbufDestroy(&platform->hostName);
|
||||||
ffStrbufDestroy(&platform->userShell);
|
ffStrbufDestroy(&platform->userShell);
|
||||||
|
|
||||||
ffStrbufDestroy(&platform->systemArchitecture);
|
FFPlatformSysinfo* info = &platform->sysinfo;
|
||||||
ffStrbufDestroy(&platform->systemName);
|
ffStrbufDestroy(&info->architecture);
|
||||||
ffStrbufDestroy(&platform->systemRelease);
|
ffStrbufDestroy(&info->name);
|
||||||
ffStrbufDestroy(&platform->systemVersion);
|
ffStrbufDestroy(&info->release);
|
||||||
ffStrbufDestroy(&platform->systemDisplayVersion);
|
ffStrbufDestroy(&info->version);
|
||||||
|
ffStrbufDestroy(&info->displayVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPlatformPathAddAbsolute(FFlist* dirs, const char* path)
|
void ffPlatformPathAddAbsolute(FFlist* dirs, const char* path)
|
||||||
|
|||||||
@@ -3,7 +3,18 @@
|
|||||||
#include "util/FFstrbuf.h"
|
#include "util/FFstrbuf.h"
|
||||||
#include "util/FFlist.h"
|
#include "util/FFlist.h"
|
||||||
|
|
||||||
typedef struct FFPlatform {
|
typedef struct FFPlatformSysinfo
|
||||||
|
{
|
||||||
|
FFstrbuf name;
|
||||||
|
FFstrbuf release;
|
||||||
|
FFstrbuf version;
|
||||||
|
FFstrbuf architecture;
|
||||||
|
FFstrbuf displayVersion;
|
||||||
|
uint32_t pageSize;
|
||||||
|
} FFPlatformSysinfo;
|
||||||
|
|
||||||
|
typedef struct FFPlatform
|
||||||
|
{
|
||||||
FFstrbuf homeDir; // Trailing slash included
|
FFstrbuf homeDir; // Trailing slash included
|
||||||
FFstrbuf cacheDir; // Trailing slash included
|
FFstrbuf cacheDir; // Trailing slash included
|
||||||
FFlist configDirs; // List of FFstrbuf, trailing slash included
|
FFlist configDirs; // List of FFstrbuf, trailing slash included
|
||||||
@@ -14,13 +25,7 @@ typedef struct FFPlatform {
|
|||||||
FFstrbuf hostName;
|
FFstrbuf hostName;
|
||||||
FFstrbuf userShell;
|
FFstrbuf userShell;
|
||||||
|
|
||||||
FFstrbuf systemName;
|
FFPlatformSysinfo sysinfo;
|
||||||
FFstrbuf systemRelease;
|
|
||||||
FFstrbuf systemVersion;
|
|
||||||
FFstrbuf systemArchitecture;
|
|
||||||
FFstrbuf systemDisplayVersion;
|
|
||||||
|
|
||||||
uint32_t pageSize;
|
|
||||||
} FFPlatform;
|
} FFPlatform;
|
||||||
|
|
||||||
void ffPlatformInit(FFPlatform* platform);
|
void ffPlatformInit(FFPlatform* platform);
|
||||||
|
|||||||
@@ -169,13 +169,19 @@ static void getUserShell(FFPlatform* platform, const struct passwd* pwd)
|
|||||||
ffStrbufAppendS(&platform->userShell, shell);
|
ffStrbufAppendS(&platform->userShell, shell);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void getPageSize(FFPlatform* platform)
|
static void getSysinfo(FFPlatformSysinfo* info, const struct utsname* uts)
|
||||||
{
|
{
|
||||||
|
ffStrbufAppendS(&info->name, uts->sysname);
|
||||||
|
ffStrbufAppendS(&info->release, uts->release);
|
||||||
|
ffStrbufAppendS(&info->version, uts->version);
|
||||||
|
ffStrbufAppendS(&info->architecture, uts->machine);
|
||||||
|
ffStrbufInit(&info->displayVersion);
|
||||||
|
|
||||||
#if defined(__FreeBSD__) || defined(__APPLE__)
|
#if defined(__FreeBSD__) || defined(__APPLE__)
|
||||||
size_t length = sizeof(platform->pageSize);
|
size_t length = sizeof(info->pageSize);
|
||||||
sysctl((int[]){ CTL_HW, HW_PAGESIZE }, 2, &platform->pageSize, &length, NULL, 0);
|
sysctl((int[]){ CTL_HW, HW_PAGESIZE }, 2, &info->pageSize, &length, NULL, 0);
|
||||||
#else
|
#else
|
||||||
platform->pageSize = (uint32_t) sysconf(_SC_PAGESIZE);
|
info->pageSize = (uint32_t) sysconf(_SC_PAGESIZE);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,11 +203,5 @@ void ffPlatformInitImpl(FFPlatform* platform)
|
|||||||
getHostName(platform, &uts);
|
getHostName(platform, &uts);
|
||||||
getUserShell(platform, pwd);
|
getUserShell(platform, pwd);
|
||||||
|
|
||||||
ffStrbufAppendS(&platform->systemName, uts.sysname);
|
getSysinfo(&platform->sysinfo, &uts);
|
||||||
ffStrbufAppendS(&platform->systemRelease, uts.release);
|
|
||||||
ffStrbufAppendS(&platform->systemVersion, uts.version);
|
|
||||||
ffStrbufAppendS(&platform->systemArchitecture, uts.machine);
|
|
||||||
ffStrbufInit(&platform->systemDisplayVersion);
|
|
||||||
|
|
||||||
getPageSize(platform);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ static void getUserShell(FFPlatform* platform)
|
|||||||
ffStrbufReplaceAllC(&platform->userShell, '\\', '/');
|
ffStrbufReplaceAllC(&platform->userShell, '\\', '/');
|
||||||
}
|
}
|
||||||
|
|
||||||
static void getSystemReleaseAndVersion(FFPlatform* platform)
|
static void getSystemReleaseAndVersion(FFPlatformSysinfo* info)
|
||||||
{
|
{
|
||||||
RTL_OSVERSIONINFOW osVersion = { .dwOSVersionInfoSize = sizeof(osVersion) };
|
RTL_OSVERSIONINFOW osVersion = { .dwOSVersionInfoSize = sizeof(osVersion) };
|
||||||
if (!NT_SUCCESS(RtlGetVersion(&osVersion)))
|
if (!NT_SUCCESS(RtlGetVersion(&osVersion)))
|
||||||
@@ -172,39 +172,39 @@ static void getSystemReleaseAndVersion(FFPlatform* platform)
|
|||||||
uint32_t ubr = 0;
|
uint32_t ubr = 0;
|
||||||
ffRegReadUint(hKey, L"UBR", &ubr, NULL);
|
ffRegReadUint(hKey, L"UBR", &ubr, NULL);
|
||||||
|
|
||||||
ffStrbufAppendF(&platform->systemRelease,
|
ffStrbufAppendF(&info->release,
|
||||||
"%u.%u.%u.%u",
|
"%u.%u.%u.%u",
|
||||||
(unsigned) osVersion.dwMajorVersion,
|
(unsigned) osVersion.dwMajorVersion,
|
||||||
(unsigned) osVersion.dwMinorVersion,
|
(unsigned) osVersion.dwMinorVersion,
|
||||||
(unsigned) osVersion.dwBuildNumber,
|
(unsigned) osVersion.dwBuildNumber,
|
||||||
(unsigned) ubr);
|
(unsigned) ubr);
|
||||||
|
|
||||||
ffStrbufInit(&platform->systemDisplayVersion);
|
ffStrbufInit(&info->displayVersion);
|
||||||
if(!ffRegReadStrbuf(hKey, L"DisplayVersion", &platform->systemDisplayVersion, NULL))
|
if(!ffRegReadStrbuf(hKey, L"DisplayVersion", &info->displayVersion, NULL))
|
||||||
{
|
{
|
||||||
if (osVersion.szCSDVersion[0])
|
if (osVersion.szCSDVersion[0])
|
||||||
ffStrbufSetWS(&platform->systemDisplayVersion, osVersion.szCSDVersion);
|
ffStrbufSetWS(&info->displayVersion, osVersion.szCSDVersion);
|
||||||
else
|
else
|
||||||
ffRegReadStrbuf(hKey, L"ReleaseId", &platform->systemDisplayVersion, NULL); // For old Windows 10
|
ffRegReadStrbuf(hKey, L"ReleaseId", &info->displayVersion, NULL); // For old Windows 10
|
||||||
}
|
}
|
||||||
|
|
||||||
ffRegReadStrbuf(hKey, L"BuildLabEx", &platform->systemVersion, NULL);
|
ffRegReadStrbuf(hKey, L"BuildLabEx", &info->version, NULL);
|
||||||
|
|
||||||
switch (osVersion.dwPlatformId)
|
switch (osVersion.dwPlatformId)
|
||||||
{
|
{
|
||||||
case VER_PLATFORM_WIN32s:
|
case VER_PLATFORM_WIN32s:
|
||||||
ffStrbufSetStatic(&platform->systemName, "WIN32s");
|
ffStrbufSetStatic(&info->name, "WIN32s");
|
||||||
break;
|
break;
|
||||||
case VER_PLATFORM_WIN32_WINDOWS:
|
case VER_PLATFORM_WIN32_WINDOWS:
|
||||||
ffStrbufSetStatic(&platform->systemName, "WIN32_WINDOWS");
|
ffStrbufSetStatic(&info->name, "WIN32_WINDOWS");
|
||||||
break;
|
break;
|
||||||
case VER_PLATFORM_WIN32_NT:
|
case VER_PLATFORM_WIN32_NT:
|
||||||
ffStrbufSetStatic(&platform->systemName, "WIN32_NT");
|
ffStrbufSetStatic(&info->name, "WIN32_NT");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void getSystemArchitectureAndPageSize(FFPlatform* platform)
|
static void getSystemArchitectureAndPageSize(FFPlatformSysinfo* info)
|
||||||
{
|
{
|
||||||
SYSTEM_INFO sysInfo;
|
SYSTEM_INFO sysInfo;
|
||||||
GetNativeSystemInfo(&sysInfo);
|
GetNativeSystemInfo(&sysInfo);
|
||||||
@@ -212,52 +212,53 @@ static void getSystemArchitectureAndPageSize(FFPlatform* platform)
|
|||||||
switch(sysInfo.wProcessorArchitecture)
|
switch(sysInfo.wProcessorArchitecture)
|
||||||
{
|
{
|
||||||
case PROCESSOR_ARCHITECTURE_AMD64:
|
case PROCESSOR_ARCHITECTURE_AMD64:
|
||||||
ffStrbufSetStatic(&platform->systemArchitecture, "x86_64");
|
ffStrbufSetStatic(&info->architecture, "x86_64");
|
||||||
break;
|
break;
|
||||||
case PROCESSOR_ARCHITECTURE_IA64:
|
case PROCESSOR_ARCHITECTURE_IA64:
|
||||||
ffStrbufSetStatic(&platform->systemArchitecture, "ia64");
|
ffStrbufSetStatic(&info->architecture, "ia64");
|
||||||
break;
|
break;
|
||||||
case PROCESSOR_ARCHITECTURE_INTEL:
|
case PROCESSOR_ARCHITECTURE_INTEL:
|
||||||
switch (sysInfo.wProcessorLevel)
|
switch (sysInfo.wProcessorLevel)
|
||||||
{
|
{
|
||||||
case 4:
|
case 4:
|
||||||
ffStrbufSetStatic(&platform->systemArchitecture, "i486");
|
ffStrbufSetStatic(&info->architecture, "i486");
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
ffStrbufSetStatic(&platform->systemArchitecture, "i586");
|
ffStrbufSetStatic(&info->architecture, "i586");
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
ffStrbufSetStatic(&platform->systemArchitecture, "i686");
|
ffStrbufSetStatic(&info->architecture, "i686");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ffStrbufSetStatic(&platform->systemArchitecture, "i386");
|
ffStrbufSetStatic(&info->architecture, "i386");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROCESSOR_ARCHITECTURE_ARM64:
|
case PROCESSOR_ARCHITECTURE_ARM64:
|
||||||
ffStrbufSetStatic(&platform->systemArchitecture, "aarch64");
|
ffStrbufSetStatic(&info->architecture, "aarch64");
|
||||||
break;
|
break;
|
||||||
case PROCESSOR_ARCHITECTURE_ARM:
|
case PROCESSOR_ARCHITECTURE_ARM:
|
||||||
ffStrbufSetStatic(&platform->systemArchitecture, "arm");
|
ffStrbufSetStatic(&info->architecture, "arm");
|
||||||
break;
|
break;
|
||||||
case PROCESSOR_ARCHITECTURE_PPC:
|
case PROCESSOR_ARCHITECTURE_PPC:
|
||||||
ffStrbufSetStatic(&platform->systemArchitecture, "ppc");
|
ffStrbufSetStatic(&info->architecture, "ppc");
|
||||||
break;
|
break;
|
||||||
case PROCESSOR_ARCHITECTURE_MIPS:
|
case PROCESSOR_ARCHITECTURE_MIPS:
|
||||||
ffStrbufSetStatic(&platform->systemArchitecture, "mips");
|
ffStrbufSetStatic(&info->architecture, "mips");
|
||||||
break;
|
break;
|
||||||
case PROCESSOR_ARCHITECTURE_ALPHA:
|
case PROCESSOR_ARCHITECTURE_ALPHA:
|
||||||
ffStrbufSetStatic(&platform->systemArchitecture, "alpha");
|
ffStrbufSetStatic(&info->architecture, "alpha");
|
||||||
break;
|
break;
|
||||||
case PROCESSOR_ARCHITECTURE_ALPHA64:
|
case PROCESSOR_ARCHITECTURE_ALPHA64:
|
||||||
ffStrbufSetStatic(&platform->systemArchitecture, "alpha64");
|
ffStrbufSetStatic(&info->architecture, "alpha64");
|
||||||
break;
|
break;
|
||||||
case PROCESSOR_ARCHITECTURE_UNKNOWN:
|
case PROCESSOR_ARCHITECTURE_UNKNOWN:
|
||||||
default:
|
default:
|
||||||
|
ffStrbufSetStatic(&info->architecture, "unknown");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
platform->pageSize = sysInfo.dwPageSize;
|
info->pageSize = sysInfo.dwPageSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPlatformInitImpl(FFPlatform* platform)
|
void ffPlatformInitImpl(FFPlatform* platform)
|
||||||
@@ -272,6 +273,6 @@ void ffPlatformInitImpl(FFPlatform* platform)
|
|||||||
getHostName(platform);
|
getHostName(platform);
|
||||||
getUserShell(platform);
|
getUserShell(platform);
|
||||||
|
|
||||||
getSystemReleaseAndVersion(platform);
|
getSystemReleaseAndVersion(&platform->sysinfo);
|
||||||
getSystemArchitectureAndPageSize(platform);
|
getSystemArchitectureAndPageSize(&platform->sysinfo);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user