workspaceThumbnails: Only show for more than two workspaces

As adjacent workspaces now peek into the window picker, the first
two workspaces are already accessible without the minimap. Hide
it in that case to give more space to the window picker, and to
not clutter the overview for users who aren't using workspaces.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3739

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1696>
This commit is contained in:
Florian Müllner 2021-02-16 20:15:21 +01:00
parent d3a1557864
commit 2fdee8e444

View File

@ -8,6 +8,8 @@ const Main = imports.ui.main;
const Util = imports.misc.util; const Util = imports.misc.util;
const Workspace = imports.ui.workspace; const Workspace = imports.ui.workspace;
const NUM_WORKSPACES_THRESHOLD = 2;
// The maximum size of a thumbnail is 5% the width and height of the screen // The maximum size of a thumbnail is 5% the width and height of the screen
var MAX_THUMBNAIL_SCALE = 0.05; var MAX_THUMBNAIL_SCALE = 0.05;
@ -718,8 +720,9 @@ var ThumbnailsBox = GObject.registerClass({
_updateShouldShow() { _updateShouldShow() {
const { nWorkspaces } = global.workspace_manager; const { nWorkspaces } = global.workspace_manager;
const shouldShow = const shouldShow = this._settings.get_boolean('dynamic-workspaces')
this._settings.get_boolean('dynamic-workspaces') || nWorkspaces > 1; ? nWorkspaces > NUM_WORKSPACES_THRESHOLD
: nWorkspaces > 1;
if (this._shouldShow === shouldShow) if (this._shouldShow === shouldShow)
return; return;