added swapnext

This commit is contained in:
vaxerski 2022-08-24 21:40:36 +02:00
parent ffaf14c19e
commit 9c3aeda9f9
2 changed files with 21 additions and 0 deletions

View File

@ -39,6 +39,7 @@ CKeybindManager::CKeybindManager() {
m_mDispatchers["dpms"] = dpms;
m_mDispatchers["movewindowpixel"] = moveWindow;
m_mDispatchers["resizewindowpixel"] = resizeWindow;
m_mDispatchers["swapnext"] = swapNext;
m_tScrollTimer.reset();
}
@ -1437,3 +1438,22 @@ void CKeybindManager::dpms(std::string arg) {
g_pCompositor->m_bDPMSStateON = enable;
}
void CKeybindManager::swapnext(std::string arg) {
CWindow* toSwap = nullptr;
if (!g_pCompositor->windowValidMapped(g_pCompositor->m_pLastWindow))
return;
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow;
if (arg == "last" || arg == "l" || arg == "prev" || arg == "p")
toSwap = g_pCompositor->getPrevWindowOnWorkspace(PLASTWINDOW);
else
toSwap = g_pCompositor->getNextWindowOnWorkspace(PLASTWINDOW);
g_pLayoutManager->getCurrentLayout()->switchWindows(PLASTWINDOW, toSwap);
g_pCompositor->focusWindow(PLASTWINDOW);
}

View File

@ -107,6 +107,7 @@ private:
static void layoutmsg(std::string);
static void toggleOpaque(std::string);
static void dpms(std::string);
static void swapnext(std::string);
friend class CCompositor;
friend class CInputManager;