core: add option to control which window to focus on close (#7368)

This commit is contained in:
ParaN3xus
2024-08-21 18:24:42 +08:00
committed by GitHub
parent 4eff224a7f
commit 946ed1f32a
3 changed files with 15 additions and 2 deletions

View File

@@ -648,7 +648,12 @@ void Events::listener_unmapWindow(void* owner, void* data) {
// refocus on a new window if needed
if (wasLastWindow) {
const auto PWINDOWCANDIDATE = g_pLayoutManager->getCurrentLayout()->getNextWindowCandidate(PWINDOW);
static auto FOCUSONCLOSE = CConfigValue<Hyprlang::INT>("input:focus_on_close");
PHLWINDOW PWINDOWCANDIDATE = nullptr;
if (*FOCUSONCLOSE)
PWINDOWCANDIDATE = (g_pCompositor->vectorToWindowUnified(g_pInputManager->getMouseCoordsInternal(), RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING));
else
PWINDOWCANDIDATE = g_pLayoutManager->getCurrentLayout()->getNextWindowCandidate(PWINDOW);
Debug::log(LOG, "On closed window, new focused candidate is {}", PWINDOWCANDIDATE);