fix: lint

This commit is contained in:
Alex 2023-04-17 09:01:14 +02:00
parent 8be889c5aa
commit ede1d25440
3 changed files with 36 additions and 39 deletions

View File

@ -10,7 +10,7 @@ extern "C" {
namespace waybar::modules { namespace waybar::modules {
using namespace std::literals::chrono_literals; using namespace std::literals::chrono_literals;
class Cava final: public ALabel { class Cava final : public ALabel {
public: public:
Cava(const std::string&, const Json::Value&); Cava(const std::string&, const Json::Value&);
virtual ~Cava(); virtual ~Cava();
@ -21,11 +21,11 @@ class Cava final: public ALabel {
util::SleeperThread thread_; util::SleeperThread thread_;
util::SleeperThread thread_fetch_input_; util::SleeperThread thread_fetch_input_;
struct error_s error_{}; //cava errors struct error_s error_ {}; // cava errors
struct config_params prm_{}; //cava parameters struct config_params prm_ {}; // cava parameters
struct audio_raw audio_raw_{}; //cava handled raw audio data(is based on audio_data) struct audio_raw audio_raw_ {}; // cava handled raw audio data(is based on audio_data)
struct audio_data audio_data_{}; //cava audio data struct audio_data audio_data_ {}; // cava audio data
struct cava_plan* plan_;//{new cava_plan{}}; struct cava_plan* plan_; //{new cava_plan{}};
// Cava API to read audio source // Cava API to read audio source
ptr input_source_; ptr input_source_;
// Delay to handle audio source // Delay to handle audio source
@ -40,8 +40,7 @@ class Cava final: public ALabel {
// Cava method // Cava method
void pause_resume(); void pause_resume();
// ModuleActionMap // ModuleActionMap
static inline std::map<const std::string, void(waybar::modules::Cava::*const)()> actionMap_{ static inline std::map<const std::string, void (waybar::modules::Cava::*const)()> actionMap_{
{"mode", &waybar::modules::Cava::pause_resume} {"mode", &waybar::modules::Cava::pause_resume}};
};
}; };
} } // namespace waybar::modules

View File

@ -190,8 +190,8 @@ auto waybar::modules::Backlight::update() -> void {
event_box_.show(); event_box_.show();
const uint8_t percent = const uint8_t percent =
best->get_max() == 0 ? 100 : round(best->get_actual() * 100.0f / best->get_max()); best->get_max() == 0 ? 100 : round(best->get_actual() * 100.0f / best->get_max());
std::string desc = fmt::format(fmt::runtime(format_), std::string desc =
fmt::arg("percent", std::to_string(percent)), fmt::format(fmt::runtime(format_), fmt::arg("percent", std::to_string(percent)),
fmt::arg("icon", getIcon(percent))); fmt::arg("icon", getIcon(percent)));
label_.set_markup(desc); label_.set_markup(desc);
getState(percent); getState(percent);
@ -201,8 +201,7 @@ auto waybar::modules::Backlight::update() -> void {
tooltip_format = config_["tooltip-format"].asString(); tooltip_format = config_["tooltip-format"].asString();
} }
if (!tooltip_format.empty()) { if (!tooltip_format.empty()) {
label_.set_tooltip_text(fmt::format( label_.set_tooltip_text(fmt::format(fmt::runtime(tooltip_format),
fmt::runtime(tooltip_format),
fmt::arg("percent", std::to_string(percent)), fmt::arg("percent", std::to_string(percent)),
fmt::arg("icon", getIcon(percent)))); fmt::arg("icon", getIcon(percent))));
} else { } else {

View File

@ -21,41 +21,43 @@ wl_array tags, layouts;
static uint num_tags = 0; static uint num_tags = 0;
void toggle_visibility(void* data, zdwl_output_v1* zdwl_output_v1) { void toggle_visibility(void *data, zdwl_output_v1 *zdwl_output_v1) {
// Intentionally empty // Intentionally empty
} }
void active(void* data, zdwl_output_v1* zdwl_output_v1, uint32_t active) { void active(void *data, zdwl_output_v1 *zdwl_output_v1, uint32_t active) {
// Intentionally empty // Intentionally empty
} }
static void set_tag(void* data, zdwl_output_v1* zdwl_output_v1, uint32_t tag, uint32_t state, uint32_t clients, uint32_t focused) { static void set_tag(void *data, zdwl_output_v1 *zdwl_output_v1, uint32_t tag, uint32_t state,
uint32_t clients, uint32_t focused) {
static_cast<Tags *>(data)->handle_view_tags(tag, state, clients, focused); static_cast<Tags *>(data)->handle_view_tags(tag, state, clients, focused);
num_tags = (state & ZDWL_OUTPUT_V1_TAG_STATE_ACTIVE) ? num_tags | (1 << tag) : num_tags & ~(1 << tag); num_tags =
(state & ZDWL_OUTPUT_V1_TAG_STATE_ACTIVE) ? num_tags | (1 << tag) : num_tags & ~(1 << tag);
} }
void set_layout_symbol(void* data, zdwl_output_v1* zdwl_output_v1, const char *layout) { void set_layout_symbol(void *data, zdwl_output_v1 *zdwl_output_v1, const char *layout) {
// Intentionally empty // Intentionally empty
} }
void title(void* data, zdwl_output_v1* zdwl_output_v1, const char* title) { void title(void *data, zdwl_output_v1 *zdwl_output_v1, const char *title) {
// Intentionally empty // Intentionally empty
} }
void dwl_frame(void* data, zdwl_output_v1* zdwl_output_v1) { void dwl_frame(void *data, zdwl_output_v1 *zdwl_output_v1) {
// Intentionally empty // Intentionally empty
} }
static void set_layout(void* data, zdwl_output_v1* zdwl_output_v1, uint32_t layout) { static void set_layout(void *data, zdwl_output_v1 *zdwl_output_v1, uint32_t layout) {
// Intentionally empty // Intentionally empty
} }
static void appid(void *data, zdwl_output_v1 *zdwl_output_v1, const char *appid) { static void appid(void *data, zdwl_output_v1 *zdwl_output_v1, const char *appid){
// Intentionally empty // Intentionally empty
}; };
static const zdwl_output_v1_listener output_status_listener_impl { static const zdwl_output_v1_listener output_status_listener_impl{
.toggle_visibility = toggle_visibility, .toggle_visibility = toggle_visibility,
.active = active, .active = active,
.tag = set_tag, .tag = set_tag,
@ -70,7 +72,7 @@ static void handle_global(void *data, struct wl_registry *registry, uint32_t nam
const char *interface, uint32_t version) { const char *interface, uint32_t version) {
if (std::strcmp(interface, zdwl_manager_v1_interface.name) == 0) { if (std::strcmp(interface, zdwl_manager_v1_interface.name) == 0) {
static_cast<Tags *>(data)->status_manager_ = static_cast<struct zdwl_manager_v1 *>( static_cast<Tags *>(data)->status_manager_ = static_cast<struct zdwl_manager_v1 *>(
(zdwl_manager_v1*)wl_registry_bind(registry, name, &zdwl_manager_v1_interface, 3)); (zdwl_manager_v1 *)wl_registry_bind(registry, name, &zdwl_manager_v1_interface, 3));
} }
if (std::strcmp(interface, wl_seat_interface.name) == 0) { if (std::strcmp(interface, wl_seat_interface.name) == 0) {
version = std::min<uint32_t>(version, 1); version = std::min<uint32_t>(version, 1);
@ -165,14 +167,12 @@ void Tags::handle_primary_clicked(uint32_t tag) {
bool Tags::handle_button_press(GdkEventButton *event_button, uint32_t tag) { bool Tags::handle_button_press(GdkEventButton *event_button, uint32_t tag) {
if (event_button->type == GDK_BUTTON_PRESS && event_button->button == 3) { if (event_button->type == GDK_BUTTON_PRESS && event_button->button == 3) {
if (!output_status_) return true; if (!output_status_) return true;
zdwl_output_v1_set_tags(output_status_, num_tags ^ tag, 0); zdwl_output_v1_set_tags(output_status_, num_tags ^ tag, 0);
} }
return true; return true;
} }
void Tags::handle_view_tags(uint32_t tag, uint32_t state, uint32_t clients, uint32_t focused) { void Tags::handle_view_tags(uint32_t tag, uint32_t state, uint32_t clients, uint32_t focused) {
// First clear all occupied state // First clear all occupied state
auto &button = buttons_[tag]; auto &button = buttons_[tag];
@ -193,7 +193,6 @@ void Tags::handle_view_tags(uint32_t tag, uint32_t state, uint32_t clients, uint
} else { } else {
button.get_style_context()->remove_class("urgent"); button.get_style_context()->remove_class("urgent");
} }
} }
} /* namespace waybar::modules::dwl */ } /* namespace waybar::modules::dwl */