Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix peristent class on buttons #3037

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/modules/sway/workspaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
if (output.asString() == bar_.output->name) {
Json::Value v;
v["name"] = p_w_name;
v["output"] = bar_.output->name;
v["target_output"] = bar_.output->name;
v["num"] = convertWorkspaceNameToNum(p_w_name);
workspaces_.emplace_back(std::move(v));
break;
Expand All @@ -166,7 +166,7 @@
// Adding to all outputs
Json::Value v;
v["name"] = p_w_name;
v["output"] = "";
v["target_output"] = "";
v["num"] = convertWorkspaceNameToNum(p_w_name);
workspaces_.emplace_back(std::move(v));
}
Expand Down Expand Up @@ -286,7 +286,7 @@
}
}

auto Workspaces::update() -> void {

Check warning on line 289 in src/modules/sway/workspaces.cpp

View workflow job for this annotation

GitHub Actions / build

src/modules/sway/workspaces.cpp:289:18 [readability-function-cognitive-complexity]

function 'update' has cognitive complexity of 33 (threshold 25)
std::lock_guard<std::mutex> lock(mutex_);
bool needReorder = filterButtons();
for (auto it = workspaces_.begin(); it != workspaces_.end(); ++it) {
Expand All @@ -313,7 +313,7 @@
} else {
button.get_style_context()->remove_class("urgent");
}
if (hasFlag((*it), "target_output")) {
if ((*it)["target_output"].isString()) {
button.get_style_context()->add_class("persistent");
} else {
button.get_style_context()->remove_class("persistent");
Expand Down
Loading