workspacesView: Center workspaces of primary display
Currently workspaces are left-aligned to the allocation, which looks odd after moving the Dash to the bottom. Allocate workspaces centered both horizontally and vertically. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1587>
This commit is contained in:
parent
bc2cb9d910
commit
eb4f6740c3
@ -114,14 +114,17 @@ class WorkspacesView extends WorkspacesViewBase {
|
|||||||
const vertical = workspaceManager.layout_rows === -1;
|
const vertical = workspaceManager.layout_rows === -1;
|
||||||
const rtl = this.text_direction === Clutter.TextDirection.RTL;
|
const rtl = this.text_direction === Clutter.TextDirection.RTL;
|
||||||
|
|
||||||
|
const [width, height] = box.get_size();
|
||||||
|
const childBox = box.copy();
|
||||||
|
|
||||||
this._workspaces.forEach((child, index) => {
|
this._workspaces.forEach((child, index) => {
|
||||||
if (rtl && !vertical)
|
if (rtl && !vertical)
|
||||||
index = nWorkspaces - index - 1;
|
index = nWorkspaces - index - 1;
|
||||||
|
|
||||||
const x = vertical ? 0 : index * this.width;
|
childBox.set_origin(
|
||||||
const y = vertical ? index * this.height : 0;
|
vertical ? 0 : index * width,
|
||||||
|
vertical ? index * height : 0);
|
||||||
child.allocate_available_size(x, y, box.get_width(), box.get_height());
|
child.allocate_align_fill(childBox, 0.5, 0.5, false, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
this._updateScrollPosition();
|
this._updateScrollPosition();
|
||||||
|
Loading…
Reference in New Issue
Block a user