summaryrefslogtreecommitdiff
path: root/src/managers/LayoutManager.cpp
diff options
context:
space:
mode:
authorDarksome <dev@darkso.me>2022-07-21 19:18:03 +0300
committerDarksome <dev@darkso.me>2022-07-21 19:18:03 +0300
commiteb8a1939e6dddaaf81f6b623d1c657b801978487 (patch)
treed62d4ca30d4114fe2e2745e36907b65ac4be20af /src/managers/LayoutManager.cpp
parent68cfc1a496f556f360c032651b75d33ddb576517 (diff)
parent7f660fed0d4a8133ccde21c3e092dbc8c6e08c60 (diff)
Merge upstream
Diffstat (limited to 'src/managers/LayoutManager.cpp')
-rw-r--r--src/managers/LayoutManager.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/managers/LayoutManager.cpp b/src/managers/LayoutManager.cpp
index ec723350..8e7e397b 100644
--- a/src/managers/LayoutManager.cpp
+++ b/src/managers/LayoutManager.cpp
@@ -4,8 +4,28 @@ IHyprLayout* CLayoutManager::getCurrentLayout() {
switch (m_iCurrentLayoutID) {
case DWINDLE:
return &m_cDwindleLayout;
+ case MASTER:
+ return &m_cMasterLayout;
}
// fallback
return &m_cDwindleLayout;
+}
+
+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());
+ }
} \ No newline at end of file