Skip to content

Commit 758c14c

Browse files
authored
Merge pull request #3801 from majutsushi/sway-workspaces-x11-class
sway/workspaces: use X11 class for XWayland windows
2 parents 78d2ce3 + 4e05659 commit 758c14c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

man/waybar-sway-workspaces.5.scd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ warp-on-scroll: ++
8888
Keys are the rules, while the values are the methods of representation.
8989
Rules may specify `class<...>`, `title<...>`, or both in order to fine-tune the matching.
9090
You may assign an empty value to a rule to have it ignored from generating any representation in workspaces.
91+
For Wayland windows `class` is matched against the `app_id`, and for X11 windows against the `class` property.
9192

9293
*window-rewrite-default*:
9394
typeof: string ++

src/modules/sway/workspaces.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,9 @@ void Workspaces::updateWindows(const Json::Value &node, std::string &windows) {
260260
if ((node["type"].asString() == "con" || node["type"].asString() == "floating_con") &&
261261
node["name"].isString()) {
262262
std::string title = g_markup_escape_text(node["name"].asString().c_str(), -1);
263-
std::string windowClass = node["app_id"].asString();
263+
std::string windowClass = node["app_id"].isString()
264+
? node["app_id"].asString()
265+
: node["window_properties"]["class"].asString();
264266

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

0 commit comments

Comments
 (0)