d6584bdcae8d8afebf5f641bb739dbe9a44c4e42

Author
shezdy <77217897+shezdy@users.noreply.github.com>
Committer
shezdy <77217897+shezdy@users.noreply.github.com>
Date

Message

movetoworkspace hyprsplit compatibility

Diff

 1diff --git a/src/dispatchers.cpp b/src/dispatchers.cpp
 2index ba152a7c0c51328ccec426da5ed3b3b312e9deaf..08c188731d030eb917e4199b239aeeaa6d8f16c5 100644
 3--- a/src/dispatchers.cpp
 4+++ b/src/dispatchers.cpp
 5@@ -1,5 +1,6 @@
 6 #include <optional>
 7 
 8+#include <dlfcn.h>
 9 #include <hyprland/src/Compositor.hpp>
10 #include <hyprland/src/desktop/DesktopTypes.hpp>
11 #include <hyprland/src/plugins/PluginAPI.hpp>
12@@ -8,6 +9,8 @@
13 #include "dispatchers.hpp"
14 #include "globals.hpp"
15 
16+typedef std::string (*PHYPRSPLIT_GET_WORKSPACE_FN)(const std::string& workspace);
17+
18 PHLWORKSPACE workspace_for_action(bool allow_fullscreen = false) {
19 	if (g_pLayoutManager->getCurrentLayout() != g_Hy3Layout.get()) return nullptr;
20 
21@@ -148,6 +151,15 @@ void dispatch_move_to_workspace(std::string value) {
22 	auto workspace = args[0];
23 	if (workspace == "") return;
24 
25+	for (auto& p: g_pPluginSystem->getAllPlugins()) {
26+		if (p->name == "hyprsplit") {
27+			PHYPRSPLIT_GET_WORKSPACE_FN hyprsplitGetWorkspace =
28+			    (PHYPRSPLIT_GET_WORKSPACE_FN) dlsym(p->m_pHandle, "hyprsplitGetWorkspace");
29+			if (hyprsplitGetWorkspace) workspace = hyprsplitGetWorkspace(workspace);
30+			break;
31+		}
32+	}
33+
34 	bool follow = args[1] == "follow";
35 
36 	g_Hy3Layout->moveNodeToWorkspace(origin_workspace, workspace, follow);