diff options
author | Jakob P. Liljenberg <admin@qvantnet.com> | 2023-12-12 22:01:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-12 22:01:21 +0100 |
commit | be731600f1ec6cb58edc6947d41d2709c6d33635 (patch) | |
tree | bd747455a9859407c222c83790574b28a416e2e1 | |
parent | f4b14ce97e35d439bcc3207c3eb78da442c92fa9 (diff) | |
parent | cfd20a374b11b75d73e043979d0b6dd4314d2919 (diff) |
Merge branch 'main' into cmake
-rw-r--r-- | src/btop_draw.cpp | 6 | ||||
-rw-r--r-- | src/btop_shared.hpp | 2 | ||||
-rw-r--r-- | src/linux/btop_collect.cpp | 4 | ||||
-rw-r--r-- | src/osx/btop_collect.cpp | 2 |
4 files changed, 10 insertions, 4 deletions
diff --git a/src/btop_draw.cpp b/src/btop_draw.cpp index edb1eec..5ae357e 100644 --- a/src/btop_draw.cpp +++ b/src/btop_draw.cpp @@ -2063,7 +2063,11 @@ namespace Draw { box = createBox(x, y, width, height, Theme::c("cpu_box"), true, (cpu_bottom ? "" : "cpu"), (cpu_bottom ? "cpu" : ""), 1); auto& custom = Config::getS("custom_cpu_name"); - const string cpu_title = uresize((custom.empty() ? Cpu::cpuName : custom) , b_width - 14); + static const bool hasCpuHz = not Cpu::get_cpuHz().empty(); + const string cpu_title = uresize( + (custom.empty() ? Cpu::cpuName : custom), + b_width - (Config::getB("show_cpu_freq") and hasCpuHz ? 14 : 4) + ); box += createBox(b_x, b_y, b_width, b_height, "", false, cpu_title); } diff --git a/src/btop_shared.hpp b/src/btop_shared.hpp index 383e189..017c7f8 100644 --- a/src/btop_shared.hpp +++ b/src/btop_shared.hpp @@ -210,6 +210,8 @@ namespace Cpu { auto get_core_mapping() -> unordered_flat_map<int, int>; extern unordered_flat_map<int, int> core_mapping; + auto get_cpuHz() -> string; + //* Get battery info from /sys auto get_battery() -> tuple<int, long, string>; } diff --git a/src/linux/btop_collect.cpp b/src/linux/btop_collect.cpp index 4bb5e71..ab4574f 100644 --- a/src/linux/btop_collect.cpp +++ b/src/linux/btop_collect.cpp @@ -339,7 +339,7 @@ namespace Cpu { } - auto name_vec = ssplit(name); + auto name_vec = ssplit(name, ' '); if ((s_contains(name, "Xeon"s) or v_contains(name_vec, "Duo"s)) and v_contains(name_vec, "CPU"s)) { auto cpu_pos = v_index(name_vec, "CPU"s); @@ -355,7 +355,7 @@ namespace Cpu { } else if (s_contains(name, "Intel"s) and v_contains(name_vec, "CPU"s)) { auto cpu_pos = v_index(name_vec, "CPU"s); - if (cpu_pos < name_vec.size() - 1 and not name_vec.at(cpu_pos + 1).ends_with(')') and name_vec.at(cpu_pos + 1) != "@") + if (cpu_pos < name_vec.size() - 1 and not name_vec.at(cpu_pos + 1).ends_with(')') and name_vec.at(cpu_pos + 1).size() != 1) name = name_vec.at(cpu_pos + 1); else name.clear(); diff --git a/src/osx/btop_collect.cpp b/src/osx/btop_collect.cpp index 0a1f338..e410c74 100644 --- a/src/osx/btop_collect.cpp +++ b/src/osx/btop_collect.cpp @@ -236,7 +236,7 @@ namespace Cpu { name += n + ' '; } name.pop_back(); - for (const auto& replace : {"Processor", "CPU", "(R)", "(TM)", "Intel", "AMD", "Core"}) { + for (const auto& replace : {"Processor", "CPU", "(R)", "(TM)", "Intel", "AMD", "Apple", "Core"}) { name = s_replace(name, replace, ""); name = s_replace(name, " ", " "); } |