From 23729258a13e068a4e36c9b38e1088d64788de06 Mon Sep 17 00:00:00 2001 From: Toni500git Date: Wed, 30 Oct 2024 17:00:48 +0100 Subject: [PATCH] assets: add cachyos some code chore too --- assets/ascii/cachyos.txt | 22 ++++++++++++++++++++++ assets/ascii/cachyos_small.txt | 8 ++++++++ src/display.cpp | 8 ++++---- src/main.cpp | 9 +++------ 4 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 assets/ascii/cachyos.txt create mode 100644 assets/ascii/cachyos_small.txt diff --git a/assets/ascii/cachyos.txt b/assets/ascii/cachyos.txt new file mode 100644 index 00000000..92820d53 --- /dev/null +++ b/assets/ascii/cachyos.txt @@ -0,0 +1,22 @@ +${green} .-------------------------: +${green} .${blue}+=${green}========================. +${green} :${blue}++${green}===${blue}++===${green}===============- :${blue}++${green}- +${green} :${blue}*++${green}====${blue}+++++==${green}===========- .==: +${green} -${blue}*+++${green}=====${blue}+***++=${green}=========: +${green} =${blue}*++++=${green}=======------------: +${green} =${blue}*+++++=${green}====- ...${green} +${green} .${blue}+*+++++${green}=-===: .${blue}=+++=${green}: +${green} :${blue}++++${green}=====-==: -***${blue}**${green}+ +${green} :${blue}++=${green}=======-=. .=+**+.${green} +${green}.${blue}+${green}==========-. .${green} +${green} :${blue}+++++++${green}====- .${green}--==-.${green} +${green} :${blue}++${green}==========. :${blue}+++++++${green}: +${green} ${green}.-===========. =*****+*+ +${green} ${green}.-===========: .+*****+: +${green} ${green}-=======${blue}++++${green}:::::::::::::::::::::::::-: .${green}---: +${green} :======${blue}++++${green}====${blue}+++******************=. +${green} ${green}:=====${blue}+++${green}==========${blue}++++++++++++++*- +${green} ${green}.====${blue}++${green}==============${blue}++++++++++*- +${green} ${green}.===${blue}+${green}==================${blue}+++++++: +${green} ${green}.-=======================${blue}+++: +${green} .......................... diff --git a/assets/ascii/cachyos_small.txt b/assets/ascii/cachyos_small.txt new file mode 100644 index 00000000..a93cb00b --- /dev/null +++ b/assets/ascii/cachyos_small.txt @@ -0,0 +1,8 @@ +${green} /''''''''''''/ +${green} /''''''''''''/ +${green} /''''''/ +${green}/''''''/ +${green}\\......\\ +${green} \\......\\ +${green} \\.............../ +${green} \\............./ diff --git a/src/display.cpp b/src/display.cpp index 485fbb1e..2ab87e48 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -23,7 +23,7 @@ * */ -/* Implementation of the system behind displaying/rendering the information */ +// Implementation of the system behind displaying/rendering the information #include "display.hpp" @@ -71,7 +71,7 @@ std::string Display::detect_distro(const Config& config) if (std::filesystem::exists(format)) return format; - return fmt::format("{}/ascii/linux.txt", config.data_dir); + return config.data_dir + "/ascii/linux.txt"; } } @@ -103,7 +103,8 @@ static std::vector render_with_image(systemInfo_t& systemInfo, std: layout.erase(std::remove_if(layout.begin(), layout.end(), [](const std::string_view str) { return str.find(MAGIC_LINE) != std::string::npos; }), layout.end()); - + + // took math from neofetch in get_term_size() and get_image_size(). seems to work nice const size_t width = image_width / font_width; const size_t height = image_height / font_height; @@ -126,7 +127,6 @@ static std::vector render_with_image(systemInfo_t& systemInfo, std: } for (size_t i = 0; i < layout.size(); ++i) - // took math from neofetch in get_term_size() and get_image_size(). seems to work nice for (size_t _ = 0; _ < width + config.offset; ++_) layout.at(i).insert(0, " "); diff --git a/src/main.cpp b/src/main.cpp index e528e739..33769373 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -508,18 +508,15 @@ int main(int argc, char *argv[]) path += "_" + config.ascii_logo_type; } - if (!std::filesystem::exists(path) && !std::filesystem::exists((path = config.data_dir + "/ascii/linux.txt"))) - { - if (!config.m_disable_source) - die("'{}' doesn't exist. Can't load image/text file", path); - } + if (!std::filesystem::exists(path) && !config.m_disable_source) + die("'{}' doesn't exist. Can't load image/text file", path); debug("{} path = {}", __PRETTY_FUNCTION__, path); #ifdef GUI_MODE if (config.gui) { - const auto& app = Gtk::Application::create("org.toni.customfetch"); + const auto app = Gtk::Application::create("org.toni.customfetch"); GUI::Window window(config, colors, path); return app->run(window); }