diff options
author | Alexander <[email protected]> | 2024-06-27 16:07:56 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2024-06-27 15:07:56 +0200 |
commit | f2dc48d92f340efe6d4264b92d38378c18a3e1ea (patch) | |
tree | 3d6f98c762fcdeaeba7c6bd874978f7a50327a31 | |
parent | e4d09aa3a9de9a9e71c10bf4b6800585b3db9a4c (diff) | |
download | Hyprland-f2dc48d92f340efe6d4264b92d38378c18a3e1ea.tar.gz Hyprland-f2dc48d92f340efe6d4264b92d38378c18a3e1ea.zip |
keybinds: never switch to another monitor with per_monitor (#6665)
Co-authored-by: Крылов Александр <[email protected]>
-rw-r--r-- | src/managers/KeybindManager.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index c5a35012..005ce392 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -1040,7 +1040,8 @@ SWorkspaceIDName getWorkspaceToChangeFromArgs(std::string args, PHLWORKSPACE PCU return getWorkspaceIDNameFromString(args); } - const SWorkspaceIDName PPREVWS = PCURRENTWORKSPACE->getPrevWorkspaceIDName(args.contains("_per_monitor")); + const bool PER_MON = args.contains("_per_monitor"); + const SWorkspaceIDName PPREVWS = PCURRENTWORKSPACE->getPrevWorkspaceIDName(PER_MON); // Do nothing if there's no previous workspace, otherwise switch to it. if (PPREVWS.id == -1) { Debug::log(LOG, "No previous workspace to change to"); @@ -1048,8 +1049,11 @@ SWorkspaceIDName getWorkspaceToChangeFromArgs(std::string args, PHLWORKSPACE PCU } const auto ID = PCURRENTWORKSPACE->m_iID; - if (const auto PWORKSPACETOCHANGETO = g_pCompositor->getWorkspaceByID(PPREVWS.id); PWORKSPACETOCHANGETO) + if (const auto PWORKSPACETOCHANGETO = g_pCompositor->getWorkspaceByID(PPREVWS.id); PWORKSPACETOCHANGETO) { + if (PER_MON && PCURRENTWORKSPACE->m_iMonitorID != PWORKSPACETOCHANGETO->m_iMonitorID) + return {WORKSPACE_NOT_CHANGED, ""}; return {ID, PWORKSPACETOCHANGETO->m_szName}; + } return {ID, PPREVWS.name.empty() ? std::to_string(PPREVWS.id) : PPREVWS.name}; } @@ -1678,7 +1682,6 @@ void CKeybindManager::moveCurrentWorkspaceToMonitor(std::string args) { // get the current workspace const auto PCURRENTWORKSPACE = g_pCompositor->m_pLastMonitor->activeWorkspace; - if (!PCURRENTWORKSPACE) { Debug::log(ERR, "moveCurrentWorkspaceToMonitor invalid workspace!"); return; |