allow cyclenext on null focus

This commit is contained in:
vaxerski 2022-10-28 21:31:39 +01:00
parent 1a767b021b
commit 9e227a52c0

View file

@ -1422,9 +1422,6 @@ void CKeybindManager::resizeWindow(std::string args) {
}
void CKeybindManager::circleNext(std::string arg) {
if (!g_pCompositor->m_pLastWindow)
return;
auto switchToWindow = [&](CWindow* PWINDOWTOCHANGETO) {
if (PWINDOWTOCHANGETO == g_pCompositor->m_pLastWindow || !PWINDOWTOCHANGETO)
return;
@ -1447,6 +1444,17 @@ void CKeybindManager::circleNext(std::string arg) {
}
};
if (!g_pCompositor->m_pLastWindow) {
// if we have a clear focus, find the first window and get the next focusable.
if (g_pCompositor->getWindowsOnWorkspace(g_pCompositor->m_pLastMonitor->activeWorkspace) > 0) {
const auto PWINDOW = g_pCompositor->getNextWindowOnWorkspace(g_pCompositor->getFirstWindowOnWorkspace(g_pCompositor->m_pLastMonitor->activeWorkspace), true);
switchToWindow(PWINDOW);
}
return;
}
if (arg == "last" || arg == "l" || arg == "prev" || arg == "p")
switchToWindow(g_pCompositor->getPrevWindowOnWorkspace(g_pCompositor->m_pLastWindow, true));
else