Revert "feat(percent): adds a percent class to numeric modules"

This reverts commit 82302e58f3b611f7ff6d686d1783b1c32914f7c9.
This commit is contained in:
Dan 2019-05-02 21:39:45 -04:00
parent e158a3e132
commit 3bac96945c
6 changed files with 0 additions and 19 deletions

View File

@ -51,8 +51,6 @@ class Backlight : public ALabel {
const std::string preferred_device_; const std::string preferred_device_;
static constexpr int EPOLL_MAX_EVENTS = 16; static constexpr int EPOLL_MAX_EVENTS = 16;
std::string old_percent_;
std::optional<BacklightDev> previous_best_; std::optional<BacklightDev> previous_best_;
std::string previous_format_; std::string previous_format_;

View File

@ -43,7 +43,6 @@ class Battery : public ALabel {
int fd_; int fd_;
std::vector<int> wds_; std::vector<int> wds_;
std::string old_status_; std::string old_status_;
std::string old_capacity_;
}; };
} // namespace waybar::modules } // namespace waybar::modules

View File

@ -23,8 +23,6 @@ class Cpu : public ALabel {
std::tuple<uint16_t, std::string> getCpuUsage(); std::tuple<uint16_t, std::string> getCpuUsage();
std::vector<std::tuple<size_t, size_t>> parseCpuinfo(); std::vector<std::tuple<size_t, size_t>> parseCpuinfo();
std::string old_usage_;
std::vector<std::tuple<size_t, size_t>> prev_times_; std::vector<std::tuple<size_t, size_t>> prev_times_;
waybar::util::SleeperThread thread_; waybar::util::SleeperThread thread_;
}; };

View File

@ -179,13 +179,8 @@ auto waybar::modules::Backlight::update() -> void {
} }
const auto percent = best->get_max() == 0 ? 100 : best->get_actual() * 100 / best->get_max(); const auto percent = best->get_max() == 0 ? 100 : best->get_actual() * 100 / best->get_max();
const auto percentClass = "percent" + std::to_string(int(std::ceil(percent/5)*5));
label_.set_markup(fmt::format( label_.set_markup(fmt::format(
format_, fmt::arg("percent", std::to_string(percent)), fmt::arg("icon", getIcon(percent)))); format_, fmt::arg("percent", std::to_string(percent)), fmt::arg("icon", getIcon(percent))));
label_.get_style_context()->remove_class(old_percent_);
label_.get_style_context()->add_class(percentClass);
old_percent_ = percentClass;
} else { } else {
if (!previous_best_.has_value()) { if (!previous_best_.has_value()) {
return; return;

View File

@ -122,13 +122,8 @@ auto waybar::modules::Battery::update() -> void {
std::transform(status.begin(), status.end(), status.begin(), ::tolower); std::transform(status.begin(), status.end(), status.begin(), ::tolower);
auto format = format_; auto format = format_;
auto state = getState(capacity); auto state = getState(capacity);
auto capacity_class = "percent" + std::to_string(int(std::ceil(capacity/5)*5));
label_.get_style_context()->remove_class(old_status_); label_.get_style_context()->remove_class(old_status_);
label_.get_style_context()->remove_class(old_capacity_);
label_.get_style_context()->add_class(status); label_.get_style_context()->add_class(status);
label_.get_style_context()->add_class(capacity_class);
old_capacity_ = capacity_class;
std::cout << fmt::format(capacity_class);
old_status_ = status; old_status_ = status;
if (!state.empty() && config_["format-" + status + "-" + state].isString()) { if (!state.empty() && config_["format-" + status + "-" + state].isString()) {
format = config_["format-" + status + "-" + state].asString(); format = config_["format-" + status + "-" + state].asString();

View File

@ -19,11 +19,7 @@ auto waybar::modules::Cpu::update() -> void {
if (tooltipEnabled()) { if (tooltipEnabled()) {
label_.set_tooltip_text(tooltip); label_.set_tooltip_text(tooltip);
} }
auto percent_class = "percent" + std::to_string(int(std::ceil(cpu_usage/5)*5));
label_.set_markup(fmt::format(format_, fmt::arg("load", cpu_load), fmt::arg("usage", cpu_usage))); label_.set_markup(fmt::format(format_, fmt::arg("load", cpu_load), fmt::arg("usage", cpu_usage)));
label_.get_style_context()->remove_class(old_usage_);
label_.get_style_context()->add_class(percent_class);
old_usage_ = percent_class;
} }
uint16_t waybar::modules::Cpu::getCpuLoad() { uint16_t waybar::modules::Cpu::getCpuLoad() {