diff options
author | vaxerski <[email protected]> | 2022-05-14 14:37:57 +0200 |
---|---|---|
committer | vaxerski <[email protected]> | 2022-05-14 14:37:57 +0200 |
commit | a1567feb3ded69ae7dd6f46bf7d1da82ee3a5ecc (patch) | |
tree | faa1d80f166de90a0e10a0ffaa2f26728ad4fa05 | |
parent | 0273d21a77074a0fdeacdaecbb4255aef2883a51 (diff) | |
download | Hyprland-a1567feb3ded69ae7dd6f46bf7d1da82ee3a5ecc.tar.gz Hyprland-a1567feb3ded69ae7dd6f46bf7d1da82ee3a5ecc.zip |
Added nofocus rule
-rw-r--r-- | src/Compositor.cpp | 5 | ||||
-rw-r--r-- | src/Window.hpp | 3 | ||||
-rw-r--r-- | src/config/ConfigManager.cpp | 1 | ||||
-rw-r--r-- | src/events/Windows.cpp | 5 |
4 files changed, 13 insertions, 1 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp index ee1a0a1c..50ce621a 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -402,6 +402,11 @@ void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) { return; } + if (pWindow->m_bNoFocus) { + Debug::log(LOG, "Ignoring focus to nofocus window!"); + return; + } + if (!pWindow || !windowValidMapped(pWindow)) { wlr_seat_keyboard_notify_clear_focus(m_sSeat.seat); return; diff --git a/src/Window.hpp b/src/Window.hpp index 11580138..7dcbb850 100644 --- a/src/Window.hpp +++ b/src/Window.hpp @@ -63,6 +63,9 @@ public: DYNLISTENER(configureX11); // + // For nofocus + bool m_bNoFocus = false; + SSurfaceTreeNode* m_pSurfaceTree = nullptr; // Animated border diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 1083db44..6716de5d 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -341,6 +341,7 @@ void CConfigManager::handleWindowRule(const std::string& command, const std::str && RULE.find("size") != 0 && RULE.find("pseudo") != 0 && RULE.find("monitor") != 0 + && RULE.find("nofocus") != 0 && RULE.find("workspace") != 0) { Debug::log(ERR, "Invalid rule found: %s", RULE.c_str()); parseError = "Invalid rule found: " + RULE; diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index 88c1d897..926d1685 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -87,6 +87,8 @@ void Events::listener_mapWindow(void* owner, void* data) { PWINDOW->m_bIsFloating = false; } else if (r.szRule.find("pseudo") == 0) { PWINDOW->m_bIsPseudotiled = true; + } else if (r.szRule.find("nofocus") == 0) { + PWINDOW->m_bNoFocus = true; } else if (r.szRule.find("opacity") == 0) { try { PWINDOW->m_sSpecialRenderData.alpha = std::stof(r.szRule.substr(r.szRule.find_first_of(' ') + 1)); @@ -147,7 +149,8 @@ void Events::listener_mapWindow(void* owner, void* data) { PWINDOW->m_vPseudoSize = PWINDOW->m_vRealSize.goalv() - Vector2D(10,10); } - g_pCompositor->focusWindow(PWINDOW); + if (!PWINDOW->m_bNoFocus) + g_pCompositor->focusWindow(PWINDOW); PWINDOW->m_pSurfaceTree = SubsurfaceTree::createTreeRoot(g_pXWaylandManager->getWindowSurface(PWINDOW), addViewCoords, PWINDOW); |