Skip to content

Commit

Permalink
cut less of cpu name if frequency is not shown
Browse files Browse the repository at this point in the history
  • Loading branch information
masiboss committed Dec 7, 2023
1 parent bcf4ad8 commit 1b2f11b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/btop_draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 2 additions & 0 deletions src/btop_shared.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
}
Expand Down

0 comments on commit 1b2f11b

Please sign in to comment.