From de477a6ff589479e6ae8773ea5da097d7d0fdce5 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Thu, 25 Aug 2022 16:47:28 +0200 Subject: [PATCH] don't focus silent windows --- src/events/Windows.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index 0bb06f63..fbaadd51 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -108,6 +108,7 @@ void Events::listener_mapWindow(void* owner, void* data) { std::string requestedWorkspace = ""; bool workspaceSilent = false; bool requestsFullscreen = PWINDOW->m_bWantsInitialFullscreen || (!PWINDOW->m_bIsX11 && PWINDOW->m_uSurface.xdg->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL && PWINDOW->m_uSurface.xdg->toplevel->requested.fullscreen); + bool shouldFocus = true; for (auto& r : WINDOWRULES) { if (r.szRule.find("monitor") == 0) { @@ -188,10 +189,14 @@ void Events::listener_mapWindow(void* owner, void* data) { // check for silent if (requestedWorkspace.contains("silent")) { workspaceSilent = true; + shouldFocus = false; } requestedWorkspace = requestedWorkspace.substr(0, requestedWorkspace.find_first_of(' ')); + if (!shouldFocus && requestedWorkspace == std::to_string(PMONITOR->activeWorkspace)) + shouldFocus = true; + if (requestedWorkspace == "special") { workspaceSilent = true; } @@ -262,7 +267,7 @@ void Events::listener_mapWindow(void* owner, void* data) { PWINDOW->m_vPseudoSize = PWINDOW->m_vRealSize.goalv() - Vector2D(10,10); } - if (!PWINDOW->m_bNoFocus && !PWINDOW->m_bNoInitialFocus && PWINDOW->m_iX11Type != 2) { + if (!PWINDOW->m_bNoFocus && !PWINDOW->m_bNoInitialFocus && PWINDOW->m_iX11Type != 2 && shouldFocus) { g_pCompositor->focusWindow(PWINDOW); PWINDOW->m_fActiveInactiveAlpha.setValueAndWarp(*PACTIVEALPHA); } else