Skip to content

Commit

Permalink
Merge pull request #3831 from c4rlo/sway-fix-config-warning
Browse files Browse the repository at this point in the history
sway: fix "Mapping is not an object" warning
  • Loading branch information
Alexays authored Dec 26, 2024
2 parents e959f1d + 8e276bb commit dbb708c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
1 change: 0 additions & 1 deletion include/modules/sway/workspaces.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class Workspaces : public AModule, public sigc::trackable {
std::vector<std::string> workspaces_order_;
Gtk::Box box_;
std::string m_formatWindowSeperator;
std::string m_windowRewriteDefault;
util::RegexCollection m_windowRewriteRules;
util::JsonParser parser_;
std::unordered_map<std::string, Gtk::Button> buttons_;
Expand Down
15 changes: 7 additions & 8 deletions src/modules/sway/workspaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,13 @@ Workspaces::Workspaces(const std::string &id, const Bar &bar, const Json::Value
m_formatWindowSeperator = " ";
}
const Json::Value &windowRewrite = config["window-rewrite"];

const Json::Value &windowRewriteDefaultConfig = config["window-rewrite-default"];
m_windowRewriteDefault =
windowRewriteDefaultConfig.isString() ? windowRewriteDefaultConfig.asString() : "?";

m_windowRewriteRules = waybar::util::RegexCollection(
windowRewrite, m_windowRewriteDefault,
[](std::string &window_rule) { return windowRewritePriorityFunction(window_rule); });
if (windowRewrite.isObject()) {
const Json::Value &windowRewriteDefaultConfig = config["window-rewrite-default"];
std::string windowRewriteDefault =
windowRewriteDefaultConfig.isString() ? windowRewriteDefaultConfig.asString() : "?";
m_windowRewriteRules = waybar::util::RegexCollection(
windowRewrite, std::move(windowRewriteDefault), windowRewritePriorityFunction);
}
ipc_.subscribe(R"(["workspace"])");
ipc_.subscribe(R"(["window"])");
ipc_.signal_event.connect(sigc::mem_fun(*this, &Workspaces::onEvent));
Expand Down

0 comments on commit dbb708c

Please sign in to comment.