Added nofocus rule

This commit is contained in:
vaxerski 2022-05-14 14:37:57 +02:00
parent 0273d21a77
commit a1567feb3d
4 changed files with 13 additions and 1 deletions

View file

@ -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;

View file

@ -63,6 +63,9 @@ public:
DYNLISTENER(configureX11);
//
// For nofocus
bool m_bNoFocus = false;
SSurfaceTreeNode* m_pSurfaceTree = nullptr;
// Animated border

View file

@ -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;

View file

@ -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);