diff --git a/README.md b/README.md index 15509e6..cc3c6d5 100644 --- a/README.md +++ b/README.md @@ -208,7 +208,7 @@ secs = " seconds" # Choices: pacman, flatpak, dpkg, apk # # Pro-tip: if your package manager isnt listed here, yet, -# use the bash command component in the layout +# use the bash command tag in the layout # e.g "Packages: $(pacman -Q | wc -l) (pacman)" pkg-managers = ["pacman", "dpkg", "flatpak"] @@ -252,24 +252,24 @@ bg-image = "/tmp/idk.png" ``` We got the config.toml file, in there we got an array variable called "layout". That's the variable where you customize how the infos should be displayed.\ -You have 4 components: `$`, `${color}`, `$(bash command)`, `$[something,equalToSomethingElse,iftrue,ifalse]`. They can be used in the ascii art text file and layout, but how to use them? +You have 4 tags: `$`, `${color}`, `$(bash command)`, `$[something,equalToSomethingElse,iftrue,ifalse]`. They can be used in the ascii art text file and layout, but how to use them? -* **The info component (`$<>`)** will print a member of a module\ +* **The info tag (`$<>`)** will print a value of a module\ e.g `$` will print the username, `$` will print the kernel version and so on.\ run "cufetch -l" for a list of builti-in modules -* **The bash command component (`$()`)** let's you execute bash commands\ +* **The bash command tag (`$()`)** let's you execute bash commands\ e.g `$(echo \"hello world\")` will indeed echo out Hello world.\ you can even use pipes\ e.g `$(echo \"hello world\" | cut -d' ' -f2)` will only print world -* **The conditional component (`$[]`)** is used for equal conditional check.\ +* **The conditional tag (`$[]`)** is used for equal conditional check.\ Syntax MUST be `$[something,equalToSomethingElse,iftrue,ifalse]` with no spaces between commas ','\ - Each part can have a component or anything else.\ + Each part can have a tag or anything else.\ e.g `$[$,$(echo $USER),the name is correct,the name is NOT correct]`\ This is useful when on some terminal or WM the detection can be different than others\ -* **The color component (`${}`)** is used for which color to use for colorizing the text\ +* **The color tag (`${}`)** is used for which color to use for colorizing the text\ e.g `${red}hello world` will indeed print "hello world" in red (or the color you set in the variable).\ The colors can be: black, red, green, blue, cyan, yellow, magenta, white and they can be configured in the config file.\ You can put a custom hex color e.g: `${#ff6622}`.\ diff --git a/assets/config-examples/config_cool.toml b/assets/config-examples/config_cool.toml index e288e4b..834dcdf 100644 --- a/assets/config-examples/config_cool.toml +++ b/assets/config-examples/config_cool.toml @@ -3,7 +3,7 @@ # here is how it works: # the variable "layout" is used for showing the infos # as like as the user want, no limitation. -# inside here there are 4 "components": $<> $() ${} $[] +# inside here there are 4 "tags": $<> $() ${} $[] # $<> lets you access a member of a module # e.g $ will print the username, $ will print the kernel version and so on. @@ -16,7 +16,7 @@ # $[] is used for equal conditional check # syntax MUST be $[something,equalToSomethingElse,iftrue,ifalse] with no spaces between commas ',' -# Each part can have a component or anything else. +# Each part can have a tag or anything else. # e.g $[$,$(echo $USER),the name is correct,the name is NOT correct] # This is useful when on some terminal or WM the detection can be different than others @@ -149,7 +149,7 @@ secs = " seconds" # Choices: pacman, flatpak, dpkg, apk # # Pro-tip: if your package manager isnt listed here, yet, -# use the bash command component in the layout +# use the bash command tag in the layout # e.g "Packages: $(pacman -Q | wc -l) (pacman)" pkg-managers = ["pacman", "dpkg", "flatpak"] diff --git a/assets/config-examples/config_modified.toml b/assets/config-examples/config_modified.toml index 950c041..819926e 100644 --- a/assets/config-examples/config_modified.toml +++ b/assets/config-examples/config_modified.toml @@ -3,7 +3,7 @@ # here is how it works: # the variable "layout" is used for showing the infos # as like as the user want, no limitation. -# inside here there are 4 "components": $<> $() ${} $[] +# inside here there are 4 "tags": $<> $() ${} $[] # $<> lets you access a member of a module # e.g $ will print the username, $ will print the kernel version and so on. @@ -16,7 +16,7 @@ # $[] is used for equal conditional check # syntax MUST be $[something,equalToSomethingElse,iftrue,ifalse] with no spaces between commas ',' -# Each part can have a component or anything else. +# Each part can have a tag or anything else. # e.g $[$,$(echo $USER),the name is correct,the name is NOT correct] # This is useful when on some terminal or WM the detection can be different than others @@ -136,7 +136,7 @@ secs = " seconds" # Choices: pacman, flatpak, dpkg, apk # # Pro-tip: if your package manager isnt listed here, yet, -# use the bash command component in the layout +# use the bash command tag in the layout # e.g "Packages: $(pacman -Q | wc -l) (pacman)" pkg-managers = ["pacman", "dpkg", "flatpak"] diff --git a/assets/config-examples/config_simple.toml b/assets/config-examples/config_simple.toml index a7b5d86..d498fd4 100644 --- a/assets/config-examples/config_simple.toml +++ b/assets/config-examples/config_simple.toml @@ -3,7 +3,7 @@ # here is how it works: # the variable "layout" is used for showing the infos # as like as the user want, no limitation. -# inside here there are 4 "components": $<> $() ${} $[] +# inside here there are 4 "tags": $<> $() ${} $[] # $<> lets you access a member of a module # e.g $ will print the username, $ will print the kernel version and so on. @@ -16,7 +16,7 @@ # $[] is used for equal conditional check # syntax MUST be $[something,equalToSomethingElse,iftrue,ifalse] with no spaces between commas ',' -# Each part can have a component or anything else. +# Each part can have a tag or anything else. # e.g $[$,$(echo $USER),the name is correct,the name is NOT correct] # This is useful when on some terminal or WM the detection can be different than others @@ -127,7 +127,7 @@ secs = " seconds" # Choices: pacman, flatpak, dpkg, apk # # Pro-tip: if your package manager isnt listed here, yet, -# use the bash command component in the layout +# use the bash command tag in the layout # e.g "Packages: $(pacman -Q | wc -l) (pacman)" pkg-managers = ["pacman", "dpkg", "flatpak"] diff --git a/assets/config-examples/nitch_like_config.toml b/assets/config-examples/nitch_like_config.toml index 7e8e065..392f039 100644 --- a/assets/config-examples/nitch_like_config.toml +++ b/assets/config-examples/nitch_like_config.toml @@ -3,7 +3,7 @@ # here is how it works: # the variable "layout" is used for showing the infos # as like as the user want, no limitation. -# inside here there are 4 "components": $<> $() ${} $[] +# inside here there are 4 "tags": $<> $() ${} $[] # $<> lets you access a member of a module # e.g $ will print the username, $ will print the kernel version and so on. @@ -16,7 +16,7 @@ # $[] is used for equal conditional check # syntax MUST be $[something,equalToSomethingElse,iftrue,ifalse] with no spaces between commas ',' -# Each part can have a component or anything else. +# Each part can have a tag or anything else. # e.g $[$,$(echo $USER),the name is correct,the name is NOT correct] # This is useful when on some terminal or WM the detection can be different than others @@ -131,7 +131,7 @@ secs = " seconds" # Choices: pacman, flatpak, dpkg, apk # # Pro-tip: if your package manager isnt listed here, yet, -# use the bash command component in the layout +# use the bash command tag in the layout # e.g "Packages: $(pacman -Q | wc -l) (pacman)" pkg-managers = ["pacman", "dpkg", "flatpak"] diff --git a/cufetch.1 b/cufetch.1 index c706055..9c05278 100644 --- a/cufetch.1 +++ b/cufetch.1 @@ -12,7 +12,7 @@ How does it work? .PP We got the config.toml file, in there we got an array variable called "layout". That's the variable where you customize how the infos should be displayed. .br -You have 4 components: $, ${color}, $(bash command), $[something,equalToSomething,ifTrue,ifFalse]. They can be used in the ascii art text file and layout, but how to use them? +You have 4 tags: $, ${color}, $(bash command), $[something,equalToSomething,ifTrue,ifFalse]. They can be used in the ascii art text file and layout, but how to use them? .PP Here's a simple bare-minimal example: .br @@ -26,9 +26,9 @@ layout = [ .br ] .PP -The \fBInfo component $<>\fR let's you print a part of a module. All the modules and their parts are listed in the `--list-modules` argument +The \fBInfo tag $<>\fR let's you print a part of a module. All the modules and their parts are listed in the `--list-modules` argument .PP -The \fBColor component ${}\fR is used for printing the text of a certain color. +The \fBColor tag ${}\fR is used for printing the text of a certain color. .br The colors can be: \fIblack\fR, \fIred\fR, \fIgreen\fR, \fIblue\fR, \fIcyan\fR, \fIyellow\fR, \fImagenta\fR, \fIwhite\fR and they can be configured in the config file. .br @@ -46,23 +46,23 @@ It's possible to enable multiple options, put these symbols before '#': OR They can have ANSI escape codes, e.g "\\e[1;31m" and "\\e[38;5;160m" (\fBNOTE\fR: 256 colors ANSI escape codes, those that have \\e[38 or \\e[48, can't be used in GUI) .br -You can also use them inside the component, like ${!#343345} or ${\\e[1;31m}. +You can also use them inside the tag, like ${!#343345} or ${\\e[1;31m}. .br To reset colors use ${0} or ${1} for reset and bold text. .br To instead use the colors that the ascii art logo uses, use ${auto} for getting the 1st color, ${auto4} for the 4th one and so on. .PP -The \fBConditional component $[]\fR is used for equal conditional check. +The \fBConditional tag $[]\fR is used for equal conditional check. .br syntax \fBMUST\fR be $[something,equalToSomethingElse,ifTrue,ifFalse] with no spaces between commas ',' .br -Each part can have a component or anything else. +Each part can have a tag or anything else. .br e.g $[$,$(echo $USER),the name is correct,the name is NOT correct] .br This is useful when on some terminal or WM the detection can be different than others .PP -The \fBBash command component $()\fR speaks for itself. It can execute normal bash commands. +The \fBBash command tag $()\fR speaks for itself. It can execute normal bash commands. .PP To escape any $ or bracket, just use \\ .SH OPTIONS @@ -103,7 +103,7 @@ Use GUI mode instead of priting in the terminal (use \fB\-V\fR to check if it's Offset between the ascii art and the system infos .TP \fB\-l\fR. \fB\-\-list\-modules\fR -Print the list of the components and its members +Print the list of the tags and its members .TP \fB\-h\fR, \fB\-\-help\fR Print this help menu diff --git a/include/config.hpp b/include/config.hpp index 6b9b7c0..88c679b 100644 --- a/include/config.hpp +++ b/include/config.hpp @@ -94,9 +94,9 @@ inline constexpr std::string_view AUTOCONFIG = R"#([config] # here is how it works: # the variable "layout" is used for showing the infos # as like as the user want, no limitation. -# inside here there are 4 "components": $<> $() ${} $[] +# inside here there are 4 "tags": $<> $() ${} $[] -# $<> lets you access a member of a module +# $<> lets you print the value of a member of a module # e.g $ will print the username, $ will print the kernel version and so on. # run "cufetch -l" for a list of builti-in modules @@ -107,7 +107,7 @@ inline constexpr std::string_view AUTOCONFIG = R"#([config] # $[] is used for equal conditional check # syntax MUST be $[something,equalToSomethingElse,iftrue,ifalse] with no spaces between commas ',' -# Each part can have a component or anything else. +# Each part can have a tag or anything else. # e.g $[$,$(echo $USER),the name is correct,the name is NOT correct] # This is useful when on some terminal or WM the detection can be different than others @@ -156,8 +156,8 @@ layout = [ "${auto}GPU: $", "${auto}RAM: $", "", - "${\e[40m} ${\e[41m} ${\e[42m} ${\e[43m} ${\e[44m} ${\e[45m} ${\e[46m} ${\e[47m} ", # normal colors - "${\e[100m} ${\e[101m} ${\e[102m} ${\e[103m} ${\e[104m} ${\e[105m} ${\e[106m} ${\e[107m} " # light colors + "$", # normal colors + "$" # light colors ] # display ascii-art or image/gif (GUI only) near layout @@ -229,7 +229,7 @@ secs = " seconds" # Choices: pacman, flatpak, dpkg, apk # # Pro-tip: if your package manager isnt listed here, yet, -# use the bash command component in the layout +# use the bash command tag in the layout # e.g "Packages: $(pacman -Q | wc -l) (pacman)" pkg-managers = ["pacman", "dpkg", "flatpak"] diff --git a/include/display.hpp b/include/display.hpp index e5d70ec..ae161f8 100644 --- a/include/display.hpp +++ b/include/display.hpp @@ -9,10 +9,26 @@ namespace Display { +/* + * Render the layout along side the ASCII art and return the vector + * @param config The config class + * @param colors The colors + * @param already_analyzed_path If already checked that the source path is not a binary file + * @param path Path to source file + */ std::vector render(const Config& config, const colors_t& colors, const bool already_analyzed_path, const std::string_view path); -void display(const std::vector& renderResult); +/* + * Display the ascii art and layout + * @param renderResult The rendered vector usually by Display::render() + */ +void display(const std::vector& renderResult); + +/* + * Detect the distro you are using and return the path to the ASCII art + * @param config The config class + */ std::string detect_distro(const Config& config); } // namespace Display diff --git a/include/gui.hpp b/include/gui.hpp index 5303f30..da919a5 100644 --- a/include/gui.hpp +++ b/include/gui.hpp @@ -35,6 +35,7 @@ class Window : public Gtk::Window { Glib::RefPtr scaled_pixbuf = m_original_pixbuf->scale_simple(width, height, Gdk::INTERP_BILINEAR); + m_bg_image.set(scaled_pixbuf); } } diff --git a/include/parse.hpp b/include/parse.hpp index 3a45d08..ed2a025 100644 --- a/include/parse.hpp +++ b/include/parse.hpp @@ -4,18 +4,34 @@ #include "config.hpp" #include "query.hpp" -// Parse input, in-place, with data from systemInfo. -// Documentation on formatting is in the default config.toml file. -// pureOutput is set to the string, but without the brackets. +/* Parse input, in-place, with data from systemInfo. + * Documentation on formatting is in the default config.toml file or the cufetch.1 manual. + * @param input The string to parse + * @param systemInfo The system infos + * @param pureOutput The output of the string but without tags + * @param config The config + * @param colors The colors + * @param parsingLayout If we are parsing layout or not + * @param is_image If the source path is an image (used for GUI mode only) + */ std::string parse(const std::string_view input, systemInfo_t& systemInfo, std::string& pureOutput, const Config& config, const colors_t& colors, const bool parsingLayout, const bool is_image = false); -// Set module values to a systemInfo_t map. -// If the name of said module matches any module name, it will be added -// else, error out. +/* Set module members values to a systemInfo_t map. + * If the name of said module matches any module name, it will be added + * else, error out. + * @param sysInfo The systemInfo_t map + * @param moduleName The module name + * @param moduleValueName The module member value name + * @param config The config + * @param colors The colors + */ void addValueFromModule(systemInfo_t& sysInfo, const std::string& moduleName, const std::string& moduleValueName, const Config& config, const colors_t& colors); +/* + * Return a module member value + */ std::string getInfoFromName(const systemInfo_t& systemInfo, const std::string_view moduleName, const std::string_view moduleValueName); diff --git a/src/main.cpp b/src/main.cpp index d53bd4e..2848565 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -162,7 +162,7 @@ ram used : used amount of RAM (auto) [2.81 GiB] free : available amount of RAM (auto) [10.46 GiB] total : total amount of RAM (auto) [15.88 GiB] - ram : swapfile used and total amount of RAM (auto) [477.68 MiB / 512.00 MiB] + swap : swapfile used and total amount of RAM (auto) [477.68 MiB / 512.00 MiB] swap_free : swapfile available amount of RAM (auto) [34.32 MiB] swap_total : swapfile total amount of RAM (auto) [512.00 MiB] swap_used : swapfile used amount of RAM (auto) [477.68 MiB] diff --git a/src/parse.cpp b/src/parse.cpp index 5c06b43..45fac82 100644 --- a/src/parse.cpp +++ b/src/parse.cpp @@ -230,7 +230,7 @@ std::string parse(const std::string_view input, systemInfo_t& systemInfo, std::s { const size_t& dot_pos = command.find('.'); if (dot_pos == std::string::npos) - die("module name '{}' doesn't have a dot '.' for separiting module name and submodule", command); + die("module name '{}' doesn't have a dot '.' for separiting module name and value", command); const std::string& moduleName = command.substr(0, dot_pos); const std::string& moduleValueName = command.substr(dot_pos + 1); @@ -248,15 +248,15 @@ std::string parse(const std::string_view input, systemInfo_t& systemInfo, std::s { const size_t& condition_comma = command.find(','); if (condition_comma == command.npos) - die("condition component {} doesn't have a comma for separiting the condition", command); + die("condition tag {} doesn't have a comma for separiting the condition", command); const size_t& equalto_comma = command.find(',', condition_comma + 1); if (equalto_comma == command.npos) - die("condition component {} doesn't have a comma for separiting the equalto", command); + die("condition tag {} doesn't have a comma for separiting the equalto", command); const size_t& true_comma = command.find(',', equalto_comma + 1); if (true_comma == command.npos) - die("condition component {} doesn't have a comma for separiting the true statment", command); + die("condition tag {} doesn't have a comma for separiting the true statment", command); const std::string& condition = command.substr(0, condition_comma); const std::string& equalto = command.substr(condition_comma + 1, equalto_comma - condition_comma - 1); @@ -739,7 +739,7 @@ void addValueFromModule(systemInfo_t& sysInfo, const std::string& moduleName, co { debug("moduleValueName.lenght() = {} && 'colors_symbol'_len = {}", moduleValueName.length(), "colors_symbol()"_len); if (moduleValueName.length() <= "colors_symbol()"_len) - die("color palette submodule '{}' in invalid.\n" + die("color palette module member '{}' in invalid.\n" "Must be like 'colors_symbol(`symbol for printing the color palette`)'.\n" "e.g 'colors_symbol(@)' or 'colors_symbol(string)'", moduleValueName); @@ -755,7 +755,7 @@ void addValueFromModule(systemInfo_t& sysInfo, const std::string& moduleName, co else if (hasStart(moduleValueName, "colors_light_symbol")) { if (moduleValueName.length() <= "colors_light_symbol()"_len) - die("color palette submodule '{}' in invalid.\n" + die("color palette module member '{}' in invalid.\n" "Must be like 'colors_light_symbol(`symbol for printing the color palette`)'.\n" "e.g 'colors_light_symbol(@)' or 'colors_light_symbol(string)'", moduleValueName);