From 757f3664cbe9e2bddea2427b641de29c4b4e4114 Mon Sep 17 00:00:00 2001 From: Hue Date: Tue, 2 Jun 2026 01:51:15 +0200 Subject: [PATCH] =?UTF-8?q?autohide-window=C2=A0:=20add=20margins=20to=20t?= =?UTF-8?q?he=20opposite=20edge=20if=20autohide=20is=20disabled?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The margins being mostly a matter of style, this makes it so that if a margin is applied and autohide is disabled, space is reserved on both sides of the window. However, wayfire 0.10.1 with gtk4-layer-shell 1.3 has a bug where auto exclusive zone doesn’t account for the margin size, which causes shell toplevels to go outside of the reserved space. Until this is fixed, on wayfire, this patch only prevents overlap and doesn’t cause the intended behaviour Wayfire issue : WayfireWM/wayfire#3038 --- src/util/wf-autohide-window.cpp | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/util/wf-autohide-window.cpp b/src/util/wf-autohide-window.cpp index 1e824d7f..7efc9c76 100644 --- a/src/util/wf-autohide-window.cpp +++ b/src/util/wf-autohide-window.cpp @@ -204,16 +204,35 @@ void WayfireAutohidingWindow::m_show_uncertain() void WayfireAutohidingWindow::update_position() { - /* Reset old anchors */ - gtk_layer_set_anchor(this->gobj(), GTK_LAYER_SHELL_EDGE_TOP, false); - gtk_layer_set_anchor(this->gobj(), GTK_LAYER_SHELL_EDGE_BOTTOM, false); - gtk_layer_set_anchor(this->gobj(), GTK_LAYER_SHELL_EDGE_LEFT, false); - gtk_layer_set_anchor(this->gobj(), GTK_LAYER_SHELL_EDGE_RIGHT, false); + // reset anchors and margins + for (auto edge : + {GTK_LAYER_SHELL_EDGE_TOP, GTK_LAYER_SHELL_EDGE_BOTTOM, GTK_LAYER_SHELL_EDGE_LEFT, + GTK_LAYER_SHELL_EDGE_RIGHT}) + { + gtk_layer_set_anchor(this->gobj(), edge, false); + gtk_layer_set_margin(this->gobj(), edge, 0); + } /* Set new anchor */ GtkLayerShellEdge edge = get_anchor_edge(position); gtk_layer_set_anchor(this->gobj(), edge, true); gtk_layer_set_margin(this->gobj(), edge, edge_margin); + if (auto_exclusive_zone) + { + if (edge == GTK_LAYER_SHELL_EDGE_TOP) + { + gtk_layer_set_margin(this->gobj(), GTK_LAYER_SHELL_EDGE_BOTTOM, edge_margin); + } else if (edge == GTK_LAYER_SHELL_EDGE_BOTTOM) + { + gtk_layer_set_margin(this->gobj(), GTK_LAYER_SHELL_EDGE_TOP, edge_margin); + } else if (edge == GTK_LAYER_SHELL_EDGE_LEFT) + { + gtk_layer_set_margin(this->gobj(), GTK_LAYER_SHELL_EDGE_RIGHT, edge_margin); + } else if (edge == GTK_LAYER_SHELL_EDGE_RIGHT) + { + gtk_layer_set_margin(this->gobj(), GTK_LAYER_SHELL_EDGE_LEFT, edge_margin); + } + } if (full_span) {