added a lockgroups dispatcher

This commit is contained in:
Vaxry 2023-02-21 12:13:35 +00:00
parent 431c74f111
commit a66ef50469
4 changed files with 16 additions and 5 deletions

View file

@ -292,7 +292,7 @@ void CHyprDwindleLayout::onWindowCreatedTiling(CWindow* pWindow) {
}
// if it's a group, add the window
if (OPENINGON->pWindow->m_sGroupData.pNextWindow) {
if (OPENINGON->pWindow->m_sGroupData.pNextWindow && !g_pKeybindManager->m_bGroupsLocked) {
m_lDwindleNodesData.remove(*PNODE);
OPENINGON->pWindow->insertWindowToGroup(pWindow);

View file

@ -87,7 +87,7 @@ void CHyprMasterLayout::onWindowCreatedTiling(CWindow* pWindow) {
getNodeFromWindow(g_pCompositor->m_pLastWindow) :
getMasterNodeOnWorkspace(pWindow->m_iWorkspaceID);
if (OPENINGON && OPENINGON->pWindow->m_sGroupData.pNextWindow && OPENINGON != PNODE) {
if (OPENINGON && OPENINGON->pWindow->m_sGroupData.pNextWindow && OPENINGON != PNODE && !g_pKeybindManager->m_bGroupsLocked) {
m_lMasterNodesData.remove(*PNODE);
OPENINGON->pWindow->insertWindowToGroup(pWindow);
@ -242,7 +242,7 @@ void CHyprMasterLayout::calculateWorkspace(const int& ws) {
if (getNodesOnWorkspace(PWORKSPACE->m_iID) < 2) {
PMASTERNODE->position = PMONITOR->vecReservedTopLeft + PMONITOR->vecPosition;
PMASTERNODE->size = Vector2D(PMONITOR->vecSize.x - PMONITOR->vecReservedTopLeft.x - PMONITOR->vecReservedBottomRight.x,
PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y - PMONITOR->vecReservedTopLeft.y);
PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y - PMONITOR->vecReservedTopLeft.y);
applyNodeDataToWindow(PMASTERNODE);
return;
} else if (PWORKSPACEDATA->orientation == ORIENTATION_LEFT || PWORKSPACEDATA->orientation == ORIENTATION_RIGHT) {

View file

@ -60,6 +60,7 @@ CKeybindManager::CKeybindManager() {
m_mDispatchers["bringactivetotop"] = bringActiveToTop;
m_mDispatchers["focusurgentorlast"] = focusUrgentOrLast;
m_mDispatchers["focuscurrentorlast"] = focusCurrentOrLast;
m_mDispatchers["lockgroups"] = lockGroups;
m_tScrollTimer.reset();
}
@ -2032,3 +2033,11 @@ void CKeybindManager::fakeFullscreenActive(std::string args) {
g_pCompositor->m_pLastWindow->m_bFakeFullscreenState || g_pCompositor->m_pLastWindow->m_bIsFullscreen);
}
}
void CKeybindManager::lockGroups(std::string args) {
if (args == "lock" || args.empty() || args == "lockgroups") {
g_pKeybindManager->m_bGroupsLocked = true;
} else {
g_pKeybindManager->m_bGroupsLocked = false;
}
}

View file

@ -25,8 +25,7 @@ struct SKeybind {
bool shadowed = false;
};
enum eFocusWindowMode
{
enum eFocusWindowMode {
MODE_CLASS_REGEX = 0,
MODE_TITLE_REGEX,
MODE_ADDRESS,
@ -55,6 +54,8 @@ class CKeybindManager {
wl_event_source* m_pActiveKeybindEventSource = nullptr;
bool m_bGroupsLocked = false;
std::list<SKeybind> m_lKeybinds;
private:
@ -133,6 +134,7 @@ class CKeybindManager {
static void pinActive(std::string);
static void mouse(std::string);
static void bringActiveToTop(std::string);
static void lockGroups(std::string);
friend class CCompositor;
friend class CInputManager;