keybinds: Added toggleswallow dispatcher (#5548)
* Added `toggleswallow` dispatcher * clang-format * Removed brackets for 1-line if
This commit is contained in:
parent
3b99e906df
commit
84c9baecc6
5 changed files with 38 additions and 7 deletions
|
|
@ -113,6 +113,7 @@ CKeybindManager::CKeybindManager() {
|
|||
m_mDispatchers["focuswindowbyclass"] = focusWindow;
|
||||
m_mDispatchers["focuswindow"] = focusWindow;
|
||||
m_mDispatchers["tagwindow"] = tagWindow;
|
||||
m_mDispatchers["toggleswallow"] = toggleSwallow;
|
||||
m_mDispatchers["submap"] = setSubmap;
|
||||
m_mDispatchers["pass"] = pass;
|
||||
m_mDispatchers["sendshortcut"] = sendshortcut;
|
||||
|
|
@ -2306,6 +2307,27 @@ SDispatchResult CKeybindManager::tagWindow(std::string args) {
|
|||
return {};
|
||||
}
|
||||
|
||||
SDispatchResult CKeybindManager::toggleSwallow(std::string args) {
|
||||
PHLWINDOWREF pWindow = g_pCompositor->m_pLastWindow;
|
||||
|
||||
if (!valid(pWindow) || !valid(pWindow->m_pSwallowed))
|
||||
return {};
|
||||
|
||||
if (pWindow->m_pSwallowed->m_bCurrentlySwallowed) {
|
||||
// Unswallow
|
||||
pWindow->m_pSwallowed->m_bCurrentlySwallowed = false;
|
||||
pWindow->m_pSwallowed->setHidden(false);
|
||||
g_pLayoutManager->getCurrentLayout()->onWindowCreated(pWindow->m_pSwallowed.lock());
|
||||
} else {
|
||||
// Reswallow
|
||||
pWindow->m_pSwallowed->m_bCurrentlySwallowed = true;
|
||||
pWindow->m_pSwallowed->setHidden(true);
|
||||
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(pWindow->m_pSwallowed.lock());
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
SDispatchResult CKeybindManager::setSubmap(std::string submap) {
|
||||
if (submap == "reset" || submap == "") {
|
||||
m_szCurrentSelectedSubmap = "";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue