Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added toggleswallow dispatcher #5548

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/desktop/Window.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@ class CWindow {
CAnimatedVariable<float> m_fDimPercent;

// swallowing
CWindow* m_pSwallowed = nullptr;
CWindow* m_pSwallowed = nullptr;
CWindow* m_pPreviouslySwallowed = nullptr;

// focus stuff
bool m_bStayFocused = false;
Expand Down
23 changes: 23 additions & 0 deletions src/managers/KeybindManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ CKeybindManager::CKeybindManager() {
m_mDispatchers["cyclenext"] = circleNext;
m_mDispatchers["focuswindowbyclass"] = focusWindow;
m_mDispatchers["focuswindow"] = focusWindow;
m_mDispatchers["toggleswallow"] = toggleSwallow;
m_mDispatchers["submap"] = setSubmap;
m_mDispatchers["pass"] = pass;
m_mDispatchers["layoutmsg"] = layoutmsg;
Expand Down Expand Up @@ -1820,6 +1821,28 @@ void CKeybindManager::focusWindow(std::string regexp) {
g_pCompositor->warpCursorTo(PWINDOW->middle());
}

void CKeybindManager::toggleSwallow(std::string args) {
CWindow* pWindow = g_pCompositor->m_pLastWindow;
if (pWindow->m_pSwallowed && g_pCompositor->windowExists(pWindow->m_pSwallowed)) {
vaxerski marked this conversation as resolved.
Show resolved Hide resolved
pWindow->m_pPreviouslySwallowed = pWindow->m_pSwallowed;

pWindow->m_pSwallowed->setHidden(false);

g_pLayoutManager->getCurrentLayout()->onWindowCreated(pWindow->m_pSwallowed);

pWindow->m_pSwallowed = nullptr;

} else if (pWindow->m_pPreviouslySwallowed && g_pCompositor->windowExists(pWindow->m_pPreviouslySwallowed)) {
pWindow->m_pSwallowed = pWindow->m_pPreviouslySwallowed;

g_pLayoutManager->getCurrentLayout()->onWindowRemoved(pWindow->m_pPreviouslySwallowed);

pWindow->m_pPreviouslySwallowed->setHidden(true);

g_pLayoutManager->getCurrentLayout()->recalculateMonitor(pWindow->m_iMonitorID);
}
}

void CKeybindManager::setSubmap(std::string submap) {
if (submap == "reset" || submap == "") {
m_szCurrentSelectedSubmap = "";
Expand Down
1 change: 1 addition & 0 deletions src/managers/KeybindManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ class CKeybindManager {
static void forceRendererReload(std::string);
static void resizeActive(std::string);
static void moveActive(std::string);
static void toggleSwallow(std::string);
static void moveWindow(std::string);
static void resizeWindow(std::string);
static void circleNext(std::string);
Expand Down
Loading