Skip to content

Commit

Permalink
Merge pull request #3801 from majutsushi/sway-workspaces-x11-class
Browse files Browse the repository at this point in the history
sway/workspaces: use X11 class for XWayland windows
  • Loading branch information
Alexays authored Dec 7, 2024
2 parents 78d2ce3 + 4e05659 commit 758c14c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions man/waybar-sway-workspaces.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ warp-on-scroll: ++
Keys are the rules, while the values are the methods of representation.
Rules may specify `class<...>`, `title<...>`, or both in order to fine-tune the matching.
You may assign an empty value to a rule to have it ignored from generating any representation in workspaces.
For Wayland windows `class` is matched against the `app_id`, and for X11 windows against the `class` property.

*window-rewrite-default*:
typeof: string ++
Expand Down
4 changes: 3 additions & 1 deletion src/modules/sway/workspaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,9 @@ void Workspaces::updateWindows(const Json::Value &node, std::string &windows) {
if ((node["type"].asString() == "con" || node["type"].asString() == "floating_con") &&
node["name"].isString()) {
std::string title = g_markup_escape_text(node["name"].asString().c_str(), -1);
std::string windowClass = node["app_id"].asString();
std::string windowClass = node["app_id"].isString()
? node["app_id"].asString()
: node["window_properties"]["class"].asString();

// Only add window rewrites that can be looked up
if (!windowClass.empty()) {
Expand Down

0 comments on commit 758c14c

Please sign in to comment.