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