mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-23 03:29:48 +01:00
Added nofocus rule
This commit is contained in:
parent
0273d21a77
commit
a1567feb3d
4 changed files with 13 additions and 1 deletions
|
@ -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;
|
||||
|
|
|
@ -63,6 +63,9 @@ public:
|
|||
DYNLISTENER(configureX11);
|
||||
//
|
||||
|
||||
// For nofocus
|
||||
bool m_bNoFocus = false;
|
||||
|
||||
SSurfaceTreeNode* m_pSurfaceTree = nullptr;
|
||||
|
||||
// Animated border
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,6 +149,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||
PWINDOW->m_vPseudoSize = PWINDOW->m_vRealSize.goalv() - Vector2D(10,10);
|
||||
}
|
||||
|
||||
if (!PWINDOW->m_bNoFocus)
|
||||
g_pCompositor->focusWindow(PWINDOW);
|
||||
|
||||
PWINDOW->m_pSurfaceTree = SubsurfaceTree::createTreeRoot(g_pXWaylandManager->getWindowSurface(PWINDOW), addViewCoords, PWINDOW);
|
||||
|
|
Loading…
Reference in a new issue