2022-03-19 15:59:53 +01:00
|
|
|
#include "LayoutManager.hpp"
|
|
|
|
|
|
|
|
IHyprLayout* CLayoutManager::getCurrentLayout() {
|
|
|
|
switch (m_iCurrentLayoutID) {
|
|
|
|
case DWINDLE:
|
|
|
|
return &m_cDwindleLayout;
|
2022-07-16 15:57:31 +02:00
|
|
|
case MASTER:
|
|
|
|
return &m_cMasterLayout;
|
2022-03-19 15:59:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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-03-19 15:59:53 +01:00
|
|
|
}
|