Hyprland/src/managers/LayoutManager.cpp

30 lines
886 B
C++
Raw Normal View History

#include "LayoutManager.hpp"
IHyprLayout* CLayoutManager::getCurrentLayout() {
switch (m_iCurrentLayoutID) {
2022-12-26 12:05:34 +01:00
case LAYOUT_DWINDLE: return &m_cDwindleLayout;
case LAYOUT_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") {
2022-12-26 12:05:34 +01:00
if (m_iCurrentLayoutID != LAYOUT_DWINDLE) {
2022-07-16 15:57:31 +02:00
getCurrentLayout()->onDisable();
2022-12-26 12:05:34 +01:00
m_iCurrentLayoutID = LAYOUT_DWINDLE;
2022-07-16 15:57:31 +02:00
getCurrentLayout()->onEnable();
}
} else if (layout == "master") {
2022-12-26 12:05:34 +01:00
if (m_iCurrentLayoutID != LAYOUT_MASTER) {
2022-07-16 15:57:31 +02:00
getCurrentLayout()->onDisable();
2022-12-26 12:05:34 +01:00
m_iCurrentLayoutID = LAYOUT_MASTER;
2022-07-16 15:57:31 +02:00
getCurrentLayout()->onEnable();
}
} else {
Debug::log(ERR, "Unknown layout %s!", layout.c_str());
}
2022-09-25 20:07:48 +02:00
}