mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-12 09:58:03 +02:00
Compare commits
44 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7eb1f616d9 | |||
| b9dbb66bd7 | |||
| a01792c06c | |||
| d707a67f89 | |||
| 5d8aa11d81 | |||
| a87463fc09 | |||
| d0a4a012c4 | |||
| 6a82d73fe9 | |||
| 7504484f21 | |||
| d497853af5 | |||
| c2f815f5ba | |||
| 4bd4ec2897 | |||
| fc685e9aa0 | |||
| 14d3bd89a7 | |||
| c3970154d6 | |||
| 66aee54401 | |||
| 979f7d19b1 | |||
| f238138711 | |||
| 6c88981b05 | |||
| c935527e6f | |||
| 04915945f5 | |||
| 153df44282 | |||
| 22012556f8 | |||
| d0b03c380b | |||
| de2cd79632 | |||
| cc40ef42f0 | |||
| ba45073e04 | |||
| a3c3f3829d | |||
| 79b7b15b46 | |||
| 111f7111b2 | |||
| 5147651bcb | |||
| ba60d9059f | |||
| 8f205b8c30 | |||
| e046787aec | |||
| 743eebaa6b | |||
| 609caad02f | |||
| a0c47204bb | |||
| 1c87693867 | |||
| 42b756e703 | |||
| d317997396 | |||
| 91dac1563b | |||
| 73cfae97d2 | |||
| 78a606c1e1 | |||
| f258e484d9 |
@@ -288,7 +288,7 @@ jobs:
|
||||
|
||||
freebsd-amd64:
|
||||
name: FreeBSD-amd64
|
||||
runs-on: macos-12
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
security-events: write
|
||||
contents: read
|
||||
@@ -300,6 +300,9 @@ jobs:
|
||||
uses: cross-platform-actions/action@master
|
||||
with:
|
||||
operating_system: freebsd
|
||||
architecture: x86-64
|
||||
cpu_count: 3
|
||||
shell: bash
|
||||
version: '13.2'
|
||||
run: |
|
||||
uname -a
|
||||
@@ -320,6 +323,43 @@ jobs:
|
||||
name: fastfetch-freebsd-amd64
|
||||
path: ./fastfetch-*.*
|
||||
|
||||
freebsd-aarch64:
|
||||
name: FreeBSD-aarch64
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
security-events: write
|
||||
contents: read
|
||||
steps:
|
||||
- name: checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: run VM
|
||||
uses: cross-platform-actions/action@master
|
||||
with:
|
||||
operating_system: freebsd
|
||||
architecture: arm64
|
||||
cpu_count: 3
|
||||
shell: bash
|
||||
version: '13.2'
|
||||
run: |
|
||||
uname -a
|
||||
sudo pkg update
|
||||
sudo pkg install -y cmake git pkgconf binutils wayland vulkan-headers vulkan-loader libxcb libXrandr libX11 libdrm glib dconf dbus sqlite3-tcl xfce4-conf ImageMagick6 ImageMagick7 chafa egl libosmesa opencl ocl-icd v4l_compat
|
||||
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On .
|
||||
cmake --build . --target package --verbose -j4
|
||||
./fastfetch --list-features
|
||||
time ./fastfetch
|
||||
time ./fastfetch --format json
|
||||
time ./flashfetch
|
||||
ldd fastfetch
|
||||
ctest
|
||||
|
||||
- name: upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: fastfetch-freebsd-aarch64
|
||||
path: ./fastfetch-*.*
|
||||
|
||||
windows-amd64:
|
||||
name: Windows-amd64
|
||||
runs-on: windows-latest
|
||||
@@ -458,6 +498,7 @@ jobs:
|
||||
- linux-aarch64
|
||||
- macos-universal
|
||||
- freebsd-amd64
|
||||
- freebsd-aarch64
|
||||
- windows-amd64
|
||||
- windows-i686
|
||||
permissions:
|
||||
|
||||
@@ -1,3 +1,37 @@
|
||||
# 2.8.7
|
||||
|
||||
Bugfixes:
|
||||
* Fix max CPU frequency detection for some cases (CPU, Linux)
|
||||
* Fix some memory leaks
|
||||
* Fix ddcutil 2.1 compatibility (Brightness, Linux)
|
||||
* Workaround `permission denied` error when reading `/proc/uptime` (Uptime, Android)
|
||||
|
||||
Features:
|
||||
* Support zellij version detection (Linux, Terminal)
|
||||
|
||||
Logo:
|
||||
* Fix PostMarketOS
|
||||
|
||||
# 2.8.6
|
||||
|
||||
Changes:
|
||||
* Due to newly introduced configs, JSONC option `{ "temperatureUnit": "C" }` has been changed to `{ "temp": { "unit": "C" } }`
|
||||
|
||||
Bugfixes:
|
||||
* Fix incorrect GPU name detection for Intel iGPU on Linux (#736, GPU, Linux)
|
||||
|
||||
Features:
|
||||
* Support additional temperature formatting options (#737)
|
||||
* `{ "temp": { "ndigits": 1 } }`
|
||||
* `{ "temp": { "color": { "green": "green", "yellow": "yellow", "red": "red" } } }`
|
||||
* Support specifying custom `pci.ids` path for Linux (GPU, Linux)
|
||||
* Support warp-linux terminal version & terminal font detection (Terminal, Linux)
|
||||
|
||||
# 2.8.5
|
||||
|
||||
Bugfixes:
|
||||
* Fix uninitialized variables
|
||||
|
||||
# 2.8.4
|
||||
|
||||
Bugfixes:
|
||||
|
||||
+15
-6
@@ -1,7 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url
|
||||
|
||||
project(fastfetch
|
||||
VERSION 2.8.4
|
||||
VERSION 2.8.7
|
||||
LANGUAGES C
|
||||
DESCRIPTION "Fast neofetch-like system information tool"
|
||||
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
|
||||
@@ -76,6 +76,10 @@ option(ENABLE_PROPRIETARY_GPU_DRIVER_API "Enable proprietary GPU driver API (NVM
|
||||
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
|
||||
|
||||
if (LINUX)
|
||||
set(CUSTOM_PCI_IDS_PATH "" CACHE STRING "Custom path to file pci.ids, defaults to `/usr/share/hwdata/pci.ids`")
|
||||
endif()
|
||||
|
||||
####################
|
||||
# Compiler options #
|
||||
####################
|
||||
@@ -118,7 +122,7 @@ if(ENABLE_ASAN)
|
||||
set(FASTFETCH_FLAGS_DEBUG "${FASTFETCH_FLAGS_DEBUG} -fsanitize=address")
|
||||
endif()
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${FASTFETCH_FLAGS_DEBUG}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${FASTFETCH_FLAGS_DEBUG}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${FASTFETCH_FLAGS_DEBUG} -fstack-protector-all -fno-delete-null-pointer-checks")
|
||||
if(NOT WIN32)
|
||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -rdynamic")
|
||||
endif()
|
||||
@@ -229,10 +233,9 @@ endif()
|
||||
|
||||
fastfetch_encode_c_string("${DATATEXT_JSON_HELP}" DATATEXT_JSON_HELP)
|
||||
fastfetch_load_text(src/data/structure.txt DATATEXT_STRUCTURE)
|
||||
fastfetch_load_text(src/data/help.txt DATATEXT_HELP)
|
||||
fastfetch_load_text(src/data/help_footer.txt DATATEXT_HELP_FOOTER)
|
||||
fastfetch_load_text(src/data/help_color.txt DATATEXT_HELP_COLOR)
|
||||
fastfetch_load_text(src/data/help_format.txt DATATEXT_HELP_FORMAT)
|
||||
fastfetch_load_text(src/data/help_config.txt DATATEXT_HELP_CONFIG)
|
||||
|
||||
configure_file(src/fastfetch_config.h.in fastfetch_config.h @ONLY)
|
||||
configure_file(src/fastfetch_datatext.h.in fastfetch_datatext.h @ONLY)
|
||||
@@ -277,6 +280,7 @@ set(LIBFASTFETCH_SRC
|
||||
src/common/printing.c
|
||||
src/common/properties.c
|
||||
src/common/settings.c
|
||||
src/common/temps.c
|
||||
src/detection/chassis/chassis.c
|
||||
src/detection/cpu/cpu.c
|
||||
src/detection/cpuusage/cpuusage.c
|
||||
@@ -724,8 +728,8 @@ if(yyjson_FOUND)
|
||||
else()
|
||||
# Used for dlopen finding dylibs installed by homebrew
|
||||
# `/opt/homebrew/lib` is not on in dlopen search path by default
|
||||
if(APPLE AND DEFINED ENV{HOMEBREW_PREFIX})
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,$ENV{HOMEBREW_PREFIX}/lib")
|
||||
if(APPLE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,/opt/homebrew/lib -Wl,-rpath,/usr/local/lib")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -762,6 +766,11 @@ if(HAVE_WCWIDTH)
|
||||
target_compile_definitions(libfastfetch PRIVATE FF_HAVE_WCWIDTH)
|
||||
endif()
|
||||
|
||||
if(NOT "${CUSTOM_PCI_IDS_PATH}" STREQUAL "")
|
||||
message(STATUS "Custom file path of pci.ids: ${CUSTOM_PCI_IDS_PATH}")
|
||||
target_compile_definitions(libfastfetch PRIVATE FF_CUSTOM_PCI_IDS_PATH=${CUSTOM_PCI_IDS_PATH})
|
||||
endif()
|
||||
|
||||
function(ff_lib_enable VARNAME PKGCONFIG_NAMES CMAKE_NAME)
|
||||
if(NOT ENABLE_${VARNAME})
|
||||
return()
|
||||
|
||||
@@ -27,6 +27,7 @@ There are [screenshots on different platforms](https://github.com/fastfetch-cli/
|
||||
|
||||
### Linux
|
||||
|
||||
* Ubuntu: `ppa:zhangsongcui3371/fastfetch`
|
||||
* Debian / Ubuntu: Download `fastfetch-<version>-Linux.deb` from [Github release page](https://github.com/fastfetch-cli/fastfetch/releases/latest) and `dpkg -i fastfetch-<version>-Linux.deb`
|
||||
* Arch Linux: `sudo pacman -S fastfetch`. You can also find fastfetch [on the AUR](https://aur.archlinux.org/packages/fastfetch-git).
|
||||
* Fedora: `sudo dnf install fastfetch`
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env fish
|
||||
|
||||
if not type -q fastfetch
|
||||
return
|
||||
exit
|
||||
end
|
||||
|
||||
complete -c fastfetch -f
|
||||
|
||||
Vendored
+12
@@ -1,3 +1,15 @@
|
||||
fastfetch (2.8.6) jammy; urgency=medium
|
||||
|
||||
* Update to 2.8.6
|
||||
|
||||
-- Carter Li <zhangsongcui@live.cn> Wed, 28 Feb 2024 10:01:40 +0800
|
||||
|
||||
fastfetch (2.8.4) jammy; urgency=medium
|
||||
|
||||
* Update to 2.8.4
|
||||
|
||||
-- Carter Li <zhangsongcui@live.cn> Fri, 23 Feb 2024 16:14:57 +0800
|
||||
|
||||
fastfetch (2.7.1ubuntu2) jammy; urgency=medium
|
||||
|
||||
* Ignore .git
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
fastfetch_2.7.1ubuntu2_source.buildinfo universe/utils optional
|
||||
fastfetch_2.8.6_source.buildinfo universe/utils optional
|
||||
|
||||
+184
-86
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/schema",
|
||||
"$schema": "https://json-schema.org/draft-07/schema",
|
||||
"$defs": {
|
||||
"colors": {
|
||||
"type": "string",
|
||||
@@ -30,6 +30,7 @@
|
||||
"percent": {
|
||||
"description": "Threshold of percentage colors",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"green": {
|
||||
"type": "integer",
|
||||
@@ -44,9 +45,37 @@
|
||||
"description": "Value greater than green and less then yellow will be shown in yellow.\nValue greater than yellow will be shown in red"
|
||||
}
|
||||
}
|
||||
},
|
||||
"temperature": {
|
||||
"description": "Detect and display temperature if supported",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"green": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 100,
|
||||
"description": "Value (in celsius) less then green will be shown in green"
|
||||
},
|
||||
"yellow": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 100,
|
||||
"description": "Value (in celsius) greater than green and less then yellow will be shown in yellow.\nValue greater than yellow will be shown in red"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"title": "JSON config",
|
||||
"description": "JSON config file for fastfetch. Usually be `~/.config/fastfetch.jsonc`",
|
||||
"properties": {
|
||||
@@ -69,6 +98,7 @@
|
||||
{
|
||||
"description": "Fastfetch logo configurations",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Set the type of the logo given",
|
||||
@@ -96,6 +126,7 @@
|
||||
},
|
||||
"color": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"description": "Overwrite a color in the logo",
|
||||
"properties": {
|
||||
"1": {
|
||||
@@ -134,8 +165,7 @@
|
||||
"description": "Color 9",
|
||||
"$ref": "#/$defs/colors"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"width": {
|
||||
"type": "integer",
|
||||
@@ -149,6 +179,7 @@
|
||||
},
|
||||
"padding": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"description": "Set the padding of the logo",
|
||||
"properties": {
|
||||
"top": {
|
||||
@@ -166,8 +197,7 @@
|
||||
"description": "Set the right padding of the logo",
|
||||
"minimum": 0
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"printRemaining": {
|
||||
"type": "boolean",
|
||||
@@ -191,6 +221,7 @@
|
||||
},
|
||||
"chafa": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"description": "Chafa configuration. See chafa document for details",
|
||||
"properties": {
|
||||
"fgOnly": {
|
||||
@@ -233,17 +264,16 @@
|
||||
"DIFFUSION"
|
||||
]
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"general": {
|
||||
"description": "Fastfetch general configurations",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"multithreading": {
|
||||
"type": "boolean",
|
||||
@@ -272,7 +302,7 @@
|
||||
"description": "Force display detection to use DRM. Linux only",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "bool",
|
||||
"type": "boolean",
|
||||
"const": false,
|
||||
"description": "Try `wayland`, then `x11`, then `drm`"
|
||||
},
|
||||
@@ -282,7 +312,7 @@
|
||||
"const": "sysfs-only"
|
||||
},
|
||||
{
|
||||
"type": "bool",
|
||||
"type": "boolean",
|
||||
"const": true,
|
||||
"description": "Try `libdrm` first, then `sysfs` if libdrm failed"
|
||||
}
|
||||
@@ -299,12 +329,12 @@
|
||||
"description": "Set the timeout (ms) when waiting for child processes, `-1` for no timeout",
|
||||
"default": 1000
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"display": {
|
||||
"description": "Configure how things to be displayed",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"stat": {
|
||||
"type": "boolean",
|
||||
@@ -345,6 +375,7 @@
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"keys": {
|
||||
"description": "Set the color of the keys",
|
||||
@@ -354,8 +385,7 @@
|
||||
"description": "Set the color of the title",
|
||||
"$ref": "#/$defs/colors"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -390,6 +420,7 @@
|
||||
},
|
||||
"size": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"description": "Set how a size value should be displayed",
|
||||
"properties": {
|
||||
"maxPrefix": {
|
||||
@@ -407,14 +438,48 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"temperatureUnit": {
|
||||
"type": "string",
|
||||
"description": "Set the unit of the temperature",
|
||||
"enum": ["CELSIUS", "C", "FAHRENHEIT", "F", "KELVIN", "K"],
|
||||
"default": "C"
|
||||
"temp": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"description": "Set how temperature values should be displayed",
|
||||
"properties": {
|
||||
"unit": {
|
||||
"type": "string",
|
||||
"description": "Set the unit of the temperature",
|
||||
"enum": ["CELSIUS", "C", "FAHRENHEIT", "F", "KELVIN", "K"],
|
||||
"default": "C"
|
||||
},
|
||||
"ndigits": {
|
||||
"type": "integer",
|
||||
"description": "Set the number of digits to keep after the decimal point when formatting temperature values",
|
||||
"minimum": 0,
|
||||
"maximum": 9,
|
||||
"default": 1
|
||||
},
|
||||
"color": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"description": "Set color used in different states of temperature values",
|
||||
"properties": {
|
||||
"green": {
|
||||
"description": "Color used in green state",
|
||||
"$ref": "#/$defs/colors"
|
||||
},
|
||||
"yellow": {
|
||||
"description": "Color used in yellow state",
|
||||
"$ref": "#/$defs/colors"
|
||||
},
|
||||
"red": {
|
||||
"description": "Color used in red state",
|
||||
"$ref": "#/$defs/colors"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"bar": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"description": "Set the bar configuration",
|
||||
"properties": {
|
||||
"charElapsed": {
|
||||
@@ -442,6 +507,7 @@
|
||||
},
|
||||
"percent": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"description": "Set how a percentage value should be displayed",
|
||||
"properties": {
|
||||
"type": {
|
||||
@@ -460,6 +526,7 @@
|
||||
},
|
||||
"color": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"description": "Set color used in different states of percentage bars and numbers",
|
||||
"properties": {
|
||||
"green": {
|
||||
@@ -483,12 +550,12 @@
|
||||
"description": "Whether to disable the stdout application buffer",
|
||||
"default": false
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"library": {
|
||||
"description": "Set the path of a library to load",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"pci": {
|
||||
"type": "string",
|
||||
@@ -590,8 +657,7 @@
|
||||
"description": "Used for brightness detection of external displays (Linux)",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"modules": {
|
||||
"description": "Fastfetch modules to run",
|
||||
@@ -664,6 +730,7 @@
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"description": "Run module with custom configurations",
|
||||
"required": [
|
||||
"type"
|
||||
@@ -676,16 +743,20 @@
|
||||
"oneOf": [
|
||||
{
|
||||
"title": "Break",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"const": "break",
|
||||
"description": "Print a empty line"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "module",
|
||||
"description": "No additional properties",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"anyOf": [
|
||||
@@ -823,11 +894,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Battery",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"const": "battery",
|
||||
@@ -839,9 +911,7 @@
|
||||
"default": false
|
||||
},
|
||||
"temp": {
|
||||
"description": "Detect and display Battery temperature if supported",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
"$ref": "#/$defs/temperature"
|
||||
},
|
||||
"percent": {
|
||||
"$ref": "#/$defs/percent"
|
||||
@@ -858,11 +928,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Bluetooth",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "List bluetooth devices",
|
||||
@@ -888,11 +959,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Brightness",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"const": "brightness",
|
||||
@@ -912,6 +984,8 @@
|
||||
},
|
||||
{
|
||||
"title": "Chassis",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"const": "chassis",
|
||||
@@ -933,15 +1007,15 @@
|
||||
},
|
||||
{
|
||||
"title": "CPU",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Print CPU name, frequency, etc",
|
||||
"const": "cpu"
|
||||
},
|
||||
"temp": {
|
||||
"description": "Detect and display CPU temperature if supported",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
"$ref": "#/$defs/temperature"
|
||||
},
|
||||
"freqNdigits": {
|
||||
"description": "Set the number of digits to keep after the decimal point when printing CPU frequency",
|
||||
@@ -962,11 +1036,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "CPU Usage",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"const": "cpuusage",
|
||||
@@ -984,6 +1059,8 @@
|
||||
},
|
||||
{
|
||||
"title": "Colors",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Print some colored blocks",
|
||||
@@ -1011,6 +1088,7 @@
|
||||
"block": {
|
||||
"description": "Set behavior of block printing",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"width": {
|
||||
"description": "Set the block width in spaces",
|
||||
@@ -1035,6 +1113,8 @@
|
||||
},
|
||||
{
|
||||
"title": "Command",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Running custom shell scripts",
|
||||
@@ -1060,11 +1140,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Custom",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Print a custom string, with or without key",
|
||||
@@ -1087,11 +1168,12 @@
|
||||
},
|
||||
"required": [
|
||||
"format"
|
||||
],
|
||||
"additionalProperties": false
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Display",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Print resolutions, refresh rates, etc",
|
||||
@@ -1134,11 +1216,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Disk",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Print partitions, space usage, disk type, etc",
|
||||
@@ -1193,11 +1276,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "DiskIO",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Print physical disk I/O throughput",
|
||||
@@ -1224,11 +1308,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "DE",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"const": "de",
|
||||
@@ -1255,6 +1340,8 @@
|
||||
},
|
||||
{
|
||||
"title": "Gamepad",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"const": "gamepad",
|
||||
@@ -1275,20 +1362,19 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "GPU",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Print GPU names, graphic memory size, type, etc",
|
||||
"const": "gpu"
|
||||
},
|
||||
"temp": {
|
||||
"description": "Detect and display GPU temperature if supported",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
"$ref": "#/$defs/temperature"
|
||||
},
|
||||
"driverSpecific": {
|
||||
"description": "Use driver specific method to detect more detailed GPU information (memory usage, core count, etc)",
|
||||
@@ -1321,11 +1407,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Local IP",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "List local IP addresses (v4 or v6), MAC addresses, etc",
|
||||
@@ -1377,11 +1464,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Memory",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"const": "memory",
|
||||
@@ -1402,11 +1490,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "NetIO",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Print network I/O throughput",
|
||||
@@ -1438,11 +1527,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "OpenGL",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Print highest OpenGL version supported by the GPU",
|
||||
@@ -1470,11 +1560,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Packages",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"const": "packages",
|
||||
@@ -1501,6 +1592,8 @@
|
||||
},
|
||||
{
|
||||
"title": "Physical Disk",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Print physical disk information",
|
||||
@@ -1511,9 +1604,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"temp": {
|
||||
"description": "Detect and display SSD temperature if supported",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
"$ref": "#/$defs/temperature"
|
||||
},
|
||||
"key": {
|
||||
"$ref": "#/$defs/key"
|
||||
@@ -1527,11 +1618,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Public IP",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Print your public IP address, etc",
|
||||
@@ -1561,11 +1653,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Separator",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Print a separator line",
|
||||
@@ -1576,11 +1669,12 @@
|
||||
"type": "string",
|
||||
"default": "-"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Sound",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Print sound devices, volume, etc",
|
||||
@@ -1611,11 +1705,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Swap",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"const": "swap",
|
||||
@@ -1636,11 +1731,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Title",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Print title, which contains your user name, hostname",
|
||||
@@ -1653,6 +1749,8 @@
|
||||
},
|
||||
"color": {
|
||||
"description": "Set colors of the different part of title",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"user": {
|
||||
"description": "Set color of the user name (left part)",
|
||||
@@ -1666,8 +1764,7 @@
|
||||
"description": "Set color of the host name (right part)",
|
||||
"$ref": "#/$defs/colors"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"key": {
|
||||
"$ref": "#/$defs/key"
|
||||
@@ -1681,11 +1778,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Weather",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Print weather information",
|
||||
@@ -1718,11 +1816,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "WM",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"const": "wm",
|
||||
@@ -1752,6 +1851,5 @@
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ void ffPrepareCommandOption(FFdata* data)
|
||||
FFOptionsModules* const options = &instance.config.modules;
|
||||
//If we don't have a custom structure, use the default one
|
||||
if(data->structure.length == 0)
|
||||
ffStrbufAppendS(&data->structure, FASTFETCH_DATATEXT_STRUCTURE);
|
||||
ffStrbufAppendS(&data->structure, FASTFETCH_DATATEXT_STRUCTURE); // Cannot use `ffStrbufSetStatic` here because we will modify the string
|
||||
|
||||
if(ffStrbufContainIgnCaseS(&data->structure, FF_CPUUSAGE_MODULE_NAME))
|
||||
ffPrepareCPUUsage();
|
||||
@@ -168,7 +168,7 @@ void ffMigrateCommandOptionToJsonc(FFdata* data, yyjson_mut_doc* jsonDoc)
|
||||
{
|
||||
//If we don't have a custom structure, use the default one
|
||||
if(data->structure.length == 0)
|
||||
ffStrbufAppendS(&data->structure, FASTFETCH_DATATEXT_STRUCTURE);
|
||||
ffStrbufAppendS(&data->structure, FASTFETCH_DATATEXT_STRUCTURE); // Cannot use `ffStrbufSetStatic` here because we will modify the string
|
||||
|
||||
//Parse the structure and call the modules
|
||||
uint32_t startIndex = 0;
|
||||
|
||||
@@ -211,6 +211,7 @@ void ffFontInitValues(FFfont* font, const char* name, const char* size)
|
||||
ffFontInit(font);
|
||||
|
||||
ffStrbufAppendS(&font->name, name);
|
||||
ffStrbufTrim(&font->name, '"');
|
||||
ffStrbufAppendS(&font->size, size);
|
||||
|
||||
fontInitPretty(font);
|
||||
|
||||
@@ -96,22 +96,6 @@ void ffParseSize(uint64_t bytes, FFstrbuf* result)
|
||||
}
|
||||
}
|
||||
|
||||
void ffParseTemperature(double celsius, FFstrbuf* buffer)
|
||||
{
|
||||
switch (instance.config.display.temperatureUnit)
|
||||
{
|
||||
case FF_TEMPERATURE_UNIT_CELSIUS:
|
||||
ffStrbufAppendF(buffer, "%.1f°C", celsius);
|
||||
break;
|
||||
case FF_TEMPERATURE_UNIT_FAHRENHEIT:
|
||||
ffStrbufAppendF(buffer, "%.1f°F", celsius * 1.8 + 32);
|
||||
break;
|
||||
case FF_TEMPERATURE_UNIT_KELVIN:
|
||||
ffStrbufAppendF(buffer, "%.1f K", celsius + 273.15);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ffParseGTK(FFstrbuf* buffer, const FFstrbuf* gtk2, const FFstrbuf* gtk3, const FFstrbuf* gtk4)
|
||||
{
|
||||
if(gtk2->length > 0 && gtk3->length > 0 && gtk4->length > 0)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "util/FFstrbuf.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -11,6 +11,12 @@ typedef struct FFVersion
|
||||
uint32_t patch;
|
||||
} FFVersion;
|
||||
|
||||
typedef struct FFColorRangeConfig
|
||||
{
|
||||
uint8_t green;
|
||||
uint8_t yellow;
|
||||
} FFColorRangeConfig;
|
||||
|
||||
#define FF_VERSION_INIT ((FFVersion) {0})
|
||||
|
||||
void ffParseSemver(FFstrbuf* buffer, const FFstrbuf* major, const FFstrbuf* minor, const FFstrbuf* patch);
|
||||
@@ -20,4 +26,3 @@ void ffVersionToPretty(const FFVersion* version, FFstrbuf* pretty);
|
||||
int8_t ffVersionCompare(const FFVersion* version1, const FFVersion* version2);
|
||||
|
||||
void ffParseSize(uint64_t bytes, FFstrbuf* result);
|
||||
void ffParseTemperature(double celsius, FFstrbuf* buffer);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "util/textModifier.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFPercentConfig config)
|
||||
void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFColorRangeConfig config)
|
||||
{
|
||||
uint8_t green = config.green, yellow = config.yellow;
|
||||
assert(green <= 100 && yellow <= 100);
|
||||
@@ -75,7 +75,7 @@ void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFPercentConfig config
|
||||
ffStrbufAppendS(buffer, FASTFETCH_TEXT_MODIFIER_RESET);
|
||||
}
|
||||
|
||||
void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFPercentConfig config, bool parentheses)
|
||||
void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFColorRangeConfig config, bool parentheses)
|
||||
{
|
||||
uint8_t green = config.green, yellow = config.yellow;
|
||||
assert(green <= 100 && yellow <= 100);
|
||||
@@ -89,9 +89,9 @@ void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFPercentConfig config
|
||||
|
||||
if (colored && !options->pipe)
|
||||
{
|
||||
const char* colorGreen = instance.config.display.percentColorGreen.chars;
|
||||
const char* colorYellow = instance.config.display.percentColorYellow.chars;
|
||||
const char* colorRed = instance.config.display.percentColorRed.chars;
|
||||
const char* colorGreen = options->percentColorGreen.chars;
|
||||
const char* colorYellow = options->percentColorYellow.chars;
|
||||
const char* colorRed = options->percentColorRed.chars;
|
||||
|
||||
if(percent != percent)
|
||||
ffStrbufAppendS(buffer, "\e[" FF_COLOR_FG_LIGHT_BLACK "m");
|
||||
@@ -126,7 +126,7 @@ void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFPercentConfig config
|
||||
ffStrbufAppendC(buffer, ')');
|
||||
}
|
||||
|
||||
bool ffPercentParseCommandOptions(const char* key, const char* subkey, const char* value, FFPercentConfig* config)
|
||||
bool ffPercentParseCommandOptions(const char* key, const char* subkey, const char* value, FFColorRangeConfig* config)
|
||||
{
|
||||
if (!ffStrStartsWithIgnCase(subkey, "percent-"))
|
||||
return false;
|
||||
@@ -160,7 +160,7 @@ bool ffPercentParseCommandOptions(const char* key, const char* subkey, const cha
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ffPercentParseJsonObject(const char* key, yyjson_val* value, FFPercentConfig* config)
|
||||
bool ffPercentParseJsonObject(const char* key, yyjson_val* value, FFColorRangeConfig* config)
|
||||
{
|
||||
if (!ffStrEqualsIgnCase(key, "percent"))
|
||||
return false;
|
||||
@@ -198,7 +198,7 @@ bool ffPercentParseJsonObject(const char* key, yyjson_val* value, FFPercentConfi
|
||||
return true;
|
||||
}
|
||||
|
||||
void ffPercentGenerateJsonConfig(yyjson_mut_doc* doc, yyjson_mut_val* module, FFPercentConfig defaultConfig, FFPercentConfig config)
|
||||
void ffPercentGenerateJsonConfig(yyjson_mut_doc* doc, yyjson_mut_val* module, FFColorRangeConfig defaultConfig, FFColorRangeConfig config)
|
||||
{
|
||||
if (config.green == defaultConfig.green && config.yellow == defaultConfig.yellow)
|
||||
return;
|
||||
|
||||
+6
-11
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "util/FFstrbuf.h"
|
||||
#include "common/parsing.h"
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -10,12 +11,6 @@ enum
|
||||
FF_PERCENTAGE_TYPE_NUM_COLOR_BIT = 1 << 3,
|
||||
};
|
||||
|
||||
typedef struct FFPercentConfig
|
||||
{
|
||||
uint8_t green;
|
||||
uint8_t yellow;
|
||||
} FFPercentConfig;
|
||||
|
||||
// if (green <= yellow)
|
||||
// [0, green]: print green
|
||||
// (green, yellow]: print yellow
|
||||
@@ -26,12 +21,12 @@ typedef struct FFPercentConfig
|
||||
// [yellow, green): print yellow
|
||||
// [0, yellow): print red
|
||||
|
||||
void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFPercentConfig config);
|
||||
void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFPercentConfig config, bool parentheses);
|
||||
void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFColorRangeConfig config);
|
||||
void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFColorRangeConfig config, bool parentheses);
|
||||
|
||||
typedef struct yyjson_val yyjson_val;
|
||||
typedef struct yyjson_mut_doc yyjson_mut_doc;
|
||||
typedef struct yyjson_mut_val yyjson_mut_val;
|
||||
bool ffPercentParseCommandOptions(const char* key, const char* subkey, const char* value, FFPercentConfig* config);
|
||||
bool ffPercentParseJsonObject(const char* key, yyjson_val* value, FFPercentConfig* config);
|
||||
void ffPercentGenerateJsonConfig(yyjson_mut_doc* doc, yyjson_mut_val* module, FFPercentConfig defaultConfig, FFPercentConfig config);
|
||||
bool ffPercentParseCommandOptions(const char* key, const char* subkey, const char* value, FFColorRangeConfig* config);
|
||||
bool ffPercentParseJsonObject(const char* key, yyjson_val* value, FFColorRangeConfig* config);
|
||||
void ffPercentGenerateJsonConfig(yyjson_mut_doc* doc, yyjson_mut_val* module, FFColorRangeConfig defaultConfig, FFColorRangeConfig config);
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
#include "fastfetch.h"
|
||||
#include "common/temps.h"
|
||||
#include "util/textModifier.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
void ffTempsAppendNum(double celsius, FFstrbuf* buffer, FFColorRangeConfig config)
|
||||
{
|
||||
if (celsius != celsius) // ignores NaN
|
||||
return;
|
||||
|
||||
const FFOptionsDisplay* options = &instance.config.display;
|
||||
const char* colorGreen = options->tempColorGreen.chars;
|
||||
const char* colorYellow = options->tempColorYellow.chars;
|
||||
const char* colorRed = options->tempColorRed.chars;
|
||||
|
||||
uint8_t green = config.green, yellow = config.yellow;
|
||||
|
||||
if (!options->pipe)
|
||||
{
|
||||
if(green <= yellow)
|
||||
{
|
||||
if (celsius > yellow)
|
||||
ffStrbufAppendF(buffer, "\e[%sm", colorRed);
|
||||
else if (celsius > green)
|
||||
ffStrbufAppendF(buffer, "\e[%sm", colorYellow);
|
||||
else
|
||||
ffStrbufAppendF(buffer, "\e[%sm", colorGreen);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (celsius < yellow)
|
||||
ffStrbufAppendF(buffer, "\e[%sm", colorRed);
|
||||
else if (celsius < green)
|
||||
ffStrbufAppendF(buffer, "\e[%sm", colorYellow);
|
||||
else
|
||||
ffStrbufAppendF(buffer, "\e[%sm", colorGreen);
|
||||
}
|
||||
}
|
||||
|
||||
switch (options->temperatureUnit)
|
||||
{
|
||||
case FF_TEMPERATURE_UNIT_CELSIUS:
|
||||
ffStrbufAppendF(buffer, "%.*f°C", options->tempNdigits, celsius);
|
||||
break;
|
||||
case FF_TEMPERATURE_UNIT_FAHRENHEIT:
|
||||
ffStrbufAppendF(buffer, "%.*f°F", options->tempNdigits, celsius * 1.8 + 32);
|
||||
break;
|
||||
case FF_TEMPERATURE_UNIT_KELVIN:
|
||||
ffStrbufAppendF(buffer, "%.*f K", options->tempNdigits, celsius + 273.15);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!options->pipe)
|
||||
ffStrbufAppendS(buffer, FASTFETCH_TEXT_MODIFIER_RESET);
|
||||
}
|
||||
|
||||
bool ffTempsParseCommandOptions(const char* key, const char* subkey, const char* value, bool* useTemp, FFColorRangeConfig* config)
|
||||
{
|
||||
if (!ffStrStartsWithIgnCase(subkey, "temp"))
|
||||
return false;
|
||||
|
||||
if (subkey[strlen("temp")] == '\0')
|
||||
{
|
||||
*useTemp = ffOptionParseBoolean(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (subkey[strlen("temp")] != '-')
|
||||
return false;
|
||||
|
||||
subkey += strlen("temp-");
|
||||
|
||||
if (ffStrEqualsIgnCase(subkey, "green"))
|
||||
{
|
||||
uint32_t num = ffOptionParseUInt32(key, value);
|
||||
if (num > 100)
|
||||
{
|
||||
fprintf(stderr, "Error: usage: %s must be between 0 and 100\n", key);
|
||||
exit(480);
|
||||
}
|
||||
config->green = (uint8_t) num;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(subkey, "yellow"))
|
||||
{
|
||||
uint32_t num = ffOptionParseUInt32(key, value);
|
||||
if (num > 100)
|
||||
{
|
||||
fprintf(stderr, "Error: usage: %s must be between 0 and 100\n", key);
|
||||
exit(480);
|
||||
}
|
||||
config->yellow = (uint8_t) num;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ffTempsParseJsonObject(const char* key, yyjson_val* value, bool* useTemp, FFColorRangeConfig* config)
|
||||
{
|
||||
if (!ffStrEqualsIgnCase(key, "temp"))
|
||||
return false;
|
||||
|
||||
if (yyjson_is_bool(value))
|
||||
{
|
||||
*useTemp = yyjson_get_bool(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (yyjson_is_null(value))
|
||||
{
|
||||
*useTemp = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!yyjson_is_obj(value))
|
||||
{
|
||||
fprintf(stderr, "Error: usage: %s must be an object or a boolean\n", key);
|
||||
exit(480);
|
||||
}
|
||||
|
||||
*useTemp = true;
|
||||
|
||||
yyjson_val* greenVal = yyjson_obj_get(value, "green");
|
||||
if (greenVal)
|
||||
{
|
||||
int num = yyjson_get_int(greenVal);
|
||||
if (num < 0 || num > 100)
|
||||
{
|
||||
fputs("Error: usage: temp.green must be between 0 and 100\n", stderr);
|
||||
exit(480);
|
||||
}
|
||||
config->green = (uint8_t) num;
|
||||
}
|
||||
|
||||
yyjson_val* yellowVal = yyjson_obj_get(value, "yellow");
|
||||
if (yellowVal)
|
||||
{
|
||||
int num = yyjson_get_int(yellowVal);
|
||||
if (num < 0 || num > 100)
|
||||
{
|
||||
fputs("Error: usage: temp.yellow must be between 0 and 100\n", stderr);
|
||||
exit(480);
|
||||
}
|
||||
config->yellow = (uint8_t) num;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ffTempsGenerateJsonConfig(yyjson_mut_doc* doc, yyjson_mut_val* module, FF_MAYBE_UNUSED bool defaultTemp, FFColorRangeConfig defaultConfig, bool temp, FFColorRangeConfig config)
|
||||
{
|
||||
assert(defaultTemp == false); // assume defaultTemp is always false
|
||||
|
||||
if (!temp)
|
||||
return;
|
||||
|
||||
if (config.green != defaultConfig.green || config.yellow != defaultConfig.yellow)
|
||||
{
|
||||
yyjson_mut_val* temp = yyjson_mut_obj_add_obj(doc, module, "temp");
|
||||
if (config.green != defaultConfig.green)
|
||||
yyjson_mut_obj_add_uint(doc, temp, "green", config.green);
|
||||
if (config.yellow != defaultConfig.yellow)
|
||||
yyjson_mut_obj_add_uint(doc, temp, "yellow", config.yellow);
|
||||
}
|
||||
else
|
||||
{
|
||||
yyjson_mut_obj_add_bool(doc, module, "temp", true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "common/parsing.h"
|
||||
|
||||
void ffTempsAppendNum(double celsius, FFstrbuf* buffer, FFColorRangeConfig config);
|
||||
bool ffTempsParseCommandOptions(const char* key, const char* subkey, const char* value, bool* useTemp, FFColorRangeConfig* config);
|
||||
bool ffTempsParseJsonObject(const char* key, yyjson_val* value, bool* useTemp, FFColorRangeConfig* config);
|
||||
void ffTempsGenerateJsonConfig(yyjson_mut_doc* doc, yyjson_mut_val* module, FF_MAYBE_UNUSED bool defaultTemp, FFColorRangeConfig defaultConfig, bool temp, FFColorRangeConfig config);
|
||||
+59
-1
@@ -656,7 +656,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "temperature-unit",
|
||||
"long": "temp-unit",
|
||||
"desc": "Set the unit of the temperature",
|
||||
"arg": {
|
||||
"type": "enum",
|
||||
@@ -667,6 +667,41 @@
|
||||
},
|
||||
"default": "C"
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "temp-ndigits",
|
||||
"desc": "Set the number of digits to keep after the decimal point when printing temperature",
|
||||
"arg": {
|
||||
"type": "num",
|
||||
"default": 2
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "temp-color-green",
|
||||
"desc": "Set color used in green state of temperature values",
|
||||
"remark": "See `-h color` for the list of available colors",
|
||||
"arg": {
|
||||
"type": "color",
|
||||
"default": "green"
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "temp-color-yellow",
|
||||
"desc": "Set color used in yellow state of temperature values",
|
||||
"remark": "See `-h color` for the list of available colors",
|
||||
"arg": {
|
||||
"type": "color",
|
||||
"default": "light_yellow"
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "temp-color-red",
|
||||
"desc": "Set color used in red state of temperature values",
|
||||
"remark": "See `-h color` for the list of available colors",
|
||||
"arg": {
|
||||
"type": "color",
|
||||
"default": "light_red"
|
||||
}
|
||||
}
|
||||
],
|
||||
"Library path": [
|
||||
@@ -1497,6 +1532,29 @@
|
||||
"type": "num"
|
||||
},
|
||||
"pseudo": true
|
||||
},
|
||||
{
|
||||
"long": "<module>-temp-green",
|
||||
"desc": [
|
||||
"Threshold of temperature colors",
|
||||
"Value less then temp-green will be shown in green"
|
||||
],
|
||||
"arg": {
|
||||
"type": "num"
|
||||
},
|
||||
"pseudo": true
|
||||
},
|
||||
{
|
||||
"long": "<module>-temp-yellow",
|
||||
"desc": [
|
||||
"Threshold of temperature colors",
|
||||
"Value greater than temp-green and less then yellow will be shown in yellow",
|
||||
"Value greater than temp-yellow will be shown in red"
|
||||
],
|
||||
"arg": {
|
||||
"type": "num"
|
||||
},
|
||||
"pseudo": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
Usage: fastfetch -c <file>
|
||||
|
||||
Loads a config file. A config file contains one flag per line. Empty lines or lines starting with # are ignored.
|
||||
If the file is relative it looks in the following order:
|
||||
- relative to the current working directory
|
||||
- relative to ~/.local/share/fastfetch/presets/
|
||||
- relative to /usr/share/fastfetch/presets/
|
||||
Fastfetch provides some default presets. List them with "fastfetch --list-presets".
|
||||
@@ -1,15 +1,15 @@
|
||||
A format string is a string that contains placeholders for values.
|
||||
These placeholders begin with a '{', containing the index of the value, and end with a '}'.
|
||||
For example the format string "Values: {1} ({2})", with the values "First" and "My second val", will produce
|
||||
For example the format string "Values: {1} ({2})", with the values "First" and "My second val", will produce "Values: First (My second val)".
|
||||
The format string can contain placeholders in any order and have multiple occurrences.
|
||||
To include spaces when setting from the command line, surround the whole string with double quotes (").
|
||||
|
||||
If the value index is missing, meaning the placeholder is "{}", an internal counter sets the value index.
|
||||
This means that the format string "Values: {1} ({2})" is equivalent to "Values: {} ({})".
|
||||
Note that this counter only counts empty placeholders, so the format string "{2} {} {}" will contain the second v
|
||||
Note that this counter only counts empty placeholders, so the format string "{2} {} {}" will contain the second value, then the first, and then the second again.
|
||||
|
||||
To make formatting easier, a double open curly brace ("{{") will be printed as a single open curly brace and not
|
||||
If a value index is misformatted or wants a non-existing value, it will be printed as is, with the curly braces aro
|
||||
To make formatting easier, a double open curly brace ("{{") will be printed as a single open curly brace and not counted as the beginning of a placeholder.
|
||||
If a value index is misformatted or wants a non-existing value, it will be printed as is, with the curly braces around it.
|
||||
If the last placeholder isn't closed, it will be treated like it was at the end of the format string.
|
||||
|
||||
To only print something if a variable is set, use "{?<index>} ... {?}".
|
||||
@@ -17,7 +17,7 @@ For example, to only print a second value if it is set, use "{?2} Second value:
|
||||
If a "{?}" is found without an opener, it is printed as is.
|
||||
|
||||
To only print something if a variable is not set, do the same as with if, just replace every '?' with a '!'.
|
||||
For example to print a fallback for a second value if it is not set, use "{?2}{2}{?}{/2}Second value fallback{/}"
|
||||
For example to print a fallback for a second value if it is not set, use "{?2}{2}{?}{/2}Second value fallback{/}".
|
||||
|
||||
To stop formatting at any point in the format string, use "{-}".
|
||||
|
||||
@@ -25,7 +25,7 @@ To print something with color, start a placeholder with a '#' and then the linux
|
||||
"\033[" at the start, and an 'm' at the end is automatically added, so don't do that.
|
||||
A "{#}" is equivalent to a "{#0}" and resets everything to normal.
|
||||
For example to print something pink and underline, use "{#4;35}...{#}".
|
||||
Information about what the numbers mean can be found here: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Sele
|
||||
Information about what the numbers mean can be found here: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters.
|
||||
Which escape codes are supported and how they look is defined by your terminal.
|
||||
|
||||
If a format string evaluates to an empty value, the whole line in the output will be discarded.
|
||||
|
||||
@@ -114,7 +114,7 @@ static const char* detectWithDdcci(FFBrightnessOptions* options, FFlist* result)
|
||||
{
|
||||
FF_SUPPRESS_IO();
|
||||
// Ref: https://github.com/rockowitz/ddcutil/issues/344
|
||||
if (ffddca_init("--disable-watch-displays", -1 /*DDCA_SYSLOG_NOT_SET*/, 1 /*DDCA_INIT_OPTIONS_DISABLE_CONFIG_FILE*/) < 0)
|
||||
if (ffddca_init(NULL, -1 /*DDCA_SYSLOG_NOT_SET*/, 1 /*DDCA_INIT_OPTIONS_DISABLE_CONFIG_FILE*/) < 0)
|
||||
return "ddca_init() failed";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -85,30 +85,58 @@ static const char* parseCpuInfo(FFCPUResult* cpu, FFstrbuf* physicalCoresBuffer,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static double getGHz(const char* file)
|
||||
static double getFrequency(FFstrbuf* basePath, const char* cpuinfoFileName, const char* scalingFileName, FFstrbuf* buffer)
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY content = ffStrbufCreate();
|
||||
if(ffAppendFileBuffer(file, &content))
|
||||
{
|
||||
double herz = ffStrbufToDouble(&content);
|
||||
uint32_t baseLen = basePath->length;
|
||||
ffStrbufAppendS(basePath, cpuinfoFileName);
|
||||
bool ok = ffReadFileBuffer(basePath->chars, buffer);
|
||||
ffStrbufSubstrBefore(basePath, baseLen);
|
||||
if (ok)
|
||||
return ffStrbufToDouble(buffer) / 1e6;
|
||||
|
||||
//ffStrbufToDouble failed
|
||||
if(herz != herz)
|
||||
return 0;
|
||||
ffStrbufAppendS(basePath, scalingFileName);
|
||||
ok = ffReadFileBuffer(basePath->chars, buffer);
|
||||
ffStrbufSubstrBefore(basePath, baseLen);
|
||||
if (ok)
|
||||
return ffStrbufToDouble(buffer) / 1e6;
|
||||
|
||||
herz /= 1000.0; //to MHz
|
||||
return herz / 1000.0; //to GHz
|
||||
}
|
||||
return 0;
|
||||
return 0.0/0.0;
|
||||
}
|
||||
|
||||
static double getFrequency(const char* info, const char* scaling)
|
||||
static bool detectFrequency(FFCPUResult* cpu)
|
||||
{
|
||||
double frequency = getGHz(info);
|
||||
if(frequency > 0.0)
|
||||
return frequency;
|
||||
FF_STRBUF_AUTO_DESTROY path = ffStrbufCreateS("/sys/devices/system/cpu/cpufreq/");
|
||||
FF_AUTO_CLOSE_DIR DIR* dir = opendir(path.chars);
|
||||
FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreate();
|
||||
uint32_t baseLen = path.length;
|
||||
bool flag = false;
|
||||
|
||||
return getGHz(scaling);
|
||||
struct dirent* entry;
|
||||
while((entry = readdir(dir)) != NULL)
|
||||
{
|
||||
if (ffStrStartsWith(entry->d_name, "policy") && isdigit(entry->d_name[strlen("policy")]))
|
||||
{
|
||||
ffStrbufAppendS(&path, entry->d_name);
|
||||
double fmin = getFrequency(&path, "/cpuinfo_min_freq", "/scaling_min_freq", &buffer);
|
||||
if (fmin != fmin) continue;
|
||||
double fmax = getFrequency(&path, "/cpuinfo_max_freq", "/scaling_max_freq", &buffer);
|
||||
if (fmax != fmax) continue;
|
||||
|
||||
if (flag)
|
||||
{
|
||||
cpu->frequencyMin = cpu->frequencyMin < fmin ? cpu->frequencyMin : fmin;
|
||||
cpu->frequencyMax = cpu->frequencyMax > fmax ? cpu->frequencyMax : fmax;
|
||||
}
|
||||
else
|
||||
{
|
||||
cpu->frequencyMin = fmin;
|
||||
cpu->frequencyMax = fmax;
|
||||
flag = true;
|
||||
}
|
||||
ffStrbufSubstrBefore(&path, baseLen);
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
static double detectCPUTemp(void)
|
||||
@@ -204,16 +232,8 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
|
||||
cpu->coresOnline = (uint16_t) get_nprocs();
|
||||
cpu->coresPhysical = (uint16_t) ffStrbufToUInt(&physicalCoresBuffer, cpu->coresLogical);
|
||||
|
||||
#define BP "/sys/devices/system/cpu/cpufreq/policy0/"
|
||||
if(ffPathExists(BP, FF_PATHTYPE_DIRECTORY))
|
||||
{
|
||||
cpu->frequencyMin = getFrequency(BP"cpuinfo_min_freq", BP"scaling_min_freq");
|
||||
cpu->frequencyMax = getFrequency(BP"cpuinfo_max_freq", BP"scaling_max_freq");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!detectFrequency(cpu))
|
||||
cpu->frequencyMin = cpu->frequencyMax = ffStrbufToDouble(&cpuMHz) / 1000;
|
||||
}
|
||||
|
||||
if(cpuUarch.length > 0)
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
static void getKDE(FFstrbuf* result, FFDEOptions* options)
|
||||
{
|
||||
ffParsePropFileValues("/usr/share/xsessions/plasmax11.desktop", 1, (FFpropquery[]) {
|
||||
ffParsePropFileValues(FASTFETCH_TARGET_DIR_USR "/share/xsessions/plasmax11.desktop", 1, (FFpropquery[]) {
|
||||
{"X-KDE-PluginInfo-Version =", result}
|
||||
});
|
||||
if(result->length == 0)
|
||||
@@ -21,7 +21,7 @@ static void getKDE(FFstrbuf* result, FFDEOptions* options)
|
||||
ffParsePropFileData("xsessions/plasma5.desktop", "X-KDE-PluginInfo-Version =", result);
|
||||
if(result->length == 0)
|
||||
{
|
||||
ffParsePropFileValues("/usr/share/wayland-sessions/plasma.desktop", 1, (FFpropquery[]) {
|
||||
ffParsePropFileValues(FASTFETCH_TARGET_DIR_USR "/share/wayland-sessions/plasma.desktop", 1, (FFpropquery[]) {
|
||||
{"X-KDE-PluginInfo-Version =", result}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -44,5 +44,5 @@ const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus);
|
||||
const char* ffGetGPUVendorString(unsigned vendorId);
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__)
|
||||
void ffGPUParsePciIds(FFstrbuf* content, uint8_t subclass, uint16_t vendor, uint16_t device, uint16_t subVendor, uint16_t subDevice, FFGPUResult* gpu);
|
||||
void ffGPUParsePciIds(FFstrbuf* content, uint8_t subclass, uint16_t vendor, uint16_t device, FFGPUResult* gpu);
|
||||
#endif
|
||||
|
||||
@@ -17,7 +17,7 @@ static bool loadPciIds(FFstrbuf* pciids)
|
||||
ffReadFileBuffer(_PATH_LOCALBASE "/share/pciids/pci.ids", pciids);
|
||||
if (pciids->length > 0) return true;
|
||||
|
||||
ffReadFileBuffer("/usr/share/pciids/pci.ids", pciids);
|
||||
ffReadFileBuffer(FASTFETCH_TARGET_DIR_USR "/share/pciids/pci.ids", pciids);
|
||||
if (pciids->length > 0) return true;
|
||||
|
||||
return false;
|
||||
@@ -74,7 +74,7 @@ const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus)
|
||||
{
|
||||
if (pciids.length == 0)
|
||||
loadPciIds(&pciids);
|
||||
ffGPUParsePciIds(&pciids, pc->pc_subclass, pc->pc_vendor, pc->pc_device, pc->pc_subvendor, pc->pc_subdevice, gpu);
|
||||
ffGPUParsePciIds(&pciids, pc->pc_subclass, pc->pc_vendor, pc->pc_device, gpu);
|
||||
}
|
||||
|
||||
#ifdef FF_USE_PROPRIETARY_GPU_DRIVER_API
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
#include "detection/gpu/gpu_driver_specific.h"
|
||||
#endif
|
||||
|
||||
#define FF_STR_INDIR(x) #x
|
||||
#define FF_STR(x) FF_STR_INDIR(x)
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
FF_MAYBE_UNUSED static void pciDetectTemp(FFGPUResult* gpu, uint32_t deviceClass)
|
||||
@@ -53,13 +56,18 @@ static void pciDetectDriver(FFGPUResult* gpu, FFstrbuf* pciDir, FFstrbuf* buffer
|
||||
|
||||
static bool loadPciIds(FFstrbuf* pciids)
|
||||
{
|
||||
ffReadFileBuffer("/usr/share/hwdata/pci.ids", pciids);
|
||||
#ifdef FF_CUSTOM_PCI_IDS_PATH
|
||||
ffReadFileBuffer(FF_STR(FF_CUSTOM_PCI_IDS_PATH), pciids);
|
||||
if (pciids->length > 0) return true;
|
||||
#endif
|
||||
|
||||
ffReadFileBuffer(FASTFETCH_TARGET_DIR_USR "/share/hwdata/pci.ids", pciids);
|
||||
if (pciids->length > 0) return true;
|
||||
|
||||
ffReadFileBuffer("/usr/share/misc/pci.ids", pciids); // debian?
|
||||
ffReadFileBuffer(FASTFETCH_TARGET_DIR_USR "/share/misc/pci.ids", pciids); // debian?
|
||||
if (pciids->length > 0) return true;
|
||||
|
||||
ffReadFileBuffer("/usr/local/share/hwdata/pci.ids", pciids);
|
||||
ffReadFileBuffer(FASTFETCH_TARGET_DIR_USR "/local/share/hwdata/pci.ids", pciids);
|
||||
if (pciids->length > 0) return true;
|
||||
|
||||
return false;
|
||||
@@ -70,7 +78,7 @@ static const char* pciDetectGPUs(const FFGPUOptions* options, FFlist* gpus)
|
||||
//https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-pci
|
||||
const char* pciDirPath = "/sys/bus/pci/devices/";
|
||||
|
||||
DIR* dirp = opendir(pciDirPath);
|
||||
FF_AUTO_CLOSE_DIR DIR* dirp = opendir(pciDirPath);
|
||||
if(dirp == NULL)
|
||||
return "Failed to open `/sys/bus/pci/devices/`";
|
||||
|
||||
@@ -143,7 +151,7 @@ static const char* pciDetectGPUs(const FFGPUOptions* options, FFlist* gpus)
|
||||
{
|
||||
if (!pciids.length)
|
||||
loadPciIds(&pciids);
|
||||
ffGPUParsePciIds(&pciids, subclassId, (uint16_t) vendorId, (uint16_t) deviceId, (uint16_t) subVendorId, (uint16_t) subDeviceId, gpu);
|
||||
ffGPUParsePciIds(&pciids, subclassId, (uint16_t) vendorId, (uint16_t) deviceId, gpu);
|
||||
}
|
||||
|
||||
pciDetectDriver(gpu, &pciDir, &buffer);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "gpu.h"
|
||||
|
||||
void ffGPUParsePciIds(FFstrbuf* content, uint8_t subclass, uint16_t vendor, uint16_t device, uint16_t subVendor, uint16_t subDevice, FFGPUResult* gpu)
|
||||
void ffGPUParsePciIds(FFstrbuf* content, uint8_t subclass, uint16_t vendor, uint16_t device, FFGPUResult* gpu)
|
||||
{
|
||||
if (content->length)
|
||||
{
|
||||
@@ -40,13 +40,6 @@ void ffGPUParsePciIds(FFstrbuf* content, uint8_t subclass, uint16_t vendor, uint
|
||||
if (start)
|
||||
{
|
||||
start += len;
|
||||
|
||||
// Search for subvendor and subdevice
|
||||
len = (uint32_t) snprintf(buffer, sizeof(buffer), "\n\t\t%04x %04x ", subVendor, subDevice);
|
||||
char* subStart = memmem(start, (size_t) (end - start), buffer, len);
|
||||
if (subStart)
|
||||
start = subStart + len;
|
||||
|
||||
end = memchr(start, '\n', (uint32_t) (end - start));
|
||||
if (!end)
|
||||
end = content->chars + content->length;
|
||||
|
||||
@@ -63,7 +63,7 @@ static const char* getSddmVersion(FFstrbuf* version)
|
||||
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(zlib, gzrewind)
|
||||
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(zlib, gzclose)
|
||||
|
||||
gzFile file = ffgzopen("/usr/share/man/man1/sddm.1.gz", "rb");
|
||||
gzFile file = ffgzopen(FASTFETCH_TARGET_DIR_USR "/share/man/man1/sddm.1.gz", "rb");
|
||||
if (file == Z_NULL)
|
||||
return "ffgzopen(\"/usr/share/man/man1/sddm.1.gz\", \"rb\") failed";
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ typedef struct FFLocalIpResult
|
||||
FFstrbuf name;
|
||||
FFstrbuf ipv4;
|
||||
FFstrbuf ipv6;
|
||||
FFstrbuf gateway4;
|
||||
FFstrbuf gateway6;
|
||||
FFstrbuf mac;
|
||||
bool defaultRoute;
|
||||
} FFLocalIpResult;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "util/windows/unicode.h"
|
||||
#include "localip.h"
|
||||
|
||||
static void addNewIp(FFlist* list, const char* name, const char* value, int type, bool newIp, bool defaultRoute)
|
||||
static void addNewIp(FFlist* list, const char* name, const char* value, int type, bool newIp, bool gateway, bool defaultRoute)
|
||||
{
|
||||
FFLocalIpResult* ip = NULL;
|
||||
|
||||
@@ -17,6 +17,8 @@ static void addNewIp(FFlist* list, const char* name, const char* value, int type
|
||||
ffStrbufInit(&ip->ipv4);
|
||||
ffStrbufInit(&ip->ipv6);
|
||||
ffStrbufInit(&ip->mac);
|
||||
ffStrbufInit(&ip->gateway4);
|
||||
ffStrbufInit(&ip->gateway6);
|
||||
ip->defaultRoute = defaultRoute;
|
||||
}
|
||||
else
|
||||
@@ -27,10 +29,10 @@ static void addNewIp(FFlist* list, const char* name, const char* value, int type
|
||||
switch (type)
|
||||
{
|
||||
case AF_INET:
|
||||
ffStrbufSetS(&ip->ipv4, value);
|
||||
ffStrbufSetS(gateway ? &ip->gateway4 : &ip->ipv4, value);
|
||||
break;
|
||||
case AF_INET6:
|
||||
ffStrbufSetS(&ip->ipv6, value);
|
||||
ffStrbufSetS(gateway ? &ip->gateway6 : &ip->ipv6, value);
|
||||
break;
|
||||
case -1:
|
||||
ffStrbufSetS(&ip->mac, value);
|
||||
@@ -57,7 +59,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
|
||||
options->showType & FF_LOCALIP_TYPE_IPV4_BIT
|
||||
? options->showType & FF_LOCALIP_TYPE_IPV6_BIT ? AF_UNSPEC : AF_INET
|
||||
: AF_INET6,
|
||||
GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_DNS_SERVER,
|
||||
GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_DNS_SERVER | (options->showType & FF_LOCALIP_TYPE_GATEWAY_BIT ? GAA_FLAG_INCLUDE_GATEWAYS : 0),
|
||||
NULL,
|
||||
adapter_addresses,
|
||||
&adapter_addresses_buffer_size);
|
||||
@@ -96,10 +98,30 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
|
||||
uint8_t* ptr = adapter->PhysicalAddress;
|
||||
snprintf(addressBuffer, sizeof(addressBuffer), "%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
ptr[0], ptr[1], ptr[2], ptr[3], ptr[4], ptr[5]);
|
||||
addNewIp(results, name, addressBuffer, -1, newIp, isDefaultRoute);
|
||||
addNewIp(results, name, addressBuffer, -1, newIp, false, isDefaultRoute);
|
||||
newIp = false;
|
||||
}
|
||||
|
||||
for (IP_ADAPTER_GATEWAY_ADDRESS_LH* ifa = adapter->FirstGatewayAddress; ifa; ifa = ifa->Next)
|
||||
{
|
||||
if (ifa->Address.lpSockaddr->sa_family == AF_INET)
|
||||
{
|
||||
SOCKADDR_IN* ipv4 = (SOCKADDR_IN*) ifa->Address.lpSockaddr;
|
||||
char addressBuffer[INET_ADDRSTRLEN + 4];
|
||||
inet_ntop(AF_INET, &ipv4->sin_addr, addressBuffer, INET_ADDRSTRLEN);
|
||||
addNewIp(results, name, addressBuffer, AF_INET, newIp, true, isDefaultRoute);
|
||||
newIp = false;
|
||||
}
|
||||
else if (ifa->Address.lpSockaddr->sa_family == AF_INET6)
|
||||
{
|
||||
SOCKADDR_IN6* ipv6 = (SOCKADDR_IN6*) ifa->Address.lpSockaddr;
|
||||
char addressBuffer[INET6_ADDRSTRLEN];
|
||||
inet_ntop(AF_INET6, &ipv6->sin6_addr, addressBuffer, INET6_ADDRSTRLEN);
|
||||
addNewIp(results, name, addressBuffer, AF_INET6, newIp, true, isDefaultRoute);
|
||||
newIp = false;
|
||||
}
|
||||
}
|
||||
|
||||
for (IP_ADAPTER_UNICAST_ADDRESS* ifa = adapter->FirstUnicastAddress; ifa; ifa = ifa->Next)
|
||||
{
|
||||
if (ifa->Address.lpSockaddr->sa_family == AF_INET)
|
||||
@@ -114,7 +136,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
|
||||
snprintf(addressBuffer + len, 4, "/%u", (unsigned) ifa->OnLinkPrefixLength);
|
||||
}
|
||||
|
||||
addNewIp(results, name, addressBuffer, AF_INET, newIp, isDefaultRoute);
|
||||
addNewIp(results, name, addressBuffer, AF_INET, newIp, false, isDefaultRoute);
|
||||
newIp = false;
|
||||
}
|
||||
else if (ifa->Address.lpSockaddr->sa_family == AF_INET6)
|
||||
@@ -122,7 +144,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
|
||||
SOCKADDR_IN6* ipv6 = (SOCKADDR_IN6*) ifa->Address.lpSockaddr;
|
||||
char addressBuffer[INET6_ADDRSTRLEN];
|
||||
inet_ntop(AF_INET6, &ipv6->sin6_addr, addressBuffer, INET6_ADDRSTRLEN);
|
||||
addNewIp(results, name, addressBuffer, AF_INET6, newIp, isDefaultRoute);
|
||||
addNewIp(results, name, addressBuffer, AF_INET6, newIp, false, isDefaultRoute);
|
||||
newIp = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,14 +45,14 @@ static void getBrewPackages(FFPackagesResult* result)
|
||||
if(ffStrSet(prefix))
|
||||
return countBrewPackages(prefix, result);
|
||||
|
||||
countBrewPackages(FASTFETCH_TARGET_DIR_ROOT"/opt/homebrew", result);
|
||||
countBrewPackages(FASTFETCH_TARGET_DIR_ROOT"/usr/local", result);
|
||||
countBrewPackages(FASTFETCH_TARGET_DIR_ROOT "/opt/homebrew", result);
|
||||
countBrewPackages(FASTFETCH_TARGET_DIR_USR "/local", result);
|
||||
}
|
||||
|
||||
static uint32_t countMacPortsPackages(const char* dirname)
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY baseDir = ffStrbufCreateS(dirname);
|
||||
ffStrbufAppendS(&baseDir, "/var/macports/software");
|
||||
ffStrbufAppendS(&baseDir, FASTFETCH_TARGET_DIR_ROOT "/var/macports/software");
|
||||
|
||||
return getNumElements(baseDir.chars, DT_DIR);
|
||||
}
|
||||
@@ -63,7 +63,7 @@ static uint32_t getMacPortsPackages()
|
||||
if(ffStrSet(prefix))
|
||||
return countMacPortsPackages(prefix);
|
||||
|
||||
return countMacPortsPackages(FASTFETCH_TARGET_DIR_ROOT"/opt/local");
|
||||
return countMacPortsPackages(FASTFETCH_TARGET_DIR_ROOT "/opt/local");
|
||||
}
|
||||
|
||||
static uint32_t getNixPackagesImpl(char* path)
|
||||
@@ -81,7 +81,7 @@ static uint32_t getNixPackagesImpl(char* path)
|
||||
ffStrbufAppendS(&command, "); do if [ -d $x ]; then echo $x ; fi ; done | cut -d- -f2- | egrep '([0-9]{1,}\\.)+[0-9]{1,}' | egrep -v '\\-doc$|\\-man$|\\-info$|\\-dev$|\\-bin$|^nixos-system-nixos-' | uniq | wc -l");
|
||||
|
||||
ffProcessAppendStdOut(&output, (char* const[]) {
|
||||
"/bin/sh",
|
||||
FASTFETCH_TARGET_DIR_ROOT "/bin/sh",
|
||||
"-c",
|
||||
command.chars,
|
||||
NULL
|
||||
|
||||
@@ -303,6 +303,34 @@ static void detectSt(FFTerminalFontResult* terminalFont, uint32_t pid)
|
||||
ffFontInitValues(&terminalFont->font, font.chars, size.chars);
|
||||
}
|
||||
|
||||
static void detectWarp(FFTerminalFontResult* terminalFont)
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY baseDir = ffStrbufCreateA(64);
|
||||
|
||||
FF_LIST_FOR_EACH(FFstrbuf, dirPrefix, instance.state.platform.configDirs)
|
||||
{
|
||||
//We need to copy the dir each time, because it used by multiple threads, so we can't directly write to it.
|
||||
ffStrbufSet(&baseDir, dirPrefix);
|
||||
ffStrbufAppendS(&baseDir, "warp-terminal/user_preferences.json");
|
||||
|
||||
yyjson_doc* doc = yyjson_read_file(baseDir.chars, YYJSON_READ_INSITU | YYJSON_READ_ALLOW_TRAILING_COMMAS | YYJSON_READ_ALLOW_COMMENTS, NULL, NULL);
|
||||
if (!doc) continue;
|
||||
|
||||
yyjson_val* prefs = yyjson_obj_get(yyjson_doc_get_root(doc), "prefs");
|
||||
if (yyjson_is_obj(prefs))
|
||||
{
|
||||
const char* fontName = yyjson_get_str(yyjson_obj_get(prefs, "FontName"));
|
||||
if (!fontName) fontName = "Hack";
|
||||
const char* fontSize = yyjson_get_str(yyjson_obj_get(prefs, "FontSize"));
|
||||
if (!fontSize) fontSize = "13";
|
||||
|
||||
ffFontInitValues(&terminalFont->font, fontName, fontSize);
|
||||
}
|
||||
yyjson_doc_free(doc);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void ffDetectTerminalFontPlatform(const FFTerminalResult* terminal, FFTerminalFontResult* terminalFont)
|
||||
{
|
||||
if(ffStrbufIgnCaseEqualS(&terminal->processName, "konsole"))
|
||||
@@ -331,4 +359,6 @@ void ffDetectTerminalFontPlatform(const FFTerminalResult* terminal, FFTerminalFo
|
||||
detectXterm(terminalFont);
|
||||
else if(ffStrbufIgnCaseEqualS(&terminal->processName, "st"))
|
||||
detectSt(terminalFont, terminal->pid);
|
||||
else if(ffStrbufIgnCaseEqualS(&terminal->processName, "warp"))
|
||||
detectWarp(terminalFont);
|
||||
}
|
||||
|
||||
@@ -423,6 +423,29 @@ static bool getTerminalVersionScreen(FFstrbuf* exe, FFstrbuf* version)
|
||||
return version->length > 0;
|
||||
}
|
||||
|
||||
static bool getTerminalVersionTmux(FFstrbuf* exe, FFstrbuf* version)
|
||||
{
|
||||
if (ffProcessAppendStdOut(version, (char* const[]) {
|
||||
exe->chars,
|
||||
"-V",
|
||||
NULL
|
||||
}) != NULL)
|
||||
return false;
|
||||
|
||||
// tmux 3.4
|
||||
ffStrbufSubstrAfterFirstC(version, ' ');
|
||||
return version->length > 0;
|
||||
}
|
||||
|
||||
static bool getTerminalVersionZellij(FFstrbuf* exe, FFstrbuf* version)
|
||||
{
|
||||
if(!getExeVersionRaw(exe, version)) return false;
|
||||
|
||||
// zellij 0.39.2
|
||||
ffStrbufSubstrAfterFirstC(version, ' ');
|
||||
return version->length > 0;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
static bool getTerminalVersionWindowsTerminal(FFstrbuf* exe, FFstrbuf* version)
|
||||
@@ -540,6 +563,9 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe
|
||||
if(ffStrbufStartsWithIgnCaseS(processName, "screen"))
|
||||
return getTerminalVersionScreen(exe, version);
|
||||
|
||||
if(ffStrbufStartsWithIgnCaseS(processName, "zellij"))
|
||||
return getTerminalVersionZellij(exe, version);
|
||||
|
||||
const char* termProgramVersion = getenv("TERM_PROGRAM_VERSION");
|
||||
if(termProgramVersion)
|
||||
{
|
||||
@@ -548,7 +574,13 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe
|
||||
{
|
||||
if(ffStrbufStartsWithIgnCaseS(processName, termProgram) || // processName ends with `.exe` on Windows
|
||||
(ffStrEquals(termProgram, "vscode") && ffStrbufStartsWithIgnCaseS(processName, "code")) ||
|
||||
(ffStrEquals(termProgram, "iTerm.app") && ffStrbufStartsWithIgnCaseS(processName, "iTermServer-"))
|
||||
|
||||
#ifdef __APPLE__
|
||||
(ffStrEquals(termProgram, "iTerm.app") && ffStrbufStartsWithIgnCaseS(processName, "iTermServer-")) ||
|
||||
#elif defined(__linux__)
|
||||
(ffStrEquals(termProgram, "WarpTerminal") && ffStrbufEqualS(processName, "warp")) ||
|
||||
#endif
|
||||
false
|
||||
) {
|
||||
ffStrbufSetS(version, termProgramVersion);
|
||||
return true;
|
||||
@@ -572,6 +604,9 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe
|
||||
}
|
||||
}
|
||||
|
||||
if(ffStrbufStartsWithIgnCaseS(processName, "tmux"))
|
||||
return getTerminalVersionTmux(exe, version);
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
return getFileVersion(exe->chars, version);
|
||||
|
||||
@@ -23,6 +23,7 @@ typedef struct FFTerminalResult
|
||||
const char* exeName; //pointer to a char in exe
|
||||
FFstrbuf exePath; //Full real path to executable file
|
||||
FFstrbuf version;
|
||||
FFstrbuf tty;
|
||||
uint32_t pid;
|
||||
uint32_t ppid;
|
||||
} FFTerminalResult;
|
||||
|
||||
@@ -148,12 +148,7 @@ static const char* getProcessNameAndPpid(pid_t pid, char* name, pid_t* ppid, int
|
||||
return "sscanf(stat) failed";
|
||||
|
||||
if (tty)
|
||||
{
|
||||
if ((tty_ >> 8) == 0x88)
|
||||
*tty = tty_ & 0xFF;
|
||||
else
|
||||
*tty = -1;
|
||||
}
|
||||
*tty = tty_ & 0xFF;
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
|
||||
@@ -571,6 +566,7 @@ const FFTerminalResult* ffDetectTerminal()
|
||||
result.exeName = result.exe.chars;
|
||||
ffStrbufInit(&result.exePath);
|
||||
ffStrbufInit(&result.version);
|
||||
ffStrbufInitS(&result.tty, ttyname(STDOUT_FILENO));
|
||||
result.pid = 0;
|
||||
result.ppid = 0;
|
||||
|
||||
|
||||
@@ -406,6 +406,7 @@ const FFTerminalResult* ffDetectTerminal(void)
|
||||
ffStrbufInit(&result.exePath);
|
||||
ffStrbufInit(&result.prettyName);
|
||||
ffStrbufInit(&result.version);
|
||||
ffStrbufInit(&result.tty);
|
||||
result.pid = 0;
|
||||
result.ppid = 0;
|
||||
|
||||
|
||||
@@ -6,20 +6,32 @@
|
||||
|
||||
const char* ffDetectUptime(FFUptimeResult* result)
|
||||
{
|
||||
#ifndef __ANDROID__ // cat: /proc/uptime: Permission denied
|
||||
|
||||
// #620
|
||||
char buf[64];
|
||||
ssize_t nRead = ffReadFileData("/proc/uptime", sizeof(buf) - 1, buf);
|
||||
if(nRead < 0)
|
||||
return "ffReadFileData(\"/proc/uptime\", sizeof(buf) - 1, buf) failed";
|
||||
buf[nRead] = '\0';
|
||||
if(nRead > 0)
|
||||
{
|
||||
buf[nRead] = '\0';
|
||||
|
||||
char *err = NULL;
|
||||
double sec = strtod(buf, &err);
|
||||
if(err != buf)
|
||||
result->uptime = (uint64_t) (sec * 1000);
|
||||
else
|
||||
return "strtod(buf, &err) failed";
|
||||
char *err = NULL;
|
||||
double sec = strtod(buf, &err);
|
||||
if(err != buf)
|
||||
{
|
||||
result->uptime = (uint64_t) (sec * 1000);
|
||||
result->bootTime = ffTimeGetNow() + result->uptime;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
struct timespec uptime;
|
||||
if (clock_gettime(CLOCK_BOOTTIME, &uptime) != 0)
|
||||
return "clock_gettime(CLOCK_BOOTTIME) failed";
|
||||
|
||||
result->uptime = (uint64_t) uptime.tv_sec * 1000 + (uint64_t) uptime.tv_nsec / 1000000;
|
||||
result->bootTime = ffTimeGetNow() + result->uptime;
|
||||
|
||||
return NULL;
|
||||
|
||||
+1
-1
@@ -135,7 +135,7 @@ static void printFullHelp()
|
||||
}
|
||||
yyjson_doc_free(doc);
|
||||
|
||||
puts("\n" FASTFETCH_DATATEXT_HELP);
|
||||
puts("\n" FASTFETCH_DATATEXT_HELP_FOOTER);
|
||||
}
|
||||
|
||||
static bool printSpecificCommandHelp(const char* command)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#define FASTFETCH_DATATEXT_JSON_HELP @DATATEXT_JSON_HELP@
|
||||
#define FASTFETCH_DATATEXT_STRUCTURE @DATATEXT_STRUCTURE@
|
||||
#define FASTFETCH_DATATEXT_HELP @DATATEXT_HELP@
|
||||
#define FASTFETCH_DATATEXT_HELP_FOOTER @DATATEXT_HELP_FOOTER@
|
||||
#define FASTFETCH_DATATEXT_HELP_COLOR @DATATEXT_HELP_COLOR@
|
||||
#define FASTFETCH_DATATEXT_HELP_FORMAT @DATATEXT_HELP_FORMAT@
|
||||
#define FASTFETCH_DATATEXT_HELP_CONFIG @DATATEXT_HELP_CONFIG@
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/\\
|
||||
/ \\
|
||||
/ \\
|
||||
/ \\
|
||||
/ \\
|
||||
/ \\
|
||||
\\ \\
|
||||
/\\ \\____ \\
|
||||
/ \\____ \\ \\
|
||||
/ / \\ \\
|
||||
/ / \\ ___\\
|
||||
/ / \\ / ____
|
||||
/ / \\/ / \\
|
||||
/ / __________/ \\
|
||||
/ \\ \\ \\
|
||||
/ \\ \\ \\
|
||||
/ / / \\
|
||||
/___________/ /____________________\\
|
||||
/\
|
||||
/ \
|
||||
/ \
|
||||
/ \
|
||||
/ \
|
||||
/ \
|
||||
\ \
|
||||
/\ \____ \
|
||||
/ \____ \ \
|
||||
/ / \ \
|
||||
/ / \ ___\
|
||||
/ / \ / ____
|
||||
/ / \/ / \
|
||||
/ / __________/ \
|
||||
/ \ \ \
|
||||
/ \ \ \
|
||||
/ / / \
|
||||
/___________/ /____________________\
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/\\
|
||||
/ \\
|
||||
/ \\
|
||||
\\__ \\
|
||||
/\\__ \\ _\\
|
||||
/ / \\/ __
|
||||
/ / ____/ \\
|
||||
/ \\ \\ \\
|
||||
/_____/ /________\\
|
||||
/\
|
||||
/ \
|
||||
/ \
|
||||
\__ \
|
||||
/\__ \ _\
|
||||
/ / \/ __
|
||||
/ / ____/ \
|
||||
/ \ \ \
|
||||
/_____/ /________\
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "common/percent.h"
|
||||
#include "common/parsing.h"
|
||||
#include "common/temps.h"
|
||||
#include "detection/battery/battery.h"
|
||||
#include "modules/battery/battery.h"
|
||||
#include "util/stringUtils.h"
|
||||
@@ -49,7 +50,7 @@ static void printBattery(FFBatteryOptions* options, FFBatteryResult* result, uin
|
||||
if(str.length > 0)
|
||||
ffStrbufAppendS(&str, " - ");
|
||||
|
||||
ffParseTemperature(result->temperature, &str);
|
||||
ffTempsAppendNum(result->temperature, &str, options->tempConfig);
|
||||
}
|
||||
|
||||
ffStrbufPutTo(&str, stdout);
|
||||
@@ -58,13 +59,15 @@ static void printBattery(FFBatteryOptions* options, FFBatteryResult* result, uin
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY capacityStr = ffStrbufCreate();
|
||||
ffPercentAppendNum(&capacityStr, result->capacity, options->percent, false);
|
||||
FF_STRBUF_AUTO_DESTROY tempStr = ffStrbufCreate();
|
||||
ffTempsAppendNum(result->temperature, &tempStr, options->tempConfig);
|
||||
ffPrintFormat(FF_BATTERY_MODULE_NAME, index, &options->moduleArgs, FF_BATTERY_NUM_FORMAT_ARGS, (FFformatarg[]){
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &result->manufacturer},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &result->modelName},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &result->technology},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &capacityStr},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &result->status},
|
||||
{FF_FORMAT_ARG_TYPE_DOUBLE, &result->temperature},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &tempStr},
|
||||
{FF_FORMAT_ARG_TYPE_UINT, &result->cycleCount},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &result->serial},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &result->manufactureDate},
|
||||
@@ -108,11 +111,8 @@ bool ffParseBatteryCommandOptions(FFBatteryOptions* options, const char* key, co
|
||||
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
|
||||
return true;
|
||||
|
||||
if (ffStrEqualsIgnCase(subKey, "temp"))
|
||||
{
|
||||
options->temp = ffOptionParseBoolean(value);
|
||||
if (ffTempsParseCommandOptions(key, subKey, value, &options->temp, &options->tempConfig))
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
if (ffStrEqualsIgnCase(subKey, "use-setup-api"))
|
||||
@@ -149,11 +149,8 @@ void ffParseBatteryJsonObject(FFBatteryOptions* options, yyjson_val* module)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "temp"))
|
||||
{
|
||||
options->temp = yyjson_get_bool(val);
|
||||
if (ffTempsParseJsonObject(key, val, &options->temp, &options->tempConfig))
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ffPercentParseJsonObject(key, val, &options->percent))
|
||||
continue;
|
||||
@@ -174,8 +171,7 @@ void ffGenerateBatteryJsonConfig(FFBatteryOptions* options, yyjson_mut_doc* doc,
|
||||
yyjson_mut_obj_add_bool(doc, module, "useSetupApi", options->useSetupApi);
|
||||
#endif
|
||||
|
||||
if (options->temp != defaultOptions.temp)
|
||||
yyjson_mut_obj_add_bool(doc, module, "temp", options->temp);
|
||||
ffTempsGenerateJsonConfig(doc, module, defaultOptions.temp, defaultOptions.tempConfig, options->temp, options->tempConfig);
|
||||
|
||||
ffPercentGenerateJsonConfig(doc, module, defaultOptions.percent, options->percent);
|
||||
}
|
||||
@@ -226,7 +222,7 @@ void ffPrintBatteryHelpFormat(void)
|
||||
"Battery technology",
|
||||
"Battery capacity (percentage)",
|
||||
"Battery status",
|
||||
"Battery temperature",
|
||||
"Battery temperature (formatted)",
|
||||
"Battery cycle count",
|
||||
"Battery serial number",
|
||||
"Battery manufactor date",
|
||||
@@ -248,7 +244,8 @@ void ffInitBatteryOptions(FFBatteryOptions* options)
|
||||
);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
options->temp = false;
|
||||
options->percent = (FFPercentConfig) { 50, 20 };
|
||||
options->tempConfig = (FFColorRangeConfig) { 60, 80 };
|
||||
options->percent = (FFColorRangeConfig) { 50, 20 };
|
||||
|
||||
#ifdef _WIN32
|
||||
options->useSetupApi = false;
|
||||
|
||||
@@ -11,7 +11,8 @@ typedef struct FFBatteryOptions
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
bool temp;
|
||||
FFPercentConfig percent;
|
||||
FFColorRangeConfig tempConfig;
|
||||
FFColorRangeConfig percent;
|
||||
|
||||
#ifdef _WIN32
|
||||
bool useSetupApi;
|
||||
|
||||
@@ -198,7 +198,7 @@ void ffInitBluetoothOptions(FFBluetoothOptions* options)
|
||||
);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
options->showDisconnected = false;
|
||||
options->percent = (FFPercentConfig) { 50, 20 };
|
||||
options->percent = (FFColorRangeConfig) { 50, 20 };
|
||||
}
|
||||
|
||||
void ffDestroyBluetoothOptions(FFBluetoothOptions* options)
|
||||
|
||||
@@ -11,5 +11,5 @@ typedef struct FFBluetoothOptions
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
bool showDisconnected;
|
||||
FFPercentConfig percent;
|
||||
FFColorRangeConfig percent;
|
||||
} FFBluetoothOptions;
|
||||
|
||||
@@ -205,7 +205,7 @@ void ffInitBrightnessOptions(FFBrightnessOptions* options)
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
|
||||
options->ddcciSleep = 10;
|
||||
options->percent = (FFPercentConfig) { 100, 100 };
|
||||
options->percent = (FFColorRangeConfig) { 100, 100 };
|
||||
}
|
||||
|
||||
void ffDestroyBrightnessOptions(FFBrightnessOptions* options)
|
||||
|
||||
@@ -11,5 +11,5 @@ typedef struct FFBrightnessOptions
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
uint32_t ddcciSleep; // ms
|
||||
FFPercentConfig percent;
|
||||
FFColorRangeConfig percent;
|
||||
} FFBrightnessOptions;
|
||||
|
||||
+10
-13
@@ -1,6 +1,7 @@
|
||||
#include "common/printing.h"
|
||||
#include "common/jsonconfig.h"
|
||||
#include "common/parsing.h"
|
||||
#include "common/temps.h"
|
||||
#include "detection/cpu/cpu.h"
|
||||
#include "modules/cpu/cpu.h"
|
||||
#include "util/stringUtils.h"
|
||||
@@ -53,13 +54,15 @@ void ffPrintCPU(FFCPUOptions* options)
|
||||
if(cpu.temperature == cpu.temperature) //FF_CPU_TEMP_UNSET
|
||||
{
|
||||
ffStrbufAppendS(&str, " - ");
|
||||
ffParseTemperature(cpu.temperature, &str);
|
||||
ffTempsAppendNum(cpu.temperature, &str, options->tempConfig);
|
||||
}
|
||||
|
||||
ffStrbufPutTo(&str, stdout);
|
||||
}
|
||||
else
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY tempStr = ffStrbufCreate();
|
||||
ffTempsAppendNum(cpu.temperature, &tempStr, options->tempConfig);
|
||||
ffPrintFormat(FF_CPU_MODULE_NAME, 0, &options->moduleArgs, FF_CPU_NUM_FORMAT_ARGS, (FFformatarg[]){
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &cpu.name},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &cpu.vendor},
|
||||
@@ -68,7 +71,7 @@ void ffPrintCPU(FFCPUOptions* options)
|
||||
{FF_FORMAT_ARG_TYPE_UINT16, &cpu.coresOnline},
|
||||
{FF_FORMAT_ARG_TYPE_DOUBLE, &cpu.frequencyMin},
|
||||
{FF_FORMAT_ARG_TYPE_DOUBLE, &cpu.frequencyMax},
|
||||
{FF_FORMAT_ARG_TYPE_DOUBLE, &cpu.temperature}
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &tempStr}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -84,11 +87,8 @@ bool ffParseCPUCPUOptions(FFCPUOptions* options, const char* key, const char* va
|
||||
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
|
||||
return true;
|
||||
|
||||
if (ffStrEqualsIgnCase(subKey, "temp"))
|
||||
{
|
||||
options->temp = ffOptionParseBoolean(value);
|
||||
if (ffTempsParseCommandOptions(key, subKey, value, &options->temp, &options->tempConfig))
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(subKey, "freq-ndigits"))
|
||||
{
|
||||
@@ -112,11 +112,8 @@ void ffParseCPUJsonObject(FFCPUOptions* options, yyjson_val* module)
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "temp"))
|
||||
{
|
||||
options->temp = yyjson_get_bool(val);
|
||||
if (ffTempsParseJsonObject(key, val, &options->temp, &options->tempConfig))
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "freqNdigits"))
|
||||
{
|
||||
@@ -135,8 +132,7 @@ void ffGenerateCPUJsonConfig(FFCPUOptions* options, yyjson_mut_doc* doc, yyjson_
|
||||
|
||||
ffJsonConfigGenerateModuleArgsConfig(doc, module, &defaultOptions.moduleArgs, &options->moduleArgs);
|
||||
|
||||
if (defaultOptions.temp != options->temp)
|
||||
yyjson_mut_obj_add_bool(doc, module, "temp", options->temp);
|
||||
ffTempsGenerateJsonConfig(doc, module, defaultOptions.temp, defaultOptions.tempConfig, options->temp, options->tempConfig);
|
||||
|
||||
if (defaultOptions.freqNdigits != options->freqNdigits)
|
||||
yyjson_mut_obj_add_uint(doc, module, "freqNdigits", options->freqNdigits);
|
||||
@@ -193,7 +189,7 @@ void ffPrintCPUHelpFormat(void)
|
||||
"Online core count",
|
||||
"Min frequency",
|
||||
"Max frequency",
|
||||
"Temperature"
|
||||
"Temperature (formatted)"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -212,6 +208,7 @@ void ffInitCPUOptions(FFCPUOptions* options)
|
||||
);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
options->temp = false;
|
||||
options->tempConfig = (FFColorRangeConfig) { 60, 80 };
|
||||
options->freqNdigits = 2;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,5 +10,6 @@ typedef struct FFCPUOptions
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
bool temp;
|
||||
FFColorRangeConfig tempConfig;
|
||||
uint8_t freqNdigits;
|
||||
} FFCPUOptions;
|
||||
|
||||
@@ -190,7 +190,7 @@ void ffInitCPUUsageOptions(FFCPUUsageOptions* options)
|
||||
);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
options->separate = false;
|
||||
options->percent = (FFPercentConfig) { 50, 80 };
|
||||
options->percent = (FFColorRangeConfig) { 50, 80 };
|
||||
}
|
||||
|
||||
void ffDestroyCPUUsageOptions(FFCPUUsageOptions* options)
|
||||
|
||||
@@ -11,5 +11,5 @@ typedef struct FFCPUUsageOptions
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
bool separate;
|
||||
FFPercentConfig percent;
|
||||
FFColorRangeConfig percent;
|
||||
} FFCPUUsageOptions;
|
||||
|
||||
@@ -484,7 +484,7 @@ void ffInitDiskOptions(FFDiskOptions* options)
|
||||
ffStrbufInit(&options->folders);
|
||||
options->showTypes = FF_DISK_VOLUME_TYPE_REGULAR_BIT | FF_DISK_VOLUME_TYPE_EXTERNAL_BIT | FF_DISK_VOLUME_TYPE_READONLY_BIT;
|
||||
options->calcType = FF_DISK_CALC_TYPE_FREE;
|
||||
options->percent = (FFPercentConfig) { 50, 80 };
|
||||
options->percent = (FFColorRangeConfig) { 50, 80 };
|
||||
}
|
||||
|
||||
void ffDestroyDiskOptions(FFDiskOptions* options)
|
||||
|
||||
@@ -30,5 +30,5 @@ typedef struct FFDiskOptions
|
||||
FFstrbuf folders;
|
||||
FFDiskVolumeType showTypes;
|
||||
FFDiskCalcType calcType;
|
||||
FFPercentConfig percent;
|
||||
FFColorRangeConfig percent;
|
||||
} FFDiskOptions;
|
||||
|
||||
@@ -220,6 +220,7 @@ void ffInitDiskIOOptions(FFDiskIOOptions* options)
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
|
||||
ffStrbufInit(&options->namePrefix);
|
||||
options->detectTotal = false;
|
||||
}
|
||||
|
||||
void ffDestroyDiskIOOptions(FFDiskIOOptions* options)
|
||||
|
||||
@@ -162,7 +162,7 @@ void ffInitGamepadOptions(FFGamepadOptions* options)
|
||||
ffGenerateGamepadJsonConfig
|
||||
);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
options->percent = (FFPercentConfig) { 50, 20 };
|
||||
options->percent = (FFColorRangeConfig) { 50, 20 };
|
||||
}
|
||||
|
||||
void ffDestroyGamepadOptions(FFGamepadOptions* options)
|
||||
|
||||
@@ -9,5 +9,5 @@ typedef struct FFGamepadOptions
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
FFPercentConfig percent;
|
||||
FFColorRangeConfig percent;
|
||||
} FFGamepadOptions;
|
||||
|
||||
+10
-13
@@ -2,6 +2,7 @@
|
||||
#include "common/parsing.h"
|
||||
#include "common/printing.h"
|
||||
#include "common/jsonconfig.h"
|
||||
#include "common/temps.h"
|
||||
#include "detection/host/host.h"
|
||||
#include "detection/gpu/gpu.h"
|
||||
#include "modules/gpu/gpu.h"
|
||||
@@ -44,7 +45,7 @@ static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResu
|
||||
if(gpu->temperature == gpu->temperature) //FF_GPU_TEMP_UNSET
|
||||
{
|
||||
ffStrbufAppendS(&output, " - ");
|
||||
ffParseTemperature(gpu->temperature, &output);
|
||||
ffTempsAppendNum(gpu->temperature, &output, options->tempConfig);
|
||||
}
|
||||
|
||||
if(gpu->dedicated.total != FF_GPU_VMEM_SIZE_UNSET && gpu->dedicated.total != 0)
|
||||
@@ -72,11 +73,13 @@ static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResu
|
||||
}
|
||||
else
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY tempStr = ffStrbufCreate();
|
||||
ffTempsAppendNum(gpu->temperature, &tempStr, options->tempConfig);
|
||||
ffPrintFormat(FF_GPU_MODULE_NAME, index, &options->moduleArgs, FF_GPU_NUM_FORMAT_ARGS, (FFformatarg[]){
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &gpu->vendor},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &gpu->name},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &gpu->driver},
|
||||
{FF_FORMAT_ARG_TYPE_DOUBLE, &gpu->temperature},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &tempStr},
|
||||
{FF_FORMAT_ARG_TYPE_INT, &gpu->coreCount},
|
||||
{FF_FORMAT_ARG_TYPE_STRING, type},
|
||||
{FF_FORMAT_ARG_TYPE_UINT64, &gpu->dedicated.total},
|
||||
@@ -146,11 +149,8 @@ bool ffParseGPUCommandOptions(FFGPUOptions* options, const char* key, const char
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(subKey, "temp"))
|
||||
{
|
||||
options->temp = ffOptionParseBoolean(value);
|
||||
if (ffTempsParseCommandOptions(key, subKey, value, &options->temp, &options->tempConfig))
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(subKey, "hide-type"))
|
||||
{
|
||||
@@ -181,11 +181,8 @@ void ffParseGPUJsonObject(FFGPUOptions* options, yyjson_val* module)
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "temp"))
|
||||
{
|
||||
options->temp = yyjson_get_bool(val);
|
||||
if (ffTempsParseJsonObject(key, val, &options->temp, &options->tempConfig))
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "driverSpecific"))
|
||||
{
|
||||
@@ -235,8 +232,7 @@ void ffGenerateGPUJsonConfig(FFGPUOptions* options, yyjson_mut_doc* doc, yyjson_
|
||||
if (options->forceVulkan != defaultOptions.forceVulkan)
|
||||
yyjson_mut_obj_add_bool(doc, module, "forceVulkan", options->forceVulkan);
|
||||
|
||||
if (options->temp != defaultOptions.temp)
|
||||
yyjson_mut_obj_add_bool(doc, module, "temp", options->temp);
|
||||
ffTempsGenerateJsonConfig(doc, module, defaultOptions.temp, defaultOptions.tempConfig, options->temp, options->tempConfig);
|
||||
|
||||
if (options->hideType != defaultOptions.hideType)
|
||||
{
|
||||
@@ -371,7 +367,8 @@ void ffInitGPUOptions(FFGPUOptions* options)
|
||||
options->forceVulkan = false;
|
||||
options->temp = false;
|
||||
options->hideType = FF_GPU_TYPE_UNKNOWN;
|
||||
options->percent = (FFPercentConfig) { 50, 80 };
|
||||
options->tempConfig = (FFColorRangeConfig) { 60, 80 };
|
||||
options->percent = (FFColorRangeConfig) { 50, 80 };
|
||||
}
|
||||
|
||||
void ffDestroyGPUOptions(FFGPUOptions* options)
|
||||
|
||||
@@ -21,5 +21,6 @@ typedef struct FFGPUOptions
|
||||
bool temp;
|
||||
bool driverSpecific;
|
||||
bool forceVulkan;
|
||||
FFPercentConfig percent;
|
||||
FFColorRangeConfig tempConfig;
|
||||
FFColorRangeConfig percent;
|
||||
} FFGPUOptions;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_LOCALIP_DISPLAY_NAME "Local IP"
|
||||
#define FF_LOCALIP_NUM_FORMAT_ARGS 5
|
||||
#define FF_LOCALIP_NUM_FORMAT_ARGS 7
|
||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||
|
||||
static int sortIps(const FFLocalIpResult* left, const FFLocalIpResult* right)
|
||||
@@ -40,12 +40,18 @@ static void printIp(FFLocalIpResult* ip, bool markDefaultRoute)
|
||||
{
|
||||
ffStrbufWriteTo(&ip->ipv4, stdout);
|
||||
flag = true;
|
||||
|
||||
if (ip->gateway4.length)
|
||||
printf(" [%s]", ip->gateway4.chars);
|
||||
}
|
||||
if (ip->ipv6.length)
|
||||
{
|
||||
if (flag) putchar(' ');
|
||||
ffStrbufWriteTo(&ip->ipv6, stdout);
|
||||
flag = true;
|
||||
|
||||
if (ip->gateway6.length)
|
||||
printf(" [%s]", ip->gateway6.chars);
|
||||
}
|
||||
if (ip->mac.length)
|
||||
{
|
||||
@@ -116,6 +122,8 @@ void ffPrintLocalIp(FFLocalIpOptions* options)
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &ip->mac},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &ip->name},
|
||||
{FF_FORMAT_ARG_TYPE_BOOL, &ip->defaultRoute},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &ip->gateway4},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &ip->gateway6},
|
||||
});
|
||||
}
|
||||
++index;
|
||||
@@ -127,6 +135,8 @@ void ffPrintLocalIp(FFLocalIpOptions* options)
|
||||
ffStrbufDestroy(&ip->name);
|
||||
ffStrbufDestroy(&ip->ipv4);
|
||||
ffStrbufDestroy(&ip->ipv6);
|
||||
ffStrbufDestroy(&ip->gateway4);
|
||||
ffStrbufDestroy(&ip->gateway6);
|
||||
ffStrbufDestroy(&ip->mac);
|
||||
}
|
||||
}
|
||||
@@ -165,6 +175,15 @@ bool ffParseLocalIpCommandOptions(FFLocalIpOptions* options, const char* key, co
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(subKey, "show-gateway"))
|
||||
{
|
||||
if (ffOptionParseBoolean(value))
|
||||
options->showType |= FF_LOCALIP_TYPE_GATEWAY_BIT;
|
||||
else
|
||||
options->showType &= ~FF_LOCALIP_TYPE_GATEWAY_BIT;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(subKey, "show-loop"))
|
||||
{
|
||||
if (ffOptionParseBoolean(value))
|
||||
@@ -238,6 +257,15 @@ void ffParseLocalIpJsonObject(FFLocalIpOptions* options, yyjson_val* module)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "showGateway"))
|
||||
{
|
||||
if (yyjson_get_bool(val))
|
||||
options->showType |= FF_LOCALIP_TYPE_GATEWAY_BIT;
|
||||
else
|
||||
options->showType &= ~FF_LOCALIP_TYPE_GATEWAY_BIT;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "showLoop"))
|
||||
{
|
||||
if (yyjson_get_bool(val))
|
||||
@@ -329,6 +357,8 @@ void ffGenerateLocalIpJsonResult(FF_MAYBE_UNUSED FFLocalIpOptions* options, yyjs
|
||||
yyjson_mut_obj_add_bool(doc, obj, "defaultRoute", ip->defaultRoute);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "ipv4", &ip->ipv4);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "ipv6", &ip->ipv6);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "gateway4", &ip->gateway4);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "gateway6", &ip->gateway6);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "mac", &ip->mac);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "name", &ip->name);
|
||||
}
|
||||
@@ -339,6 +369,8 @@ exit:
|
||||
ffStrbufDestroy(&ip->name);
|
||||
ffStrbufDestroy(&ip->ipv4);
|
||||
ffStrbufDestroy(&ip->ipv6);
|
||||
ffStrbufDestroy(&ip->gateway4);
|
||||
ffStrbufDestroy(&ip->gateway6);
|
||||
ffStrbufDestroy(&ip->mac);
|
||||
}
|
||||
}
|
||||
@@ -350,7 +382,9 @@ void ffPrintLocalIpHelpFormat(void)
|
||||
"Local IPv6 address",
|
||||
"Physical (MAC) address",
|
||||
"Interface name",
|
||||
"Is default route"
|
||||
"Is default route",
|
||||
"Gateway IPv4 address",
|
||||
"Gateway IPv6 address",
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ typedef enum FFLocalIpType
|
||||
FF_LOCALIP_TYPE_IPV4_BIT = 1 << 1,
|
||||
FF_LOCALIP_TYPE_IPV6_BIT = 1 << 2,
|
||||
FF_LOCALIP_TYPE_MAC_BIT = 1 << 3,
|
||||
FF_LOCALIP_TYPE_GATEWAY_BIT = 1 << 4,
|
||||
|
||||
FF_LOCALIP_TYPE_COMPACT_BIT = 1 << 10,
|
||||
} FFLocalIpType;
|
||||
|
||||
@@ -148,7 +148,7 @@ void ffInitMemoryOptions(FFMemoryOptions* options)
|
||||
ffGenerateMemoryJsonConfig
|
||||
);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
options->percent = (FFPercentConfig) { 50, 80 };
|
||||
options->percent = (FFColorRangeConfig) { 50, 80 };
|
||||
}
|
||||
|
||||
void ffDestroyMemoryOptions(FFMemoryOptions* options)
|
||||
|
||||
@@ -10,5 +10,5 @@ typedef struct FFMemoryOptions
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
FFPercentConfig percent;
|
||||
FFColorRangeConfig percent;
|
||||
} FFMemoryOptions;
|
||||
|
||||
@@ -257,6 +257,7 @@ void ffInitNetIOOptions(FFNetIOOptions* options)
|
||||
true
|
||||
#endif
|
||||
;
|
||||
options->detectTotal = false;
|
||||
}
|
||||
|
||||
void ffDestroyNetIOOptions(FFNetIOOptions* options)
|
||||
|
||||
@@ -11,4 +11,5 @@ typedef struct FFPhysicalDiskOptions
|
||||
|
||||
FFstrbuf namePrefix;
|
||||
bool temp;
|
||||
FFColorRangeConfig tempConfig;
|
||||
} FFPhysicalDiskOptions;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "common/printing.h"
|
||||
#include "common/jsonconfig.h"
|
||||
#include "common/parsing.h"
|
||||
#include "common/temps.h"
|
||||
#include "detection/physicaldisk/physicaldisk.h"
|
||||
#include "modules/physicaldisk/physicaldisk.h"
|
||||
#include "util/stringUtils.h"
|
||||
@@ -96,12 +97,14 @@ void ffPrintPhysicalDisk(FFPhysicalDiskOptions* options)
|
||||
if(buffer.length > 0)
|
||||
ffStrbufAppendS(&buffer, " - ");
|
||||
|
||||
ffParseTemperature(dev->temperature, &buffer);
|
||||
ffTempsAppendNum(dev->temperature, &buffer, options->tempConfig);
|
||||
}
|
||||
ffStrbufPutTo(&buffer, stdout);
|
||||
}
|
||||
else
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY tempStr = ffStrbufCreate();
|
||||
ffTempsAppendNum(dev->temperature, &tempStr, options->tempConfig);
|
||||
if (dev->type & FF_PHYSICALDISK_TYPE_READWRITE)
|
||||
readOnlyType = "Read-write";
|
||||
ffParseSize(dev->size, &buffer);
|
||||
@@ -115,7 +118,7 @@ void ffPrintPhysicalDisk(FFPhysicalDiskOptions* options)
|
||||
{FF_FORMAT_ARG_TYPE_STRING, removableType},
|
||||
{FF_FORMAT_ARG_TYPE_STRING, readOnlyType},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &dev->revision},
|
||||
{FF_FORMAT_ARG_TYPE_DOUBLE, &dev->temperature},
|
||||
{FF_FORMAT_ARG_TYPE_DOUBLE, &tempStr},
|
||||
});
|
||||
}
|
||||
++index;
|
||||
@@ -127,6 +130,7 @@ void ffPrintPhysicalDisk(FFPhysicalDiskOptions* options)
|
||||
ffStrbufDestroy(&dev->interconnect);
|
||||
ffStrbufDestroy(&dev->devPath);
|
||||
ffStrbufDestroy(&dev->serial);
|
||||
ffStrbufDestroy(&dev->revision);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,11 +147,8 @@ bool ffParsePhysicalDiskCommandOptions(FFPhysicalDiskOptions* options, const cha
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(subKey, "temp"))
|
||||
{
|
||||
options->temp = ffOptionParseBoolean(value);
|
||||
if (ffTempsParseCommandOptions(key, subKey, value, &options->temp, &options->tempConfig))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -171,11 +172,8 @@ void ffParsePhysicalDiskJsonObject(FFPhysicalDiskOptions* options, yyjson_val* m
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "temp"))
|
||||
{
|
||||
options->temp = yyjson_get_bool(val);
|
||||
if (ffTempsParseJsonObject(key, val, &options->temp, &options->tempConfig))
|
||||
continue;
|
||||
}
|
||||
|
||||
ffPrintError(FF_PHYSICALDISK_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
@@ -191,8 +189,7 @@ void ffGeneratePhysicalDiskJsonConfig(FFPhysicalDiskOptions* options, yyjson_mut
|
||||
if (!ffStrbufEqual(&options->namePrefix, &defaultOptions.namePrefix))
|
||||
yyjson_mut_obj_add_strbuf(doc, module, "namePrefix", &options->namePrefix);
|
||||
|
||||
if (options->temp != defaultOptions.temp)
|
||||
yyjson_mut_obj_add_bool(doc, module, "temp", options->temp);
|
||||
ffTempsGenerateJsonConfig(doc, module, defaultOptions.temp, defaultOptions.tempConfig, options->temp, options->tempConfig);
|
||||
}
|
||||
|
||||
void ffGeneratePhysicalDiskJsonResult(FFPhysicalDiskOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
|
||||
@@ -248,6 +245,8 @@ void ffGeneratePhysicalDiskJsonResult(FFPhysicalDiskOptions* options, yyjson_mut
|
||||
ffStrbufDestroy(&dev->name);
|
||||
ffStrbufDestroy(&dev->interconnect);
|
||||
ffStrbufDestroy(&dev->devPath);
|
||||
ffStrbufDestroy(&dev->serial);
|
||||
ffStrbufDestroy(&dev->revision);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,7 +262,7 @@ void ffPrintPhysicalDiskHelpFormat(void)
|
||||
"Device kind (Removable or Fixed)",
|
||||
"Device kind (Read-only or Read-write)",
|
||||
"Product revision",
|
||||
"Device temperature",
|
||||
"Device temperature (formatted)",
|
||||
});
|
||||
}
|
||||
|
||||
@@ -284,6 +283,7 @@ void ffInitPhysicalDiskOptions(FFPhysicalDiskOptions* options)
|
||||
|
||||
ffStrbufInit(&options->namePrefix);
|
||||
options->temp = false;
|
||||
options->tempConfig = (FFColorRangeConfig) { 40, 60 };
|
||||
}
|
||||
|
||||
void ffDestroyPhysicalDiskOptions(FFPhysicalDiskOptions* options)
|
||||
|
||||
@@ -18,5 +18,5 @@ typedef struct FFSoundOptions
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
FFSoundType soundType;
|
||||
FFPercentConfig percent;
|
||||
FFColorRangeConfig percent;
|
||||
} FFSoundOptions;
|
||||
|
||||
@@ -255,7 +255,7 @@ void ffInitSoundOptions(FFSoundOptions* options)
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
|
||||
options->soundType = FF_SOUND_TYPE_MAIN;
|
||||
options->percent = (FFPercentConfig) { 80, 90 };
|
||||
options->percent = (FFColorRangeConfig) { 80, 90 };
|
||||
}
|
||||
|
||||
void ffDestroySoundOptions(FFSoundOptions* options)
|
||||
|
||||
@@ -10,5 +10,5 @@ typedef struct FFSwapOptions
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
FFPercentConfig percent;
|
||||
FFColorRangeConfig percent;
|
||||
} FFSwapOptions;
|
||||
|
||||
@@ -157,7 +157,7 @@ void ffInitSwapOptions(FFSwapOptions* options)
|
||||
ffGenerateSwapJsonConfig
|
||||
);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
options->percent = (FFPercentConfig) { 50, 80 };
|
||||
options->percent = (FFColorRangeConfig) { 50, 80 };
|
||||
}
|
||||
|
||||
void ffDestroySwapOptions(FFSwapOptions* options)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define FF_TERMINAL_NUM_FORMAT_ARGS 7
|
||||
#define FF_TERMINAL_NUM_FORMAT_ARGS 8
|
||||
|
||||
void ffPrintTerminal(FFTerminalOptions* options)
|
||||
{
|
||||
@@ -37,6 +37,7 @@ void ffPrintTerminal(FFTerminalOptions* options)
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &result->prettyName},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &result->version},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &result->exePath},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &result->tty},
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -95,6 +96,7 @@ void ffGenerateTerminalJsonResult(FF_MAYBE_UNUSED FFTerminalOptions* options, yy
|
||||
yyjson_mut_obj_add_uint(doc, obj, "ppid", result->ppid);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "prettyName", &result->prettyName);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "version", &result->version);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "tty", &result->tty);
|
||||
}
|
||||
|
||||
void ffPrintTerminalHelpFormat(void)
|
||||
@@ -107,6 +109,7 @@ void ffPrintTerminalHelpFormat(void)
|
||||
"Terminal pretty name",
|
||||
"Terminal version",
|
||||
"Terminal full exe path",
|
||||
"Terminal tty / pts used",
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+109
-35
@@ -94,20 +94,46 @@ const char* ffOptionsParseDisplayJsonConfig(FFOptionsDisplay* options, yyjson_va
|
||||
yyjson_val* ndigits = yyjson_obj_get(val, "ndigits");
|
||||
if (ndigits) options->percentNdigits = (uint8_t) yyjson_get_uint(ndigits);
|
||||
}
|
||||
else if (ffStrEqualsIgnCase(key, "temperatureUnit"))
|
||||
else if (ffStrEqualsIgnCase(key, "temp"))
|
||||
{
|
||||
int value;
|
||||
const char* error = ffJsonConfigParseEnum(val, &value, (FFKeyValuePair[]) {
|
||||
{ "CELSIUS", FF_TEMPERATURE_UNIT_CELSIUS },
|
||||
{ "C", FF_TEMPERATURE_UNIT_CELSIUS },
|
||||
{ "FAHRENHEIT", FF_TEMPERATURE_UNIT_FAHRENHEIT },
|
||||
{ "F", FF_TEMPERATURE_UNIT_FAHRENHEIT },
|
||||
{ "KELVIN", FF_TEMPERATURE_UNIT_KELVIN },
|
||||
{ "K", FF_TEMPERATURE_UNIT_KELVIN },
|
||||
{},
|
||||
});
|
||||
if (error) return error;
|
||||
options->temperatureUnit = (FFTemperatureUnit) value;
|
||||
if (!yyjson_is_obj(val))
|
||||
return "display.temp must be an object";
|
||||
|
||||
yyjson_val* unit = yyjson_obj_get(val, "unit");
|
||||
if (unit)
|
||||
{
|
||||
int value;
|
||||
const char* error = ffJsonConfigParseEnum(unit, &value, (FFKeyValuePair[]) {
|
||||
{ "CELSIUS", FF_TEMPERATURE_UNIT_CELSIUS },
|
||||
{ "C", FF_TEMPERATURE_UNIT_CELSIUS },
|
||||
{ "FAHRENHEIT", FF_TEMPERATURE_UNIT_FAHRENHEIT },
|
||||
{ "F", FF_TEMPERATURE_UNIT_FAHRENHEIT },
|
||||
{ "KELVIN", FF_TEMPERATURE_UNIT_KELVIN },
|
||||
{ "K", FF_TEMPERATURE_UNIT_KELVIN },
|
||||
{},
|
||||
});
|
||||
if (error) return error;
|
||||
options->temperatureUnit = (FFTemperatureUnit) value;
|
||||
}
|
||||
|
||||
yyjson_val* ndigits = yyjson_obj_get(val, "ndigits");
|
||||
if (ndigits) options->tempNdigits = (uint8_t) yyjson_get_uint(ndigits);
|
||||
|
||||
yyjson_val* color = yyjson_obj_get(val, "color");
|
||||
if (color)
|
||||
{
|
||||
if (!yyjson_is_obj(color))
|
||||
return "display.temperature.color must be an object";
|
||||
|
||||
yyjson_val* green = yyjson_obj_get(color, "green");
|
||||
if (green) ffOptionParseColor(yyjson_get_str(green), &options->tempColorGreen);
|
||||
|
||||
yyjson_val* yellow = yyjson_obj_get(color, "yellow");
|
||||
if (yellow) ffOptionParseColor(yyjson_get_str(yellow), &options->tempColorYellow);
|
||||
|
||||
yyjson_val* red = yyjson_obj_get(color, "red");
|
||||
if (red) ffOptionParseColor(yyjson_get_str(red), &options->tempColorRed);
|
||||
}
|
||||
}
|
||||
else if (ffStrEqualsIgnCase(key, "percent"))
|
||||
{
|
||||
@@ -253,17 +279,31 @@ bool ffOptionsParseDisplayCommandLine(FFOptionsDisplay* options, const char* key
|
||||
{}
|
||||
});
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(key, "--temperature-unit"))
|
||||
else if(ffStrStartsWithIgnCase(key, "--temperature-"))
|
||||
{
|
||||
options->temperatureUnit = (FFTemperatureUnit) ffOptionParseEnum(key, value, (FFKeyValuePair[]) {
|
||||
{ "CELSIUS", FF_TEMPERATURE_UNIT_CELSIUS },
|
||||
{ "C", FF_TEMPERATURE_UNIT_CELSIUS },
|
||||
{ "FAHRENHEIT", FF_TEMPERATURE_UNIT_FAHRENHEIT },
|
||||
{ "F", FF_TEMPERATURE_UNIT_FAHRENHEIT },
|
||||
{ "KELVIN", FF_TEMPERATURE_UNIT_KELVIN },
|
||||
{ "K", FF_TEMPERATURE_UNIT_KELVIN },
|
||||
{},
|
||||
});
|
||||
const char* subkey = key + strlen("--temperature-");
|
||||
if(ffStrEqualsIgnCase(subkey, "unit"))
|
||||
{
|
||||
options->temperatureUnit = (FFTemperatureUnit) ffOptionParseEnum(key, value, (FFKeyValuePair[]) {
|
||||
{ "CELSIUS", FF_TEMPERATURE_UNIT_CELSIUS },
|
||||
{ "C", FF_TEMPERATURE_UNIT_CELSIUS },
|
||||
{ "FAHRENHEIT", FF_TEMPERATURE_UNIT_FAHRENHEIT },
|
||||
{ "F", FF_TEMPERATURE_UNIT_FAHRENHEIT },
|
||||
{ "KELVIN", FF_TEMPERATURE_UNIT_KELVIN },
|
||||
{ "K", FF_TEMPERATURE_UNIT_KELVIN },
|
||||
{},
|
||||
});
|
||||
}
|
||||
else if (ffStrEqualsIgnCase(subkey, "ndigits"))
|
||||
options->tempNdigits = (uint8_t) ffOptionParseUInt32(key, value);
|
||||
else if(ffStrEqualsIgnCase(subkey, "color-green"))
|
||||
ffOptionParseColor(value, &options->tempColorGreen);
|
||||
else if(ffStrEqualsIgnCase(subkey, "color-yellow"))
|
||||
ffOptionParseColor(value, &options->tempColorYellow);
|
||||
else if(ffStrEqualsIgnCase(subkey, "color-red"))
|
||||
ffOptionParseColor(value, &options->tempColorRed);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else if(ffStrStartsWithIgnCase(key, "--percent-"))
|
||||
{
|
||||
@@ -323,11 +363,16 @@ void ffOptionsInitDisplay(FFOptionsDisplay* options)
|
||||
options->binaryPrefixType = FF_BINARY_PREFIX_TYPE_IEC;
|
||||
options->sizeNdigits = 2;
|
||||
options->sizeMaxPrefix = UINT8_MAX;
|
||||
options->temperatureUnit = FF_TEMPERATURE_UNIT_CELSIUS;
|
||||
options->stat = false;
|
||||
options->noBuffer = false;
|
||||
options->keyWidth = 0;
|
||||
|
||||
options->temperatureUnit = FF_TEMPERATURE_UNIT_CELSIUS;
|
||||
options->tempNdigits = 1;
|
||||
ffStrbufInitStatic(&options->tempColorGreen, FF_COLOR_FG_GREEN);
|
||||
ffStrbufInitStatic(&options->tempColorYellow, FF_COLOR_FG_LIGHT_YELLOW);
|
||||
ffStrbufInitStatic(&options->tempColorRed, FF_COLOR_FG_LIGHT_RED);
|
||||
|
||||
ffStrbufInitStatic(&options->barCharElapsed, "■");
|
||||
ffStrbufInitStatic(&options->barCharTotal, "-");
|
||||
options->barWidth = 10;
|
||||
@@ -430,20 +475,38 @@ void ffOptionsGenerateDisplayJsonConfig(FFOptionsDisplay* options, yyjson_mut_do
|
||||
yyjson_mut_obj_add_val(doc, obj, "size", size);
|
||||
}
|
||||
|
||||
if (options->temperatureUnit != defaultOptions.temperatureUnit)
|
||||
{
|
||||
switch (options->temperatureUnit)
|
||||
yyjson_mut_val* temperature = yyjson_mut_obj(doc);
|
||||
if (options->temperatureUnit != defaultOptions.temperatureUnit)
|
||||
{
|
||||
case FF_TEMPERATURE_UNIT_CELSIUS:
|
||||
yyjson_mut_obj_add_str(doc, obj, "temperatureUnit", "C");
|
||||
break;
|
||||
case FF_TEMPERATURE_UNIT_FAHRENHEIT:
|
||||
yyjson_mut_obj_add_str(doc, obj, "temperatureUnit", "F");
|
||||
break;
|
||||
case FF_TEMPERATURE_UNIT_KELVIN:
|
||||
yyjson_mut_obj_add_str(doc, obj, "temperatureUnit", "K");
|
||||
break;
|
||||
switch (options->temperatureUnit)
|
||||
{
|
||||
case FF_TEMPERATURE_UNIT_CELSIUS:
|
||||
yyjson_mut_obj_add_str(doc, obj, "unit", "C");
|
||||
break;
|
||||
case FF_TEMPERATURE_UNIT_FAHRENHEIT:
|
||||
yyjson_mut_obj_add_str(doc, obj, "unit", "F");
|
||||
break;
|
||||
case FF_TEMPERATURE_UNIT_KELVIN:
|
||||
yyjson_mut_obj_add_str(doc, obj, "unit", "K");
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (options->tempNdigits != defaultOptions.tempNdigits)
|
||||
yyjson_mut_obj_add_uint(doc, temperature, "ndigits", options->tempNdigits);
|
||||
{
|
||||
yyjson_mut_val* color = yyjson_mut_obj(doc);
|
||||
if (!ffStrbufEqual(&options->tempColorGreen, &defaultOptions.tempColorGreen))
|
||||
yyjson_mut_obj_add_strbuf(doc, color, "green", &options->tempColorGreen);
|
||||
if (!ffStrbufEqual(&options->tempColorYellow, &defaultOptions.tempColorYellow))
|
||||
yyjson_mut_obj_add_strbuf(doc, color, "yellow", &options->tempColorYellow);
|
||||
if (!ffStrbufEqual(&options->tempColorRed, &defaultOptions.tempColorRed))
|
||||
yyjson_mut_obj_add_strbuf(doc, color, "red", &options->tempColorRed);
|
||||
if (yyjson_mut_obj_size(color) > 0)
|
||||
yyjson_mut_obj_add_val(doc, temperature, "color", color);
|
||||
}
|
||||
if (yyjson_mut_obj_size(temperature) > 0)
|
||||
yyjson_mut_obj_add_val(doc, obj, "temp", temperature);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -452,6 +515,17 @@ void ffOptionsGenerateDisplayJsonConfig(FFOptionsDisplay* options, yyjson_mut_do
|
||||
yyjson_mut_obj_add_uint(doc, percent, "type", options->percentType);
|
||||
if (options->percentNdigits != defaultOptions.percentNdigits)
|
||||
yyjson_mut_obj_add_uint(doc, percent, "ndigits", options->percentNdigits);
|
||||
{
|
||||
yyjson_mut_val* color = yyjson_mut_obj(doc);
|
||||
if (!ffStrbufEqual(&options->percentColorGreen, &defaultOptions.percentColorGreen))
|
||||
yyjson_mut_obj_add_strbuf(doc, color, "green", &options->percentColorGreen);
|
||||
if (!ffStrbufEqual(&options->percentColorYellow, &defaultOptions.percentColorYellow))
|
||||
yyjson_mut_obj_add_strbuf(doc, color, "yellow", &options->percentColorYellow);
|
||||
if (!ffStrbufEqual(&options->percentColorRed, &defaultOptions.percentColorRed))
|
||||
yyjson_mut_obj_add_strbuf(doc, color, "red", &options->percentColorRed);
|
||||
if (yyjson_mut_obj_size(color) > 0)
|
||||
yyjson_mut_obj_add_val(doc, percent, "color", color);
|
||||
}
|
||||
if (yyjson_mut_obj_size(percent) > 0)
|
||||
yyjson_mut_obj_add_val(doc, obj, "percent", percent);
|
||||
}
|
||||
|
||||
@@ -35,6 +35,10 @@ typedef struct FFOptionsDisplay
|
||||
uint8_t sizeNdigits;
|
||||
uint8_t sizeMaxPrefix;
|
||||
FFTemperatureUnit temperatureUnit;
|
||||
uint8_t tempNdigits;
|
||||
FFstrbuf tempColorGreen;
|
||||
FFstrbuf tempColorYellow;
|
||||
FFstrbuf tempColorRed;
|
||||
FFstrbuf barCharElapsed;
|
||||
FFstrbuf barCharTotal;
|
||||
uint8_t barWidth;
|
||||
|
||||
Reference in New Issue
Block a user