mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-02 03:14:15 +01:00
fastfetch: support --key-width
This commit is contained in:
+4
-1
@@ -5,7 +5,10 @@ Changes:
|
||||
* Previously: `$ NO_CONFIG=1 fastfetch --os-key \\\\ -s os -l none` prints `\: *`. Note the backslashs are unescaped twice (once by shell and once by fastfetch).
|
||||
* Now: `$ NO_CONFIG=1 fastfetch --os-key \\\\ -s os -l none` prints `\\: *`
|
||||
|
||||
# 2.0.0 (beta)
|
||||
Features:
|
||||
* Add `--key-width` for aligning the left edge of values
|
||||
|
||||
# 2.0.0-beta
|
||||
|
||||
Fastfetch v2 introduces a new configuration file format: JSON config. Please refer to <https://github.com/fastfetch-cli/fastfetch/wiki/Configuration> for details.
|
||||
|
||||
|
||||
@@ -221,6 +221,11 @@
|
||||
"title": "Use multiple threads to detect values",
|
||||
"default": true
|
||||
},
|
||||
"thread": {
|
||||
"type": "boolean",
|
||||
"title": "Alias of multithreading",
|
||||
"default": true
|
||||
},
|
||||
"stat": {
|
||||
"type": "boolean",
|
||||
"title": "Show time usage (in ms) for individual modules",
|
||||
|
||||
@@ -68,6 +68,7 @@ static void defaultConfig(void)
|
||||
instance.config.multithreading = true;
|
||||
instance.config.stat = false;
|
||||
instance.config.noBuffer = false;
|
||||
instance.config.keyWidth = 0;
|
||||
|
||||
ffInitTitleOptions(&instance.config.title);
|
||||
ffInitOSOptions(&instance.config.os);
|
||||
|
||||
@@ -433,6 +433,8 @@ const char* ffParseDisplayJsonConfig(void)
|
||||
config->percentType = (uint32_t) yyjson_get_uint(val);
|
||||
else if (ffStrEqualsIgnCase(key, "noBuffer"))
|
||||
config->noBuffer = yyjson_get_bool(val);
|
||||
else if (ffStrEqualsIgnCase(key, "keyWidth"))
|
||||
config->keyWidth = (uint32_t) yyjson_get_uint(val);
|
||||
else
|
||||
return "Unknown display property";
|
||||
}
|
||||
|
||||
@@ -46,6 +46,9 @@ void ffPrintLogoAndKey(const char* moduleName, uint8_t moduleIndex, const FFstrb
|
||||
|
||||
if(!instance.config.pipe)
|
||||
fputs(FASTFETCH_TEXT_MODIFIER_RESET, stdout);
|
||||
|
||||
if (instance.config.keyWidth > 0)
|
||||
printf("\e[%uG", (unsigned) (instance.config.keyWidth + instance.state.logoWidth));
|
||||
}
|
||||
|
||||
void ffPrintFormatString(const char* moduleName, uint8_t moduleIndex, const FFstrbuf* customKeyFormat, const FFstrbuf* customKeyColor, const FFstrbuf* format, uint32_t numArgs, const FFformatarg* arguments)
|
||||
|
||||
@@ -997,6 +997,8 @@ static void parseOption(FFdata* data, const char* key, const char* value)
|
||||
optionCheckString(key, value, &instance.config.colorTitle);
|
||||
ffOptionParseColor(value, &instance.config.colorTitle);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(key, "--key-width"))
|
||||
instance.config.keyWidth = ffOptionParseUInt32(key, value);
|
||||
else if(ffStrEqualsIgnCase(key, "--bright-color"))
|
||||
instance.config.brightColor = ffOptionParseBoolean(value);
|
||||
else if(ffStrEqualsIgnCase(key, "-c") || ffStrEqualsIgnCase(key, "--color"))
|
||||
|
||||
@@ -60,6 +60,7 @@ typedef struct FFconfig
|
||||
bool stat;
|
||||
bool noBuffer;
|
||||
int32_t processingTimeout;
|
||||
uint32_t keyWidth;
|
||||
|
||||
// Module options that cannot be put in module option structure
|
||||
#if defined(__linux__) || defined(__FreeBSD__)
|
||||
|
||||
Reference in New Issue
Block a user