d892bb6db778be42c8656f755809124d3606c4e1

Author
outfoxxed <outfoxxed@outfoxxed.me>
Committer
outfoxxed <outfoxxed@outfoxxed.me>
Date

Message

Fix hy3 dispatchers in named workspaces

Diff

 1diff --git a/src/main.cpp b/src/main.cpp
 2index f299fe92a18322710fded7165d77cb1897035d9a..97b0aa7c8123962030254c639eebe8ff5c692b11 100644
 3--- a/src/main.cpp
 4+++ b/src/main.cpp
 5@@ -29,7 +29,7 @@ int workspace_for_action() {
 6 
 7 	int workspace_id = g_pCompositor->m_pLastMonitor->activeWorkspace;
 8 
 9-	if (workspace_id < 0) return -1;
10+	if (workspace_id == -1) return -1;
11 	auto* workspace = g_pCompositor->getWorkspaceByID(workspace_id);
12 	if (workspace == nullptr) return -1;
13 	if (workspace->m_bHasFullscreenWindow) return -1;
14@@ -39,7 +39,7 @@ int workspace_for_action() {
15 
16 void dispatch_makegroup(std::string arg) {
17 	int workspace = workspace_for_action();
18-	if (workspace < 0) return;
19+	if (workspace == -1) return;
20 
21 	if (arg == "h") {
22 		g_Hy3Layout->makeGroupOnWorkspace(workspace, Hy3GroupLayout::SplitH);
23@@ -60,7 +60,7 @@ std::optional<ShiftDirection> parseShiftArg(std::string arg) {
24 
25 void dispatch_movewindow(std::string value) {
26 	int workspace = workspace_for_action();
27-	if (workspace < 0) return;
28+	if (workspace == -1) return;
29 
30 	auto args = CVarList(value);
31 
32@@ -72,7 +72,7 @@ void dispatch_movewindow(std::string value) {
33 
34 void dispatch_movefocus(std::string arg) {
35 	int workspace = workspace_for_action();
36-	if (workspace < 0) return;
37+	if (workspace == -1) return;
38 
39 	if (auto shift = parseShiftArg(arg)) {
40 		g_Hy3Layout->shiftFocus(workspace, shift.value());
41@@ -81,17 +81,17 @@ void dispatch_movefocus(std::string arg) {
42 
43 void dispatch_raisefocus(std::string arg) {
44 	int workspace = workspace_for_action();
45-	if (workspace < 0) return;
46+	if (workspace == -1) return;
47 
48 	g_Hy3Layout->raiseFocus(workspace);
49 }
50 
51 void dispatch_debug(std::string arg) {
52 	int workspace = workspace_for_action();
53-	if (workspace < 0) return;
54+	if (workspace == -1) return;
55 
56 	auto* root = g_Hy3Layout->getWorkspaceRootGroup(workspace);
57-	if (workspace < 0) {
58+	if (workspace == -1) {
59 		Debug::log(LOG, "DEBUG NODES: no nodes on workspace");
60 	} else {
61 		Debug::log(LOG, "DEBUG NODES\n%s", root->debugNode().c_str());