fix: lint
This commit is contained in:
@ -158,7 +158,8 @@ void AAppIconLabel::updateAppIcon() {
|
||||
} else if (app_icon_name_.front() == '/') {
|
||||
try {
|
||||
int scaled_icon_size = app_icon_size_ * image_.get_scale_factor();
|
||||
auto pixbuf = Gdk::Pixbuf::create_from_file(app_icon_name_, scaled_icon_size, scaled_icon_size);
|
||||
auto pixbuf =
|
||||
Gdk::Pixbuf::create_from_file(app_icon_name_, scaled_icon_size, scaled_icon_size);
|
||||
|
||||
auto surface = Gdk::Cairo::create_surface_from_pixbuf(pixbuf, image_.get_scale_factor(),
|
||||
image_.get_window());
|
||||
|
||||
@ -142,7 +142,7 @@ static void handleSignalMainThread(int signum, bool& reload) {
|
||||
spdlog::debug("Received SIGCHLD in signalThread");
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(reap_mtx);
|
||||
for (auto it = reap.begin(); it != reap.end(); ) {
|
||||
for (auto it = reap.begin(); it != reap.end();) {
|
||||
if (waitpid(*it, nullptr, WNOHANG) == *it) {
|
||||
spdlog::debug("Reaped child with PID: {}", *it);
|
||||
it = reap.erase(it);
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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_) {
|
||||
|
||||
@ -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");
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -79,20 +79,38 @@ static void upsert_device(std::vector<BacklightDevice>& devices, udev_device* de
|
||||
});
|
||||
if (found != devices.end()) {
|
||||
if (actual != nullptr) {
|
||||
try { found->set_actual(std::stoi(actual)); } catch (const std::exception&) {}
|
||||
try {
|
||||
found->set_actual(std::stoi(actual));
|
||||
} catch (const std::exception&) {
|
||||
}
|
||||
}
|
||||
if (max != nullptr) {
|
||||
try { found->set_max(std::stoi(max)); } catch (const std::exception&) {}
|
||||
try {
|
||||
found->set_max(std::stoi(max));
|
||||
} catch (const std::exception&) {
|
||||
}
|
||||
}
|
||||
if (power != nullptr) {
|
||||
try { found->set_powered(std::stoi(power) == 0); } catch (const std::exception&) {}
|
||||
try {
|
||||
found->set_powered(std::stoi(power) == 0);
|
||||
} catch (const std::exception&) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int actual_int = 0, max_int = 0;
|
||||
bool power_bool = true;
|
||||
try { if (actual != nullptr) actual_int = std::stoi(actual); } catch (const std::exception&) {}
|
||||
try { if (max != nullptr) max_int = std::stoi(max); } catch (const std::exception&) {}
|
||||
try { if (power != nullptr) power_bool = std::stoi(power) == 0; } catch (const std::exception&) {}
|
||||
try {
|
||||
if (actual != nullptr) actual_int = std::stoi(actual);
|
||||
} catch (const std::exception&) {
|
||||
}
|
||||
try {
|
||||
if (max != nullptr) max_int = std::stoi(max);
|
||||
} catch (const std::exception&) {
|
||||
}
|
||||
try {
|
||||
if (power != nullptr) power_bool = std::stoi(power) == 0;
|
||||
} catch (const std::exception&) {
|
||||
}
|
||||
devices.emplace_back(name, actual_int, max_int, power_bool);
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,7 +63,8 @@ void waybar::Portal::refreshAppearance() {
|
||||
Glib::VariantBase modev;
|
||||
container.get_child(modev, 0);
|
||||
auto mode =
|
||||
Glib::VariantBase::cast_dynamic<Glib::Variant<Glib::Variant<Glib::Variant<uint32_t>>>>(modev)
|
||||
Glib::VariantBase::cast_dynamic<Glib::Variant<Glib::Variant<Glib::Variant<uint32_t>>>>(
|
||||
modev)
|
||||
.get()
|
||||
.get()
|
||||
.get();
|
||||
|
||||
Reference in New Issue
Block a user