diff --git a/include/modules/gps.hpp b/include/modules/gps.hpp index 3701634b..80df12ba 100644 --- a/include/modules/gps.hpp +++ b/include/modules/gps.hpp @@ -14,27 +14,27 @@ namespace waybar::modules { - class Gps : public ALabel { - public: - Gps(const std::string&, const Json::Value&); - virtual ~Gps(); - auto update() -> void override; +class Gps : public ALabel { + public: + Gps(const std::string&, const Json::Value&); + virtual ~Gps(); + auto update() -> void override; - private: - #ifdef WANT_RFKILL - util::Rfkill rfkill_; - #endif - const std::string getFixModeName() const; - const std::string getFixModeString() const; + private: +#ifdef WANT_RFKILL + util::Rfkill rfkill_; +#endif + const std::string getFixModeName() const; + const std::string getFixModeString() const; - const std::string getFixStatusString() const; + const std::string getFixStatusString() const; - util::SleeperThread thread_, gps_thread_; - gps_data_t gps_data_; - std::string state_; + util::SleeperThread thread_, gps_thread_; + gps_data_t gps_data_; + std::string state_; - bool hideDisconnected = true; - bool hideNoFix = false; - }; + bool hideDisconnected = true; + bool hideNoFix = false; +}; } // namespace waybar::modules diff --git a/src/modules/custom.cpp b/src/modules/custom.cpp index 0220e348..db5c6db3 100644 --- a/src/modules/custom.cpp +++ b/src/modules/custom.cpp @@ -35,7 +35,7 @@ waybar::modules::Custom::~Custom() { void waybar::modules::Custom::delayWorker() { thread_ = [this] { - for (int i: this->pid_children_) { + for (int i : this->pid_children_) { int status; waitpid(i, &status, 0); } diff --git a/src/modules/gps.cpp b/src/modules/gps.cpp index f075b44c..a7bab659 100644 --- a/src/modules/gps.cpp +++ b/src/modules/gps.cpp @@ -1,4 +1,5 @@ #include "modules/gps.hpp" + #include #include @@ -15,15 +16,15 @@ #endif namespace { - using namespace waybar::util; - constexpr const char *DEFAULT_FORMAT = "{mode}"; +using namespace waybar::util; +constexpr const char* DEFAULT_FORMAT = "{mode}"; } // namespace - waybar::modules::Gps::Gps(const std::string& id, const Json::Value& config) -: ALabel(config, "gps", id, "{}", 5) + : ALabel(config, "gps", id, "{}", 5) #ifdef WANT_RFKILL -,rfkill_{RFKILL_TYPE_GPS} + , + rfkill_{RFKILL_TYPE_GPS} #endif { thread_ = [this] { @@ -66,9 +67,9 @@ waybar::modules::Gps::Gps(const std::string& id, const Json::Value& config) } }; - #ifdef WANT_RFKILL +#ifdef WANT_RFKILL rfkill_.on_update.connect(sigc::hide(sigc::mem_fun(*this, &Gps::update))); - #endif +#endif } const std::string waybar::modules::Gps::getFixModeName() const { @@ -80,9 +81,9 @@ const std::string waybar::modules::Gps::getFixModeName() const { case MODE_3D: return "fix-3d"; default: - #ifdef WANT_RFKILL +#ifdef WANT_RFKILL if (rfkill_.getState()) return "disabled"; - #endif +#endif return "disconnected"; } } @@ -120,18 +121,19 @@ const std::string waybar::modules::Gps::getFixStatusString() const { return "PPS Fix"; default: - #ifdef WANT_RFKILL +#ifdef WANT_RFKILL if (rfkill_.getState()) return "Disabled"; - #endif +#endif return "Unknown"; } } auto waybar::modules::Gps::update() -> void { - sleep(0); // Wait for gps status change + sleep(0); // Wait for gps status change - if ((gps_data_.fix.mode == MODE_NOT_SEEN && hideDisconnected) || (gps_data_.fix.mode == MODE_NO_FIX && hideNoFix)) { + if ((gps_data_.fix.mode == MODE_NOT_SEEN && hideDisconnected) || + (gps_data_.fix.mode == MODE_NO_FIX && hideNoFix)) { event_box_.set_visible(false); return; } @@ -163,7 +165,6 @@ auto waybar::modules::Gps::update() -> void { state_ = state; } - auto format = format_; fmt::dynamic_format_arg_store store; @@ -191,7 +192,7 @@ auto waybar::modules::Gps::update() -> void { auto text = fmt::vformat(format, store); - if (tooltipEnabled()) { + if (tooltipEnabled()) { if (tooltip_format.empty() && config_["tooltip-format"].isString()) { tooltip_format = config_["tooltip-format"].asString(); } @@ -205,13 +206,11 @@ auto waybar::modules::Gps::update() -> void { } } label_.set_markup(text); -// Call parent update -ALabel::update(); + // Call parent update + ALabel::update(); } waybar::modules::Gps::~Gps() { gps_stream(&gps_data_, WATCH_DISABLE, NULL); gps_close(&gps_data_); } - - diff --git a/src/modules/hyprland/language.cpp b/src/modules/hyprland/language.cpp index 1dbdfeba..2989926a 100644 --- a/src/modules/hyprland/language.cpp +++ b/src/modules/hyprland/language.cpp @@ -66,9 +66,10 @@ auto Language::update() -> void { void Language::onEvent(const std::string& ev) { std::lock_guard lg(mutex_); std::string kbName(begin(ev) + ev.find_last_of('>') + 1, begin(ev) + ev.find_first_of(',')); - + // Last comma before variants parenthesis, eg: - // activelayout>>micro-star-int'l-co.,-ltd.-msi-gk50-elite-gaming-keyboard,English (US, intl., with dead keys) + // activelayout>>micro-star-int'l-co.,-ltd.-msi-gk50-elite-gaming-keyboard,English (US, intl., + // with dead keys) std::string beforParenthesis(begin(ev), begin(ev) + ev.find_last_of('(')); auto layoutName = ev.substr(beforParenthesis.find_last_of(',') + 1); diff --git a/src/modules/hyprland/workspaces.cpp b/src/modules/hyprland/workspaces.cpp index b5801759..bb03f707 100644 --- a/src/modules/hyprland/workspaces.cpp +++ b/src/modules/hyprland/workspaces.cpp @@ -791,25 +791,21 @@ void Workspaces::sortSpecialCentered() { size_t center = normalWorkspaces.size() / 2; - m_workspaces.insert(m_workspaces.end(), - std::make_move_iterator(normalWorkspaces.begin()), + m_workspaces.insert(m_workspaces.end(), std::make_move_iterator(normalWorkspaces.begin()), std::make_move_iterator(normalWorkspaces.begin() + center)); - m_workspaces.insert(m_workspaces.end(), - std::make_move_iterator(specialWorkspaces.begin()), + m_workspaces.insert(m_workspaces.end(), std::make_move_iterator(specialWorkspaces.begin()), std::make_move_iterator(specialWorkspaces.end())); m_workspaces.insert(m_workspaces.end(), std::make_move_iterator(normalWorkspaces.begin() + center), std::make_move_iterator(normalWorkspaces.end())); - - m_workspaces.insert(m_workspaces.end(), - std::make_move_iterator(hiddenWorkspaces.begin()), + + m_workspaces.insert(m_workspaces.end(), std::make_move_iterator(hiddenWorkspaces.begin()), std::make_move_iterator(hiddenWorkspaces.end())); } void Workspaces::sortWorkspaces() { - std::ranges::sort( // m_workspaces, [&](std::unique_ptr &a, std::unique_ptr &b) { // Helper comparisons diff --git a/src/modules/mpris/mpris.cpp b/src/modules/mpris/mpris.cpp index 30dd31ea..2b345fc5 100644 --- a/src/modules/mpris/mpris.cpp +++ b/src/modules/mpris/mpris.cpp @@ -610,11 +610,11 @@ bool Mpris::handleToggle(GdkEventButton* const& e) { // Command pattern: encapsulate each button's action const ButtonAction actions[] = { - {1, "on-click", [&]() { playerctl_player_play_pause(player, &error); }}, - {2, "on-click-middle", [&]() { playerctl_player_previous(player, &error); }}, - {3, "on-click-right", [&]() { playerctl_player_next(player, &error); }}, - {8, "on-click-backward", [&]() { playerctl_player_previous(player, &error); }}, - {9, "on-click-forward", [&]() { playerctl_player_next(player, &error); }}, + {1, "on-click", [&]() { playerctl_player_play_pause(player, &error); }}, + {2, "on-click-middle", [&]() { playerctl_player_previous(player, &error); }}, + {3, "on-click-right", [&]() { playerctl_player_next(player, &error); }}, + {8, "on-click-backward", [&]() { playerctl_player_previous(player, &error); }}, + {9, "on-click-forward", [&]() { playerctl_player_next(player, &error); }}, }; for (const auto& action : actions) { diff --git a/src/modules/niri/workspaces.cpp b/src/modules/niri/workspaces.cpp index 73f81dc0..7dfc0b35 100644 --- a/src/modules/niri/workspaces.cpp +++ b/src/modules/niri/workspaces.cpp @@ -172,7 +172,6 @@ std::string Workspaces::getIcon(const std::string &value, const Json::Value &ws) const auto &icons = config_["format-icons"]; if (!icons) return value; - if (ws["is_urgent"].asBool() && icons["urgent"]) return icons["urgent"].asString(); if (ws["active_window_id"].isNull() && icons["empty"]) return icons["empty"].asString(); diff --git a/src/modules/wlr/taskbar.cpp b/src/modules/wlr/taskbar.cpp index 5e497516..589638e8 100644 --- a/src/modules/wlr/taskbar.cpp +++ b/src/modules/wlr/taskbar.cpp @@ -712,7 +712,7 @@ void Task::update() { fmt::format(fmt::runtime(format_tooltip_), fmt::arg("title", title), fmt::arg("name", name), fmt::arg("app_id", app_id), fmt::arg("state", state_string()), fmt::arg("short_state", state_string(true))); - + txt = waybar::util::rewriteString(txt, config_["rewrite"]); if (markup)