fix: lint

This commit is contained in:
Alex
2025-01-25 09:31:32 +01:00
parent 90911a15b6
commit 481b01d9af
11 changed files with 37 additions and 44 deletions

View File

@ -51,8 +51,8 @@ class Clock final : public ALabel {
day cldBaseDay_{0}; // calendar Cached day. Is used when today is changing(midnight) day cldBaseDay_{0}; // calendar Cached day. Is used when today is changing(midnight)
std::string cldText_{""}; // calendar text to print std::string cldText_{""}; // calendar text to print
CldMode cldMode_{CldMode::MONTH}; CldMode cldMode_{CldMode::MONTH};
auto get_calendar(const year_month_day& today, const year_month_day& ymd, auto get_calendar(const year_month_day& today, const year_month_day& ymd, const time_zone* tz)
const time_zone* tz) -> const std::string; -> const std::string;
// get local time zone // get local time zone
auto local_zone() -> const time_zone*; auto local_zone() -> const time_zone*;

View File

@ -61,8 +61,8 @@ class Workspaces : public AModule, public EventHandler {
// Config // Config
void parseConfig(const Json::Value& config); void parseConfig(const Json::Value& config);
auto populateIconsMap(const Json::Value& formatIcons) -> void; auto populateIconsMap(const Json::Value& formatIcons) -> void;
static auto populateBoolConfig(const Json::Value& config, const std::string& key, static auto populateBoolConfig(const Json::Value& config, const std::string& key, bool& member)
bool& member) -> void; -> void;
auto populateSortByConfig(const Json::Value& config) -> void; auto populateSortByConfig(const Json::Value& config) -> void;
auto populateIgnoreWorkspacesConfig(const Json::Value& config) -> void; auto populateIgnoreWorkspacesConfig(const Json::Value& config) -> void;
auto populateFormatWindowSeparatorConfig(const Json::Value& config) -> void; auto populateFormatWindowSeparatorConfig(const Json::Value& config) -> void;

View File

@ -622,8 +622,8 @@ inline auto convertInto(std::string const &source, bool &target) -> ParserResult
} }
#ifdef CLARA_CONFIG_OPTIONAL_TYPE #ifdef CLARA_CONFIG_OPTIONAL_TYPE
template <typename T> template <typename T>
inline auto convertInto(std::string const &source, inline auto convertInto(std::string const &source, CLARA_CONFIG_OPTIONAL_TYPE<T> &target)
CLARA_CONFIG_OPTIONAL_TYPE<T> &target) -> ParserResult { -> ParserResult {
T temp; T temp;
auto result = convertInto(source, temp); auto result = convertInto(source, temp);
if (result) target = std::move(temp); if (result) target = std::move(temp);
@ -751,8 +751,8 @@ class ParserBase {
public: public:
virtual ~ParserBase() = default; virtual ~ParserBase() = default;
virtual auto validate() const -> Result { return Result::ok(); } virtual auto validate() const -> Result { return Result::ok(); }
virtual auto parse(std::string const &exeName, virtual auto parse(std::string const &exeName, TokenStream const &tokens) const
TokenStream const &tokens) const -> InternalParseResult = 0; -> InternalParseResult = 0;
virtual auto cardinality() const -> size_t { return 1; } virtual auto cardinality() const -> size_t { return 1; }
auto parse(Args const &args) const -> InternalParseResult { auto parse(Args const &args) const -> InternalParseResult {
@ -1098,8 +1098,8 @@ struct Parser : ParserBase {
using ParserBase::parse; using ParserBase::parse;
auto parse(std::string const &exeName, auto parse(std::string const &exeName, TokenStream const &tokens) const
TokenStream const &tokens) const -> InternalParseResult override { -> InternalParseResult override {
struct ParserInfo { struct ParserInfo {
ParserBase const *parser = nullptr; ParserBase const *parser = nullptr;
size_t count = 0; size_t count = 0;

View File

@ -49,8 +49,8 @@ auto getBoolProperty(GDBusProxy* proxy, const char* property_name) -> bool {
return false; return false;
} }
auto getOptionalStringProperty(GDBusProxy* proxy, auto getOptionalStringProperty(GDBusProxy* proxy, const char* property_name)
const char* property_name) -> std::optional<std::string> { -> std::optional<std::string> {
auto gvar = g_dbus_proxy_get_cached_property(proxy, property_name); auto gvar = g_dbus_proxy_get_cached_property(proxy, property_name);
if (gvar) { if (gvar) {
std::string property_value = g_variant_get_string(gvar, NULL); std::string property_value = g_variant_get_string(gvar, NULL);
@ -345,8 +345,8 @@ auto waybar::modules::Bluetooth::onInterfaceAddedOrRemoved(GDBusObjectManager* m
auto waybar::modules::Bluetooth::onInterfaceProxyPropertiesChanged( auto waybar::modules::Bluetooth::onInterfaceProxyPropertiesChanged(
GDBusObjectManagerClient* manager, GDBusObjectProxy* object_proxy, GDBusProxy* interface_proxy, GDBusObjectManagerClient* manager, GDBusObjectProxy* object_proxy, GDBusProxy* interface_proxy,
GVariant* changed_properties, const gchar* const* invalidated_properties, GVariant* changed_properties, const gchar* const* invalidated_properties, gpointer user_data)
gpointer user_data) -> void { -> void {
std::string interface_name = g_dbus_proxy_get_interface_name(interface_proxy); std::string interface_name = g_dbus_proxy_get_interface_name(interface_proxy);
std::string object_path = g_dbus_object_get_object_path(G_DBUS_OBJECT(object_proxy)); std::string object_path = g_dbus_object_get_object_path(G_DBUS_OBJECT(object_proxy));
@ -395,8 +395,8 @@ auto waybar::modules::Bluetooth::getDeviceBatteryPercentage(GDBusObject* object)
return std::nullopt; return std::nullopt;
} }
auto waybar::modules::Bluetooth::getDeviceProperties(GDBusObject* object, auto waybar::modules::Bluetooth::getDeviceProperties(GDBusObject* object, DeviceInfo& device_info)
DeviceInfo& device_info) -> bool { -> bool {
GDBusProxy* proxy_device = G_DBUS_PROXY(g_dbus_object_get_interface(object, "org.bluez.Device1")); GDBusProxy* proxy_device = G_DBUS_PROXY(g_dbus_object_get_interface(object, "org.bluez.Device1"));
if (proxy_device != NULL) { if (proxy_device != NULL) {
@ -462,8 +462,9 @@ auto waybar::modules::Bluetooth::findCurController() -> std::optional<Controller
return controller_info; return controller_info;
} }
auto waybar::modules::Bluetooth::findConnectedDevices( auto waybar::modules::Bluetooth::findConnectedDevices(const std::string& cur_controller_path,
const std::string& cur_controller_path, std::vector<DeviceInfo>& connected_devices) -> void { std::vector<DeviceInfo>& connected_devices)
-> void {
GList* objects = g_dbus_object_manager_get_objects(manager_.get()); GList* objects = g_dbus_object_manager_get_objects(manager_.get());
for (GList* l = objects; l != NULL; l = l->next) { for (GList* l = objects; l != NULL; l = l->next) {
GDBusObject* object = G_DBUS_OBJECT(l->data); GDBusObject* object = G_DBUS_OBJECT(l->data);

View File

@ -199,8 +199,8 @@ const unsigned cldRowsInMonth(const year_month& ym, const weekday& firstdow) {
return 2u + ceil<weeks>((weekday{ym / 1} - firstdow) + ((ym / last).day() - day{0})).count(); return 2u + ceil<weeks>((weekday{ym / 1} - firstdow) + ((ym / last).day() - day{0})).count();
} }
auto cldGetWeekForLine(const year_month& ym, const weekday& firstdow, auto cldGetWeekForLine(const year_month& ym, const weekday& firstdow, const unsigned line)
const unsigned line) -> const year_month_weekday { -> const year_month_weekday {
unsigned index{line - 2}; unsigned index{line - 2};
if (weekday{ym / 1} == firstdow) ++index; if (weekday{ym / 1} == firstdow) ++index;
return ym / firstdow[index]; return ym / firstdow[index];

View File

@ -98,13 +98,9 @@ Window::~Window() {
} }
} }
void Window::handle_title(const char *title) { void Window::handle_title(const char *title) { title_ = Glib::Markup::escape_text(title); }
title_ = Glib::Markup::escape_text(title);
}
void Window::handle_appid(const char *appid) { void Window::handle_appid(const char *appid) { appid_ = Glib::Markup::escape_text(appid); }
appid_ = Glib::Markup::escape_text(appid);
}
void Window::handle_layout_symbol(const char *layout_symbol) { void Window::handle_layout_symbol(const char *layout_symbol) {
layout_symbol_ = Glib::Markup::escape_text(layout_symbol); layout_symbol_ = Glib::Markup::escape_text(layout_symbol);

View File

@ -6,22 +6,20 @@
#include <spdlog/spdlog.h> #include <spdlog/spdlog.h>
#include <algorithm> #include <algorithm>
#include <shared_mutex>
#include <thread>
#include <vector> #include <vector>
#include "modules/hyprland/backend.hpp" #include "modules/hyprland/backend.hpp"
#include "util/rewrite_string.hpp" #include "util/rewrite_string.hpp"
#include "util/sanitize_str.hpp" #include "util/sanitize_str.hpp"
#include <shared_mutex>
#include <thread>
namespace waybar::modules::hyprland { namespace waybar::modules::hyprland {
std::shared_mutex windowIpcSmtx; std::shared_mutex windowIpcSmtx;
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, "{title}", 0, true), bar_(bar) { : AAppIconLabel(config, "window", id, "{title}", 0, true), bar_(bar) {
std::unique_lock<std::shared_mutex> windowIpcUniqueLock(windowIpcSmtx); std::unique_lock<std::shared_mutex> windowIpcUniqueLock(windowIpcSmtx);
modulesReady = true; modulesReady = true;
@ -51,7 +49,6 @@ Window::~Window() {
} }
auto Window::update() -> void { auto Window::update() -> void {
std::shared_lock<std::shared_mutex> windowIpcShareLock(windowIpcSmtx); std::shared_lock<std::shared_mutex> windowIpcShareLock(windowIpcSmtx);
std::string windowName = waybar::util::sanitize_string(workspace_.last_window_title); std::string windowName = waybar::util::sanitize_string(workspace_.last_window_title);
@ -153,7 +150,6 @@ auto Window::WindowData::parse(const Json::Value& value) -> Window::WindowData {
} }
void Window::queryActiveWorkspace() { void Window::queryActiveWorkspace() {
std::shared_lock<std::shared_mutex> windowIpcShareLock(windowIpcSmtx); std::shared_lock<std::shared_mutex> windowIpcShareLock(windowIpcSmtx);
if (separateOutputs_) { if (separateOutputs_) {

View File

@ -590,8 +590,8 @@ auto Workspaces::populateIconsMap(const Json::Value &formatIcons) -> void {
m_iconsMap.emplace("", ""); m_iconsMap.emplace("", "");
} }
auto Workspaces::populateBoolConfig(const Json::Value &config, const std::string &key, auto Workspaces::populateBoolConfig(const Json::Value &config, const std::string &key, bool &member)
bool &member) -> void { -> void {
const auto &configValue = config[key]; const auto &configValue = config[key];
if (configValue.isBool()) { if (configValue.isBool()) {
member = configValue.asBool(); member = configValue.asBool();

View File

@ -118,8 +118,8 @@ auto WorkspaceManager::sort_workspaces() -> void {
} }
} }
auto WorkspaceManager::register_manager(wl_registry *registry, uint32_t name, auto WorkspaceManager::register_manager(wl_registry *registry, uint32_t name, uint32_t version)
uint32_t version) -> void { -> void {
if (workspace_manager_) { if (workspace_manager_) {
spdlog::warn("Register workspace manager again although already registered!"); spdlog::warn("Register workspace manager again although already registered!");
return; return;