fix: lint

This commit is contained in:
Alex
2026-02-24 00:49:23 +01:00
parent ef3d55980e
commit 802bf184fb
8 changed files with 39 additions and 16 deletions

View File

@ -80,7 +80,8 @@ std::tuple<std::vector<uint16_t>, std::string> waybar::modules::CpuUsage::getCpu
auto [prev_idle, prev_total] = prev_times[0];
const float delta_idle = curr_idle - prev_idle;
const float delta_total = curr_total - prev_total;
uint16_t tmp = (delta_total > 0) ? static_cast<uint16_t>(100 * (1 - delta_idle / delta_total)) : 0;
uint16_t tmp =
(delta_total > 0) ? static_cast<uint16_t>(100 * (1 - delta_idle / delta_total)) : 0;
tooltip = fmt::format("Total: {}%\nCores: (pending)", tmp);
usage.push_back(tmp);
} else {
@ -102,7 +103,8 @@ std::tuple<std::vector<uint16_t>, std::string> waybar::modules::CpuUsage::getCpu
}
const float delta_idle = curr_idle - prev_idle;
const float delta_total = curr_total - prev_total;
uint16_t tmp = (delta_total > 0) ? static_cast<uint16_t>(100 * (1 - delta_idle / delta_total)) : 0;
uint16_t tmp =
(delta_total > 0) ? static_cast<uint16_t>(100 * (1 - delta_idle / delta_total)) : 0;
if (i == 0) {
tooltip = fmt::format("Total: {}%", tmp);
} else {

View File

@ -45,7 +45,7 @@ waybar::modules::Network::readBandwidthUsage() {
std::istringstream iss(line);
std::string ifacename;
iss >> ifacename; // ifacename contains "eth0:"
iss >> ifacename; // ifacename contains "eth0:"
if (ifacename.empty()) continue;
ifacename.pop_back(); // remove trailing ':'
if (ifacename != ifname_) {

View File

@ -102,9 +102,9 @@ Sndio::~Sndio() { sioctl_close(hdl_); }
auto Sndio::update() -> void {
auto format = format_;
unsigned int vol = (maxval_ > 0)
? static_cast<unsigned int>(100. * static_cast<double>(volume_) / static_cast<double>(maxval_))
: 0;
unsigned int vol = (maxval_ > 0) ? static_cast<unsigned int>(100. * static_cast<double>(volume_) /
static_cast<double>(maxval_))
: 0;
if (volume_ == 0) {
label_.get_style_context()->add_class("muted");

View File

@ -62,7 +62,8 @@ UPower::UPower(const std::string& id, const Json::Value& config)
GError* gErr = NULL;
upClient_ = up_client_new_full(NULL, &gErr);
if (upClient_ == NULL) {
spdlog::error("Upower. UPower client connection error. {}", gErr ? gErr->message : "unknown error");
spdlog::error("Upower. UPower client connection error. {}",
gErr ? gErr->message : "unknown error");
if (gErr) g_error_free(gErr);
}