added maximize windowrule

This commit is contained in:
vaxerski 2022-12-23 19:34:28 +00:00
parent e6cbb6072b
commit 5fe437da7e
2 changed files with 6 additions and 3 deletions

View file

@ -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 && 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.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 != "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); RULE.find("workspace") != 0 && RULE.find("bordercolor") != 0);
} }

View file

@ -111,6 +111,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
bool requestsFullscreen = PWINDOW->m_bWantsInitialFullscreen || 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.xdg->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL && PWINDOW->m_uSurface.xdg->toplevel->requested.fullscreen) ||
(PWINDOW->m_bIsX11 && PWINDOW->m_uSurface.xwayland->fullscreen); (PWINDOW->m_bIsX11 && PWINDOW->m_uSurface.xwayland->fullscreen);
bool requestsMaximize = false;
bool shouldFocus = true; bool shouldFocus = true;
bool workspaceSpecial = false; bool workspaceSpecial = false;
@ -173,6 +174,8 @@ void Events::listener_mapWindow(void* owner, void* data) {
PWINDOW->m_sAdditionalConfigData.forceAllowsInput = true; PWINDOW->m_sAdditionalConfigData.forceAllowsInput = true;
} else if (r.szRule == "pin") { } else if (r.szRule == "pin") {
PWINDOW->m_bPinned = true; PWINDOW->m_bPinned = true;
} else if (r.szRule == "maximize") {
requestsMaximize = true;
} else if (r.szRule.find("idleinhibit") == 0) { } else if (r.szRule.find("idleinhibit") == 0) {
auto IDLERULE = r.szRule.substr(r.szRule.find_first_of(' ') + 1); 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_vRealPosition.setCallbackOnEnd(setAnimToMove);
PWINDOW->m_vRealSize.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) // fix fullscreen on requested (basically do a switcheroo)
if (PWORKSPACE->m_bHasFullscreenWindow) { if (PWORKSPACE->m_bHasFullscreenWindow) {
const auto PFULLWINDOW = g_pCompositor->getFullscreenWindowOnWorkspace(PWORKSPACE->m_iID); 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_vRealPosition.warp();
PWINDOW->m_vRealSize.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) { if (pFullscreenWindow && workspaceSilent) {