fix Linter errors

This commit is contained in:
kennypm 2022-07-19 21:49:56 -04:00
parent 714451e4f9
commit 23eaffc04b

View File

@ -14,10 +14,8 @@ waybar::modules::JACK::JACK(const std::string& id, const Json::Value& config)
}
std::string waybar::modules::JACK::JACKState() {
if(state_.compare("xrun") == 0)
return "xrun";
if(state_.compare("connected") == 0)
return "connected";
if (state_.compare("xrun") == 0) return "xrun";
if (state_.compare("connected") == 0) return "connected";
client_ = jack_client_open("waybar", JackNoStartServer, NULL);
if (client_) {
@ -31,8 +29,7 @@ std::string waybar::modules::JACK::JACKState() {
jack_set_xrun_callback(client_, xrunCallback, this);
jack_on_shutdown(client_, shutdownCallback, this);
if (!jack_activate(client_))
return "connected";
if (!jack_activate(client_)) return "connected";
}
return "disconnected";
}
@ -64,22 +61,21 @@ auto waybar::modules::JACK::update() -> void {
format = config_["format-" + state].asString();
} else if (config_["format"].isString()) {
format = config_["format"].asString();
} else format = "DSP {load}%";
} else
format = "DSP {load}%";
if (!label_.get_style_context()->has_class(state))
label_.get_style_context()->add_class(state);
state_ = state;
label_.set_markup(fmt::format(format, fmt::arg("load", std::round(load)),
fmt::arg("bufsize", bufsize_),
fmt::arg("samplerate", samplerate_),
fmt::arg("bufsize", bufsize_), fmt::arg("samplerate", samplerate_),
fmt::arg("latency", fmt::format("{:.2f}", latency)),
fmt::arg("xruns", xruns_)));
if (tooltipEnabled()) {
std::string tooltip_format = "{bufsize}/{samplerate} {latency}ms";
if (config_["tooltip-format"].isString())
tooltip_format = config_["tooltip-format"].asString();
if (config_["tooltip-format"].isString()) tooltip_format = config_["tooltip-format"].asString();
label_.set_tooltip_text(fmt::format(tooltip_format, fmt::arg("load", std::round(load)),
fmt::arg("bufsize", bufsize_),
fmt::arg("samplerate", samplerate_),
@ -113,10 +109,6 @@ int bufSizeCallback(unsigned int size, void *obj) {
return static_cast<waybar::modules::JACK *>(obj)->bufSize(size);
}
int xrunCallback(void *obj) {
return static_cast<waybar::modules::JACK*>(obj)->xrun();
}
int xrunCallback(void *obj) { return static_cast<waybar::modules::JACK *>(obj)->xrun(); }
void shutdownCallback(void *obj) {
return static_cast<waybar::modules::JACK*>(obj)->shutdown();
}
void shutdownCallback(void *obj) { return static_cast<waybar::modules::JACK *>(obj)->shutdown(); }