diff options
author | vaxerski <[email protected]> | 2022-08-25 22:34:53 +0200 |
---|---|---|
committer | vaxerski <[email protected]> | 2022-08-25 22:34:53 +0200 |
commit | 7b01c3d028ee5e6423b65388966162a50813b83b (patch) | |
tree | 5ccd511ba9d527220244902008b93f0e86bc868f | |
parent | 89018bfa954e038050e47a399d88e8a8b34dc481 (diff) | |
download | Hyprland-7b01c3d028ee5e6423b65388966162a50813b83b.tar.gz Hyprland-7b01c3d028ee5e6423b65388966162a50813b83b.zip |
allow specifying window for toggle floating
-rw-r--r-- | src/managers/KeybindManager.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index adc77140..ec4755a8 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -463,19 +463,28 @@ void CKeybindManager::clearKeybinds() { } void CKeybindManager::toggleActiveFloating(std::string args) { - const auto ACTIVEWINDOW = g_pCompositor->m_pLastWindow; + CWindow* PWINDOW = nullptr; + + if (args != "" && args != "active" && args.length() > 1) { + PWINDOW = g_pCompositor->getWindowByRegex(args); + } else { + PWINDOW = g_pCompositor->m_pLastWindow; + } + + if (!PWINDOW) + return; - if (g_pCompositor->windowValidMapped(ACTIVEWINDOW)) { + if (g_pCompositor->windowValidMapped(PWINDOW)) { // remove drag status g_pInputManager->currentlyDraggedWindow = nullptr; - ACTIVEWINDOW->m_bIsFloating = !ACTIVEWINDOW->m_bIsFloating; + PWINDOW->m_bIsFloating = !PWINDOW->m_bIsFloating; - if (ACTIVEWINDOW->m_iWorkspaceID == SPECIAL_WORKSPACE_ID) { - moveActiveToWorkspace(std::to_string(g_pCompositor->getMonitorFromID(ACTIVEWINDOW->m_iMonitorID)->activeWorkspace)); + if (PWINDOW->m_iWorkspaceID == SPECIAL_WORKSPACE_ID && PWINDOW == g_pCompositor->m_pLastWindow) { + moveActiveToWorkspace(std::to_string(g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID)->activeWorkspace)); } - g_pLayoutManager->getCurrentLayout()->changeWindowFloatingMode(ACTIVEWINDOW); + g_pLayoutManager->getCurrentLayout()->changeWindowFloatingMode(PWINDOW); } } |