summaryrefslogtreecommitdiffstats
path: root/src/btop_draw.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/btop_draw.cpp')
-rw-r--r--src/btop_draw.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/btop_draw.cpp b/src/btop_draw.cpp
index 9e49d1f..ae9ba69 100644
--- a/src/btop_draw.cpp
+++ b/src/btop_draw.cpp
@@ -717,14 +717,14 @@ namespace Cpu {
const auto& [percent, watts, seconds, status] = current_bat;
- if (redraw or percent != old_percent or watts != old_watts or seconds != old_seconds or status != old_status) {
+ if (redraw or percent != old_percent or (watts != old_watts and Config::getB("show_battery_watts")) or seconds != old_seconds or status != old_status) {
old_percent = percent;
old_watts = watts;
old_seconds = seconds;
old_status = status;
const string str_time = (seconds > 0 ? sec_to_dhms(seconds, true, true) : "");
const string str_percent = to_string(percent) + '%';
- const string str_watts = (watts != -1 ? fmt::format("{:.2f}", watts) + 'W' : "");
+ const string str_watts = (watts != -1 and Config::getB("show_battery_watts") ? fmt::format("{:.2f}", watts) + 'W' : "");
const auto& bat_symbol = bat_symbols.at((bat_symbols.contains(status) ? status : "unknown"));
const int current_len = (Term::width >= 100 ? 11 : 0) + str_time.size() + str_percent.size() + str_watts.size() + to_string(Config::getI("update_ms")).size();
const int current_pos = Term::width - current_len - 17;
@@ -736,7 +736,7 @@ namespace Cpu {
out += Mv::to(y, bat_pos) + title_left + Theme::c("title") + Fx::b + "BAT" + bat_symbol + ' ' + str_percent
+ (Term::width >= 100 ? Fx::ub + ' ' + bat_meter(percent) + Fx::b : "")
- + (not str_time.empty() ? ' ' + Theme::c("title") + str_time : "") + (not str_watts.empty() ? ' ' + Theme::c("title") + Fx::b + str_watts : " ") + Fx::ub + title_right;
+ + (not str_time.empty() ? ' ' + Theme::c("title") + str_time : "") + (not str_watts.empty() ? " " + Theme::c("title") + Fx::b + str_watts : "") + Fx::ub + title_right;
}
}
else if (bat_pos > 0) {