[gnome-shell] workspace: Center-align window previews if there's only a single row
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] workspace: Center-align window previews if there's only a single row
- Date: Wed, 3 Mar 2021 14:19:53 +0000 (UTC)
commit 31d7770eeb1c7fddb57ff7b8b92bddd17cb3548c
Author: Jonas Dreßler <verdre v0yd nl>
Date: Wed Feb 3 10:37:56 2021 +0100
workspace: Center-align window previews if there's only a single row
Instead of always aligning window previews vertically at the bottom of
their row, only do that if we have multiple rows. If there's only a
single row of windows, align every window vertically centered.
This is a very small step towards the new layout for window previews in
the overview, but since the release of 40 is getting nearer and nearer,
changing more is not feasible anymore.
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3634
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1737>
js/ui/workspace.js | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index fbbbef2b3b..ec08b7355a 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -343,7 +343,10 @@ var UnalignedLayoutStrategy = class extends LayoutStrategy {
compensation /= 2;
for (let i = 0; i < rows.length; i++) {
- let row = rows[i];
+ const row = rows[i];
+ const rowY = row.y + compensation;
+ const rowHeight = row.height * row.additionalScale;
+
let x = row.x;
for (let j = 0; j < row.windows.length; j++) {
let window = row.windows[j];
@@ -357,7 +360,14 @@ var UnalignedLayoutStrategy = class extends LayoutStrategy {
const cloneHeight = window.boundingBox.height * s;
let cloneX = x + (cellWidth - cloneWidth) / 2;
- let cloneY = row.y + row.height * row.additionalScale - cellHeight + compensation;
+ let cloneY;
+
+ // If there's only one row, align windows vertically centered inside the row
+ if (rows.length === 1)
+ cloneY = rowY + (rowHeight - cloneHeight) / 2;
+ // If there are multiple rows, align windows to the bottom edge of the row
+ else
+ cloneY = rowY + rowHeight - cellHeight;
// Align with the pixel grid to prevent blurry windows at scale = 1
cloneX = Math.floor(cloneX);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]