diff --git a/CMakeLists.txt b/CMakeLists.txt index cc912c338..5add4ef7e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,12 +75,13 @@ add_library(libfastfetch STATIC src/common/threading.c src/common/io.c src/common/processing.c - src/common/logo.c src/common/format.c src/common/parsing.c src/common/settings.c src/common/library.c src/common/networking.c + src/logo/logo.c + src/logo/builtin.c src/detection/os.c src/detection/plasma.c src/detection/gtk.c diff --git a/completions/bash b/completions/bash index 1b1df9d1d..e4258e604 100644 --- a/completions/bash +++ b/completions/bash @@ -122,8 +122,7 @@ __fastfetch_completion() "--recache" "--nocache" "--show-errors" - "--color-logo" - "--print-remaining-logo" + "--logo-print-remaining" "--multithreading" "--allow-slow-operations" "--disable-linewrap" @@ -134,13 +133,23 @@ __fastfetch_completion() ) local FF_OPTIONS_STRING=( + "--logo-type" + "--logo-padding" + "--logo-padding-left" + "--logo-padding-right" + "--logo-color-1" + "--logo-color-2" + "--logo-color-3" + "--logo-color-4" + "--logo-color-5" + "--logo-color-6" + "--logo-color-7" + "--logo-color-8" + "--logo-color-9" "-c" "--color" - "--spacing" - "-s" "--separator" - "-x" - "--offsetx" + "-s" "--structure" "--set" "--os-format" diff --git a/src/common/init.c b/src/common/init.c index 48ec48902..0ccc945e5 100644 --- a/src/common/init.c +++ b/src/common/init.c @@ -91,7 +91,9 @@ static void initCacheDir(FFstate* state) static void initState(FFstate* state) { - state->logoWidth = 0; + ffStrbufInit(&state->logoWidthEscapeCode); + state->logoHeight = 0; + state->keysHeight = 0; state->passwd = getpwuid(getuid()); uname(&state->utsname); sysinfo(&state->sysinfo); @@ -102,25 +104,24 @@ static void initState(FFstate* state) static void defaultConfig(FFinstance* instance) { - ffStrbufInit(&instance->config.color); + ffStrbufInit(&instance->config.logoName); + instance->config.logoType = FF_LOGO_TYPE_AUTO; + for(uint8_t i = 0; i < (uint8_t) FASTFETCH_LOGO_MAX_COLORS; ++i) + ffStrbufInit(&instance->config.logoColors[i]); + instance->config.logoPaddingLeft = 0; + instance->config.logoPaddingRight = 4; + instance->config.logoPrintRemaining = true; + ffStrbufInit(&instance->config.mainColor); ffStrbufInit(&instance->config.separator); ffStrbufAppendS(&instance->config.separator, ": "); - instance->config.logoKeySpacing = 4; - instance->config.offsetx = 0; - instance->config.colorLogo = true; instance->config.showErrors = false; instance->config.recache = false; instance->config.cacheSave = true; - instance->config.printRemainingLogo = true; instance->config.allowSlowOperations = false; instance->config.disableLinewrap = true; instance->config.hideCursor = true; - instance->config.userLogoIsRaw = false; - - for(uint8_t i = 0; i < (uint8_t) FASTFETCH_LOGO_MAX_COLORS; ++i) - ffStrbufInit(&instance->config.logoColors[i]); ffStrbufInitA(&instance->config.osFormat, 0); ffStrbufInitA(&instance->config.osKey, 0); @@ -253,21 +254,25 @@ void ffStart(FFinstance* instance) sigaction(SIGTERM, &action, NULL); sigaction(SIGQUIT, &action, NULL); + //reset everything to default before we start printing + fputs(FASTFETCH_TEXT_MODIFIER_RESET, stdout); + if(instance->config.hideCursor) fputs("\033[?25l", stdout); if(instance->config.disableLinewrap) fputs("\033[?7l", stdout); + + ffPrintLogo(instance); } void ffFinish(FFinstance* instance) { - if(instance->config.printRemainingLogo) - ffPrintRemainingLogo(instance); - + ffPrintRemainingLogo(instance); resetConsole(instance->config.disableLinewrap, instance->config.hideCursor); } +//Must be in a file compiled with the libfastfetch target, because the FF_HAVE* macros are not defined for the executable targets void ffListFeatures() { fputs( diff --git a/src/common/io.c b/src/common/io.c index 5b9516341..bcd8105cf 100644 --- a/src/common/io.c +++ b/src/common/io.c @@ -7,35 +7,6 @@ #define FF_IO_CACHE_VALUE_EXTENSION "ffcv" #define FF_IO_CACHE_SPLIT_EXTENSION "ffcs" -void ffPrintLogoAndKey(FFinstance* instance, const char* moduleName, uint8_t moduleIndex, const FFstrbuf* customKeyFormat) -{ - ffPrintLogoLine(instance); - - fputs(FASTFETCH_TEXT_MODIFIER_BOLT, stdout); - ffPrintColor(&instance->config.color); - - if(customKeyFormat == NULL || customKeyFormat->length == 0) - { - fputs(moduleName, stdout); - - if(moduleIndex > 0) - printf(" %hhu", moduleIndex); - } - else - { - FFstrbuf key; - ffStrbufInit(&key); - ffParseFormatString(&key, customKeyFormat, NULL, 1, (FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_UINT8, &moduleIndex} - }); - ffStrbufWriteTo(&key, stdout); - ffStrbufDestroy(&key); - } - - fputs(FASTFETCH_TEXT_MODIFIER_RESET, stdout); - ffStrbufWriteTo(&instance->config.separator, stdout); -} - void ffPrintError(FFinstance* instance, const char* moduleName, uint8_t moduleIndex, const FFstrbuf* customKeyFormat, const FFstrbuf* formatString, uint32_t numFormatArgs, const char* message, ...) { if(!instance->config.showErrors) diff --git a/src/common/logo.c b/src/common/logo.c deleted file mode 100644 index 1d3e76259..000000000 --- a/src/common/logo.c +++ /dev/null @@ -1,1508 +0,0 @@ -#include "fastfetch.h" - -#include -#include -#include - -#define FF_LOGO_INIT static FFlogo logo; static bool init = false; if(init) return &logo; init = true; logo.isFromUser = false; -#define FF_LOGO_NAMES(...) static const char* names[] = (const char*[]) { __VA_ARGS__, NULL }; logo.names = names; -#define FF_LOGO_LINES(x) logo.lines = x; -#define FF_LOGO_COLORS(...) static const char* colors[] = (const char*[]) { __VA_ARGS__, NULL }; logo.builtinColors = colors; -#define FF_LOGO_RETURN return &logo; - -static const FFlogo* getLogoUnknown() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("unkown", "question mark") - FF_LOGO_LINES( - " ________ \n" - " _jgN########Ngg_ \n" - " _N##N@@\"\" \"\"9NN##Np_ \n" - "d###P N####p\n" - "\"^^\" T####\n" - " d###P\n" - " _g###@F \n" - " _gN##@P \n" - " gN###F\" \n" - " d###F \n" - " 0###F \n" - " 0###F \n" - " 0###F \n" - " \"NN@' \n" - " \n" - " ___ \n" - " q###r \n" - " \"\" " - ) - FF_LOGO_COLORS("") - FF_LOGO_RETURN -} - -static const FFlogo* getLogoNone() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("none", "empty", "") - FF_LOGO_LINES("") - FF_LOGO_COLORS("") - FF_LOGO_RETURN -} - -static const FFlogo* getLogoAndroid() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("android") - FF_LOGO_LINES( - "$1 -o o- \n" - "$1 +hydNNNNdyh+ \n" - "$1 +mMMMMMMMMMMMMm+ \n" - "$1 `dMM$2m:$1NMMMMMMN$2:m$1MMd` \n" - "$1 hMMMMMMMMMMMMMMMMMMh \n" - "$1 .. yyyyyyyyyyyyyyyyyyyy .. \n" - "$1.mMMm`MMMMMMMMMMMMMMMMMMMM`mMMm.\n" - "$1:MMMM-MMMMMMMMMMMMMMMMMMMM-MMMM:\n" - "$1:MMMM-MMMMMMMMMMMMMMMMMMMM-MMMM:\n" - "$1:MMMM-MMMMMMMMMMMMMMMMMMMM-MMMM:\n" - "$1:MMMM-MMMMMMMMMMMMMMMMMMMM-MMMM:\n" - "$1-MMMM-MMMMMMMMMMMMMMMMMMMM-MMMM-\n" - "$1 +yy+ MMMMMMMMMMMMMMMMMMMM +yy+ \n" - "$1 mMMMMMMMMMMMMMMMMMMm \n" - "$1 `/++MMMMh++hMMMM++/` \n" - "$1 MMMMo oMMMM \n" - "$1 MMMMo oMMMM \n" - "$1 oNMm- -mMNs " - ) - FF_LOGO_COLORS( - "32", //green - "37" //white - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoAndroidSmall() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("android-small", "android_small") - FF_LOGO_LINES( - "$1 ;, ,; \n" - "$1 ';,.-----.,;' \n" - "$1 ,' ', \n" - "$1 / O O \\ \n" - "$1| |\n" - "$1'-----------------'" - ) - FF_LOGO_COLORS( - "32" //green - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoArch() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("arch", "archlinux", "arch-linux") - FF_LOGO_LINES( - "$1 -` \n" - "$1 .o+` \n" - "$1 `ooo/ \n" - "$1 `+oooo: \n" - "$1 `+oooooo: \n" - "$1 -+oooooo+: \n" - "$1 `/:-:++oooo+: \n" - "$1 `/++++/+++++++: \n" - "$1 `/++++++++++++++: \n" - "$1 `/+++ooooooooooooo/` \n" - "$1 ./ooosssso++osssssso+` \n" - "$1 .oossssso-````/ossssss+` \n" - "$1 -osssssso. :ssssssso. \n" - "$1 :osssssss/ osssso+++. \n" - "$1 /ossssssss/ +ssssooo/- \n" - "$1 `/ossssso+/:- -:/+osssso+- \n" - "$1 `+sso+:-` `.-/+oso: \n" - "$1`++:. `-/+/\n" - "$1.` `/"; - ) - FF_LOGO_COLORS( - "36" //cyan - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoArchSmall() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("arch_small", "archlinux_small", "arch-linux-small") - FF_LOGO_LINES( - "$1 /\\ \n" - "$1 / \\ \n" - "$1 / \\ \n" - "$1 / \\ \n" - "$1 / ,, \\ \n" - "$1 / | | \\ \n" - "$1/_-'' ''-_\\" - ) - FF_LOGO_COLORS( - "36" //cyan - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoArtix() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("artix", "artixlinux", "artix-linux") - FF_LOGO_LINES( - "$1 ' \n" - "$1 'o' \n" - "$1 'ooo' \n" - "$1 'ooxoo' \n" - "$1 'ooxxxoo' \n" - "$1 'oookkxxoo' \n" - "$1 'oiioxkkxxoo' \n" - "$1 ':;:iiiioxxxoo' \n" - "$1 `'.;::ioxxoo'' \n" - "$1 '-. `':;jiooo' \n" - "$1 'oooio-.. `'i:io' \n" - "$1 'ooooxxxxoio:,. `'-;' \n" - "$1 'ooooxxxxxkkxoooIi:-. `' \n" - "$1 'ooooxxxxxkkkkxoiiiiiji' \n" - "$1 'ooooxxxxxkxxoiiii:'` .i' \n" - "$1 'ooooxxxxxoi:::'` .;ioxo' \n" - "$1 'ooooxooi::'` .:iiixkxxo' \n" - "$1 'ooooi:'` `'';ioxxo' \n" - "$1'i:'` '':io' \n" - "$1'` `'"; - ) - FF_LOGO_COLORS( - "36" //cyan - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoArtixSmall() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("artix_small", "artixlinux_small", "artix-linux-small") - FF_LOGO_LINES( - "$1 /\\ \n" - "$1 / \\ \n" - "$1 /`'.,\\ \n" - "$1 / ', \n" - "$1 / ,`\\ \n" - "$1 / ,.'`. \\ \n" - "$1/.,'` `'.\\" - ) - FF_LOGO_COLORS( - "36" //cyan - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoArcoLinux() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("Arco", "Arcolinux", "Arco-linux") - FF_LOGO_LINES( - "$1 /- \n" - "$1 ooo: \n" - "$1 yoooo/ \n" - "$1 yooooooo \n" - "$1 yooooooooo \n" - "$1 yooooooooooo \n" - "$1 .yooooooooooooo \n" - "$1 .oooooooooooooooo \n" - "$1 .oooooooarcoooooooo \n" - "$1 .ooooooooo-oooooooooo \n" - "$1 .ooooooooo- oooooooooo \n" - "$1 :ooooooooo. :ooooooooo \n" - "$1 :ooooooooo. :ooooooooo \n" - "$1 :oooarcooo .oooarcooo \n" - "$1 :ooooooooy .ooooooooo \n" - "$1 :ooooooooo $2 /ooooooooooooooooooo \n" - "$1 :ooooooooo $2 .-ooooooooooooooooo. \n" - "$1 ooooooooo- $2 -ooooooooooooo. \n" - "$1 ooooooooo- $2 .-oooooooooo. \n" - "$1 ooooooooo. $2 -ooooooooo "; - ) - FF_LOGO_COLORS( - "34", //blue - "32" //green - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoCachyOS() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("cachyos", "cachyos-linux") - FF_LOGO_LINES( - "$1 $3.$1-------------------------: \n" - "$1 .$2+=$1========================. \n" - "$1 :$2++$1===$2++===$1===============- :$2++$1- \n" - "$1 :$2*++$1====$2+++++==$1===========- .==: \n" - "$1 -$2*+++$1=====$2+***++=$1=========: \n" - "$1 =$2*++++=$1=======------------: \n" - "$1 =$2*+++++=$1====- $3...$1 \n" - "$1 .$2+*+++++$1=-===: .$2=+++=$1: \n" - "$1 :$2++++$1=====-==: -***$2**$1+ \n" - "$1 :$2++=$1=======-=. .=+**+$3.$1 \n" - "$1.$2+$1==========-. $3.$1 \n" - "$1 :$2+++++++$1====- $3.$1--==-$3.$1 \n" - "$1 :$2++$1==========. $3:$2+++++++$1$3: \n" - "$1 .-===========. =*****+*+ \n" - "$1 .-===========: .+*****+: \n" - "$1 -=======$2++++$1:::::::::::::::::::::::::-: $3.$1---: \n" - "$1 :======$2++++$1====$2+++******************=. \n" - "$1 :=====$2+++$1==========$2++++++++++++++*- \n" - "$1 .====$2++$1==============$2++++++++++*- \n" - "$1 .===$2+$1==================$2+++++++: \n" - "$1 .-=======================$2+++: \n" - "$1 $3.......................... " - ) - FF_LOGO_COLORS( - "36", //cyan - "32", //green - "30" //black - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoCelOS() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("celos", "celos-linux") - FF_LOGO_LINES( - "$1 `-:/++++/:-` \n" - "$1 -/syyyyyyyyyyyyy+- \n" - "$1 :ssssyyyyyyyyyyyyyyyy/ \n" - "$1 .osy$2mmmmmmmmmmmmmmmNNNNNmmhy+ \n" - "$1 .sssshhhhhhhddddddddddddddds- \n" - "$1 `osssssssyyyyyyyyyyyyyyyyyyhy` \n" - "$1 :ssssssyyyyyyyyyyyyyyyyyyyyhh/ \n" - "$2sMMMMMMMMMMMMMMMMMMMMMMMh$1yyyyyyhho \n" - "$1 :sssssssyyyyyyyyyyyyyyyyyyyhh/ \n" - "$1 `ssssssssyyyyyyyyyyyyyyyyyyhy. \n" - "$1 -sssssyddddddddddddddddddddy \n" - "$1 -ssss$2hmmmmmmmmmmmmmmmmmmmyssss-\n" - "$1 `/ssssyyyyyyyyyyyyyyyy+` \n" - "$1 `:osyyyyyyyyyyyyys/` \n" - "$1 `.:/+ooooo+:-` " - ) - FF_LOGO_COLORS( - "35", //magenta - "30" //black - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoCentOS() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("centos", "centos-linux") - FF_LOGO_LINES( - "$1 .. \n" - "$1 .PLTJ. \n" - "$1 <><><><> \n" - "$2 KKSSV' 4KKK $1LJ$4 KKKL.'VSSKK \n" - "$2 KKV' 4KKKKK $1LJ$4 KKKKAL 'VKK \n" - "$2 V' ' 'VKKKK $1LJ$4 KKKKV' ' 'V \n" - "$2 .4MA.' 'VKK $1LJ$4 KKV' '.4Mb. \n" - "$4 . $2KKKKKA.' 'V $1LJ$4 V' '.4KKKKK $3. \n" - "$4 .4D $2KKKKKKKA.'' $1LJ$4 ''.4KKKKKKK $3FA. \n" - "$4\n" - "$4 'VD $3KKKKKKKK'.. $2LJ $1..'KKKKKKKK $3FV \n" - "$4 ' $3VKKKKK'. .4 $2LJ $1K. .'KKKKKV $3' \n" - "$3 'VK'. .4KK $2LJ $1KKA. .'KV' \n" - "$3 A. . .4KKKK $2LJ $1KKKKA. . .4 \n" - "$3 KKA. 'KKKKK $2LJ $1KKKKK' .4KK \n" - "$3 KKSSA. VKKK $2LJ $1KKKV .4SSKK \n" - "$2 <><><><> \n" - "$1 'MKKM' \n" - "$1 '' " - ) - FF_LOGO_COLORS( - "33", //yellow - "32", //green - "34", //blue - "35", //magenta - "37" //white - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoCentOSSmall() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("centos_small", "centos-linux-small") - FF_LOGO_LINES( - "$2 ____$1^$4____ \n" - "$2 |\\ $1|$4 /| \n" - "$2 | \\ $1|$4 / | \n" - "$4<---- $3---->\n" - "$3 | / $2|$1 \\ | \n" - "$3 |/__$2|$1__\\| \n" - "$2 v " - ) - FF_LOGO_COLORS( - "33", //yellow - "32", //green - "34", //blue - "35" //magenta - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoDebian() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("debian", "debian-linux") - FF_LOGO_LINES( - "$2 _,met$$$$$$$$$$gg. \n" - "$2 ,g$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$P. \n" - "$2 ,g$$$$P\" \"\"\"Y$$$$.\". \n" - "$2 ,$$$$P' `$$$$$$. \n" - "$2',$$$$P ,ggs. `$$$$b:\n" - "$2`d$$$$' ,$P\"' $1.$2 $$$$$$ \n" - "$2 $$$$P d$' $1,$2 $$$$$$P\n" - "$2 $$$$: $$. $1-$2 ,d$$$$' \n" - "$2 $$$$; Y$b._ _,d$P' \n" - "$2 Y$$$$. $1`.$2`\"Y$$$$$$$$P\"' \n " - "$2 `$$$$b $1\"-.__ \n" - "$2 `Y$$$$ \n" - "$2 `Y$$$$. \n" - "$2 `$$$$b. \n" - "$2 `Y$$$$b. \n" - "$2 `\"Y$$b._ \n" - "$2 `\"\"\" " - ) - FF_LOGO_COLORS( - "31", //red - "37" //white - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoDebianSmall() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("debian_small", "debian-linux-small") - FF_LOGO_LINES( - "$1 _____ \n" - "$1 / __ \\ \n" - "$1| / |\n" - "$1| \\___- \n" - "$1-_ \n" - "$1 --_ " - ) - FF_LOGO_COLORS( - "31" //red - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoEndeavour() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("endeavour", "endeavour-linux", "endeavouros", "endeavouros-linux") - FF_LOGO_LINES( - "$2 ./$1o$3. \n" - "$2 ./$1sssso$3- \n" - "$2 `:$1osssssss+$3- \n" - "$2 `:+$1sssssssssso$3/. \n" - "$2 `-/o$1ssssssssssssso$3/. \n" - "$2 `-/+$1sssssssssssssssso$3+:` \n" - "$2 `-:/+$1sssssssssssssssssso$3+/. \n" - "$2 `.://o$1sssssssssssssssssssso$3++- \n" - "$2 .://+$1ssssssssssssssssssssssso$3++: \n" - "$2 .:///o$1ssssssssssssssssssssssssso$3++: \n" - "$2 `:////$1ssssssssssssssssssssssssssso$3+++.\n" - "$2`-////+$1ssssssssssssssssssssssssssso$3++++-\n" - "$2 `..-+$1oosssssssssssssssssssssssso$3+++++/`\n" - "$3./++++++++++++++++++++++++++++++/:. \n" - "$3`:::::::::::::::::::::::::------`` " - ) - FF_LOGO_COLORS( - "35", //magenta - "31", //red - "34" //blue - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoFedora() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("fedora", "fedora-linux") - FF_LOGO_LINES( - "$1 .',;::::;,'. \n" - "$1 .';:cccccccccccc:;,. \n" - "$1 .;cccccccccccccccccccccc;. \n" - "$1 .:cccccccccccccccccccccccccc:. \n" - "$1 .;ccccccccccccc;$2.:dddl:.$1;ccccccc;. \n" - "$1 .:ccccccccccccc;$2OWMKOOXMWd$1;ccccccc:. \n" - "$1.:ccccccccccccc;$2KMMc$1;cc;$2xMMc$1;ccccccc:.\n" - "$1,cccccccccccccc;$2MMM.$1;cc;$2;WW:$1;cccccccc,\n" - "$1:cccccccccccccc;$2MMM.$1;cccccccccccccccc:\n" - "$1:ccccccc;$2oxOOOo$1;$2MMM000k.$1;cccccccccccc:\n" - "$1cccccc;$20MMKxdd:$1;$2MMMkddc.$1;cccccccccccc;\n" - "$1ccccc;$2XMO'$1;cccc;$2MMM.$1;cccccccccccccccc'\n" - "$1ccccc;$2MMo$1;ccccc;$2MMW.$1;ccccccccccccccc; \n" - "$1ccccc;$20MNc.$1ccc$2.xMMd$1;ccccccccccccccc; \n" - "$1cccccc;$2dNMWXXXWM0:$1;cccccccccccccc:, \n" - "$1cccccccc;$2.:odl:.$1;cccccccccccccc:,. \n" - "$1ccccccccccccccccccccccccccccc:'. \n" - "$1:ccccccccccccccccccccccc:;,.. \n" - "$1 ':cccccccccccccccc::;,. " - ) - FF_LOGO_COLORS( - "34", //blue - "37" //white - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoFedoraSmall() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("fedora_small", "fedora-linux-small") - FF_LOGO_LINES( - "$1 ,'''''. \n" - "$1 | ,. |\n" - "$1 | | '_'\n" - "$1 ,....| |.. \n" - "$1.' ,_;| ..' \n" - "$1| | | | \n" - "$1| ',_,' | \n" - "$1 '. ,' \n" - "$1 ''''' " - ) - FF_LOGO_COLORS( - "34" //blue - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoFedoraOld() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("fedora_old", "fedora-old", "fedora-linux-old", "fedora-linux_old") - FF_LOGO_LINES( - "$1 /:-------------:\\ \n" - "$1 :-------------------:: \n" - "$1 :-----------$2/shhOHbmp$1---:\\ \n" - "$1 /-----------$2omMMMNNNMMD$1 ---: \n" - "$1 :-----------$2sMMMMNMNMP$1. ---: \n" - "$1 :-----------$2:MMMdP$1------- ---\\\n" - "$1,------------$2:MMMd$1-------- ---:\n" - "$1:------------$2:MMMd$1------- .---:\n" - "$1:---- $2oNMMMMMMMMMNho$1 .----:\n" - "$1:-- .$2+shhhMMMmhhy++$1 .------/\n" - "$1:- -------$2:MMMd$1--------------: \n" - "$1:- --------$2/MMMd$1-------------; \n" - "$1:- ------$2/hMMMy$1------------: \n" - "$1:--$2 :dMNdhhdNMMNo$1------------; \n" - "$1:---$2:sdNMMMMNds:$1------------: \n" - "$1:------$2:://:$1-------------:: \n" - "$1:---------------------:// " - ) - FF_LOGO_COLORS( - "34", //blue - "37" //white - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoGaruda() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("garuda", "garuda-linux") - FF_LOGO_LINES( - "$1 .%;888:8898898: \n" - "$1 x;XxXB%89b8:b8%b88: \n" - "$1 .8Xxd 8X:. \n" - "$1 .8Xx; 8x:. \n" - "$1 .tt8x .d x88; \n" - "$1 .@8x8; .db: xx@; \n" - "$1 ,tSXX° .bbbbbbbbbbbbbbbbbbbB8x@;\n" - "$1 .SXxx bBBBBBBBBBBBBBBBBBBBbSBX8;\n" - "$1 ,888S pd!\n" - "$18X88/ q \n" - "$18X88/ \n" - "$1GBB. \n" - "$1 x%88 d888@8@X@X@X88X@@XX@@X@8@X. \n" - "$1 dxXd dB8b8b8B8B08bB88b998888b88x. \n" - "$1 dxx8o .@@;. \n" - "$1 dx88 .t@x. \n" - "$1 d:SS@8ba89aa67a853Sxxad. \n" - "$1 .d988999889889899dd. " - ) - FF_LOGO_COLORS( - "31" //red - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoGentoo() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("gentoo", "gentoo-linux") - FF_LOGO_LINES( - "$1 -/oyddmdhs+:. \n" - "$1 -o$2dNMMMMMMMMNNmhy+$1-` \n" - "$1 -y$2NMMMMMMMMMMMNNNmmdhy$1+- \n" - "$1 `o$2mMMMMMMMMMMMMNmdmmmmddhhy$1/` \n" - "$1 om$2MMMMMMMMMMMN$1hhyyyo$2hmdddhhhd$1o` \n" - "$1.y$2dMMMMMMMMMMd$1hs++so/s$2mdddhhhhdm$1+` \n" - "$1 oy$2hdmNMMMMMMMN$1dyooy$2dmddddhhhhyhN$1d.\n" - "$1 :o$2yhhdNNMMMMMMMNNNmmdddhhhhhyym$1Mh\n" - "$1 .:$2+sydNMMMMMNNNmmmdddhhhhhhmM$1my\n" - "$1 /m$2MMMMMMNNNmmmdddhhhhhmMNh$1s:\n" - "$1 `o$2NMMMMMMMNNNmmmddddhhdmMNhs$1+` \n" - "$1 `s$2NMMMMMMMMNNNmmmdddddmNMmhs$1/. \n" - "$1 /N$2MMMMMMMMNNNNmmmdddmNMNdso$1:` \n" - "$1+M$2MMMMMMNNNNNmmmmdmNMNdso$1/- \n" - "$1yM$2MNNNNNNNmmmmmNNMmhs+/$1-` \n" - "$1/h$2MMNNNNNNNNMNdhs++/$1-` \n" - "$1`/$2ohdmmddhys+++/:$1.` \n" - "$1 `-//////:--. " - ) - FF_LOGO_COLORS( - "35", //magenta - "37" //white - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoGentooSmall() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("gentoo_small", "gentoo-linux-small") - FF_LOGO_LINES( - "$1 _-----_ \n" - "$1( \\ \n" - "$1\\ 0 \\ \n" - "$2 \\ ) \n" - "$2 / _/ \n" - "$2( _- \n" - "$2\\____- " - ) - FF_LOGO_COLORS( - "35", //magenta - "37" //white - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoKDENeon() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("kde", "kde-neon", "neon") - FF_LOGO_LINES( - "$1 `..---+/---..` \n" - "$1 `---.`` `` `.---.` \n" - "$1 .--.` `` `-:-. \n" - "$1 `:/: `.----//----.` :/- \n" - "$1 .:. `---` `--.` .:` \n" - "$1 .:` `--` .:- `:. \n" - "$1 `/ `:. `.-::-.` -:` `/` \n" - "$1 /. /. `:++++++++:` .: .: \n" - "$1`/ .: `+++++++++++/ /` `+`\n" - "$1/+` -- .++++++++++++` :. .+:\n" - "$1`/ .: `+++++++++++/ /` `+`\n" - "$1 /` /. `:++++++++:` .: .: \n" - "$1 ./ `:. `.:::-.` -:` `/` \n" - "$1 .:` `--` .:- `:. \n" - "$1 .:. `---` `--.` .:` \n" - "$1 `:/: `.----//----.` :/- \n" - "$1 .-:.` `` `-:-. \n" - "$1 `---.`` `` `.---.` \n" - "$1 `..---+/---..` "; - ) - FF_LOGO_COLORS( - "32" //green - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoLinux() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("linux", "linux-generic") - FF_LOGO_LINES( - "$2 ##### \n" - "$2 ####### \n" - "$2 ##$1O$2#$1O$2## \n" - "$2 #$3#####$2# \n" - "$2 ##$1##$3###$1##$2## \n" - "$2 #$1##########$2## \n" - "$2 #$1############$2## \n" - "$2 #$1############$2### \n" - "$3 ##$2#$1###########$2##$3# \n" - "$3######$2#$1#######$2#$3######\n" - "$3#######$2#$1#####$2#$3#######\n" - "$3 #####$2#######$3##### " - ) - FF_LOGO_COLORS( - "37", //white - "30", //black - "33" //yellow - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoManjaro() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("manjaro", "manjaro-linux") - FF_LOGO_LINES( - "$1██████████████████ ████████\n" - "$1██████████████████ ████████\n" - "$1██████████████████ ████████\n" - "$1██████████████████ ████████\n" - "$1████████ ████████\n" - "$1████████ ████████ ████████\n" - "$1████████ ████████ ████████\n" - "$1████████ ████████ ████████\n" - "$1████████ ████████ ████████\n" - "$1████████ ████████ ████████\n" - "$1████████ ████████ ████████\n" - "$1████████ ████████ ████████\n" - "$1████████ ████████ ████████\n" - "$1████████ ████████ ████████" - ) - FF_LOGO_COLORS( - "32" //green - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoManjaroSmall() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("manjaro_small", "manjaro-linux-small") - FF_LOGO_LINES( - "$1||||||||| ||||\n" - "$1||||||||| ||||\n" - "$1|||| ||||\n" - "$1|||| |||| ||||\n" - "$1|||| |||| ||||\n" - "$1|||| |||| ||||\n" - "$1|||| |||| ||||" - ) - FF_LOGO_COLORS( - "32" //green - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoMint() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("mint", "linuxmint", "mint-linux", "linux-mint") - FF_LOGO_LINES( - "$2 ...-:::::-... \n" - "$2 .-MMMMMMMMMMMMMMM-. \n" - "$2 .-MMMM$1`..-:::::::-..`$2MMMM-. \n" - "$2 .:MMMM$1.:MMMMMMMMMMMMMMM:.$2MMMM:. \n" - "$2 -MMM$1-M---MMMMMMMMMMMMMMMMMMM.$2MMM- \n" - "$2 `:MMM$1:MM` :MMMM:....::-...-MMMM:$2MMM:` \n" - "$2 :MMM$1:MMM` :MM:` `` `` `:MMM:$2MMM: \n" - "$2.MMM$1.MMMM` :MM. -MM. .MM- `MMMM.$2MMM.\n" - "$2:MMM$1:MMMM` :MM. -MM- .MM: `MMMM-$2MMM:\n" - "$2:MMM$1:MMMM` :MM. -MM- .MM: `MMMM:$2MMM:\n" - "$2:MMM$1:MMMM` :MM. -MM- .MM: `MMMM-$2MMM:\n" - "$2.MMM$1.MMMM` :MM:--:MM:--:MM: `MMMM.$2MMM.\n" - "$2 :MMM$1:MMM- `-MMMMMMMMMMMM-` -MMM-$2MMM: \n" - "$2 :MMM$1:MMM:` `:MMM:$2MMM: \n" - "$2 .MMM$1.MMMM:--------------:MMMM.$2MMM. \n" - "$2 '-MMMM$1.-MMMMMMMMMMMMMMM-.$2MMMM-' \n" - "$2 '.-MMMM$1``--:::::--``$2MMMM-.' \n" - "$2 '-MMMMMMMMMMMMM-' \n" - "$2 ``-:::::-`` " - ) - FF_LOGO_COLORS( - "32", //green - "37" //white - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoMintSmall() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("mint_small", "linuxmint_small", "mint-linux-small") - FF_LOGO_LINES( - "$1 __________ \n" - "$1|_ \\\n" - "$1 | $2| _____ $1|\n" - "$1 | $2| | | | $1|\n" - "$1 | $2| | | | $1|\n" - "$1 | $2\\__$2___/ $1|\n" - "$1 \\_________/" - ) - FF_LOGO_COLORS( - "32", //green - "37" //white - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoMintOld() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("mint_old", "mint-old", "mint-linux_old", "mint-linux-old", "linux-mint_old", "linux-mint-old") - FF_LOGO_LINES( - "$1MMMMMMMMMMMMMMMMMMMMMMMMMmds+. \n" - "$1MMm----::-://////////////oymNMd+` \n" - "$1MMd $2/++ $1-sNMd: \n" - "$1MMNso/` $2dMM `.::-. .-::.` $1.hMN:\n" - "$1ddddMMh $2dMM :hNMNMNhNMNMNh: $1`NMm\n" - "$1 NMm $2dMM .NMN/-+MMM+-/NMN` $1dMM\n" - "$1 NMm $2dMM -MMm `MMM dMM. $1dMM\n" - "$1 NMm $2dMM -MMm `MMM dMM. $1dMM\n" - "$1 NMm $2dMM .mmd `mmm yMM. $1dMM\n" - "$1 NMm $2dMM` ..` ... ydm. $1dMM\n" - "$1 hMM- $2+MMd/-------...-:sdds $1dMM\n" - "$1 -NMm- $2:hNMNNNmdddddddddy/` $1dMM\n" - "$1 -dMNs-$2``-::::-------.`` $1dMM \n" - "$1 `/dMNmy+/:-------------:/yMMM \n" - "$1 ./ydNMMMMMMMMMMMMMMMMMMMMM \n" - "$1 .MMMMMMMMMMMMMMMMMMM " - ) - FF_LOGO_COLORS( - "32", //green - "37" //white - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoOpenSuse() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("suse", "opensuse", "open_suse", "open-suse", "suse-linux") - FF_LOGO_LINES( - "$2 .;ldkO0000Okdl;. \n" - "$2 .;d00xl:^''''''^:ok00d;. \n" - "$2 .d00l' 'o00d. \n" - "$2 .d0Kd'$1 Okxol:;,. $2:O0d \n" - "$2 .OK$1KKK0kOKKKKKKKKKKOxo:, $2lKO. \n" - "$2 ,0K$1KKKKKKKKKKKKKKK0P^$2,,,$1^dx:$2 ;00, \n" - "$2.OK$1KKKKKKKKKKKKKKKk'$2.oOPPb.$1'0k.$2 cKO.\n" - "$2:KK$1KKKKKKKKKKKKKKK: $2kKx..dd $1lKd$2 'OK:\n" - "$2dKK$1KKKKKKKKKOx0KKKd $2^0KKKO' $1kKKc$2 dKd\n" - "$2dKK$1KKKKKKKKKK;.;oOKx,..$2^$1..;kKKK0.$2 dKd\n" - "$2:KK$1KKKKKKKKKK0o;...^cdxxOK0O/^^' $2.0K:\n" - "$2 kKK$1KKKKKKKKKKKKK0x;,,......,;od $2lKk \n" - "$2 '0K$1KKKKKKKKKKKKKKKKKKKK00KKOo^ $2c00' \n" - "$2 'kK$1KKOxddxkOO00000Okxoc;'' $2.dKk' \n" - "$2 l0Ko. .c00l' \n" - "$2 'l0Kk:. .;xK0l' \n" - "$2 'lkK0xl:;,,,,;:ldO0kl' \n" - "$2 '^:ldxkkkkxdl:^' " - ) - FF_LOGO_COLORS( - "32", //green - "37" //white - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoOpenSuseSmall() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("suse_small", "opensuse_small", "open_suse_small", "open-suse_small") - FF_LOGO_LINES( - "$1 _______ \n" - "$1__| __ \\ \n" - "$1 / .\\ \\\n" - "$1 \\__/ |\n" - "$1 _______|\n" - "$1 \\_______\n" - "$1__________/" - ) - FF_LOGO_COLORS( - "32" //green - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoOpenSuseLeap() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("opensuse_leap", "open_suse_leap", "opensuse-leap", "open-suse-leap", "suse_leap", "suse-leap", "opensuseleap") - FF_LOGO_LINES( - "$2 .-++:. \n" - "$2 ./oooooo/- \n" - "$2 `:oooooooooooo:. \n" - "$2 -+oooooooooooooooo+-` \n" - "$2 ./oooooooooooooooooooooo/- \n" - "$2 :oooooooooooooooooooooooooo: \n" - "$2 ` `-+oooooooooooooooooooo/- ` \n" - "$2 `:oo/- .:ooooooooooooooo+:` `-+oo/. \n" - "$2`/oooooo:. -/oooooooooo/. ./oooooo/.\n" - "$2 `:+ooooo+-` `:+oooo+- `:oooooo+:` \n" - "$2 .:oooooo/. .::` -+oooooo/. \n" - "$2 -/oooooo:. ./oooooo+- \n" - "$2 `:+ooooo+-:+oooooo:` \n" - "$2 ./oooooooooo/. \n" - "$2 -/oooo+:` \n" - "$2 `:/. " - ) - FF_LOGO_COLORS( - "32", //green - "37" //white - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoOpenSuseTumbleweed() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("opensuse_tumbleweed", "open_suse_tumbleweed", "opensuse-tumbleweed", "open-suse-tumbleweed", "suse_tumbleweed", "suse-tumbleweed", "opensusetumbleweed") - FF_LOGO_LINES( - "$2 ...... \n" - "$2 .,cdxxxoc,. .:kKMMMNWMMMNk:. \n" - "$2 cKMMN0OOOKWMMXo. ; ;0MWk:. .:OMMk. \n" - "$2 ;WMK;. .lKMMNM, :NMK, .OMW; \n" - "$2 cMW; 'WMMMN ,XMK, oMM'\n" - "$2.MMc ..;l. xMN: KM0\n" - "$2'MM. 'NMO oMM\n" - "$2.MM, .kMMl xMN\n" - "$2 KM0 .kMM0. .dl:,.. .WMd\n" - "$2 .XM0. ,OMMK, OMMMK. .XMK \n" - "$2 oWMO:. .;xNMMk, NNNMKl. .xWMx \n" - "$2 :ONMMNXMMMKx; . ,xNMWKkxllox0NMWk, \n" - "$2 ..... .:dOOXXKOxl, " - ) - FF_LOGO_COLORS( - "32", //green - "37" //white - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoPop() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("pop", "popos", "pop_os", "pop-linux") - FF_LOGO_LINES( - "$1 ///////////// \n" - "$1 ///////////////////// \n" - "$1 ///////$2*767$1//////////////// \n" - "$1 //////$27676767676*$1////////////// \n" - "$1 /////$276767$1//$27676767$1////////////// \n" - "$1 /////$2767676$1///$2*76767$1/////////////// \n" - "$1 ///////$2767676$1///$276767$1.///$27676*$1/////// \n" - "$1/////////$2767676$1//$276767$1///$2767676$1////////\n" - "$1//////////$276767676767$1////$276767$1/////////\n" - "$1///////////$276767676$1//////$27676$1//////////\n" - "$1////////////,$27676$1,///////$2767$1///////////\n" - "$1/////////////*$27676$1///////$276$1////////////\n" - "$1///////////////$27676$1////////////////////\n" - "$1 ///////////////$27676$1///$2767$1//////////// \n" - "$1 //////////////////////$2'$1//////////// \n" - "$1 //////$2.7676767676767676767,$1////// \n" - "$1 /////$2767676767676767676767$1///// \n" - "$1 /////////////////////////// \n" - "$1 ///////////////////// \n" - "$1 ///////////// " - ) - FF_LOGO_COLORS( - "36", //cyan - "37" //white - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoPopSmall() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("pop_small", "popos_small", "pop_os_small", "pop-linux-small") - FF_LOGO_LINES( - "$1______ \n" - "$1\\ _ \\ __\n" - "$1 \\ \\ \\ \\ / /\n" - "$1 \\ \\_\\ \\ / / \n" - "$1 \\ ___\\ /_/ \n" - "$1 \\ \\ _ \n" - "$1 __\\_\\__(_)_ \n" - "$1 (___________)` " - ) - FF_LOGO_COLORS( - "36" //cyan - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoReborn() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("reborn", "reborn-os", "rebornos", "rebornos-linux", "reborn-os-linux") - FF_LOGO_LINES( - "$1 ::::::::::::::::::::::: \n" - "$1 .:^!!!!!!!!!^.^!!!!!!!!!^:. \n" - "$1 .:~!!!!!!!!!!^.^!!!!!!!!!!~:. \n" - "$1 .:~!!!!!~~~~~~^.^~~~~~~!!!!!~:. \n" - "$1 .^!!!!!~::$2=====:.:=====$1::~!!!!!^. \n" - "$1 .::^~~!!~:$2^77777?~.~?77777^$1:~!!~~^::. \n" - "$1 .:~~^:::^.$2^77777!!^.^7!77777^$1.^:::^~~:. \n" - "$1 .:~!!!!~::::$2^~!!::^^^^^::!!~^$1::::~!!!!~:. \n" - "$1 .^!!!!!~::$2!7!~^:.^?JJJJJ?^.:^~!7!$1::~!!!!!^. \n" - "$1.:^!!!!!~:$2^77777~.~JJJJJJJJJ~.~77777^$1:~!!!!!^:.\n" - "$1.:^!!!!!~:$2^77777~.~JJJJJJJJJ~.~77777^$1:~!!!!!^:.\n" - "$1 .^!!!!!~::$2!7!~^:.^?JJJJJ?^.:^~!7!$1::~!!!!!^. \n" - "$1 .:~!!!!~::$2::^~!!::^^^^^::!!~^::$1::~!!!!~:. \n" - "$1 .:~~^:::^.$2^77777!!^.^7!77777^.$1^:::^~~:. \n" - "$1 .::^~~!!~:$2^77777?~.~?77777^$1:~!!~~^::. \n" - "$1 .^!!!!!~::$2=====:.:=====$1::~!!!!!^. \n" - "$1 .:~!!!!!~~~~~~^.^~~~~~~!!!!!~:. \n" - "$1 .:~!!!!!!!!!!^.^!!!!!!!!!!~:. \n" - "$1 .:^!!!!!!!!!^.^!!!!!!!!!^:. \n" - "$1 ::::::::::::::::::::::: \n" - ) - FF_LOGO_COLORS( - "34", //blue - "36" //cyan - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoRebornSmall() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("reborn_small", "reborn-os-small", "rebornos_small", "rebornos-linux-small", "reborn-os-linux-small") - FF_LOGO_LINES( - "$1 _______________ \n" - "$1 / \\ / \\ \n" - "$1 / \\_______/ \\ \n" - "$1 / / \\ / \\ \\ \n" - "$1 / / \\___/ \\ \\ \n" - "$1/____/____/ \\____\\____\\ \n" - "$1\\ \\ \\___/ / / \n" - "$1 \\ \\ / \\ / / \n" - "$1 \\ \\/_______\\/ / \n" - "$1 \\ / \\ / \n" - "$1 \\_/___________\\_/ \n" - ) - FF_LOGO_COLORS( - "34" //blue - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoUbuntu() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("ubuntu", "ubuntu-linux") - FF_LOGO_LINES( - "$1 .-/+oossssoo+/-. \n" - "$1 `:+ssssssssssssssssss+:` \n" - "$1 -+ssssssssssssssssssyyssss+- \n" - "$1 .ossssssssssssssssssd$2MMMNy$1sssso. \n" - "$1 /sssssssssss$2hdmmNNmmyNMMMMh$1ssssss/ \n" - "$1 +sssssssss$2hmydMMMMMMMNddddy$1ssssssss+ \n" - "$1 /ssssssss$2hNMMMyhhyyyyhmNMMMNh$1ssssssss/ \n" - "$1.ssssssss$2dMMMNh$1ssssssssss$2hNMMMd$1ssssssss.\n" - "$1+ssss$2hhhyNMMNy$1ssssssssssss$2yNMMMy$1sssssss+\n" - "$1oss$2yNMMMNyMMh$1ssssssssssssss$2hmmmh$1ssssssso\n" - "$1oss$2yNMMMNyMMh$1ssssssssssssss$2hmmmh$1ssssssso\n" - "$1+ssss$2hhhyNMMNy$1ssssssssssss$2yNMMMy$1sssssss+\n" - "$1.ssssssss$2dMMMNh$1ssssssssss$2hNMMMd$1ssssssss.\n" - "$1 /ssssssss$2hNMMMyhhyyyyhdNMMMNh$1ssssssss/ \n" - "$1 +sssssssss$2dmydMMMMMMMMddddy$1ssssssss+ \n" - "$1 /sssssssssss$2hdmNNNNmyNMMMMh$1ssssss/ \n" - "$1 .ossssssssssssssssss$2dMMMNy$1sssso. \n" - "$1 -+sssssssssssssssss$2yyy$1ssss+- \n" - "$1 `:+ssssssssssssssssss+:` \n" - "$1 .-/+oossssoo+/-. " - ) - FF_LOGO_COLORS( - "31", //red - "37" //white - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoUbuntuSmall() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("ubuntu_small", "ubuntu-linux-small") - FF_LOGO_LINES( - "$1 _ \n" - "$1 ---(_)\n" - "$1 _/ --- \\\n" - "$1(_) | | \n" - "$1 \\ --- _/\n" - "$1 ---(_)" - ) - FF_LOGO_COLORS( - "31" //red - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoVoid() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("void", "void-linux") - FF_LOGO_LINES( - "$1 __.;=====;.__ \n" - "$1 _.=+==++=++=+=+===;. \n" - "$1 -=+++=+===+=+=+++++=_ \n" - "$1 . -=:`` `--==+=++==. \n" - "$1 _vi, ` --+=++++: \n" - "$1 .uvnvi. _._ -==+==+. \n" - "$1 .vvnvnI` .;==|==;. :|=||=|. \n" - "$2+QmQQm$1pvvnv;$2 _yYsyQQWUUQQQm #QmQ#$1:$2QQQWUV$QQm.\n" - "$2 -QQWQW$1pvvo$2wZ?.wQQQE$1==<$2QWWQ/QWQW.QQWW$1(:$2 jQWQE\n" - "$2 -$QQQQmmU' jQQQ$1@+=<$2QWQQ)mQQQ.mQQQC$1+;$2jWQQ@'\n" - "$2 -$WQ8Y$1nI:$2 QWQQwgQQWV$1`$2mWQQ.jQWQQgyyWW@! \n" - "$1 -1vvnvv. `~+++` ++|+++ \n" - "$1 +vnvnnv, `-|=== \n" - "$1 +vnvnvns. . :=- \n" - "$1 -Invnvvnsi..___..=sv=. ` \n" - "$1 +Invnvnvnnnnnnnnvvnn;. \n" - "$1 ~|Invnvnvvnvvvnnv}+` \n" - "$1 -~|{*l}*|~ " - ) - FF_LOGO_COLORS( - "32", //green - "30" //black - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoVoidSmall() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("void_small", "void-linux-small") - FF_LOGO_LINES( - "$1 _______ \n" - "$1 _ \\______ - \n" - "$1| \\ ___ \\ |\n" - "$1| | / \\ | |\n" - "$1| | \\___/ | |\n" - "$1| \\______ \\_|\n" - "$1 -_______\\ " - ) - FF_LOGO_COLORS( - "32" //green - ) - FF_LOGO_RETURN -} - -static const FFlogo* getLogoZorin() -{ - FF_LOGO_INIT - FF_LOGO_NAMES("zorin", "zorin-linux", "zorinos", "zorinos-linux") - FF_LOGO_LINES( - "$1 `osssssssssssssssssssso` \n" - "$1 .osssssssssssssssssssssso. \n" - "$1 .+oooooooooooooooooooooooo+. \n" - " \n" - " \n" - "$1 `::::::::::::::::::::::. .:` \n" - "$1 `+ssssssssssssssssss+:.` `.:+ssso` \n" - "$1.ossssssssssssssso/. `-+ossssssso.\n" - "$1ssssssssssssso/-` `-/osssssssssssss\n" - "$1.ossssssso/-` .-/ossssssssssssssso.\n" - "$1 `+sss+:. `.:+ssssssssssssssssss+` \n" - "$1 `:. .::::::::::::::::::::::` \n" - " \n" - " \n" - "$1 .+oooooooooooooooooooooooo+. \n" - "$1 -osssssssssssssssssssssso- \n" - "$1 `osssssssssssssssssssso` " - ) - FF_LOGO_COLORS( - "34" //blue - ) - FF_LOGO_RETURN -} - -typedef const FFlogo*(*GetLogoMethod)(); - -static GetLogoMethod* getLogoMethods() -{ - static GetLogoMethod logoMethods[] = { - getLogoNone, - getLogoUnknown, - getLogoAndroid, - getLogoAndroidSmall, - getLogoArch, - getLogoArchSmall, - getLogoArcoLinux, - getLogoArtix, - getLogoArtixSmall, - getLogoCachyOS, - getLogoCelOS, - getLogoCentOS, - getLogoCentOSSmall, - getLogoDebian, - getLogoDebianSmall, - getLogoEndeavour, - getLogoFedora, - getLogoFedoraSmall, - getLogoFedoraOld, - getLogoGaruda, - getLogoGentoo, - getLogoGentooSmall, - getLogoKDENeon, - getLogoLinux, - getLogoManjaro, - getLogoManjaroSmall, - getLogoMint, - getLogoMintSmall, - getLogoMintOld, - getLogoOpenSuse, - getLogoOpenSuseSmall, - getLogoOpenSuseLeap, - getLogoOpenSuseTumbleweed, - getLogoPop, - getLogoPopSmall, - getLogoReborn, - getLogoRebornSmall, - getLogoUbuntu, - getLogoUbuntuSmall, - getLogoVoid, - getLogoVoidSmall, - getLogoZorin, - NULL - }; - - return logoMethods; -} - -static bool logoHasName(const FFlogo* logo, const char* name) -{ - const char** logoName = logo->names; - - while(*logoName != NULL) - { - if(strcasecmp(*logoName, name) == 0) - return true; - - ++logoName; - } - - return false; -} - -static void setLogo(FFinstance* instance, const FFlogo* logo) -{ - instance->config.logo = logo; - instance->state.logoWidth = 0; - instance->state.logoLinesIndex = logo->lines; - - const char** colors = logo->builtinColors; - int counter = 0; - - while(!logo->isFromUser && *colors != NULL) - { - ffStrbufSetS(&instance->config.logoColors[counter], *colors); - ++counter; - ++colors; - } - - for(; counter < FASTFETCH_LOGO_MAX_COLORS; ++counter) - ffStrbufClear(&instance->config.logoColors[counter]); -} - -static bool loadLogoSet(FFinstance* instance, const char* name) -{ - GetLogoMethod* logoMethod = getLogoMethods(); - - while(*logoMethod != NULL) - { - const FFlogo* logo = (*logoMethod)(); - if(logoHasName(logo, name)) - { - setLogo(instance, logo); - return true; - } - - ++logoMethod; - } - - return false; -} - -void ffLoadLogoSet(FFinstance* instance, const char* logo) -{ - if(loadLogoSet(instance, logo)) - return; - - FFstrbuf logoChars; - ffStrbufInitA(&logoChars, 1024); - - if(!ffGetFileContent(logo, &logoChars)) - { - ffStrbufDestroy(&logoChars); - if(instance->config.showErrors) - printf(FASTFETCH_TEXT_MODIFIER_ERROR"Error: unknown logo / logo file not found: %s"FASTFETCH_TEXT_MODIFIER_RESET"\n", logo); - setLogo(instance, getLogoUnknown()); - return; - } - - static FFlogo dummyLogo; - dummyLogo.isFromUser = true; - dummyLogo.lines = logoChars.chars; - setLogo(instance, &dummyLogo); -} - -static bool loadLogoSetWithVersion(FFinstance* instance, const FFstrbuf* versionID, const FFstrbuf* name) -{ - bool isFedora = logoHasName(getLogoFedora(), name->chars); - bool isMint = logoHasName(getLogoMint(), name->chars); - - if(versionID->length == 0 || ( - !isFedora && - !isMint - )) return loadLogoSet(instance, name->chars); - - long version = strtol(versionID->chars, NULL, 10); - - #define FF_LOAD_LOGO_WITH_VERSION(ver, newLogo, oldLogo) setLogo(instance, (version == 0 || version == LONG_MAX || version == LONG_MIN || version > ver) ? newLogo : oldLogo); - - if(isFedora) - FF_LOAD_LOGO_WITH_VERSION(34, getLogoFedora(), getLogoFedoraOld()) - else if(isMint) - FF_LOAD_LOGO_WITH_VERSION(19, getLogoMint(), getLogoMintOld()) - - #undef FF_LOAD_LOGO_WITH_VERSION - - return true; -} - -void ffLoadLogo(FFinstance* instance) -{ - const FFOSResult* result = ffDetectOS(instance); - - if( - !loadLogoSetWithVersion(instance, &result->versionID, &result->name) && //e.g. Pop!_OS - !loadLogoSetWithVersion(instance, &result->versionID, &result->id) && //e.g. popos - !loadLogoSetWithVersion(instance, &result->versionID, &result->idLike) && //e.g. ubuntu - !loadLogoSetWithVersion(instance, &result->versionID, &result->systemName) //e.g. linux - ) setLogo(instance, getLogoUnknown()); -} - -static uint32_t strLengthUTF8(const char* str, uint32_t bytesLength) -{ - uint32_t length = 0; - - for (uint32_t i = 0; i < bytesLength; ++i) - { - int c = (unsigned char) str[i]; - - if(c<=127) {} // i += 0; - else if((c & 0xE0) == 0xC0) i += 1; - else if((c & 0xF0) == 0xE0) i += 2; - else if((c & 0xF8) == 0xF0) i += 3; - else return 0; //invalid utf8 - - ++length; - } - - return length; -} - -#define LOGO_LINE_PRINT_CHAR(c, cut) \ - if(cut == 0) \ - putchar(c); \ - else \ - --cut; - -void ffPrintLogoLine(FFinstance* instance) -{ - //If offset x is positive, print it as whitespaces left from the logo - for(int16_t i = 0; i < instance->config.offsetx; i++) - putchar(' '); - - //If we have more informations than lines in the logo, print whitespaces. - //We can return after this, since logoWidth includes logoKeySpacing. - if(*instance->state.logoLinesIndex == '\0') - { - for(uint32_t i = 0; i < instance->state.logoWidth; ++i) - putchar(' '); - return; - } - - //Save the start of the line and the length of color placeholders, so we can calculate the length of the line at the end - const char* start = instance->state.logoLinesIndex; - uint32_t colorPlaceholdersLength = 0; - - - //If offset x is negative, we will cut the logo. Save the total amount to cut, and the currently cut amount - uint32_t cutValue = instance->config.offsetx < 0 ? (uint32_t) (instance->config.offsetx * -1) : 0; - uint32_t cut = cutValue; - - //Logo is always bold - fputs(FASTFETCH_TEXT_MODIFIER_BOLT, stdout); - - while(*instance->state.logoLinesIndex != '\n' && *instance->state.logoLinesIndex != '\0') - { - //Get the current char - char current = *instance->state.logoLinesIndex; - - //We have a color encoding directly in the logo. Print it and increase colorPlaceholdersLength - if(instance->config.logo->isFromUser && current == '\033' && *(instance->state.logoLinesIndex + 1) == '[') - { - //At this point we don't know if the start ends with a 'm', so we need to buffer - FFstrbuf colorBuffer; - ffStrbufInit(&colorBuffer); - - char* indexCopy = instance->state.logoLinesIndex; - while(*indexCopy != '\n' && *indexCopy != '\0') - { - ffStrbufAppendC(&colorBuffer, *indexCopy); - - if(*indexCopy == 'm') - break; - - ++indexCopy; - } - - //It was a color encoding, write it and increase colorPlaceholdersLength - if(*indexCopy == 'm') - { - ffStrbufWriteTo(&colorBuffer, stdout); - colorPlaceholdersLength += colorBuffer.length; - instance->state.logoLinesIndex = indexCopy + 1; // + 1 to skip the 'm' - current = *instance->state.logoLinesIndex; - } - - ffStrbufDestroy(&colorBuffer); - } - - //Not a color placeholder, just print it. User files don't support colors this way. - if(current != '$' || instance->config.userLogoIsRaw) - { - LOGO_LINE_PRINT_CHAR(current, cut); - ++instance->state.logoLinesIndex; - continue; - } - - //Skip the dollar sign - ++instance->state.logoLinesIndex; - current = *instance->state.logoLinesIndex; - - //We have a dollar sign at the end of the line. Just print it. - if(current == '\n' || current == '\0') - { - if(cut == 0) - putchar('$'); - break; - } - - //We definitly have something to print and are not at the end of the line. - //Already increase it here, so i don't have to write it multiple times - ++instance->state.logoLinesIndex; - - //We have two dollar signs. Print one. - if(current == '$') - { - LOGO_LINE_PRINT_CHAR('$', cut); - ++colorPlaceholdersLength; - continue; - } - - //Map the number to an array index, so that '1' -> 0, '2' -> 1, etc. - int index = ((int) current) - 49; - - //Invalid index, just print the $ and the following char - if(index < 0 || index >= FASTFETCH_LOGO_MAX_COLORS) - { - LOGO_LINE_PRINT_CHAR('$', cut); - LOGO_LINE_PRINT_CHAR(current, cut); - continue; - } - - //Index can maximal be 9, so we have exactly two chars for the color - colorPlaceholdersLength += 2; - - // If we don't color our logo, skip it - if(!instance->config.colorLogo) - continue; - - ffPrintColor(&instance->config.logoColors[index]); - } - - //Reset out bold logo - fputs(FASTFETCH_TEXT_MODIFIER_RESET, stdout); - - //Print the whitespaces between logo and keys. If cut is left, substract it from the spacing. Never go below a spacing of 0. - const uint32_t logoKeySpacing = cut > instance->config.logoKeySpacing ? 0 : instance->config.logoKeySpacing - cut; - for(uint32_t i = 0; i < logoKeySpacing; ++i) - putchar(' '); - - //If we haven't yet calculated the length of the line, do it now - if(instance->state.logoWidth == 0) - { - instance->state.logoWidth = strLengthUTF8(start, (uint32_t) (instance->state.logoLinesIndex - start)) - colorPlaceholdersLength + instance->config.logoKeySpacing; - instance->state.logoWidth = cutValue > instance->state.logoWidth ? 0 : instance->state.logoWidth - cutValue; - } - - //If we just finished a line and not the entire logo, skip the newline char - if(*instance->state.logoLinesIndex == '\n') - ++instance->state.logoLinesIndex; -} - -void ffPrintRemainingLogo(FFinstance* instance) -{ - while(*instance->state.logoLinesIndex != '\0') - { - ffPrintLogoLine(instance); - putchar('\n'); - } -} - -void ffPrintLogos(FFinstance* instance) -{ - GetLogoMethod* methods = getLogoMethods(); - - while(*methods != NULL) - { - setLogo(instance, (*methods)()); - printf(FASTFETCH_TEXT_MODIFIER_BOLT"\033[%sm%s"FASTFETCH_TEXT_MODIFIER_RESET":\n", instance->config.colorLogo ? instance->config.logo->builtinColors[0] : "", instance->config.logo->names[0]); - ffPrintRemainingLogo(instance); - puts("\n"); - ++methods; - } -} - -void ffListLogos() -{ - GetLogoMethod* methods = getLogoMethods(); - - uint32_t counter = 0; - - while(*methods != NULL) - { - const FFlogo* logo = (*methods)(); - - const char** names = logo->names; - - printf("%u)%s ", counter, counter < 10 ? " " : ""); - ++counter; - - while(*names != NULL) - { - printf("\"%s\" ", *names); - ++names; - } - - putchar('\n'); - - ++methods; - } -} - -void ffListLogosForAutocompletion() -{ - GetLogoMethod* methods = getLogoMethods(); - - while(*methods != NULL) - { - printf("%s\n", (*methods)()->names[0]); - ++methods; - } -} diff --git a/src/data/config.txt b/src/data/config.txt index 990c4d339..2b440eecf 100644 --- a/src/data/config.txt +++ b/src/data/config.txt @@ -27,38 +27,17 @@ # Get the default structure with "fastfetch --print-structure". #--structure $"FASTFETCH_DATATEXT_STRUCTURE$" -# Logo option: -# Sets the logo to use. -# List available logos with "fastfetch --list-logos". -# Print available logos with "fastfetch --print-logos". -# Must be the name of an available logo or a path to a text file containing a custom logo. -# Default is the current distribution. -#--logo arch +# Multithreading option: +# Sets if fastfetch should use multiple threads to detect the values. +# Must be true or false. +# Default is true. +#--multithreading true -# Color option: -# Sets the color of the keys. -# Must be linux console color codes or the name of a color. -# Default is the primary color of the logo. -# Use "fastfetch --help color" to learn more and see examples. -#--color magenta - -# Spacing option: -# Sets the amount of whitespace between the logo and keys. -# Must be an positive integer. -# Default is 4. -#--spacing 4 - -# Separator option: -# Sets the string placed between a key and its value. -# Can be any string. -# Default is ": ". -#--separator ": " - -# Offset option: -# Sets the amount of whitespace before the logo. Can be negative to cut the logo. -# Must be an integer. -# Default is 0. -#--offsetx 0 +# Slow operations option: +# Sets if fastfetch is allowed to use known slow operations to detect more / better values. +# Must be true or false. +# Default is false. +#--allow-slow-operations false # Linewrap option: # Sets if fastfetch should disable linewrap during the run. @@ -72,35 +51,19 @@ # Default is true. #--hide-cursor true -# Remaing logo option: -# Sets if the remaining logo should be printed, if it is higher than the information printed. -# Must be true or false. -# Default is true. -#--print-remaining-logo true +# Logo option: +# Sets the logo to use. +# List available logos with "fastfetch --list-logos". +# Print available logos with "fastfetch --print-logos". +# Must be the name of an available logo or a path to a text file containing a custom logo. +# Default is the current distribution. +#--logo arch -# Multithreading option: -# Sets if fastfetch should use multiple threads to detect the values. -# Must be true or false. -# Default is true. -#--multithreading true - -# Slow operations option: -# Sets if fastfetch is allowed to use known slow operations to detect more / better values. -# Must be true or false. -# Default is false. -#--allow-slow-operations false - -# Color logo option: -# Sets if the logo should be colored. -# Must be true or false. -# Default is true. -#--color-logo true - -# Separator string option: -# Sets the string printed by the "separator" module (usually between title and rest of output) -# Must be any string. It is repated / cut to fit perfectly. -# Default is "-" -#--separator-string - +# Logo type option: +# Sets the logo type to use. +# Must be auto, builtin, file or raw. +# Default is auto. +#--logo-type auto # Logo color options: # Overwrite a color in the logo. Also works for user provided logos. @@ -109,16 +72,53 @@ # Default is the one specified by the logo. # Use "fastfetch --help color" to learn more and see examples. # Valid index range is [1-9]. -#--color-1 red -#--color-2 32 +#--logo-color-1 red +#--logo-color-2 32 # [...] -#--color-9 yellow +#--logo-color-9 yellow -# User logo raw option: -# Sets if color replacements should be performed on the user provided logo. +# Logo padding option: +# Adds a padding to the left and the right side of the logo. +# Must be a positive integer. +# Default is 0. +#--logo-padding 0 + +# Logo padding left option: +# Adds a padding to the left side of the logo. +# Must be a positive integer. +# Default is 0. +#--logo-padding-left 0 + +# Logo padding right option: +# Adds a padding to the right side of the logo. +# Must be a positive integer. +# Default is 0. +#--logo-padding-right 0 + +# Logo print remaining option: +# Sets if the remaining logo should be printed, it is has more lines than modules to show. # Must be true or false. # Default is true. -#--color-raw true +#--logo-print-remaining true + +# Color option: +# Sets the color of the keys. +# Must be linux console color codes or the name of a color. +# Default is the primary color of the logo. +# Use "fastfetch --help color" to learn more and see examples. +#--color magenta + +# Separator option: +# Sets the string placed between a key and its value. +# Can be any string. +# Default is ": ". +#--separator ": " + +# Separator string option: +# Sets the string printed by the "separator" module (usually between title and rest of output) +# Must be any string. It is repated / cut to fit perfectly. +# Default is "-" +#--separator-string - # Public IP timeout option: # Sets the time to wait for the public ip server to respond. diff --git a/src/data/help.txt b/src/data/help.txt index 298ad2d97..d5ade5d1c 100644 --- a/src/data/help.txt +++ b/src/data/help.txt @@ -1,39 +1,41 @@ Usage: fastfetch Informative options: - -h, --help: shows this message and exits - -h , --help : shows help for a specific command and exits - -v --version: prints the version of fastfetch and exits - --list-logos: list available logos and exits - --list-modules: lists available modules and exits - --list-presets: list presets fastfetch knows about and exits. They can be loaded with --load-config. (+) - --list-features: list the supported features fastfetch was compiled with and exits. Mainly for development. - --print-logos: show available logos and exits - --print-config: prints the default config and exits - --print-structure: prints the default stucture and exits + -h,--help: shows this message and exits + -h,--help : shows help for a specific command and exits + -v,--version: prints the version of fastfetch and exits + --list-logos: list available logos and exits + --list-modules: lists available modules and exits + --list-presets: list presets fastfetch knows about and exits. They can be loaded with --load-config. (+) + --list-features: list the supported features fastfetch was compiled with and exits. Mainly for development. + --print-logos: show available logos and exits + --print-config: prints the default config and exits + --print-structure: prints the default stucture and exits General options: - --structure : sets the structure of the fetch. Must be a colon separated list of keys. Use "fastfetch --list-modules" to see the ones available. - --set : hard set the value of a key - -c , --color : sets the color of the keys. Must be a linux console color code or the name of a color (+) - --color-[1-9] : overwrites a color of the logo. Must be a linux console color code or the name of a color - --spacing : sets the distance between logo and text - -s , --separator : sets the separator between key and value. Default is a colon with a space - -x , --offsetx : sets the x offset. Can be negative to cut the logo, but no more than logo width. - --show-errors : print occuring errors - -r --recache : generate new cached values - --nocache : don't use cached values, but also don't overwrite existing ones - --print-remaining-logo : print the remaining logo, if it is higher than the number of lines shown - --multithreading : use multiple threads to detect values - --load-config : load a config file (+) - --allow-slow-operations : Allow operations that are usually very slow for more detailed output - --disable-linewrap : Disable linewrap during the run - --hide-cursor : Hide the cursor during the run - --logo-raw : Print a custom logo as is, without any color replacements + -r,--recache : generate new cached values + --nocache : don't use cached values, but also don't overwrite existing ones + --load-config : load a config file or a preset (+) + --multithreading : use multiple threads to detect values + --allow-slow-operations : allow operations that are usually very slow for more detailed output Logo options: - -l , --logo : sets the shown logo. Also changes the main color accordingly. This will also load file contents as logo if the given argument is a valid path. - --color-logo : if set to false, the logo will be black / white + -l,--logo : set the logo to use. The type is specified by --logo-type. If default: the name of a builtin logo or a path to a file + --logo-type : set the type of the logo given. Must be auto, builtin, file or raw + --logo-color-[1-9] : overwrite a color in the logo + --logo-padding : set the padding on the left and the right of the logo + --logo-padding-left : set the padding on the left of the logo + --logo-padding-right : set the padding on the right of the logo + --logo-print-remaining : weather to print the remaining logo, if it has more lines than modules to display + +Display options: + -s,--structure : sets the structure of the fetch. Must be a colon separated list of keys. Use "fastfetch --list-modules" to see the ones available. + -c,--color : sets the color of the keys. Must be a linux console color code or the name of a color (+) + --separator : sets the separator between key and value. Default is a colon with a space + --set : hard set the value of a key + --show-errors : print occuring errors + --disable-linewrap : weather to disable linewrap during the run + --hide-cursor : weather to hide the cursor during the run Format options: Provide the format string for custom output. Use fastfetch --help *-format for specific help. --os-format diff --git a/src/detection/os.c b/src/detection/os.c index fb8d2c45a..918e0e787 100644 --- a/src/detection/os.c +++ b/src/detection/os.c @@ -28,7 +28,7 @@ static void parseFile(const char* fileName, FFOSResult* result) #endif -const FFOSResult* ffDetectOS(FFinstance* instance) +const FFOSResult* ffDetectOS(const FFinstance* instance) { static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; static FFOSResult result; diff --git a/src/fastfetch.c b/src/fastfetch.c index 78cde1fbb..ee4c60d1e 100644 --- a/src/fastfetch.c +++ b/src/fastfetch.c @@ -12,8 +12,6 @@ typedef struct FFdata { FFvaluestore valuestore; FFstrbuf structure; - FFstrbuf logoName; - FFstrbuf logoColors[FASTFETCH_LOGO_MAX_COLORS]; bool multithreading; } FFdata; @@ -608,8 +606,31 @@ static void optionParseColor(const char* key, const char* value, FFstrbuf* buffe } } +static uint32_t optionParseUInt32(const char* key, const char* value) +{ + if(value == NULL) + { + fprintf(stderr, "Error: usage: %s \n", key); + exit(480); + } + + char* end; + uint32_t num = (uint32_t) strtoul(value, &end, 10); + if(*end != '\0') + { + fprintf(stderr, "Error: usage: %s \n", key); + exit(479); + } + + return num; +} + static void parseOption(FFinstance* instance, FFdata* data, const char* key, const char* value) { + /////////////////////// + //Informative options// + /////////////////////// + if(strcasecmp(key, "-h") == 0 || strcasecmp(key, "--help") == 0) { printCommandHelp(value); @@ -625,21 +646,6 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con puts(FASTFETCH_PROJECT_VERSION); exit(0); } - else if(strcasecmp(key, "--list-logos") == 0) - { - ffListLogos(); - exit(0); - } - else if(strcasecmp(key, "--list-logos-autocompletion") == 0) - { - ffListLogosForAutocompletion(); - exit(0); - } - else if(strcasecmp(key, "--print-logos") == 0) - { - ffPrintLogos(instance); - exit(0); - } else if(strcasecmp(key, "--print-config") == 0) { fputs(FASTFETCH_DATATEXT_CONFIG, stdout); @@ -665,32 +671,115 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con ffListFeatures(); exit(0); } - else if(strcasecmp(key, "--spacing") == 0) + else if(strcasecmp(key, "--list-logos") == 0) + { + ffListBuiltinLogos(); + exit(0); + } + else if(strcasecmp(key, "--list-logos-autocompletion") == 0) + { + ffListBuiltinLogosAutocompletion(); + exit(0); + } + else if(strcasecmp(key, "--print-logos") == 0) + { + ffPrintBuiltinLogos(instance); + exit(0); + } + + /////////////////// + //General options// + /////////////////// + + else if(strcasecmp(key, "-r") == 0 || strcasecmp(key, "--recache") == 0) + { + //Set cacheSave as well, beacuse the user expects the values to be cached when expliciting using --recache + instance->config.recache = optionParseBoolean(value); + instance->config.cacheSave = instance->config.recache; + } + else if(strcasecmp(key, "--nocache") == 0) + { + instance->config.recache = optionParseBoolean(value); + instance->config.cacheSave = false; + } + else if(strcasecmp(key, "--load-config") == 0) + optionParseConfigFile(instance, data, key, value); + else if(strcasecmp(key, "--multithreading") == 0) + data->multithreading = optionParseBoolean(value); + else if(strcasecmp(key, "--allow-slow-operations") == 0) + instance->config.allowSlowOperations = optionParseBoolean(value); + + //////////////// + //Logo options// + //////////////// + + else if(strcasecmp(key, "-l") == 0 || strcasecmp(key, "--logo") == 0) + optionParseString(key, value, &instance->config.logoName); + else if(strcasecmp(key, "--logo-type") == 0) { if(value == NULL) { - fprintf(stderr, "Error: usage: %s \n", key); - exit(404); + fprintf(stderr, "Error: usage: %s \n", key); + exit(476); } - if(sscanf(value, "%hu", &instance->config.logoKeySpacing) != 1) + + if(strcasecmp(value, "auto") == 0) + instance->config.logoType = FF_LOGO_TYPE_AUTO; + else if(strcasecmp(value, "builtin") == 0) + instance->config.logoType = FF_LOGO_TYPE_BUILTIN; + else if(strcasecmp(value, "file") == 0) + instance->config.logoType = FF_LOGO_TYPE_FILE; + else if(strcasecmp(value, "raw") == 0) + instance->config.logoType = FF_LOGO_TYPE_RAW; + else { - fprintf(stderr, "Error: couldn't parse %s to uint16_t\n", value); - exit(405); + fprintf(stderr, "Error: unknown logo type: %s\n", value); + exit(478); } } - else if(strcasecmp(key, "-x") == 0 || strcasecmp(key, "--offsetx") == 0) + else if(strncasecmp(key, "--logo-color-", 13) == 0 && key[13] != '\0' && key[14] == '\0') // matches "--logo-color-*" { - if(value == NULL) + //Map the number to an array index, so that '1' -> 0, '2' -> 1, etc. + int index = (int)key[13] - 49; + + //Match only --logo-color-[1-9] + if(index < 0 || index >= FASTFETCH_LOGO_MAX_COLORS) { - fprintf(stderr, "Error: usage: %s \n", key); - exit(408); - } - if(sscanf(value, "%hi", &instance->config.offsetx) != 1) - { - fprintf(stderr, "Error: couldn't parse %s to int16_t\n", value); - exit(409); + fprintf(stderr, "Error: invalid --color-[1-9] index: %c\n", key[13]); + exit(472); } + + optionParseColor(key, value, &instance->config.logoColors[index]); } + else if(strcasecmp(key, "--logo-padding") == 0) + { + uint32_t padding = optionParseUInt32(key, value); + instance->config.logoPaddingLeft = padding; + instance->config.logoPaddingRight = padding; + } + else if(strcasecmp(key, "--logo-padding-left") == 0) + instance->config.logoPaddingLeft = optionParseUInt32(key, value); + else if(strcasecmp(key, "--logo-padding-right") == 0) + instance->config.logoPaddingRight = optionParseUInt32(key, value); + else if(strcasecmp(key, "--logo-print-remaining") == 0) + instance->config.logoPrintRemaining = optionParseBoolean(value); + + /////////////////// + //Display options// + /////////////////// + + else if(strcasecmp(key, "--show-errors") == 0) + instance->config.showErrors = optionParseBoolean(value); + else if(strcasecmp(key, "--disable-linewrap") == 0) + instance->config.disableLinewrap = optionParseBoolean(value); + else if(strcasecmp(key, "--hide-cursor") == 0) + instance->config.hideCursor = optionParseBoolean(value); + else if(strcasecmp(key, "-s") == 0 || strcasecmp(key, "--structure") == 0) + optionParseString(key, value, &data->structure); + else if(strcasecmp(key, "--separator") == 0) + optionParseString(key, value, &instance->config.separator); + else if(strcasecmp(key, "-c") == 0 || strcasecmp(key, "--color") == 0) + optionParseColor(key, value, &instance->config.mainColor); else if(strcasecmp(key, "--set") == 0) { if(value == NULL) @@ -711,43 +800,11 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con ffValuestoreSet(&data->valuestore, value, separator + 1); } - else if(strcasecmp(key, "-r") == 0 || strcasecmp(key, "--recache") == 0) - { - //Set cacheSave as well, beacuse the user expects the values to be cached when expliciting using --recache - instance->config.recache = optionParseBoolean(value); - instance->config.cacheSave = instance->config.recache; - } - else if(strcasecmp(key, "--nocache") == 0) - { - instance->config.recache = optionParseBoolean(value); - instance->config.cacheSave = false; - } - else if(strcasecmp(key, "--load-config") == 0) - optionParseConfigFile(instance, data, key, value); - else if(strcasecmp(key, "--show-errors") == 0) - instance->config.showErrors = optionParseBoolean(value); - else if(strcasecmp(key, "--color-logo") == 0) - instance->config.colorLogo = optionParseBoolean(value); - else if(strcasecmp(key, "--print-remaining-logo") == 0) - instance->config.printRemainingLogo = optionParseBoolean(value); - else if(strcasecmp(key, "--multithreading") == 0) - data->multithreading = optionParseBoolean(value); - else if(strcasecmp(key, "--allow-slow-operations") == 0) - instance->config.allowSlowOperations = optionParseBoolean(value); - else if(strcasecmp(key, "--disable-linewrap") == 0) - instance->config.disableLinewrap = optionParseBoolean(value); - else if(strcasecmp(key, "--hide-cursor") == 0) - instance->config.hideCursor = optionParseBoolean(value); - else if(strcasecmp(key, "--logo-raw") == 0) - instance->config.userLogoIsRaw = optionParseBoolean(value); - else if(strcasecmp(key, "--structure") == 0) - optionParseString(key, value, &data->structure); - else if(strcasecmp(key, "-l") == 0 || strcasecmp(key, "--logo") == 0) - optionParseString(key, value, &data->logoName); - else if(strcasecmp(key, "-s") == 0 || strcasecmp(key, "--separator") == 0) - optionParseString(key, value, &instance->config.separator); - else if(strcasecmp(key, "-c") == 0 || strcasecmp(key, "--color") == 0) - optionParseColor(key, value, &instance->config.color); + + //////////////////////// + //Format + Key options// + //////////////////////// + else if(strcasecmp(key, "--os-format") == 0) optionParseString(key, value, &instance->config.osFormat); else if(strcasecmp(key, "--os-key") == 0) @@ -872,6 +929,11 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con optionParseString(key, value, &instance->config.timeKey); else if(strcasecmp(key, "--time-format") == 0) optionParseString(key, value, &instance->config.timeFormat); + + /////////////////// + //Library options// + /////////////////// + else if(strcasecmp(key, "--lib-PCI") == 0) optionParseString(key, value, &instance->config.libPCI); else if(strcasecmp(key, "--lib-vulkan") == 0) @@ -896,6 +958,11 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con optionParseString(key, value, &instance->config.libXFConf); else if(strcasecmp(key, "--lib-rpm") == 0) optionParseString(key, value, &instance->config.librpm); + + ////////////////// + //Module options// + ////////////////// + else if(strcasecmp(key, "--disk-folders") == 0) optionParseString(key, value, &instance->config.diskFolders); else if(strcasecmp(key, "--battery-dir") == 0) @@ -913,33 +980,12 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con else if(strcasecmp(key, "--player-name") == 0) optionParseString(key, value, &instance->config.playerName); else if(strcasecmp(key, "--public-ip-timeout") == 0) - { - if(value == NULL) - { - fprintf(stderr, "Error: usage: %s \n", key); - exit(465); - } + instance->config.publicIpTimeout = optionParseUInt32(key, value); - if(sscanf(value, "%u", &instance->config.publicIpTimeout) != 1) - { - fprintf(stderr, "Error: couldn't parse %s to uint32_t\n", value); - exit(466); - } - } - else if(strncasecmp(key, "--color-", 7) == 0 && key[8] != '\0' && key[9] == '\0') // matches "--color-*" - { - //Map the number to an array index, so that '1' -> 0, '2' -> 1, etc. - int index = (int)key[8] - 49; + ////////////////// + //Unknown option// + ////////////////// - //Match only --color-[1-9] - if(index < 0 || index >= FASTFETCH_LOGO_MAX_COLORS) - { - fprintf(stderr, "Error: invalid --color-[1-9] index: %c\n", key[8]); - exit(472); - } - - optionParseColor(key, value, &data->logoColors[index]); - } else { fprintf(stderr, "Error: unknown option: %s\n", key); @@ -1089,32 +1135,11 @@ int main(int argc, const char** argv) FFdata data; ffValuestoreInit(&data.valuestore); ffStrbufInitA(&data.structure, 256); - ffStrbufInitA(&data.logoName, 0); data.multithreading = true; - for(uint8_t i = 0; i < FASTFETCH_LOGO_MAX_COLORS; i++) - ffStrbufInitA(&data.logoColors[i], 0); - parseDefaultConfigFile(&instance, &data); parseArguments(&instance, &data, argc, argv); - //Load custom logo if it exists - if(data.logoName.length > 0) - ffLoadLogoSet(&instance, data.logoName.chars); - else - ffLoadLogo(&instance); - - //If we haven't set key color, use primary color of logo - if(instance.config.color.length == 0) - ffStrbufSet(&instance.config.color, &instance.config.logoColors[0]); - - //Overwrite logo colors with custom colors - for(uint8_t i = 0; i < FASTFETCH_LOGO_MAX_COLORS; i++) - { - if(data.logoColors[i].length > 0) - ffStrbufSet(&instance.config.logoColors[i], &data.logoColors[i]); - } - //Start detection threads if(data.multithreading) ffStartDetectionThreads(&instance); diff --git a/src/fastfetch.h b/src/fastfetch.h index 76a5eed3a..1cc22c283 100644 --- a/src/fastfetch.h +++ b/src/fastfetch.h @@ -31,32 +31,32 @@ static inline void ffUnused(int dummy, ...) { (void) dummy; } #define FASTFETCH_LOGO_MAX_COLORS 9 //two digits would make parsing much more complicated (index 1 - 9) -typedef struct FFlogo +typedef enum FFLogoType { - const char** names; //Null terminated - char* lines; - bool isFromUser; - const char** builtinColors; // [0] is used as key color, if not user specified -} FFlogo; + FF_LOGO_TYPE_AUTO, //If something is given, first try builtin, then file. Otherwise detect logo + FF_LOGO_TYPE_BUILTIN, //Builtin ascii art. + FF_LOGO_TYPE_FILE, //Raw text file, printed as is. + FF_LOGO_TYPE_RAW, //Raw text file, printed with color codes replacement. +} FFLogoType; typedef struct FFconfig { - const FFlogo* logo; + FFstrbuf logoName; + FFLogoType logoType; FFstrbuf logoColors[FASTFETCH_LOGO_MAX_COLORS]; + uint32_t logoPaddingLeft; + uint32_t logoPaddingRight; + bool logoPrintRemaining; - uint16_t logoKeySpacing; + FFstrbuf mainColor; //If this is empty, ffPrintLogo will set it to the main color of the logo FFstrbuf separator; - int16_t offsetx; - FFstrbuf color; - bool colorLogo; + bool showErrors; bool recache; bool cacheSave; - bool printRemainingLogo; bool allowSlowOperations; bool disableLinewrap; bool hideCursor; - bool userLogoIsRaw; FFstrbuf osFormat; FFstrbuf osKey; @@ -153,8 +153,9 @@ typedef struct FFconfig typedef struct FFstate { - uint32_t logoWidth; - char* logoLinesIndex; + FFstrbuf logoWidthEscapeCode; + uint32_t logoHeight; + uint32_t keysHeight; struct passwd* passwd; struct utsname utsname; @@ -375,9 +376,9 @@ typedef enum FFInitState #define FF_LIBRARY_LOAD_SYMBOL(library, symbolName, returnValue) \ __typeof__(&symbolName) FF_LIBRARY_LOAD_SYMBOL_ADRESS(library, ff ## symbolName, symbolName, returnValue); -/*************************/ -/* Common util functions */ -/*************************/ +////////////////////// +// Common functions // +////////////////////// //common/init.c void ffInitInstance(FFinstance* instance); @@ -390,7 +391,6 @@ void ffListFeatures(); void ffStartDetectionThreads(FFinstance* instance); //common/io.c -void ffPrintLogoAndKey(FFinstance* instance, const char* moduleName, uint8_t moduleIndex, const FFstrbuf* customKeyFormat); void ffPrintError(FFinstance* instance, const char* moduleName, uint8_t moduleIndex, const FFstrbuf* customKeyFormat, const FFstrbuf* formatString, uint32_t numFormatArgs, const char* message, ...); void ffPrintFormatString(FFinstance* instance, const char* moduleName, uint8_t moduleIndex, const FFstrbuf* customKeyFormat, const FFstrbuf* formatString, const FFstrbuf* error, uint32_t numArgs, const FFformatarg* arguments); void ffGetCacheFilePath(FFinstance* instance, const char* moduleName, const char* extension, FFstrbuf* buffer); @@ -437,16 +437,6 @@ void* ffLibraryLoad(const FFstrbuf* userProvidedName, ...); //common/networking.c void ffNetworkingGetHttp(const char* host, const char* path, uint32_t timeout, FFstrbuf* buffer); -//common/logo.c -void ffLoadLogoSet(FFinstance* instance, const char* logo); -void ffLoadLogo(FFinstance* instance); -void ffPrintLogoLine(FFinstance* instance); -void ffPrintRemainingLogo(FFinstance* instance); - -void ffPrintLogos(FFinstance* instance); -void ffListLogos(); -void ffListLogosForAutocompletion(); - //common/format.c void ffFormatAppendFormatArg(FFstrbuf* buffer, const FFformatarg* formatarg); void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, const FFstrbuf* error, uint32_t numArgs, const FFformatarg* arguments); @@ -476,8 +466,26 @@ FFvariant ffSettingsGetXFConf(FFinstance* instance, const char* channelName, con bool ffSettingsGetAndroidProperty(const char* propName, FFstrbuf* result); #endif +//////////////////// +// Logo functions // +//////////////////// + +void ffPrintLogo(FFinstance* instance); +void ffPrintRemainingLogo(FFinstance* instance); + +void ffPrintLogoLine(FFinstance* instance); +void ffPrintLogoAndKey(FFinstance* instance, const char* moduleName, uint8_t moduleIndex, const FFstrbuf* customKeyFormat); + +void ffPrintBuiltinLogos(FFinstance* instance); +void ffListBuiltinLogos(); +void ffListBuiltinLogosAutocompletion(); + +///////////////////////// +// Detection functions // +///////////////////////// + //detection/os.c -const FFOSResult* ffDetectOS(FFinstance* instance); +const FFOSResult* ffDetectOS(const FFinstance* instance); //detection/plasma.c const FFPlasmaResult* ffDetectPlasma(FFinstance* instance); @@ -502,9 +510,9 @@ const FFMediaResult* ffDetectMedia(FFinstance* instance); //detection/dateTime.c const FFDateTimeResult* ffDetectDateTime(const FFinstance* instance); -/********************/ -/* Module functions */ -/********************/ +////////////////////// +// Module functions // +////////////////////// //Common const FFTitleResult* ffDetectTitle(FFinstance* instance); diff --git a/src/logo/builtin.c b/src/logo/builtin.c new file mode 100644 index 000000000..58dd68a80 --- /dev/null +++ b/src/logo/builtin.c @@ -0,0 +1,1377 @@ +#include "logo.h" + +#include +#include +#include +#include + +typedef struct FFlogo +{ + const char* data; + const char** names; //Null terminated + const char** builtinColors; //Null terminated + bool performColorReplacement; +} FFlogo; + +#define FF_LOGO_INIT static FFlogo logo; static bool init = false; if(init) return &logo; init = true; +#define FF_LOGO_NAMES(...) static const char* names[] = (const char*[]) { __VA_ARGS__, NULL }; logo.names = names; +#define FF_LOGO_LINES(x) logo.data = x; +#define FF_LOGO_COLORS(...) static const char* colors[] = (const char*[]) { __VA_ARGS__, NULL }; logo.builtinColors = colors; +#define FF_LOGO_RETURN return &logo; + +static const FFlogo* getLogoUnknown() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("unkown", "question mark", "?") + FF_LOGO_LINES( + " ________\n" + " _jgN########Ngg_\n" + " _N##N@@\"\" \"\"9NN##Np_\n" + "d###P N####p\n" + "\"^^\" T####\n" + " d###P\n" + " _g###@F\n" + " _gN##@P\n" + " gN###F\"\n" + " d###F\n" + " 0###F\n" + " 0###F\n" + " 0###F\n" + " \"NN@'\n" + "\n" + " ___\n" + " q###r\n" + " \"\"" + ) + FF_LOGO_COLORS("") + FF_LOGO_RETURN +} + +static const FFlogo* getLogoNone() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("none", "empty", "") + FF_LOGO_LINES("") + FF_LOGO_COLORS("") + FF_LOGO_RETURN +} + +static const FFlogo* getLogoAndroid() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("android") + FF_LOGO_LINES( + " -o o-\n" + " +hydNNNNdyh+\n" + " +mMMMMMMMMMMMMm+\n" + " `dMM$2m:$1NMMMMMMN$2:m$1MMd`\n" + " hMMMMMMMMMMMMMMMMMMh\n" + " .. yyyyyyyyyyyyyyyyyyyy ..\n" + ".mMMm`MMMMMMMMMMMMMMMMMMMM`mMMm.\n" + ":MMMM-MMMMMMMMMMMMMMMMMMMM-MMMM:\n" + ":MMMM-MMMMMMMMMMMMMMMMMMMM-MMMM:\n" + ":MMMM-MMMMMMMMMMMMMMMMMMMM-MMMM:\n" + ":MMMM-MMMMMMMMMMMMMMMMMMMM-MMMM:\n" + "-MMMM-MMMMMMMMMMMMMMMMMMMM-MMMM-\n" + " +yy+ MMMMMMMMMMMMMMMMMMMM +yy+\n" + " mMMMMMMMMMMMMMMMMMMm\n" + " `/++MMMMh++hMMMM++/`\n" + " MMMMo oMMMM\n" + " MMMMo oMMMM\n" + " oNMm- -mMNs" + ) + FF_LOGO_COLORS( + "32", //green + "37" //white + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoAndroidSmall() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("android-small", "android_small") + FF_LOGO_LINES( + " ;, ,;\n" + " ';,.-----.,;'\n" + " ,' ',\n" + " / O O \\\n" + "| |\n" + "'-----------------'" + ) + FF_LOGO_COLORS( + "32" //green + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoArch() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("arch", "archlinux", "arch-linux") + FF_LOGO_LINES( + " -`\n" + " .o+`\n" + " `ooo/\n" + " `+oooo:\n" + " `+oooooo:\n" + " -+oooooo+:\n" + " `/:-:++oooo+:\n" + " `/++++/+++++++:\n" + " `/++++++++++++++:\n" + " `/+++ooooooooooooo/`\n" + " ./ooosssso++osssssso+`\n" + " .oossssso-````/ossssss+`\n" + " -osssssso. :ssssssso.\n" + " :osssssss/ osssso+++.\n" + " /ossssssss/ +ssssooo/-\n" + " `/ossssso+/:- -:/+osssso+-\n" + " `+sso+:-` `.-/+oso:\n" + "`++:. `-/+/\n" + ".` `/"; + ) + FF_LOGO_COLORS( + "36" //cyan + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoArchSmall() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("arch_small", "archlinux_small", "arch-linux-small") + FF_LOGO_LINES( + " /\\\n" + " / \\\n" + " / \\\n" + " / \\\n" + " / ,, \\\n" + " / | | \\\n" + "/_-'' ''-_\\" + ) + FF_LOGO_COLORS( + "36" //cyan + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoArtix() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("artix", "artixlinux", "artix-linux") + FF_LOGO_LINES( + " '\n" + " 'o'\n" + " 'ooo'\n" + " 'ooxoo'\n" + " 'ooxxxoo'\n" + " 'oookkxxoo'\n" + " 'oiioxkkxxoo'\n" + " ':;:iiiioxxxoo'\n" + " `'.;::ioxxoo''\n" + " '-. `':;jiooo'\n" + " 'oooio-.. `'i:io'\n" + " 'ooooxxxxoio:,. `'-;'\n" + " 'ooooxxxxxkkxoooIi:-. `'\n" + " 'ooooxxxxxkkkkxoiiiiiji'\n" + " 'ooooxxxxxkxxoiiii:'` .i'\n" + " 'ooooxxxxxoi:::'` .;ioxo'\n" + " 'ooooxooi::'` .:iiixkxxo'\n" + " 'ooooi:'` `'';ioxxo'\n" + "'i:'` '':io'\n" + "'` `'"; + ) + FF_LOGO_COLORS( + "36" //cyan + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoArtixSmall() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("artix_small", "artixlinux_small", "artix-linux-small") + FF_LOGO_LINES( + " /\\\n" + " / \\\n" + " /`'.,\\\n" + " / ',\n" + " / ,`\\\n" + " / ,.'`. \\\n" + "/.,'` `'.\\" + ) + FF_LOGO_COLORS( + "36" //cyan + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoArcoLinux() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("arco", "arcolinux", "arco-linux") + FF_LOGO_LINES( + " /-\n" + " ooo:\n" + " yoooo/\n" + " yooooooo\n" + " yooooooooo\n" + " yooooooooooo\n" + " .yooooooooooooo\n" + " .oooooooooooooooo\n" + " .oooooooarcoooooooo\n" + " .ooooooooo-oooooooooo\n" + " .ooooooooo- oooooooooo\n" + " :ooooooooo. :ooooooooo\n" + " :ooooooooo. :ooooooooo\n" + " :oooarcooo .oooarcooo\n" + " :ooooooooy .ooooooooo\n" + " $1:ooooooooo $2/ooooooooooooooooooo\n" + " $1:ooooooooo $2.-ooooooooooooooooo.\n" + " $1ooooooooo- $2-ooooooooooooo.\n" + " $1ooooooooo- $2.-oooooooooo.\n" + "$1ooooooooo. $2-ooooooooo"; + ) + FF_LOGO_COLORS( + "34", //blue + "32" //green + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoCachyOS() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("cachy", "cachyos", "cachy-linux", "cachyos-linux") + FF_LOGO_LINES( + " $3.$1-------------------------:\n" + " .$2+=$1========================.\n" + " :$2++$1===$2++===$1===============- :$2++$1-\n" + " :$2*++$1====$2+++++==$1===========- .==:\n" + " -$2*+++$1=====$2+***++=$1=========:\n" + " =$2*++++=$1=======------------:\n" + " =$2*+++++=$1====- $3...$1\n" + " .$2+*+++++$1=-===: .$2=+++=$1:\n" + " :$2++++$1=====-==: -***$2**$1+\n" + " :$2++=$1=======-=. .=+**+$3.$1\n" + ".$2+$1==========-. $3.$1\n" + " :$2+++++++$1====- $3.$1--==-$3.$1\n" + " :$2++$1==========. $3:$2+++++++$1$3:\n" + " $1.-===========. =*****+*+\n" + " $1.-===========: .+*****+:\n" + " $1-=======$2++++$1:::::::::::::::::::::::::-: $3.$1---:\n" + " :======$2++++$1====$2+++******************=.\n" + " $1:=====$2+++$1==========$2++++++++++++++*-\n" + " $1.====$2++$1==============$2++++++++++*-\n" + " $1.===$2+$1==================$2+++++++:\n" + " $1.-=======================$2+++:\n" + " $3.........................." + ) + FF_LOGO_COLORS( + "36", //cyan + "32", //green + "30" //black + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoCelOS() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("cel", "celos", "cel-linux", "celos-linux") + FF_LOGO_LINES( + " `-:/++++/:-`\n" + " -/syyyyyyyyyyyyy+-\n" + " :ssssyyyyyyyyyyyyyyyy/\n" + " .osy$2mmmmmmmmmmmmmmmNNNNNmmhy+\n" + " $1.sssshhhhhhhddddddddddddddds-\n" + " $1`osssssssyyyyyyyyyyyyyyyyyyhy`\n" + " $1:ssssssyyyyyyyyyyyyyyyyyyyyhh/\n" + "$2sMMMMMMMMMMMMMMMMMMMMMMMh$1yyyyyyhho\n" + " :sssssssyyyyyyyyyyyyyyyyyyyhh/\n" + " `ssssssssyyyyyyyyyyyyyyyyyyhy.\n" + " -sssssyddddddddddddddddddddy\n" + " -ssss$2hmmmmmmmmmmmmmmmmmmmyssss-\n" + " $1`/ssssyyyyyyyyyyyyyyyy+`\n" + " $1`:osyyyyyyyyyyyyys/`\n" + " $1`.:/+ooooo+:-`" + ) + FF_LOGO_COLORS( + "35", //magenta + "30" //black + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoCentOS() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("cent", "centos", "cent-linux", "centos-linux") + FF_LOGO_LINES( + " ..\n" + " .PLTJ.\n" + " <><><><>\n" + " $2KKSSV' 4KKK $1LJ$4 KKKL.'VSSKK\n" + " $2KKV' 4KKKKK $1LJ$4 KKKKAL 'VKK\n" + " $2V' ' 'VKKKK $1LJ$4 KKKKV' ' 'V\n" + " $2.4MA.' 'VKK $1LJ$4 KKV' '.4Mb.\n" + " $4. $2KKKKKA.' 'V $1LJ$4 V' '.4KKKKK $3.\n" + " $4.4D $2KKKKKKKA.'' $1LJ$4 ''.4KKKKKKK $3FA.\n" + "$4\n" + " '$4VD $3KKKKKKKK'.. $2LJ $1..'KKKKKKKK $3FV\n" + " $4' $3VKKKKK'. .4 $2LJ $1K. .'KKKKKV $3'\n" + " $3'VK'. .4KK $2LJ $1KKA. .'KV'\n" + " $3A. . .4KKKK $2LJ $1KKKKA. . .4\n" + " $3KKA. 'KKKKK $2LJ $1KKKKK' .4KK\n" + " $3KKSSA. VKKK $2LJ $1KKKV .4SSKK\n" + " $2<><><><>\n" + " $2'MKKM'\n" + " $2''" + ) + FF_LOGO_COLORS( + "33", //yellow + "32", //green + "34", //blue + "35", //magenta + "37" //white + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoCentOSSmall() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("cent_small", "centos_small", "cent-linux_small", "cent-linux-small", "centos-linux-small") + FF_LOGO_LINES( + " $2____$1^$4____\n" + " $2|\\ $1|$4 /|\n" + " $2| \\ $1|$4 / |\n" + "$4<---- $3---->\n" + " $3| / $2|$1 \\ |\n" + " $3|/__$2|$1__\\|\n" + " $2v" + ) + FF_LOGO_COLORS( + "33", //yellow + "32", //green + "34", //blue + "35" //magenta + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoDebian() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("debian", "debian-linux") + FF_LOGO_LINES( + " $2_,met$$$$$$$$$$gg.\n" + " ,g$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$P.\n" + " ,g$$$$P\" \"\"\"Y$$$$.\".\n" + " ,$$$$P' `$$$$$$.\n" + "',$$$$P ,ggs. `$$$$b:\n" + "`d$$$$' ,$P\"' $1.$2 $$$$$$\n" + " $$$$P d$' $1,$2 $$$$$$P\n" + " $$$$: $$. $1-$2 ,d$$$$'\n" + " $$$$; Y$b._ _,d$P'\n" + " Y$$$$. $1`.$2`\"Y$$$$$$$$P\"'\n" + " `$$$$b $1\"-.__\n" + " $2`Y$$$$\n" + " `Y$$$$.\n" + " `$$$$b.\n" + " `Y$$$$b.\n" + " `\"Y$$b._\n" + " `\"\"\"" + ) + FF_LOGO_COLORS( + "31", //red + "37" //white + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoDebianSmall() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("debian_small", "debian-linux-small") + FF_LOGO_LINES( + " _____\n" + " / __ \\\n" + "| / |\n" + "| \\___-\n" + "-_\n" + " --_" + ) + FF_LOGO_COLORS( + "31" //red + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoEndeavour() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("endeavour", "endeavour-linux", "endeavouros", "endeavouros-linux") + FF_LOGO_LINES( + " $2./$1o$3.\n" + " $2./$1sssso$3-\n" + " $2`:$1osssssss+$3-\n" + " $2`:+$1sssssssssso$3/.\n" + " $2`-/o$1ssssssssssssso$3/.\n" + " $2`-/+$1sssssssssssssssso$3+:`\n" + " $2`-:/+$1sssssssssssssssssso$3+/.\n" + " $2`.://o$1sssssssssssssssssssso$3++-\n" + " $2.://+$1ssssssssssssssssssssssso$3++:\n" + " $2.:///o$1ssssssssssssssssssssssssso$3++:\n" + " $2`:////$1ssssssssssssssssssssssssssso$3+++.\n" + "$2`-////+$1ssssssssssssssssssssssssssso$3++++-\n" + " $2`..-+$1oosssssssssssssssssssssssso$3+++++/`\n" + "$3./++++++++++++++++++++++++++++++/:.\n" + "`:::::::::::::::::::::::::------``" + ) + FF_LOGO_COLORS( + "35", //magenta + "31", //red + "34" //blue + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoFedora() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("fedora", "fedora-linux") + FF_LOGO_LINES( + " .',;::::;,'.\n" + " .';:cccccccccccc:;,.\n" + " .;cccccccccccccccccccccc;.\n" + " .:cccccccccccccccccccccccccc:.\n" + " .;ccccccccccccc;$2.:dddl:.$1;ccccccc;.\n" + " .:ccccccccccccc;$2OWMKOOXMWd$1;ccccccc:.\n" + ".:ccccccccccccc;$2KMMc$1;cc;$2xMMc$1;ccccccc:.\n" + ",cccccccccccccc;$2MMM.$1;cc;$2;WW:$1;cccccccc,\n" + ":cccccccccccccc;$2MMM.$1;cccccccccccccccc:\n" + ":ccccccc;$2oxOOOo$1;$2MMM000k.$1;cccccccccccc:\n" + "cccccc;$20MMKxdd:$1;$2MMMkddc.$1;cccccccccccc;\n" + "ccccc;$2XMO'$1;cccc;$2MMM.$1;cccccccccccccccc'\n" + "ccccc;$2MMo$1;ccccc;$2MMW.$1;ccccccccccccccc;\n" + "ccccc;$20MNc.$1ccc$2.xMMd$1;ccccccccccccccc;\n" + "cccccc;$2dNMWXXXWM0:$1;cccccccccccccc:,\n" + "cccccccc;$2.:odl:.$1;cccccccccccccc:,.\n" + "ccccccccccccccccccccccccccccc:'.\n" + ":ccccccccccccccccccccccc:;,..\n" + " ':cccccccccccccccc::;,." + ) + FF_LOGO_COLORS( + "34", //blue + "37" //white + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoFedoraSmall() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("fedora_small", "fedora-linux-small") + FF_LOGO_LINES( + " ,'''''.\n" + " | ,. |\n" + " | | '_'\n" + " ,....| |..\n" + ".' ,_;| ..'\n" + "| | | |\n" + "| ',_,' |\n" + " '. ,'\n" + " '''''" + ) + FF_LOGO_COLORS( + "34" //blue + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoFedoraOld() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("fedora_old", "fedora-old", "fedora-linux-old", "fedora-linux_old") + FF_LOGO_LINES( + " /:-------------:\\\n" + " :-------------------::\n" + " :-----------$2/shhOHbmp$1---:\\\n" + " /-----------$2omMMMNNNMMD$1 ---:\n" + " :-----------$2sMMMMNMNMP$1. ---:\n" + " :-----------$2:MMMdP$1------- ---\\\n" + ",------------$2:MMMd$1-------- ---:\n" + ":------------$2:MMMd$1------- .---:\n" + ":---- $2oNMMMMMMMMMNho$1 .----:\n" + ":-- .$2+shhhMMMmhhy++$1 .------/\n" + ":- -------$2:MMMd$1--------------:\n" + ":- --------$2/MMMd$1-------------;\n" + ":- ------$2/hMMMy$1------------:\n" + ":--$2 :dMNdhhdNMMNo$1------------;\n" + ":---$2:sdNMMMMNds:$1------------:\n" + ":------$2:://:$1-------------::\n" + ":---------------------://" + ) + FF_LOGO_COLORS( + "34", //blue + "37" //white + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoGaruda() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("garuda", "garuda-linux") + FF_LOGO_LINES( + " .%;888:8898898:\n" + " x;XxXB%89b8:b8%b88:\n" + " .8Xxd 8X:.\n" + " .8Xx; 8x:.\n" + " .tt8x .d x88;\n" + " .@8x8; .db: xx@;\n" + " ,tSXX° .bbbbbbbbbbbbbbbbbbbB8x@;\n" + " .SXxx bBBBBBBBBBBBBBBBBBBBbSBX8;\n" + " ,888S pd!\n" + "8X88/ q\n" + "8X88/\n" + "GBB.\n" + " x%88 d888@8@X@X@X88X@@XX@@X@8@X.\n" + " dxXd dB8b8b8B8B08bB88b998888b88x.\n" + " dxx8o .@@;.\n" + " dx88 .t@x.\n" + " d:SS@8ba89aa67a853Sxxad.\n" + " .d988999889889899dd." + ) + FF_LOGO_COLORS( + "31" //red + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoGentoo() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("gentoo", "gentoo-linux") + FF_LOGO_LINES( + " -/oyddmdhs+:.\n" + " -o$2dNMMMMMMMMNNmhy+$1-`\n" + " -y$2NMMMMMMMMMMMNNNmmdhy$1+-\n" + " `o$2mMMMMMMMMMMMMNmdmmmmddhhy$1/`\n" + " om$2MMMMMMMMMMMN$1hhyyyo$2hmdddhhhd$1o`\n" + ".y$2dMMMMMMMMMMd$1hs++so/s$2mdddhhhhdm$1+`\n" + " oy$2hdmNMMMMMMMN$1dyooy$2dmddddhhhhyhN$1d.\n" + " :o$2yhhdNNMMMMMMMNNNmmdddhhhhhyym$1Mh\n" + " .:$2+sydNMMMMMNNNmmmdddhhhhhhmM$1my\n" + " /m$2MMMMMMNNNmmmdddhhhhhmMNh$1s:\n" + " `o$2NMMMMMMMNNNmmmddddhhdmMNhs$1+`\n" + " `s$2NMMMMMMMMNNNmmmdddddmNMmhs$1/.\n" + " /N$2MMMMMMMMNNNNmmmdddmNMNdso$1:`\n" + "+M$2MMMMMMNNNNNmmmmdmNMNdso$1/-\n" + "yM$2MNNNNNNNmmmmmNNMmhs+/$1-`\n" + "/h$2MMNNNNNNNNMNdhs++/$1-`\n" + "`/$2ohdmmddhys+++/:$1.`\n" + " `-//////:--." + ) + FF_LOGO_COLORS( + "35", //magenta + "37" //white + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoGentooSmall() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("gentoo_small", "gentoo-linux-small") + FF_LOGO_LINES( + " _-----_\n" + "( \\\n" + "\\ 0 \\\n" + " $2\\ )\n" + " / _/\n" + "( _-\n" + "\\____-" + ) + FF_LOGO_COLORS( + "35", //magenta + "37" //white + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoKDENeon() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("kde", "kde-neon", "neon") + FF_LOGO_LINES( + " `..---+/---..`\n" + " `---.`` `` `.---.`\n" + " .--.` `` `-:-.\n" + " `:/: `.----//----.` :/-\n" + " .:. `---` `--.` .:`\n" + " .:` `--` .:- `:.\n" + " `/ `:. `.-::-.` -:` `/`\n" + " /. /. `:++++++++:` .: .:\n" + "`/ .: `+++++++++++/ /` `+`\n" + "/+` -- .++++++++++++` :. .+:\n" + "`/ .: `+++++++++++/ /` `+`\n" + " /` /. `:++++++++:` .: .:\n" + " ./ `:. `.:::-.` -:` `/`\n" + " .:` `--` .:- `:.\n" + " .:. `---` `--.` .:`\n" + " `:/: `.----//----.` :/-\n" + " .-:.` `` `-:-.\n" + " `---.`` `` `.---.`\n" + " `..---+/---..`" + ) + FF_LOGO_COLORS( + "32" //green + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoLinux() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("linux", "linux-generic") + FF_LOGO_LINES( + " $2#####\n" + " $2#######\n" + " $2##$1O$2#$1O$2##\n" + " $2#$3#####$2#\n" + " $2##$1##$3###$1##$2##\n" + " $2#$1##########$2##\n" + " $2#$1############$2##\n" + " $2#$1############$2###\n" + " $3##$2#$1###########$2##$3#\n" + "$3######$2#$1#######$2#$3######\n" + "$3#######$2#$1#####$2#$3#######\n" + " $3#####$2#######$3#####" + ) + FF_LOGO_COLORS( + "37", //white + "30", //black + "33" //yellow + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoManjaro() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("manjaro", "manjaro-linux") + FF_LOGO_LINES( + "██████████████████ ████████\n" + "██████████████████ ████████\n" + "██████████████████ ████████\n" + "██████████████████ ████████\n" + "████████ ████████\n" + "████████ ████████ ████████\n" + "████████ ████████ ████████\n" + "████████ ████████ ████████\n" + "████████ ████████ ████████\n" + "████████ ████████ ████████\n" + "████████ ████████ ████████\n" + "████████ ████████ ████████\n" + "████████ ████████ ████████\n" + "████████ ████████ ████████" + ) + FF_LOGO_COLORS( + "32" //green + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoManjaroSmall() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("manjaro_small", "manjaro-linux-small") + FF_LOGO_LINES( + "||||||||| ||||\n" + "||||||||| ||||\n" + "|||| ||||\n" + "|||| |||| ||||\n" + "|||| |||| ||||\n" + "|||| |||| ||||\n" + "|||| |||| ||||" + ) + FF_LOGO_COLORS( + "32" //green + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoMint() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("mint", "linuxmint", "mint-linux", "linux-mint") + FF_LOGO_LINES( + " $2...-:::::-...\n" + " .-MMMMMMMMMMMMMMM-.\n" + " .-MMMM$1`..-:::::::-..`$2MMMM-.\n" + " .:MMMM$1.:MMMMMMMMMMMMMMM:.$2MMMM:.\n" + " -MMM$1-M---MMMMMMMMMMMMMMMMMMM.$2MMM-\n" + " `:MMM$1:MM` :MMMM:....::-...-MMMM:$2MMM:`\n" + " :MMM$1:MMM` :MM:` `` `` `:MMM:$2MMM:\n" + ".MMM$1.MMMM` :MM. -MM. .MM- `MMMM.$2MMM.\n" + ":MMM$1:MMMM` :MM. -MM- .MM: `MMMM-$2MMM:\n" + ":MMM$1:MMMM` :MM. -MM- .MM: `MMMM:$2MMM:\n" + ":MMM$1:MMMM` :MM. -MM- .MM: `MMMM-$2MMM:\n" + ".MMM$1.MMMM` :MM:--:MM:--:MM: `MMMM.$2MMM.\n" + " :MMM$1:MMM- `-MMMMMMMMMMMM-` -MMM-$2MMM:\n" + " :MMM$1:MMM:` `:MMM:$2MMM:\n" + " .MMM$1.MMMM:--------------:MMMM.$2MMM.\n" + " '-MMMM$1.-MMMMMMMMMMMMMMM-.$2MMMM-'\n" + " '.-MMMM$1``--:::::--``$2MMMM-.'\n" + " '-MMMMMMMMMMMMM-'\n" + " ``-:::::-``" + ) + FF_LOGO_COLORS( + "32", //green + "37" //white + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoMintSmall() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("mint_small", "linuxmint_small", "mint-linux-small") + FF_LOGO_LINES( + " __________\n" + "|_ \\\n" + " | $2| _____ $1|\n" + " | $2| | | | $1|\n" + " | $2| | | | $1|\n" + " | $2\\__$2___/ $1|\n" + " \\_________/" + ) + FF_LOGO_COLORS( + "32", //green + "37" //white + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoMintOld() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("mint_old", "mint-old", "mint-linux_old", "mint-linux-old", "linux-mint_old", "linux-mint-old") + FF_LOGO_LINES( + "MMMMMMMMMMMMMMMMMMMMMMMMMmds+.\n" + "MMm----::-://////////////oymNMd+`\n" + "MMd $2/++ $1-sNMd:\n" + "MMNso/` $2dMM `.::-. .-::.` $1.hMN:\n" + "ddddMMh $2dMM :hNMNMNhNMNMNh: $1`NMm\n" + " NMm $2dMM .NMN/-+MMM+-/NMN` $1dMM\n" + " NMm $2dMM -MMm `MMM dMM. $1dMM\n" + " NMm $2dMM -MMm `MMM dMM. $1dMM\n" + " NMm $2dMM .mmd `mmm yMM. $1dMM\n" + " NMm $2dMM` ..` ... ydm. $1dMM\n" + " hMM- $2+MMd/-------...-:sdds $1dMM\n" + " -NMm- $2:hNMNNNmdddddddddy/` $1dMM\n" + " -dMNs-$2``-::::-------.`` $1dMM\n" + " `/dMNmy+/:-------------:/yMMM\n" + " ./ydNMMMMMMMMMMMMMMMMMMMMM\n" + " .MMMMMMMMMMMMMMMMMMM" + ) + FF_LOGO_COLORS( + "32", //green + "37" //white + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoOpenSuse() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("suse", "opensuse", "open_suse", "open-suse", "suse-linux") + FF_LOGO_LINES( + " $2.;ldkO0000Okdl;.\n" + " .;d00xl:^''''''^:ok00d;.\n" + " .d00l' 'o00d.\n" + " .d0Kd'$1 Okxol:;,. $2:O0d\n" + " .OK$1KKK0kOKKKKKKKKKKOxo:, $2lKO.\n" + " ,0K$1KKKKKKKKKKKKKKK0P^$2,,,$1^dx:$2 ;00,\n" + ".OK$1KKKKKKKKKKKKKKKk'$2.oOPPb.$1'0k.$2 cKO.\n" + ":KK$1KKKKKKKKKKKKKKK: $2kKx..dd $1lKd$2 'OK:\n" + "dKK$1KKKKKKKKKOx0KKKd $2^0KKKO' $1kKKc$2 dKd\n" + "dKK$1KKKKKKKKKK;.;oOKx,..$2^$1..;kKKK0.$2 dKd\n" + ":KK$1KKKKKKKKKK0o;...^cdxxOK0O/^^' $2.0K:\n" + " kKK$1KKKKKKKKKKKKK0x;,,......,;od $2lKk\n" + " '0K$1KKKKKKKKKKKKKKKKKKKK00KKOo^ $2c00'\n" + " 'kK$1KKOxddxkOO00000Okxoc;'' $2.dKk'\n" + " l0Ko. .c00l'\n" + " 'l0Kk:. .;xK0l'\n" + " 'lkK0xl:;,,,,;:ldO0kl'\n" + " '^:ldxkkkkxdl:^'" + ) + FF_LOGO_COLORS( + "32", //green + "37" //white + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoOpenSuseSmall() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("suse_small", "opensuse_small", "open_suse_small", "open-suse_small") + FF_LOGO_LINES( + " _______\n" + "__| __ \\\n" + " / .\\ \\\n" + " \\__/ |\n" + " _______|\n" + " \\_______\n" + "__________/" + ) + FF_LOGO_COLORS( + "32" //green + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoOpenSuseLeap() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("opensuse_leap", "open_suse_leap", "opensuse-leap", "open-suse-leap", "suse_leap", "suse-leap", "opensuseleap") + FF_LOGO_LINES( + " $2.-++:.\n" + " ./oooooo/-\n" + " `:oooooooooooo:.\n" + " -+oooooooooooooooo+-`\n" + " ./oooooooooooooooooooooo/-\n" + " :oooooooooooooooooooooooooo:\n" + " ` `-+oooooooooooooooooooo/- `\n" + " `:oo/- .:ooooooooooooooo+:` `-+oo/.\n" + "`/oooooo:. -/oooooooooo/. ./oooooo/.\n" + " `:+ooooo+-` `:+oooo+- `:oooooo+:`\n" + " .:oooooo/. .::` -+oooooo/.\n" + " -/oooooo:. ./oooooo+-\n" + " `:+ooooo+-:+oooooo:`\n" + " ./oooooooooo/.\n" + " -/oooo+:`\n" + " `:/." + ) + FF_LOGO_COLORS( + "32", //green + "37" //white + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoOpenSuseTumbleweed() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("opensuse_tumbleweed", "open_suse_tumbleweed", "opensuse-tumbleweed", "open-suse-tumbleweed", "suse_tumbleweed", "suse-tumbleweed", "opensusetumbleweed") + FF_LOGO_LINES( + " $2......\n" + " .,cdxxxoc,. .:kKMMMNWMMMNk:.\n" + " cKMMN0OOOKWMMXo. ; ;0MWk:. .:OMMk.\n" + " ;WMK;. .lKMMNM, :NMK, .OMW;\n" + " cMW; 'WMMMN ,XMK, oMM'\n" + ".MMc ..;l. xMN: KM0\n" + "'MM. 'NMO oMM\n" + ".MM, .kMMl xMN\n" + " KM0 .kMM0. .dl:,.. .WMd\n" + " .XM0. ,OMMK, OMMMK. .XMK\n" + " oWMO:. .;xNMMk, NNNMKl. .xWMx\n" + " :ONMMNXMMMKx; . ,xNMWKkxllox0NMWk,\n" + " ..... .:dOOXXKOxl," + ) + FF_LOGO_COLORS( + "32", //green + "37" //white + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoPop() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("pop", "popos", "pop_os", "pop-linux") + FF_LOGO_LINES( + " /////////////\n" + " /////////////////////\n" + " ///////$2*767$1////////////////\n" + " //////$27676767676*$1//////////////\n" + " /////$276767$1//$27676767$1//////////////\n" + " /////$2767676$1///$2*76767$1///////////////\n" + " ///////$2767676$1///$276767$1.///$27676*$1///////\n" + "/////////$2767676$1//$276767$1///$2767676$1////////\n" + "//////////$276767676767$1////$276767$1/////////\n" + "///////////$276767676$1//////$27676$1//////////\n" + "////////////,$27676$1,///////$2767$1///////////\n" + "/////////////*$27676$1///////$276$1////////////\n" + "///////////////$27676$1////////////////////\n" + " ///////////////$27676$1///$2767$1////////////\n" + " //////////////////////$2'$1////////////\n" + " //////$2.7676767676767676767,$1//////\n" + " /////$2767676767676767676767$1/////\n" + " ///////////////////////////\n" + " /////////////////////\n" + " /////////////" + ) + FF_LOGO_COLORS( + "36", //cyan + "37" //white + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoPopSmall() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("pop_small", "popos_small", "pop_os_small", "pop-linux-small") + FF_LOGO_LINES( + "______\n" + "\\ _ \\ __\n" + " \\ \\ \\ \\ / /\n" + " \\ \\_\\ \\ / /\n" + " \\ ___\\ /_/\n" + " \\ \\ _\n" + " __\\_\\__(_)_\n" + " (___________)`" + ) + FF_LOGO_COLORS( + "36" //cyan + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoReborn() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("reborn", "reborn-os", "rebornos", "rebornos-linux", "reborn-os-linux") + FF_LOGO_LINES( + " :::::::::::::::::::::::\n" + " .:^!!!!!!!!!^.^!!!!!!!!!^:.\n" + " .:~!!!!!!!!!!^.^!!!!!!!!!!~:.\n" + " .:~!!!!!~~~~~~^.^~~~~~~!!!!!~:.\n" + " .^!!!!!~::$2=====:.:=====$1::~!!!!!^.\n" + " .::^~~!!~:$2^77777?~.~?77777^$1:~!!~~^::.\n" + " .:~~^:::^.$2^77777!!^.^7!77777^$1.^:::^~~:.\n" + " .:~!!!!~::::$2^~!!::^^^^^::!!~^$1::::~!!!!~:.\n" + " .^!!!!!~::$2!7!~^:.^?JJJJJ?^.:^~!7!$1::~!!!!!^.\n" + ".:^!!!!!~:$2^77777~.~JJJJJJJJJ~.~77777^$1:~!!!!!^:.\n" + ".:^!!!!!~:$2^77777~.~JJJJJJJJJ~.~77777^$1:~!!!!!^:.\n" + " .^!!!!!~::$2!7!~^:.^?JJJJJ?^.:^~!7!$1::~!!!!!^.\n" + " .:~!!!!~::$2::^~!!::^^^^^::!!~^::$1::~!!!!~:.\n" + " .:~~^:::^.$2^77777!!^.^7!77777^.$1^:::^~~:.\n" + " .::^~~!!~:$2^77777?~.~?77777^$1:~!!~~^::.\n" + " .^!!!!!~::$2=====:.:=====$1::~!!!!!^.\n" + " .:~!!!!!~~~~~~^.^~~~~~~!!!!!~:.\n" + " .:~!!!!!!!!!!^.^!!!!!!!!!!~:.\n" + " .:^!!!!!!!!!^.^!!!!!!!!!^:.\n" + " :::::::::::::::::::::::\n" + ) + FF_LOGO_COLORS( + "34", //blue + "36" //cyan + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoRebornSmall() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("reborn_small", "reborn-os-small", "rebornos_small", "rebornos-linux-small", "reborn-os-linux-small") + FF_LOGO_LINES( + " _______________\n" + " / \\ / \\\n" + " / \\_______/ \\\n" + " / / \\ / \\ \\\n" + " / / \\___/ \\ \\\n" + "/____/____/ \\____\\____\\\n" + "\\ \\ \\___/ / /\n" + " \\ \\ / \\ / /\n" + " \\ \\/_______\\/ /\n" + " \\ / \\ /\n" + " \\_/___________\\_/\n" + ) + FF_LOGO_COLORS( + "34" //blue + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoUbuntu() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("ubuntu", "ubuntu-linux") + FF_LOGO_LINES( + " .-/+oossssoo+/-.\n" + " `:+ssssssssssssssssss+:`\n" + " -+ssssssssssssssssssyyssss+-\n" + " .ossssssssssssssssssd$2MMMNy$1sssso.\n" + " /sssssssssss$2hdmmNNmmyNMMMMh$1ssssss/\n" + " +sssssssss$2hmydMMMMMMMNddddy$1ssssssss+\n" + " /ssssssss$2hNMMMyhhyyyyhmNMMMNh$1ssssssss/\n" + ".ssssssss$2dMMMNh$1ssssssssss$2hNMMMd$1ssssssss.\n" + "+ssss$2hhhyNMMNy$1ssssssssssss$2yNMMMy$1sssssss+\n" + "oss$2yNMMMNyMMh$1ssssssssssssss$2hmmmh$1ssssssso\n" + "oss$2yNMMMNyMMh$1ssssssssssssss$2hmmmh$1ssssssso\n" + "+ssss$2hhhyNMMNy$1ssssssssssss$2yNMMMy$1sssssss+\n" + ".ssssssss$2dMMMNh$1ssssssssss$2hNMMMd$1ssssssss.\n" + " /ssssssss$2hNMMMyhhyyyyhdNMMMNh$1ssssssss/\n" + " +sssssssss$2dmydMMMMMMMMddddy$1ssssssss+\n" + " /sssssssssss$2hdmNNNNmyNMMMMh$1ssssss/\n" + " .ossssssssssssssssss$2dMMMNy$1sssso.\n" + " -+sssssssssssssssss$2yyy$1ssss+-\n" + " `:+ssssssssssssssssss+:`\n" + " .-/+oossssoo+/-." + ) + FF_LOGO_COLORS( + "31", //red + "37" //white + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoUbuntuSmall() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("ubuntu_small", "ubuntu-linux-small") + FF_LOGO_LINES( + " _\n" + " ---(_)\n" + " _/ --- \\\n" + "(_) | |\n" + " \\ --- _/\n" + " ---(_)" + ) + FF_LOGO_COLORS( + "31" //red + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoVoid() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("void", "void-linux") + FF_LOGO_LINES( + " __.;=====;.__\n" + " _.=+==++=++=+=+===;.\n" + " -=+++=+===+=+=+++++=_\n" + " . -=:`` `--==+=++==.\n" + " _vi, ` --+=++++:\n" + " .uvnvi. _._ -==+==+.\n" + " .vvnvnI` .;==|==;. :|=||=|.\n" + "$2+QmQQm$1pvvnv;$2 _yYsyQQWUUQQQm #QmQ#$1:$2QQQWUV$QQm.\n" + " $2-QQWQW$1pvvo$2wZ?.wQQQE$1==<$2QWWQ/QWQW.QQWW$1(:$2 jQWQE\n" + " $2-$QQQQmmU' jQQQ$1@+=<$2QWQQ)mQQQ.mQQQC$1+;$2jWQQ@'\n" + " $2-$WQ8Y$1nI:$2 QWQQwgQQWV$1`$2mWQQ.jQWQQgyyWW@!\n" + " $1-1vvnvv. `~+++` ++|+++\n" + " +vnvnnv, `-|===\n" + " +vnvnvns. . :=-\n" + " -Invnvvnsi..___..=sv=. `\n" + " +Invnvnvnnnnnnnnvvnn;.\n" + " ~|Invnvnvvnvvvnnv}+`\n" + " -~|{*l}*|~" + ) + FF_LOGO_COLORS( + "32", //green + "30" //black + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoVoidSmall() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("void_small", "void-linux-small") + FF_LOGO_LINES( + " _______\n" + " _ \\______ -\n" + "| \\ ___ \\ |\n" + "| | / \\ | |\n" + "| | \\___/ | |\n" + "| \\______ \\_|\n" + " -_______\\" + ) + FF_LOGO_COLORS( + "32" //green + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoZorin() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("zorin", "zorin-linux", "zorinos", "zorinos-linux") + FF_LOGO_LINES( + " `osssssssssssssssssssso`\n" + " .osssssssssssssssssssssso.\n" + " .+oooooooooooooooooooooooo+.\n" + "\n" + "\n" + " `::::::::::::::::::::::. .:`\n" + " `+ssssssssssssssssss+:.` `.:+ssso`\n" + ".ossssssssssssssso/. `-+ossssssso.\n" + "ssssssssssssso/-` `-/osssssssssssss\n" + ".ossssssso/-` .-/ossssssssssssssso.\n" + " `+sss+:. `.:+ssssssssssssssssss+`\n" + " `:. .::::::::::::::::::::::`\n" + "\n" + "\n" + " .+oooooooooooooooooooooooo+.\n" + " -osssssssssssssssssssssso-\n" + " `osssssssssssssssssssso`" + ) + FF_LOGO_COLORS( + "34" //blue + ) + FF_LOGO_RETURN +} + +typedef const FFlogo*(*GetLogoMethod)(); + +static GetLogoMethod* getLogos() +{ + static GetLogoMethod logoMethods[] = { + getLogoNone, + getLogoUnknown, + getLogoAndroid, + getLogoAndroidSmall, + getLogoArch, + getLogoArchSmall, + getLogoArcoLinux, + getLogoArtix, + getLogoArtixSmall, + getLogoCachyOS, + getLogoCelOS, + getLogoCentOS, + getLogoCentOSSmall, + getLogoDebian, + getLogoDebianSmall, + getLogoEndeavour, + getLogoFedora, + getLogoFedoraSmall, + getLogoFedoraOld, + getLogoGaruda, + getLogoGentoo, + getLogoGentooSmall, + getLogoKDENeon, + getLogoLinux, + getLogoManjaro, + getLogoManjaroSmall, + getLogoMint, + getLogoMintSmall, + getLogoMintOld, + getLogoOpenSuse, + getLogoOpenSuseSmall, + getLogoOpenSuseLeap, + getLogoOpenSuseTumbleweed, + getLogoPop, + getLogoPopSmall, + getLogoReborn, + getLogoRebornSmall, + getLogoUbuntu, + getLogoUbuntuSmall, + getLogoVoid, + getLogoVoidSmall, + getLogoZorin, + NULL + }; + + return logoMethods; +} + +static bool logoHasName(const FFlogo* logo, const char* name) +{ + const char** logoName = logo->names; + + while(*logoName != NULL) + { + if(strcasecmp(*logoName, name) == 0) + return true; + ++logoName; + } + + return false; +} + +static const FFlogo* getBuiltinLogo(const char* name) +{ + GetLogoMethod* methods = getLogos(); + + while(*methods != NULL) + { + const FFlogo* logo = (*methods)(); + if(logoHasName(logo, name)) + return logo; + ++methods; + } + + return NULL; +} + +static const FFlogo* detectBuiltinLogoWithVersion(const FFstrbuf* versionString, const FFstrbuf* name) +{ + if(versionString->length == 0) + return getBuiltinLogo(name->chars); + + #define FF_PRINT_LOGO_VERSIONED_IF_EXISTS(newLogo, oldLogo, ver) \ + if(logoHasName(newLogo, name->chars)) \ + { \ + long version = strtol(versionString->chars, NULL, 10); \ + return (version == 0 || version == LONG_MAX || version == LONG_MIN || version > ver) ? newLogo : oldLogo; \ + } + + FF_PRINT_LOGO_VERSIONED_IF_EXISTS(getLogoFedora(), getLogoFedoraOld(), 34) + FF_PRINT_LOGO_VERSIONED_IF_EXISTS(getLogoMint(), getLogoMintOld(), 19) + + return getBuiltinLogo(name->chars); +} + +static const FFlogo* detectBuiltinLogo(const FFinstance* instance) +{ + static const FFlogo* logo; + static bool detected = false; + if(detected) + return logo; + + detected = true; + + const FFOSResult* os = ffDetectOS(instance); + + logo = detectBuiltinLogoWithVersion(&os->version, &os->name); + if(logo != NULL) + return logo; + + logo = detectBuiltinLogoWithVersion(&os->version, &os->id); + if(logo != NULL) + return logo; + + logo = detectBuiltinLogoWithVersion(&os->version, &os->idLike); + if(logo != NULL) + return logo; + + logo = detectBuiltinLogoWithVersion(&os->version, &os->systemName); + if(logo != NULL) + return logo; + + return getLogoUnknown(); +} + +void ffLogoSetMainColor(FFinstance* instance) +{ + const FFlogo* logo; + if(instance->config.logoName.length > 0) + { + logo = getBuiltinLogo(instance->config.logoName.chars); + if(logo == NULL) + logo = getLogoUnknown(); + } + else + logo = detectBuiltinLogo(instance); + + ffStrbufAppendS(&instance->config.mainColor, logo->builtinColors[0]); +} + +static void printLogoStruct(FFinstance* instance, const FFlogo* logo, bool doColorReplacement) +{ + if(!doColorReplacement) + { + ffLogoPrint(instance, logo->data, false); + return; + } + + const char** colors = logo->builtinColors; + for(int i = 0; *colors != NULL && i < FASTFETCH_LOGO_MAX_COLORS; i++, colors++) + { + if(instance->config.logoColors[i].length == 0) + ffStrbufAppendS(&instance->config.logoColors[i], *colors); + } + + ffLogoPrint(instance, logo->data, true); +} + +void ffLogoPrintUnknown(FFinstance* instance) +{ + printLogoStruct(instance, getLogoUnknown(), false); +} + +void ffLogoPrintBuiltin(FFinstance* instance) +{ + const FFlogo* logo = getBuiltinLogo(instance->config.logoName.chars); + if(logo == NULL) + ffLogoPrintUnknown(instance); + else + printLogoStruct(instance, logo, true); +} + +bool ffLogoPrintBuiltinIfExists(FFinstance* instance) +{ + const FFlogo* logo = getBuiltinLogo(instance->config.logoName.chars); + if(logo == NULL) + return false; + + printLogoStruct(instance, logo, true); + return true; +} + +void ffLogoPrintBuiltinDetected(FFinstance* instance) +{ + printLogoStruct(instance, detectBuiltinLogo(instance), true); +} + +void ffPrintBuiltinLogos(FFinstance* instance) +{ + GetLogoMethod* methods = getLogos(); + + while(*methods != NULL) + { + const FFlogo* logo = (*methods)(); + printf("\033[%sm%s:\033[0m\n", logo->builtinColors[0], logo->names[0]); + printLogoStruct(instance, logo, true); + ffPrintRemainingLogo(instance); + + instance->state.logoHeight = 0; + for(uint8_t i = 0; i < FASTFETCH_LOGO_MAX_COLORS; i++) + ffStrbufClear(&instance->config.logoColors[i]); + + puts("\n"); + ++methods; + } +} + +void ffListBuiltinLogos() +{ + GetLogoMethod* methods = getLogos(); + + uint32_t counter = 0; + + while(*methods != NULL) + { + const FFlogo* logo = (*methods)(); + const char** names = logo->names; + + printf("%u)%s ", counter, counter < 10 ? " " : ""); + ++counter; + + while(*names != NULL) + { + printf("\"%s\" ", *names); + ++names; + } + + putchar('\n'); + ++methods; + } +} + +void ffListBuiltinLogosAutocompletion() +{ + GetLogoMethod* methods = getLogos(); + + while(*methods != NULL) + { + printf("%s\n", (*methods)()->names[0]); + ++methods; + } +} diff --git a/src/logo/logo.c b/src/logo/logo.c new file mode 100644 index 000000000..96a88e353 --- /dev/null +++ b/src/logo/logo.c @@ -0,0 +1,248 @@ +#include "logo.h" + +#include + +static inline void printSpaces(uint32_t padding) +{ + for(uint32_t i = 0; i < padding; i++) + putchar(' '); +} + +void ffLogoPrint(FFinstance* instance, const char* data, bool doColorReplacement) +{ + uint32_t maxLineLength = 0; + uint32_t currentlineLength = 0; + + fputs(FASTFETCH_TEXT_MODIFIER_BOLT, stdout); + printSpaces(instance->config.logoPaddingLeft); + + //Use logoColor[0] as the default color + if(doColorReplacement) + ffPrintColor(&instance->config.logoColors[0]); + + while(*data != '\0') + { + //We are at the end of a line. Print paddings and update max line length + if(*data == '\n' || (*data == '\r' && *(data + 1) == '\n')) + { + printSpaces(instance->config.logoPaddingRight); + + //We have \r\n, skip the \r + if(*data == '\r') + ++data; + + putchar('\n'); + ++data; + + printSpaces(instance->config.logoPaddingLeft); + + if(currentlineLength > maxLineLength) + maxLineLength = currentlineLength; + + currentlineLength = 0; + ++instance->state.logoHeight; + continue; + } + + //Always print tabs as 4 spaces, to have consistent spacing + if(*data == '\t') + { + printSpaces(4); + ++data; + continue; + } + + //We have an escape sequence direclty as bytes. We print it, but don't increase the line length + if(*data == '\033' && *(data + 1) == '[') + { + const char* start = data; + + fputs("\033[", stdout); + data += 2; + + while(isdigit(*data) || *data == ';') + putchar(*data++); // number + + //We have a valid control sequence, print it and continue with next char + if(isascii(*data)) + { + putchar(*data++); // single letter, end of control sequence + continue; + } + + //Invalid control sequence, try to get most accurate length + currentlineLength += (uint32_t) (data - start - 1); //-1 for \033 which for sure doesn't take any space + + //Don't continue here, print the char after the letters with the unicode printing + } + + //We have a fastfetch color placeholder. Replace it with the esacape sequence, don't increase the line length + if(doColorReplacement && *data == '$') + { + ++data; + + //If we have $$, or $\0, print it as single $ + if(*data == '$' || *data == '\0') + { + putchar('$'); + ++currentlineLength; + ++data; + continue; + } + + //Map the number to an array index, so that '1' -> 0, '2' -> 1, etc. + int index = ((int) *data) - 49; + + //If the index is valid, print the color. Otherwise continue as normal + if(index < 0 || index >= FASTFETCH_LOGO_MAX_COLORS) + { + putchar('$'); + ++currentlineLength; + //Don't continue here, we want to print the current char as unicode + } + else + { + ffPrintColor(&instance->config.logoColors[index]); + ++data; + continue; + } + } + + //Do the printing, respecting unicode + + ++currentlineLength; + + int codepoint = (unsigned char) *data; + uint8_t bytes; + + if(codepoint <= 127) + bytes = 1; + else if((codepoint & 0xE0) == 0xC0) + bytes = 2; + else if((codepoint & 0xF0) == 0xE0) + bytes = 3; + else if((codepoint & 0xF8) == 0xF0) + bytes = 4; + else + bytes = 1; //Invalid utf8, print it as is, byte by byte + + for(uint8_t i = 0; i < bytes; ++i) + { + if(*data == '\0') + break; + + putchar(*data++); + } + } + + printSpaces(instance->config.logoPaddingRight); + fputs(FASTFETCH_TEXT_MODIFIER_RESET, stdout); + + //Happens if the last line is the longest + if(currentlineLength > maxLineLength) + maxLineLength = currentlineLength; + + maxLineLength += instance->config.logoPaddingLeft + instance->config.logoPaddingRight; + + //If the logo is none, and we have no padding, don't go to the left + if(maxLineLength > 0) + ffStrbufAppendF(&instance->state.logoWidthEscapeCode, "\033[%uC", maxLineLength); + + //If the logo height is > 1, go up the height + if(instance->state.logoHeight > 0) + printf("\033[%uA", instance->state.logoHeight); + + //Go to the leftmost position + fputs("\033[9999999D", stdout); +} + +static void logoPrintFile(FFinstance* instance, bool doColorReplacement) +{ + FFstrbuf content; + ffStrbufInitA(&content, 2047); + + if(ffAppendFileContent(instance->config.logoName.chars, &content)) + ffLogoPrint(instance, content.chars, doColorReplacement); + else + ffLogoPrintUnknown(instance); +} + +static void logoPrintDetected(FFinstance* instance) +{ + if(instance->config.logoName.length > 0) + { + if(!ffLogoPrintBuiltinIfExists(instance)) + logoPrintFile(instance, true); + return; + } + + ffLogoPrintBuiltinDetected(instance); +} + +void ffPrintLogo(FFinstance* instance) +{ + if(instance->config.mainColor.length == 0) + ffLogoSetMainColor(instance); + + if(( //Logo type needs set logo name, but nothing was given. Print question mark + instance->config.logoType == FF_LOGO_TYPE_BUILTIN || + instance->config.logoType == FF_LOGO_TYPE_FILE || + instance->config.logoType == FF_LOGO_TYPE_RAW + ) && instance->config.logoName.length == 0 + ) + ffLogoPrintUnknown(instance); + else if(instance->config.logoType == FF_LOGO_TYPE_BUILTIN) + ffLogoPrintBuiltin(instance); + else if(instance->config.logoType == FF_LOGO_TYPE_FILE) + logoPrintFile(instance, true); + else if(instance->config.logoType == FF_LOGO_TYPE_RAW) + logoPrintFile(instance, false); + else + logoPrintDetected(instance); +} + +void ffPrintRemainingLogo(FFinstance* instance) +{ + if(!instance->config.logoPrintRemaining) + return; + + for(uint32_t i = instance->state.keysHeight; i <= instance->state.logoHeight; i++) + ffStrbufPutTo(&instance->state.logoWidthEscapeCode, stdout); +} + +void ffPrintLogoLine(FFinstance* instance) +{ + ffStrbufWriteTo(&instance->state.logoWidthEscapeCode, stdout); + ++instance->state.keysHeight; + fputs(FASTFETCH_TEXT_MODIFIER_RESET, stdout); +} + +void ffPrintLogoAndKey(FFinstance* instance, const char* moduleName, uint8_t moduleIndex, const FFstrbuf* customKeyFormat) +{ + ffPrintLogoLine(instance); + + fputs(FASTFETCH_TEXT_MODIFIER_BOLT, stdout); + ffPrintColor(&instance->config.mainColor); + + if(customKeyFormat == NULL || customKeyFormat->length == 0) + { + fputs(moduleName, stdout); + + if(moduleIndex > 0) + printf(" %hhu", moduleIndex); + } + else + { + FFstrbuf key; + ffStrbufInit(&key); + ffParseFormatString(&key, customKeyFormat, NULL, 1, (FFformatarg[]){ + {FF_FORMAT_ARG_TYPE_UINT8, &moduleIndex} + }); + ffStrbufWriteTo(&key, stdout); + ffStrbufDestroy(&key); + } + + fputs(FASTFETCH_TEXT_MODIFIER_RESET, stdout); + ffStrbufWriteTo(&instance->config.separator, stdout); + fputs(FASTFETCH_TEXT_MODIFIER_RESET, stdout); +} diff --git a/src/logo/logo.h b/src/logo/logo.h new file mode 100644 index 000000000..a7f0fb614 --- /dev/null +++ b/src/logo/logo.h @@ -0,0 +1,19 @@ +#pragma once + +#ifndef FASTFETCH_INCLUDED_LOGO_logo +#define FASTFETCH_INCLUDED_LOGO_logo + +#include "fastfetch.h" + +//logo.c +void ffLogoPrint(FFinstance* instance, const char* data, bool doColorReplacement); + +//builtin.c +void ffLogoSetMainColor(FFinstance* instance); + +void ffLogoPrintUnknown(FFinstance* instance); +void ffLogoPrintBuiltin(FFinstance* instance); +bool ffLogoPrintBuiltinIfExists(FFinstance* instance); +void ffLogoPrintBuiltinDetected(FFinstance* instance); + +#endif diff --git a/src/modules/title.c b/src/modules/title.c index 9158105a9..84c71f298 100644 --- a/src/modules/title.c +++ b/src/modules/title.c @@ -31,7 +31,7 @@ const FFTitleResult* ffDetectTitle(FFinstance* instance) static inline void printTitlePart(FFinstance* instance, const FFstrbuf* content) { fputs(FASTFETCH_TEXT_MODIFIER_BOLT, stdout); - ffPrintColor(&instance->config.color); + ffPrintColor(&instance->config.mainColor); ffStrbufWriteTo(content, stdout); fputs(FASTFETCH_TEXT_MODIFIER_RESET, stdout); }