From a3c7cd67807c8c3af48c54bc1ef83d3165be50f8 Mon Sep 17 00:00:00 2001 From: Toni500git Date: Mon, 4 Nov 2024 17:05:16 +0100 Subject: [PATCH] parse: add os.name_id + main: fix ascii-logo-type --- src/main.cpp | 13 +++++++++---- src/parse.cpp | 2 ++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 3376937..5e67004 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -140,7 +140,8 @@ NOTE: there are modules such as "user.de_version" that may slow down cufetch bec cufetch is still fast tho :) os - name : OS name (pretty_name) [Ubuntu 22.04.4 LTS, Arch Linux] + name : OS name (pretty name) [Ubuntu 22.04.4 LTS, Arch Linux] + name_id : OS name id [ubuntu, arch] kernel : kernel name and version [Linux 6.9.3-zen1-1-zen] kernel_name : kernel name [Linux] kernel_version: kernel version [6.9.3-zen1-1-zen] @@ -500,12 +501,16 @@ int main(int argc, char *argv[]) if (!config.ascii_logo_type.empty() && config.m_display_distro) { - const size_t& pos = path.rfind('.'); + std::string logo_type_path{path}; + const size_t pos = path.rfind('.'); if (pos != std::string::npos) - path.insert(pos, "_" + config.ascii_logo_type); + logo_type_path.insert(pos, "_" + config.ascii_logo_type); else - path += "_" + config.ascii_logo_type; + logo_type_path += "_" + config.ascii_logo_type; + + if (std::filesystem::exists(logo_type_path)) + path = logo_type_path; } if (!std::filesystem::exists(path) && !config.m_disable_source) diff --git a/src/parse.cpp b/src/parse.cpp index 98c9c0a..5fed944 100644 --- a/src/parse.cpp +++ b/src/parse.cpp @@ -885,6 +885,8 @@ void addValueFromModule(const std::string& moduleName, const std::string& module { case "name"_fnv1a16: SYSINFO_INSERT(query_system.os_pretty_name()); break; + case "name_id"_fnv1a16: SYSINFO_INSERT(query_system.os_id()); break; + case "uptime"_fnv1a16: SYSINFO_INSERT(get_auto_uptime(uptime_days, uptime_hours.count() % 24, uptime_mins.count() % 60, uptime_secs.count() % 60, config));