Fix killactive and movetoworkspace not working in fullscreen

This commit is contained in:
outfoxxed 2024-01-14 02:43:37 -08:00
parent 783c7ae0cf
commit 7c643fa66e
No known key found for this signature in database
GPG key ID: 4C88A185FB89301E

View file

@ -6,7 +6,7 @@
#include "dispatchers.hpp" #include "dispatchers.hpp"
#include "globals.hpp" #include "globals.hpp"
int workspace_for_action() { int workspace_for_action(bool allow_fullscreen = false) {
if (g_pLayoutManager->getCurrentLayout() != g_Hy3Layout.get()) return -1; if (g_pLayoutManager->getCurrentLayout() != g_Hy3Layout.get()) return -1;
int workspace_id = g_pCompositor->m_pLastMonitor->activeWorkspace; int workspace_id = g_pCompositor->m_pLastMonitor->activeWorkspace;
@ -14,7 +14,7 @@ int workspace_for_action() {
if (workspace_id == -1) return -1; if (workspace_id == -1) return -1;
auto* workspace = g_pCompositor->getWorkspaceByID(workspace_id); auto* workspace = g_pCompositor->getWorkspaceByID(workspace_id);
if (workspace == nullptr) return -1; if (workspace == nullptr) return -1;
if (workspace->m_bHasFullscreenWindow) return -1; if (!allow_fullscreen && workspace->m_bHasFullscreenWindow) return -1;
return workspace_id; return workspace_id;
} }
@ -120,7 +120,7 @@ void dispatch_movefocus(std::string value) {
} }
void dispatch_move_to_workspace(std::string value) { void dispatch_move_to_workspace(std::string value) {
int origin_workspace = workspace_for_action(); int origin_workspace = workspace_for_action(true);
if (origin_workspace == -1) return; if (origin_workspace == -1) return;
auto args = CVarList(value); auto args = CVarList(value);
@ -202,7 +202,7 @@ void dispatch_setswallow(std::string arg) {
} }
void dispatch_killactive(std::string value) { void dispatch_killactive(std::string value) {
int workspace = workspace_for_action(); int workspace = workspace_for_action(true);
if (workspace == -1) return; if (workspace == -1) return;
g_Hy3Layout->killFocusedNode(workspace); g_Hy3Layout->killFocusedNode(workspace);