diff options
| author | Vaxry <vaxry@vaxry.net> | 2025-07-16 15:51:11 +0200 |
|---|---|---|
| committer | Vaxry <vaxry@vaxry.net> | 2025-07-16 15:51:11 +0200 |
| commit | 5349667992f5047be0c607468e8c0d74a5e7e00c (patch) | |
| tree | 044f183fa179940cfe32bc7f4fb29dcb0ccb19bd /src/layout/MasterLayout.cpp | |
| parent | c4a4c341568944bd4fb9cd503558b2de602c0213 (diff) | |
master: add ignoremaster to swapwithmaster
fixes #11042
Diffstat (limited to 'src/layout/MasterLayout.cpp')
| -rw-r--r-- | src/layout/MasterLayout.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/layout/MasterLayout.cpp b/src/layout/MasterLayout.cpp index abdf8032..c0f8e5a7 100644 --- a/src/layout/MasterLayout.cpp +++ b/src/layout/MasterLayout.cpp @@ -1078,11 +1078,12 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri auto command = vars[0]; - // swapwithmaster <master | child | auto> + // swapwithmaster <master | child | auto> <ignoremaster> // first message argument can have the following values: // * master - keep the focus at the new master // * child - keep the focus at the new child // * auto (default) - swap the focus (keep the focus of the previously selected window) + // * ignoremaster - ignore if master is focused if (command == "swapwithmaster") { const auto PWINDOW = header.pWindow; @@ -1099,13 +1100,15 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri const auto NEWCHILD = PMASTER->pWindow.lock(); + const bool IGNORE_IF_MASTER = vars.size() >= 2 && std::ranges::any_of(vars, [](const auto& e) { return e == "ignoremaster"; }); + if (PMASTER->pWindow.lock() != PWINDOW) { const auto NEWMASTER = PWINDOW; const bool newFocusToChild = vars.size() >= 2 && vars[1] == "child"; switchWindows(NEWMASTER, NEWCHILD); const auto NEWFOCUS = newFocusToChild ? NEWCHILD : NEWMASTER; switchToWindow(NEWFOCUS); - } else { + } else if (!IGNORE_IF_MASTER) { for (auto const& n : m_masterNodesData) { if (n.workspaceID == PMASTER->workspaceID && !n.isMaster) { const auto NEWMASTER = n.pWindow.lock(); |
