Merge pull request #4193 from burbschat/output-classes

Add CSS classes for sway workspace indicators depending on associated output
This commit is contained in:
Alexis Rouillard
2026-07-03 22:58:25 +02:00
committed by GitHub
2 changed files with 19 additions and 0 deletions
+12
View File
@@ -357,6 +357,18 @@ auto Workspaces::update() -> void {
button.get_style_context()->remove_class("empty");
}
if ((*it)["output"].isString()) {
// Simply attempt to remove all output classes every time to reset output classes. This works
// even if a class has not been previously added to the style context.
for (const auto &oclass : config_["output-classes"]) {
button.get_style_context()->remove_class(oclass.asString());
}
// If output-classes contains a class for output associated with current workspace button, add
// the class to its style context.
std::string output_name = (*it)["output"].asString();
if (config_["output-classes"].isMember(output_name) &&
config_["output-classes"][output_name].isString()) {
button.get_style_context()->add_class(config_["output-classes"][output_name].asString());
}
if (((*it)["output"].asString()) == bar_.output->name) {
button.get_style_context()->add_class("current_output");
} else {