Skip to content

Commit 802bf18

Browse files
committed
fix: lint
1 parent ef3d559 commit 802bf18

File tree

8 files changed

+39
-16
lines changed

8 files changed

+39
-16
lines changed

src/AAppIconLabel.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ void AAppIconLabel::updateAppIcon() {
158158
} else if (app_icon_name_.front() == '/') {
159159
try {
160160
int scaled_icon_size = app_icon_size_ * image_.get_scale_factor();
161-
auto pixbuf = Gdk::Pixbuf::create_from_file(app_icon_name_, scaled_icon_size, scaled_icon_size);
161+
auto pixbuf =
162+
Gdk::Pixbuf::create_from_file(app_icon_name_, scaled_icon_size, scaled_icon_size);
162163

163164
auto surface = Gdk::Cairo::create_surface_from_pixbuf(pixbuf, image_.get_scale_factor(),
164165
image_.get_window());

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ static void handleSignalMainThread(int signum, bool& reload) {
142142
spdlog::debug("Received SIGCHLD in signalThread");
143143
{
144144
std::lock_guard<std::mutex> lock(reap_mtx);
145-
for (auto it = reap.begin(); it != reap.end(); ) {
145+
for (auto it = reap.begin(); it != reap.end();) {
146146
if (waitpid(*it, nullptr, WNOHANG) == *it) {
147147
spdlog::debug("Reaped child with PID: {}", *it);
148148
it = reap.erase(it);

src/modules/cpu_usage/common.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ std::tuple<std::vector<uint16_t>, std::string> waybar::modules::CpuUsage::getCpu
8080
auto [prev_idle, prev_total] = prev_times[0];
8181
const float delta_idle = curr_idle - prev_idle;
8282
const float delta_total = curr_total - prev_total;
83-
uint16_t tmp = (delta_total > 0) ? static_cast<uint16_t>(100 * (1 - delta_idle / delta_total)) : 0;
83+
uint16_t tmp =
84+
(delta_total > 0) ? static_cast<uint16_t>(100 * (1 - delta_idle / delta_total)) : 0;
8485
tooltip = fmt::format("Total: {}%\nCores: (pending)", tmp);
8586
usage.push_back(tmp);
8687
} else {
@@ -102,7 +103,8 @@ std::tuple<std::vector<uint16_t>, std::string> waybar::modules::CpuUsage::getCpu
102103
}
103104
const float delta_idle = curr_idle - prev_idle;
104105
const float delta_total = curr_total - prev_total;
105-
uint16_t tmp = (delta_total > 0) ? static_cast<uint16_t>(100 * (1 - delta_idle / delta_total)) : 0;
106+
uint16_t tmp =
107+
(delta_total > 0) ? static_cast<uint16_t>(100 * (1 - delta_idle / delta_total)) : 0;
106108
if (i == 0) {
107109
tooltip = fmt::format("Total: {}%", tmp);
108110
} else {

src/modules/network.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ waybar::modules::Network::readBandwidthUsage() {
4545
std::istringstream iss(line);
4646

4747
std::string ifacename;
48-
iss >> ifacename; // ifacename contains "eth0:"
48+
iss >> ifacename; // ifacename contains "eth0:"
4949
if (ifacename.empty()) continue;
5050
ifacename.pop_back(); // remove trailing ':'
5151
if (ifacename != ifname_) {

src/modules/sndio.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ Sndio::~Sndio() { sioctl_close(hdl_); }
102102

103103
auto Sndio::update() -> void {
104104
auto format = format_;
105-
unsigned int vol = (maxval_ > 0)
106-
? static_cast<unsigned int>(100. * static_cast<double>(volume_) / static_cast<double>(maxval_))
107-
: 0;
105+
unsigned int vol = (maxval_ > 0) ? static_cast<unsigned int>(100. * static_cast<double>(volume_) /
106+
static_cast<double>(maxval_))
107+
: 0;
108108

109109
if (volume_ == 0) {
110110
label_.get_style_context()->add_class("muted");

src/modules/upower.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ UPower::UPower(const std::string& id, const Json::Value& config)
6262
GError* gErr = NULL;
6363
upClient_ = up_client_new_full(NULL, &gErr);
6464
if (upClient_ == NULL) {
65-
spdlog::error("Upower. UPower client connection error. {}", gErr ? gErr->message : "unknown error");
65+
spdlog::error("Upower. UPower client connection error. {}",
66+
gErr ? gErr->message : "unknown error");
6667
if (gErr) g_error_free(gErr);
6768
}
6869

src/util/backlight_backend.cpp

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,20 +79,38 @@ static void upsert_device(std::vector<BacklightDevice>& devices, udev_device* de
7979
});
8080
if (found != devices.end()) {
8181
if (actual != nullptr) {
82-
try { found->set_actual(std::stoi(actual)); } catch (const std::exception&) {}
82+
try {
83+
found->set_actual(std::stoi(actual));
84+
} catch (const std::exception&) {
85+
}
8386
}
8487
if (max != nullptr) {
85-
try { found->set_max(std::stoi(max)); } catch (const std::exception&) {}
88+
try {
89+
found->set_max(std::stoi(max));
90+
} catch (const std::exception&) {
91+
}
8692
}
8793
if (power != nullptr) {
88-
try { found->set_powered(std::stoi(power) == 0); } catch (const std::exception&) {}
94+
try {
95+
found->set_powered(std::stoi(power) == 0);
96+
} catch (const std::exception&) {
97+
}
8998
}
9099
} else {
91100
int actual_int = 0, max_int = 0;
92101
bool power_bool = true;
93-
try { if (actual != nullptr) actual_int = std::stoi(actual); } catch (const std::exception&) {}
94-
try { if (max != nullptr) max_int = std::stoi(max); } catch (const std::exception&) {}
95-
try { if (power != nullptr) power_bool = std::stoi(power) == 0; } catch (const std::exception&) {}
102+
try {
103+
if (actual != nullptr) actual_int = std::stoi(actual);
104+
} catch (const std::exception&) {
105+
}
106+
try {
107+
if (max != nullptr) max_int = std::stoi(max);
108+
} catch (const std::exception&) {
109+
}
110+
try {
111+
if (power != nullptr) power_bool = std::stoi(power) == 0;
112+
} catch (const std::exception&) {
113+
}
96114
devices.emplace_back(name, actual_int, max_int, power_bool);
97115
}
98116
}

src/util/portal.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ void waybar::Portal::refreshAppearance() {
6363
Glib::VariantBase modev;
6464
container.get_child(modev, 0);
6565
auto mode =
66-
Glib::VariantBase::cast_dynamic<Glib::Variant<Glib::Variant<Glib::Variant<uint32_t>>>>(modev)
66+
Glib::VariantBase::cast_dynamic<Glib::Variant<Glib::Variant<Glib::Variant<uint32_t>>>>(
67+
modev)
6768
.get()
6869
.get()
6970
.get();

0 commit comments

Comments
 (0)