mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-30 00:37:23 +01:00
Font: add option to display fonts inline ( enabled by default )
This commit is contained in:
@@ -180,6 +180,7 @@ __fastfetch_completion()
|
||||
"--cpu-temp"
|
||||
"--gpu-temp"
|
||||
"--battery-temp"
|
||||
"--font-inline"
|
||||
"--localip-show-ipv4"
|
||||
"--localip-show-ipv6"
|
||||
"--localip-show-loop"
|
||||
|
||||
@@ -233,6 +233,8 @@ static void defaultConfig(FFinstance* instance)
|
||||
|
||||
ffStrbufInitA(&instance->config.separatorString, 0);
|
||||
|
||||
instance->config.fontInline = true;
|
||||
|
||||
instance->config.localIpShowIpV4 = true;
|
||||
instance->config.localIpShowIpV6 = false;
|
||||
instance->config.localIpShowLoop = false;
|
||||
|
||||
@@ -97,6 +97,7 @@ Module specific options:
|
||||
--cpu-temp <?value>: Detect and display CPU temperature if supported. Default is false
|
||||
--gpu-temp <?value>: Detect and display GPU temperature if supported. Default is false
|
||||
--battery-temp <?value>: Detect and display Battery temperature if supported. Default is false
|
||||
--font-inline <?value>: Display fonts of different DE in one line
|
||||
--localip-show-ipv4 <?value>: Show ipv4 addresses in local ip module. Default is true
|
||||
--localip-show-ipv6 <?value>: Show ipv6 addresses in local ip module. Default is false
|
||||
--localip-show-loop <?value>: Show loop back addresses (127.0.0.1) in local ip module. Default is false
|
||||
|
||||
@@ -1269,6 +1269,8 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con
|
||||
optionParseString(key, value, &instance->config.batteryDir);
|
||||
else if(strcasecmp(key, "--separator-string") == 0)
|
||||
optionParseString(key, value, &instance->config.separatorString);
|
||||
else if(strcasecmp(key, "--font-inline") == 0)
|
||||
instance->config.fontInline = optionParseBoolean(value);
|
||||
else if(strcasecmp(key, "--localip-show-ipv4") == 0)
|
||||
instance->config.localIpShowIpV4 = optionParseBoolean(value);
|
||||
else if(strcasecmp(key, "--localip-show-ipv6") == 0)
|
||||
|
||||
@@ -165,6 +165,8 @@ typedef struct FFconfig
|
||||
|
||||
FFstrbuf separatorString;
|
||||
|
||||
bool fontInline;
|
||||
|
||||
bool localIpShowLoop;
|
||||
bool localIpShowIpV4;
|
||||
bool localIpShowIpV6;
|
||||
|
||||
+29
-17
@@ -25,26 +25,38 @@ void ffPrintFont(FFinstance* instance)
|
||||
return;
|
||||
}
|
||||
|
||||
for(uint32_t i = 0; i < list.length; ++i)
|
||||
if (instance->config.font.outputFormat.length == 0 && instance->config.fontInline)
|
||||
{
|
||||
FFFontResult* font = (FFFontResult*)ffListGet(&list, i);
|
||||
if(instance->config.font.outputFormat.length == 0)
|
||||
ffPrintLogoAndKey(instance, FF_FONT_MODULE_NAME, 0, &instance->config.font.key);
|
||||
for(uint32_t i = 0; i < list.length; ++i)
|
||||
{
|
||||
FFstrbuf key;
|
||||
ffStrbufInitF(&key, "%s (%s)", FF_FONT_MODULE_NAME, font->type);
|
||||
ffPrintLogoAndKey(instance, key.chars, 0, &instance->config.font.key);
|
||||
puts(font->fontPretty.chars);
|
||||
ffStrbufDestroy(&key);
|
||||
FFFontResult* font = (FFFontResult*)ffListGet(&list, i);
|
||||
printf("[%s] %*s%s", font->type, font->fontPretty.length, font->fontPretty.chars, i < list.length - 1 ? ", " : "");
|
||||
ffStrbufDestroy(&font->fontPretty);
|
||||
}
|
||||
putchar('\n');
|
||||
}
|
||||
else
|
||||
{
|
||||
for(uint32_t i = 0; i < list.length; ++i)
|
||||
{
|
||||
FFFontResult* font = (FFFontResult*)ffListGet(&list, i);
|
||||
if(instance->config.font.outputFormat.length == 0)
|
||||
{
|
||||
char keyChars[32];
|
||||
snprintf(keyChars, sizeof(keyChars), "%s (%s)", FF_FONT_MODULE_NAME, font->type);
|
||||
ffPrintLogoAndKey(instance, keyChars, 0, &instance->config.font.key);
|
||||
puts(font->fontPretty.chars);
|
||||
}
|
||||
else
|
||||
{
|
||||
ffPrintFormat(instance, FF_FONT_MODULE_NAME, 0, &instance->config.font, FF_FONT_NUM_FORMAT_ARGS, (FFformatarg[]){
|
||||
{FF_FORMAT_ARG_TYPE_STRING, font->type},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &font->fontPretty}
|
||||
});
|
||||
}
|
||||
ffStrbufDestroy(&font->fontPretty);
|
||||
}
|
||||
else
|
||||
{
|
||||
ffPrintFormat(instance, FF_FONT_MODULE_NAME, 0, &instance->config.font, FF_FONT_NUM_FORMAT_ARGS, (FFformatarg[]){
|
||||
{FF_FORMAT_ARG_TYPE_STRING, font->type},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &font->fontPretty}
|
||||
});
|
||||
}
|
||||
ffStrbufDestroy(&font->fontPretty);
|
||||
}
|
||||
|
||||
ffListDestroy(&list);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user