mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
CPUUsage: rename cpuusage-display-type to separate
This commit is contained in:
@@ -5,6 +5,7 @@ Features:
|
||||
* Support GNOME Console terminal version and font detection (Terminal, Linux)
|
||||
* Add `--cpu-freq-ndigits` to set number of digits for CPU frequency (CPU)
|
||||
* New module to detect physical disk I/O usage (DiskIO)
|
||||
* Add `--cpuusage-separate` to display CPU usage per CPU logical core
|
||||
|
||||
Bugfixes:
|
||||
* Fix possible crashes on Windows 7 (Disk, Windows)
|
||||
|
||||
+14
-4
@@ -631,10 +631,6 @@
|
||||
"const": "chassis",
|
||||
"description": "Print chassis type (desktop, laptop, etc)"
|
||||
},
|
||||
{
|
||||
"const": "cpuusage",
|
||||
"description": "Print CPU usage. Costs some time to collect data"
|
||||
},
|
||||
{
|
||||
"const": "cursor",
|
||||
"description": "Print cursor style name"
|
||||
@@ -876,6 +872,20 @@
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
{
|
||||
"title": "CPU Usage",
|
||||
"properties": {
|
||||
"type": {
|
||||
"const": "cpuusage",
|
||||
"description": "Print CPU usage. Costs some time to collect data"
|
||||
},
|
||||
"separate": {
|
||||
"type": "boolean",
|
||||
"description": "Display CPU usage per CPU logical core, instead of an average result",
|
||||
"default": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Colors",
|
||||
"properties": {
|
||||
|
||||
@@ -141,6 +141,7 @@ Module specific options:
|
||||
--battery-dir <folder>: The directory where the battery folders are. Standard: /sys/class/power_supply/
|
||||
--cpu-temp <?value>: Detect and display CPU temperature if supported. Default is false
|
||||
--cpu-freq-ndigits <num>: Set the number of digits to keep after the decimal point when printing CPU frequency. Default is 2
|
||||
--cpuusage-separate <?value>: Display CPU usage per CPU logical core, instead of an average result. Default is false
|
||||
--gpu-temp <?value>: Detect and display GPU temperature if supported. Default is false
|
||||
--gpu-force-vulkan <?value>: Force using vulkan to detect GPUs, which support video memory usage detection with `--allow-slow-operations`. Default is false
|
||||
--gpu-hide-type <?value>: Specify the type of GPUs should not be printed. Must be `integrated`, `discrete` or `none`. Default is none
|
||||
|
||||
@@ -45,7 +45,7 @@ void ffPrintCPUUsage(FFCPUUsageOptions* options)
|
||||
ffPrintLogoAndKey(FF_CPUUSAGE_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT);
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY str = ffStrbufCreate();
|
||||
if (options->displayType == FF_CPUUSAGE_DISPLAY_TYPE_DEFAULT)
|
||||
if (!options->separate)
|
||||
{
|
||||
if(instance.config.percentType & FF_PERCENTAGE_TYPE_BAR_BIT)
|
||||
ffAppendPercentBar(&str, avgValue, 0, 50, 80);
|
||||
@@ -98,13 +98,9 @@ bool ffParseCPUUsageCommandOptions(FFCPUUsageOptions* options, const char* key,
|
||||
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
|
||||
return true;
|
||||
|
||||
if (ffStrEqualsIgnCase(subKey, "display-type"))
|
||||
if (ffStrEqualsIgnCase(subKey, "separate"))
|
||||
{
|
||||
options->displayType = (FFCPUUsageDisplayType) ffOptionParseEnum(key, value, (FFKeyValuePair[]) {
|
||||
{ "default", FF_CPUUSAGE_DISPLAY_TYPE_DEFAULT },
|
||||
{ "separate", FF_CPUUSAGE_DISPLAY_TYPE_SEPARATE },
|
||||
{},
|
||||
});
|
||||
options->separate = ffOptionParseBoolean(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -129,18 +125,9 @@ void ffParseCPUUsageJsonObject(FFCPUUsageOptions* options, yyjson_val* module)
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "display-type"))
|
||||
if (ffStrEqualsIgnCase(key, "separate"))
|
||||
{
|
||||
int value;
|
||||
const char* error = ffJsonConfigParseEnum(val, &value, (FFKeyValuePair[]) {
|
||||
{ "default", FF_CPUUSAGE_DISPLAY_TYPE_DEFAULT },
|
||||
{ "separate", FF_CPUUSAGE_DISPLAY_TYPE_SEPARATE },
|
||||
{},
|
||||
});
|
||||
if (error)
|
||||
ffPrintErrorString(FF_CPUUSAGE_MODULE_NAME, 0, NULL, FF_PRINT_TYPE_NO_CUSTOM_KEY, "Invalid %s value: %s", key, error);
|
||||
else
|
||||
options->displayType = (FFCPUUsageDisplayType) value;
|
||||
options->separate = yyjson_get_bool(val);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,15 +4,10 @@
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef enum FFCPUUsageDisplayType {
|
||||
FF_CPUUSAGE_DISPLAY_TYPE_DEFAULT,
|
||||
FF_CPUUSAGE_DISPLAY_TYPE_SEPARATE,
|
||||
} FFCPUUsageDisplayType;
|
||||
|
||||
typedef struct FFCPUUsageOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
FFCPUUsageDisplayType displayType;
|
||||
bool separate;
|
||||
} FFCPUUsageOptions;
|
||||
|
||||
Reference in New Issue
Block a user