feat(niri/workspaces): add window icons via window-rewrite

Adds format-window-separator, window-rewrite and window-rewrite-default
options plus the {windows} format replacement to the niri/workspaces
module (rebased onto master; coexists with ignore-workspaces).
This commit is contained in:
Abhijeet
2026-07-04 01:42:23 +02:00
committed by Alexays
parent 7ffee464b3
commit 9e10a9aec9
4 changed files with 211 additions and 12 deletions
+11
View File
@@ -9,6 +9,7 @@
#include "AModule.hpp"
#include "bar.hpp"
#include "modules/niri/backend.hpp"
#include "util/regex_collection.hpp" // Added for rewrite rules
namespace waybar::modules::niri {
@@ -26,6 +27,10 @@ class Workspaces : public AModule, public EventHandler {
std::string getIcon(const std::string& value, const Json::Value& ws);
bool isWorkspaceIgnored(const std::string& name);
bool handleScroll(GdkEventScroll* /*unused*/) override;
// Added for window rewrite
void populateWindowRewriteConfig();
void populateFormatWindowSeparatorConfig();
std::string getRewrite(const std::string& app_id, const std::string& title);
const Bar& bar_;
Gtk::Box box_;
@@ -37,6 +42,12 @@ class Workspaces : public AModule, public EventHandler {
bool sort_by_id_ = false;
bool sort_by_name_ = false;
bool sort_by_coordinates_ = false;
// Added for window rewrite
util::RegexCollection m_windowRewriteRules;
std::string m_windowRewriteDefault;
std::string m_formatWindowSeparator;
};
} // namespace waybar::modules::niri