Added moveintogroup dispatcher

This commit is contained in:
vaxerski 2023-02-26 13:52:11 +00:00
parent 3bfaeacf7d
commit 55b412e0f4
2 changed files with 28 additions and 2 deletions

View file

@ -61,6 +61,7 @@ CKeybindManager::CKeybindManager() {
m_mDispatchers["focusurgentorlast"] = focusUrgentOrLast; m_mDispatchers["focusurgentorlast"] = focusUrgentOrLast;
m_mDispatchers["focuscurrentorlast"] = focusCurrentOrLast; m_mDispatchers["focuscurrentorlast"] = focusCurrentOrLast;
m_mDispatchers["lockgroups"] = lockGroups; m_mDispatchers["lockgroups"] = lockGroups;
m_mDispatchers["moveintogroup"] = moveIntoGroup;
m_tScrollTimer.reset(); m_tScrollTimer.reset();
} }
@ -2056,3 +2057,26 @@ void CKeybindManager::lockGroups(std::string args) {
g_pKeybindManager->m_bGroupsLocked = false; g_pKeybindManager->m_bGroupsLocked = false;
} }
} }
void CKeybindManager::moveIntoGroup(std::string args) {
char arg = args[0];
if (!isDirection(args)) {
Debug::log(ERR, "Cannot move into group in direction %c, unsupported direction. Supported: l,r,u/t,d/b", arg);
return;
}
const auto PWINDOW = g_pCompositor->m_pLastWindow;
if (!PWINDOW || PWINDOW->m_bIsFloating)
return;
const auto PWINDOWINDIR = g_pCompositor->getWindowInDirection(PWINDOW, arg);
if (!PWINDOWINDIR || !PWINDOWINDIR->m_sGroupData.pNextWindow)
return;
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(PWINDOW);
PWINDOWINDIR->insertWindowToGroup(PWINDOW);
}

View file

@ -25,7 +25,8 @@ struct SKeybind {
bool shadowed = false; bool shadowed = false;
}; };
enum eFocusWindowMode { enum eFocusWindowMode
{
MODE_CLASS_REGEX = 0, MODE_CLASS_REGEX = 0,
MODE_TITLE_REGEX, MODE_TITLE_REGEX,
MODE_ADDRESS, MODE_ADDRESS,
@ -135,6 +136,7 @@ class CKeybindManager {
static void mouse(std::string); static void mouse(std::string);
static void bringActiveToTop(std::string); static void bringActiveToTop(std::string);
static void lockGroups(std::string); static void lockGroups(std::string);
static void moveIntoGroup(std::string);
friend class CCompositor; friend class CCompositor;
friend class CInputManager; friend class CInputManager;