Skip to content

Commit f7b4451

Browse files
committed
fix(hyprland): support additional v2 events
1 parent 17cee0d commit f7b4451

File tree

2 files changed

+225
-221
lines changed

2 files changed

+225
-221
lines changed

include/modules/hyprland/workspaces.hpp

+12-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <cstdint>
88
#include <map>
99
#include <memory>
10+
#include <optional>
1011
#include <regex>
1112
#include <string>
1213
#include <vector>
@@ -55,7 +56,7 @@ class Workspaces : public AModule, public EventHandler {
5556

5657
static Json::Value createMonitorWorkspaceData(std::string const& name,
5758
std::string const& monitor);
58-
void removeWorkspace(std::string const& name);
59+
void removeWorkspace(std::string const& workspaceString);
5960
void setUrgentWorkspace(std::string const& windowaddress);
6061

6162
// Config
@@ -74,10 +75,11 @@ class Workspaces : public AModule, public EventHandler {
7475
void onWorkspaceActivated(std::string const& payload);
7576
void onSpecialWorkspaceActivated(std::string const& payload);
7677
void onWorkspaceDestroyed(std::string const& payload);
77-
void onWorkspaceCreated(std::string const& workspaceName,
78+
void onWorkspaceCreated(std::string const& payload,
7879
Json::Value const& clientsData = Json::Value::nullRef);
7980
void onWorkspaceMoved(std::string const& payload);
8081
void onWorkspaceRenamed(std::string const& payload);
82+
static std::optional<int> parseWorkspaceId(std::string const& workspaceIdStr);
8183

8284
// monitor events
8385
void onMonitorFocused(std::string const& payload);
@@ -93,11 +95,18 @@ class Workspaces : public AModule, public EventHandler {
9395

9496
int windowRewritePriorityFunction(std::string const& window_rule);
9597

98+
// event payload management
99+
template <typename... Args>
100+
static std::string makePayload(Args const&... args);
101+
static std::pair<std::string, std::string> splitDoublePayload(std::string const& payload);
102+
static std::tuple<std::string, std::string, std::string> splitTriplePayload(
103+
std::string const& payload);
104+
96105
// Update methods
97106
void doUpdate();
98107
void removeWorkspacesToRemove();
99108
void createWorkspacesToCreate();
100-
static std::vector<std::string> getVisibleWorkspaces();
109+
static std::vector<int> getVisibleWorkspaces();
101110
void updateWorkspaceStates();
102111
bool updateWindowsToCreate();
103112

0 commit comments

Comments
 (0)