From 5fe437da7e6a56e0eab68f857f9e00612d44225a Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Fri, 23 Dec 2022 19:34:28 +0000 Subject: [PATCH] added maximize windowrule --- src/config/ConfigManager.cpp | 2 +- src/events/Windows.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 401e7f1c..29d3189c 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -735,7 +735,7 @@ bool windowRuleValid(const std::string& RULE) { return !(RULE != "float" && RULE != "tile" && RULE.find("opacity") != 0 && RULE.find("move") != 0 && RULE.find("size") != 0 && RULE.find("minsize") != 0 && RULE.find("maxsize") != 0 && RULE.find("pseudo") != 0 && RULE.find("monitor") != 0 && RULE.find("idleinhibit") != 0 && RULE != "nofocus" && RULE != "noblur" && RULE != "noshadow" && RULE != "noborder" && RULE != "center" && RULE != "opaque" && RULE != "forceinput" && RULE != "fullscreen" && RULE != "nofullscreenrequest" && - RULE != "nomaxsize" && RULE != "pin" && RULE != "noanim" && RULE != "windowdance" && RULE.find("animation") != 0 && RULE.find("rounding") != 0 && + RULE != "nomaxsize" && RULE != "pin" && RULE != "noanim" && RULE != "windowdance" && RULE != "maximize" && RULE.find("animation") != 0 && RULE.find("rounding") != 0 && RULE.find("workspace") != 0 && RULE.find("bordercolor") != 0); } diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index 80b11831..00bcab97 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -111,6 +111,7 @@ void Events::listener_mapWindow(void* owner, void* data) { 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) || (PWINDOW->m_bIsX11 && PWINDOW->m_uSurface.xwayland->fullscreen); + bool requestsMaximize = false; bool shouldFocus = true; bool workspaceSpecial = false; @@ -173,6 +174,8 @@ void Events::listener_mapWindow(void* owner, void* data) { PWINDOW->m_sAdditionalConfigData.forceAllowsInput = true; } else if (r.szRule == "pin") { PWINDOW->m_bPinned = true; + } else if (r.szRule == "maximize") { + requestsMaximize = true; } else if (r.szRule.find("idleinhibit") == 0) { auto IDLERULE = r.szRule.substr(r.szRule.find_first_of(' ') + 1); @@ -457,7 +460,7 @@ void Events::listener_mapWindow(void* owner, void* data) { PWINDOW->m_vRealPosition.setCallbackOnEnd(setAnimToMove); PWINDOW->m_vRealSize.setCallbackOnEnd(setAnimToMove); - if (requestsFullscreen && !PWINDOW->m_bNoFullscreenRequest) { + if ((requestsFullscreen || requestsMaximize) && !PWINDOW->m_bNoFullscreenRequest) { // fix fullscreen on requested (basically do a switcheroo) if (PWORKSPACE->m_bHasFullscreenWindow) { const auto PFULLWINDOW = g_pCompositor->getFullscreenWindowOnWorkspace(PWORKSPACE->m_iID); @@ -467,7 +470,7 @@ void Events::listener_mapWindow(void* owner, void* data) { PWINDOW->m_vRealPosition.warp(); PWINDOW->m_vRealSize.warp(); - g_pCompositor->setWindowFullscreen(PWINDOW, true, FULLSCREEN_FULL); + g_pCompositor->setWindowFullscreen(PWINDOW, true, requestsFullscreen ? FULLSCREEN_FULL : FULLSCREEN_MAXIMIZED); } if (pFullscreenWindow && workspaceSilent) {