mirror of
https://github.com/aristocratos/btop.git
synced 2024-06-10 22:44:48 +12:00
Merge branch 'main' into cmake
This commit is contained in:
commit
be731600f1
|
@ -2063,7 +2063,11 @@ namespace Draw {
|
||||||
box = createBox(x, y, width, height, Theme::c("cpu_box"), true, (cpu_bottom ? "" : "cpu"), (cpu_bottom ? "cpu" : ""), 1);
|
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");
|
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);
|
box += createBox(b_x, b_y, b_width, b_height, "", false, cpu_title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -210,6 +210,8 @@ namespace Cpu {
|
||||||
auto get_core_mapping() -> unordered_flat_map<int, int>;
|
auto get_core_mapping() -> unordered_flat_map<int, int>;
|
||||||
extern unordered_flat_map<int, int> core_mapping;
|
extern unordered_flat_map<int, int> core_mapping;
|
||||||
|
|
||||||
|
auto get_cpuHz() -> string;
|
||||||
|
|
||||||
//* Get battery info from /sys
|
//* Get battery info from /sys
|
||||||
auto get_battery() -> tuple<int, long, string>;
|
auto get_battery() -> tuple<int, long, string>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)) {
|
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);
|
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)) {
|
else if (s_contains(name, "Intel"s) and v_contains(name_vec, "CPU"s)) {
|
||||||
auto cpu_pos = v_index(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);
|
name = name_vec.at(cpu_pos + 1);
|
||||||
else
|
else
|
||||||
name.clear();
|
name.clear();
|
||||||
|
|
|
@ -236,7 +236,7 @@ namespace Cpu {
|
||||||
name += n + ' ';
|
name += n + ' ';
|
||||||
}
|
}
|
||||||
name.pop_back();
|
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, replace, "");
|
||||||
name = s_replace(name, " ", " ");
|
name = s_replace(name, " ", " ");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue