2024-08-29 11:45:17 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <gtkmm/button.h>
|
|
|
|
|
#include <json/value.h>
|
|
|
|
|
|
|
|
|
|
#include "AModule.hpp"
|
|
|
|
|
#include "bar.hpp"
|
|
|
|
|
#include "modules/niri/backend.hpp"
|
|
|
|
|
|
|
|
|
|
namespace waybar::modules::niri {
|
|
|
|
|
|
|
|
|
|
class Workspaces : public AModule, public EventHandler {
|
|
|
|
|
public:
|
2026-02-04 09:24:14 +01:00
|
|
|
Workspaces(const std::string&, const Bar&, const Json::Value&);
|
2024-08-29 11:45:17 +03:00
|
|
|
~Workspaces() override;
|
|
|
|
|
void update() override;
|
|
|
|
|
|
|
|
|
|
private:
|
2026-02-04 09:24:14 +01:00
|
|
|
void onEvent(const Json::Value& ev) override;
|
2024-08-29 11:45:17 +03:00
|
|
|
void doUpdate();
|
2026-02-04 09:24:14 +01:00
|
|
|
Gtk::Button& addButton(const Json::Value& ws);
|
|
|
|
|
std::string getIcon(const std::string& value, const Json::Value& ws);
|
2024-08-29 11:45:17 +03:00
|
|
|
|
2026-02-04 09:24:14 +01:00
|
|
|
const Bar& bar_;
|
2024-08-29 11:45:17 +03:00
|
|
|
Gtk::Box box_;
|
|
|
|
|
// Map from niri workspace id to button.
|
|
|
|
|
std::unordered_map<uint64_t, Gtk::Button> buttons_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace waybar::modules::niri
|