Add IDs to sway workspace buttons for CSS styling

In case you want to style a specific workspace add IDs to the workspace
buttons. Styling is done by matching button#sway-workspace-${name}.
pull/819/head
Pedro Côrte-Real 2020-08-12 11:41:00 +01:00
parent 4c4691dc2e
commit 29fa74f621
2 changed files with 2 additions and 0 deletions

View File

@ -139,3 +139,4 @@ n.b.: the list of outputs can be obtained from command line using *swaymsg -t ge
- *#workspaces button.urgent*
- *#workspaces button.persistent*
- *#workspaces button.current_output*
- *#workspaces button#sway-workspace-${name}

View File

@ -248,6 +248,7 @@ Gtk::Button &Workspaces::addButton(const Json::Value &node) {
auto pair = buttons_.emplace(node["name"].asString(), node["name"].asString());
auto &&button = pair.first->second;
box_.pack_start(button, false, false, 0);
button.set_name("sway-workspace-" + node["name"].asString());
button.set_relief(Gtk::RELIEF_NONE);
if (!config_["disable-click"].asBool()) {
button.signal_pressed().connect([this, node] {