Hyprland/src/managers/LayoutManager.cpp

32 lines
868 B
C++
Raw Normal View History

#include "LayoutManager.hpp"
IHyprLayout* CLayoutManager::getCurrentLayout() {
switch (m_iCurrentLayoutID) {
2022-09-25 20:07:48 +02:00
case DWINDLE:
return &m_cDwindleLayout;
2022-07-16 15:57:31 +02:00
case MASTER:
return &m_cMasterLayout;
}
// fallback
return &m_cDwindleLayout;
2022-07-16 15:57:31 +02:00
}
void CLayoutManager::switchToLayout(std::string layout) {
if (layout == "dwindle") {
if (m_iCurrentLayoutID != DWINDLE) {
getCurrentLayout()->onDisable();
m_iCurrentLayoutID = DWINDLE;
getCurrentLayout()->onEnable();
}
} else if (layout == "master") {
if (m_iCurrentLayoutID != MASTER) {
getCurrentLayout()->onDisable();
m_iCurrentLayoutID = MASTER;
getCurrentLayout()->onEnable();
}
} else {
Debug::log(ERR, "Unknown layout %s!", layout.c_str());
}
2022-09-25 20:07:48 +02:00
}