feat: allow sorting niri workspaces

This commit is contained in:
Raphael Kimmig
2025-12-07 12:18:24 +01:00
parent 161367d961
commit 85a8fca0de
3 changed files with 105 additions and 2 deletions
+6
View File
@@ -2,6 +2,7 @@
#include <gtkmm/button.h>
#include <json/value.h>
#include <vector>
#include "AModule.hpp"
#include "bar.hpp"
@@ -18,6 +19,7 @@ class Workspaces : public AModule, public EventHandler {
private:
void onEvent(const Json::Value &ev) override;
void doUpdate();
void sortWorkspaces(std::vector<Json::Value> &workspaces) const;
Gtk::Button &addButton(const Json::Value &ws);
std::string getIcon(const std::string &value, const Json::Value &ws);
@@ -25,6 +27,10 @@ class Workspaces : public AModule, public EventHandler {
Gtk::Box box_;
// Map from niri workspace id to button.
std::unordered_map<uint64_t, Gtk::Button> buttons_;
bool sort_by_id_ = false;
bool sort_by_name_ = false;
bool sort_by_coordinates_ = false;
};
} // namespace waybar::modules::niri