diff --git a/hyprscrolling/Scrolling.cpp b/hyprscrolling/Scrolling.cpp index 9b2a508..a385abe 100644 --- a/hyprscrolling/Scrolling.cpp +++ b/hyprscrolling/Scrolling.cpp @@ -145,7 +145,7 @@ SP SWorkspaceData::add() { return col; } -SP SWorkspaceData::add(size_t after) { +SP SWorkspaceData::add(int after) { static const auto PCOLWIDTH = CConfigValue("plugin:hyprscrolling:column_width"); auto col = makeShared(self.lock()); col->self = col; @@ -1125,15 +1125,20 @@ void CScrollingLayout::moveWindowTo(PHLWINDOW w, const std::string& dir, bool si if (dir == "l") { const auto COL = WS->prev(DATA->column.lock()); - if (!COL) - return; DATA->column->remove(w); - if (COL->windowDatas.size() > 1 || DATA->column) - COL->add(DATA, COL->idxForHeight(g_pInputManager->getMouseCoordsInternal().y) - 1); - else - COL->add(DATA); - WS->centerCol(COL); + + if (!COL) { + const auto NEWCOL = WS->add(-1); + NEWCOL->add(DATA); + WS->centerCol(NEWCOL); + } else { + if (COL->windowDatas.size() > 1 || DATA->column) + COL->add(DATA, COL->idxForHeight(g_pInputManager->getMouseCoordsInternal().y) - 1); + else + COL->add(DATA); + WS->centerCol(COL); + } } else if (dir == "r") { const auto COL = WS->next(DATA->column.lock()); diff --git a/hyprscrolling/Scrolling.hpp b/hyprscrolling/Scrolling.hpp index 435edce..2e6e6f9 100644 --- a/hyprscrolling/Scrolling.hpp +++ b/hyprscrolling/Scrolling.hpp @@ -61,7 +61,7 @@ struct SWorkspaceData { int leftOffset = 0; SP add(); - SP add(size_t after); + SP add(int after); int64_t idx(SP c); void remove(SP c); double maxWidth();