fix: lint

This commit is contained in:
Alex 2024-03-22 23:21:57 +01:00
parent 32e241dc47
commit 19f3ce6f85
2 changed files with 12 additions and 23 deletions

View File

@ -6,14 +6,14 @@
#include "AAppIconLabel.hpp" #include "AAppIconLabel.hpp"
#include "bar.hpp" #include "bar.hpp"
#include "util/json.hpp"
#include "dwl-ipc-unstable-v2-client-protocol.h" #include "dwl-ipc-unstable-v2-client-protocol.h"
#include "util/json.hpp"
namespace waybar::modules::dwl { namespace waybar::modules::dwl {
class Window : public AAppIconLabel, public sigc::trackable { class Window : public AAppIconLabel, public sigc::trackable {
public: public:
Window(const std::string&, const waybar::Bar&, const Json::Value&); Window(const std::string &, const waybar::Bar &, const Json::Value &);
virtual ~Window() = default; virtual ~Window() = default;
void handle_layout(const uint32_t layout); void handle_layout(const uint32_t layout);
@ -23,8 +23,9 @@ class Window : public AAppIconLabel, public sigc::trackable {
void handle_frame(); void handle_frame();
struct zdwl_ipc_manager_v2 *status_manager_; struct zdwl_ipc_manager_v2 *status_manager_;
private: private:
const Bar& bar_; const Bar &bar_;
std::string title_; std::string title_;
std::string appid_; std::string appid_;

View File

@ -9,7 +9,6 @@
#include "client.hpp" #include "client.hpp"
#include "dwl-ipc-unstable-v2-client-protocol.h" #include "dwl-ipc-unstable-v2-client-protocol.h"
#include "util/rewrite_string.hpp" #include "util/rewrite_string.hpp"
namespace waybar::modules::dwl { namespace waybar::modules::dwl {
@ -43,7 +42,7 @@ static void set_layout(void *data, zdwl_ipc_output_v2 *zdwl_output_v2, uint32_t
static_cast<Window *>(data)->handle_layout(layout); static_cast<Window *>(data)->handle_layout(layout);
} }
static void appid(void *data, zdwl_ipc_output_v2 *zdwl_output_v2, const char *appid){ static void appid(void *data, zdwl_ipc_output_v2 *zdwl_output_v2, const char *appid) {
static_cast<Window *>(data)->handle_appid(appid); static_cast<Window *>(data)->handle_appid(appid);
}; };
@ -73,7 +72,7 @@ static void handle_global_remove(void *data, struct wl_registry *registry, uint3
static const wl_registry_listener registry_listener_impl = {.global = handle_global, static const wl_registry_listener registry_listener_impl = {.global = handle_global,
.global_remove = handle_global_remove}; .global_remove = handle_global_remove};
Window::Window(const std::string& id, const Bar& bar, const Json::Value& config) Window::Window(const std::string &id, const Bar &bar, const Json::Value &config)
: AAppIconLabel(config, "window", id, "{}", 0, true), bar_(bar) { : AAppIconLabel(config, "window", id, "{}", 0, true), bar_(bar) {
struct wl_display *display = Client::inst()->wl_display; struct wl_display *display = Client::inst()->wl_display;
struct wl_registry *registry = wl_display_get_registry(display); struct wl_registry *registry = wl_display_get_registry(display);
@ -92,29 +91,18 @@ Window::Window(const std::string& id, const Bar& bar, const Json::Value& config)
zdwl_ipc_manager_v2_destroy(status_manager_); zdwl_ipc_manager_v2_destroy(status_manager_);
} }
void Window::handle_title(const char *title) { void Window::handle_title(const char *title) { title_ = title; }
title_ = title;
}
void Window::handle_appid(const char *appid) { void Window::handle_appid(const char *appid) { appid_ = appid; }
appid_ = appid;
}
void Window::handle_layout_symbol(const char *layout_symbol) { void Window::handle_layout_symbol(const char *layout_symbol) { layout_symbol_ = layout_symbol; }
layout_symbol_ = layout_symbol;
}
void Window::handle_layout(const uint32_t layout) { void Window::handle_layout(const uint32_t layout) { layout_ = layout; }
layout_ = layout;
}
void Window::handle_frame() { void Window::handle_frame() {
label_.set_markup(waybar::util::rewriteString( label_.set_markup(waybar::util::rewriteString(
fmt::format( fmt::format(fmt::runtime(format_), fmt::arg("title", title_),
fmt::runtime(format_), fmt::arg("layout", layout_symbol_), fmt::arg("app_id", appid_)),
fmt::arg("title", title_),
fmt::arg("layout", layout_symbol_),
fmt::arg("app_id", appid_)),
config_["rewrite"])); config_["rewrite"]));
updateAppIconName(appid_, ""); updateAppIconName(appid_, "");
updateAppIcon(); updateAppIcon();