sway/workspaces: support ignore window-rewrite
Similar to hyprland implementation to ignore "" empty rules
This commit is contained in:
parent
9c40137d05
commit
90ac7d5d2c
|
@ -87,6 +87,7 @@ warp-on-scroll: ++
|
|||
Regex rules to map window class to an icon or preferred method of representation for a workspace's window.
|
||||
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.
|
||||
|
||||
*window-rewrite-default*:
|
||||
typeof: string ++
|
||||
|
|
|
@ -261,14 +261,18 @@ void Workspaces::updateWindows(const Json::Value &node, std::string &windows) {
|
|||
node["name"].isString()) {
|
||||
std::string title = g_markup_escape_text(node["name"].asString().c_str(), -1);
|
||||
std::string windowClass = node["app_id"].asString();
|
||||
|
||||
// Only add window rewrites that can be looked up
|
||||
if (!windowClass.empty()) {
|
||||
std::string windowReprKey = fmt::format("class<{}> title<{}>", windowClass, title);
|
||||
std::string window = m_windowRewriteRules.get(windowReprKey);
|
||||
// allow result to have formatting
|
||||
window =
|
||||
fmt::format(fmt::runtime(window), fmt::arg("name", title), fmt::arg("class", windowClass));
|
||||
window = fmt::format(fmt::runtime(window), fmt::arg("name", title),
|
||||
fmt::arg("class", windowClass));
|
||||
windows.append(window);
|
||||
windows.append(m_formatWindowSeperator);
|
||||
}
|
||||
}
|
||||
for (const Json::Value &child : node["nodes"]) {
|
||||
updateWindows(child, windows);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue