workspaceThumnails: Add :should-show property

We currently have two components that show or hide the minimap:

 - the thumbnails hide themselves in case of a single static workspace
 - overview controls show the minimap when no search is active

That obviously doesn't work correctly.

To fix this, change thumbnails to set a new :should-show property instead
of the visibility, and let the overview controls take it into account
when changing the visibility.

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:40:43 +01:00
parent bf8e762178
commit f239179682
2 changed files with 27 additions and 9 deletions

View File

@ -303,6 +303,9 @@ class ControlsManager extends St.Widget {
this._thumbnailsBox =
new WorkspaceThumbnail.ThumbnailsBox(this._workspaceAdjustment);
this._thumbnailsBox.connect('notify::should-show',
() => this._updateThumbnailsBox());
this._workspacesDisplay = new WorkspacesView.WorkspacesDisplay(
this,
this._workspaceAdjustment,
@ -426,10 +429,11 @@ class ControlsManager extends St.Widget {
}
_updateThumbnailsBox(animate = false) {
const { shouldShow } = this._thumbnailsBox;
const { searchActive } = this._searchController;
const [opacity, scale, translationY] = this._getThumbnailsBoxParams();
const thumbnailsBoxVisible = !searchActive && opacity !== 0;
const thumbnailsBoxVisible = shouldShow && !searchActive && opacity !== 0;
if (thumbnailsBoxVisible) {
this._thumbnailsBox.opacity = 0;
this._thumbnailsBox.visible = thumbnailsBoxVisible;