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:
parent
bf8e762178
commit
f239179682
@ -303,6 +303,9 @@ class ControlsManager extends St.Widget {
|
|||||||
|
|
||||||
this._thumbnailsBox =
|
this._thumbnailsBox =
|
||||||
new WorkspaceThumbnail.ThumbnailsBox(this._workspaceAdjustment);
|
new WorkspaceThumbnail.ThumbnailsBox(this._workspaceAdjustment);
|
||||||
|
this._thumbnailsBox.connect('notify::should-show',
|
||||||
|
() => this._updateThumbnailsBox());
|
||||||
|
|
||||||
this._workspacesDisplay = new WorkspacesView.WorkspacesDisplay(
|
this._workspacesDisplay = new WorkspacesView.WorkspacesDisplay(
|
||||||
this,
|
this,
|
||||||
this._workspaceAdjustment,
|
this._workspaceAdjustment,
|
||||||
@ -426,10 +429,11 @@ class ControlsManager extends St.Widget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_updateThumbnailsBox(animate = false) {
|
_updateThumbnailsBox(animate = false) {
|
||||||
|
const { shouldShow } = this._thumbnailsBox;
|
||||||
const { searchActive } = this._searchController;
|
const { searchActive } = this._searchController;
|
||||||
const [opacity, scale, translationY] = this._getThumbnailsBoxParams();
|
const [opacity, scale, translationY] = this._getThumbnailsBoxParams();
|
||||||
|
|
||||||
const thumbnailsBoxVisible = !searchActive && opacity !== 0;
|
const thumbnailsBoxVisible = shouldShow && !searchActive && opacity !== 0;
|
||||||
if (thumbnailsBoxVisible) {
|
if (thumbnailsBoxVisible) {
|
||||||
this._thumbnailsBox.opacity = 0;
|
this._thumbnailsBox.opacity = 0;
|
||||||
this._thumbnailsBox.visible = thumbnailsBoxVisible;
|
this._thumbnailsBox.visible = thumbnailsBoxVisible;
|
||||||
|
@ -607,6 +607,10 @@ var ThumbnailsBox = GObject.registerClass({
|
|||||||
'scale', 'scale', 'scale',
|
'scale', 'scale', 'scale',
|
||||||
GObject.ParamFlags.READWRITE,
|
GObject.ParamFlags.READWRITE,
|
||||||
0, Infinity, 0),
|
0, Infinity, 0),
|
||||||
|
'should-show': GObject.ParamSpec.boolean(
|
||||||
|
'should-show', 'should-show', 'should-show',
|
||||||
|
GObject.ParamFlags.READABLE,
|
||||||
|
true),
|
||||||
},
|
},
|
||||||
}, class ThumbnailsBox extends St.Widget {
|
}, class ThumbnailsBox extends St.Widget {
|
||||||
_init(scrollAdjustment) {
|
_init(scrollAdjustment) {
|
||||||
@ -643,6 +647,8 @@ var ThumbnailsBox = GObject.registerClass({
|
|||||||
this._stateUpdateQueued = false;
|
this._stateUpdateQueued = false;
|
||||||
this._animatingIndicator = false;
|
this._animatingIndicator = false;
|
||||||
|
|
||||||
|
this._shouldShow = true;
|
||||||
|
|
||||||
this._stateCounts = {};
|
this._stateCounts = {};
|
||||||
for (let key in ThumbnailState)
|
for (let key in ThumbnailState)
|
||||||
this._stateCounts[ThumbnailState[key]] = 0;
|
this._stateCounts[ThumbnailState[key]] = 0;
|
||||||
@ -669,7 +675,7 @@ var ThumbnailsBox = GObject.registerClass({
|
|||||||
|
|
||||||
this._settings = new Gio.Settings({ schema_id: MUTTER_SCHEMA });
|
this._settings = new Gio.Settings({ schema_id: MUTTER_SCHEMA });
|
||||||
this._settings.connect('changed::dynamic-workspaces',
|
this._settings.connect('changed::dynamic-workspaces',
|
||||||
this._updateSwitcherVisibility.bind(this));
|
() => this._updateShouldShow());
|
||||||
|
|
||||||
Main.layoutManager.connect('monitors-changed', () => {
|
Main.layoutManager.connect('monitors-changed', () => {
|
||||||
this._destroyThumbnails();
|
this._destroyThumbnails();
|
||||||
@ -700,12 +706,16 @@ var ThumbnailsBox = GObject.registerClass({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_updateSwitcherVisibility() {
|
_updateShouldShow() {
|
||||||
let workspaceManager = global.workspace_manager;
|
const { nWorkspaces } = global.workspace_manager;
|
||||||
|
const shouldShow =
|
||||||
|
this._settings.get_boolean('dynamic-workspaces') || nWorkspaces > 1;
|
||||||
|
|
||||||
this.visible =
|
if (this._shouldShow === shouldShow)
|
||||||
this._settings.get_boolean('dynamic-workspaces') ||
|
return;
|
||||||
workspaceManager.n_workspaces > 1;
|
|
||||||
|
this._shouldShow = shouldShow;
|
||||||
|
this.notify('should-show');
|
||||||
}
|
}
|
||||||
|
|
||||||
_activateThumbnailAtPoint(stageX, stageY, time) {
|
_activateThumbnailAtPoint(stageX, stageY, time) {
|
||||||
@ -960,7 +970,7 @@ var ThumbnailsBox = GObject.registerClass({
|
|||||||
|
|
||||||
this.addThumbnails(0, workspaceManager.n_workspaces);
|
this.addThumbnails(0, workspaceManager.n_workspaces);
|
||||||
|
|
||||||
this._updateSwitcherVisibility();
|
this._updateShouldShow();
|
||||||
}
|
}
|
||||||
|
|
||||||
_destroyThumbnails() {
|
_destroyThumbnails() {
|
||||||
@ -1011,7 +1021,7 @@ var ThumbnailsBox = GObject.registerClass({
|
|||||||
this.removeThumbnails(removedIndex, removedNum);
|
this.removeThumbnails(removedIndex, removedNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._updateSwitcherVisibility();
|
this._updateShouldShow();
|
||||||
}
|
}
|
||||||
|
|
||||||
addThumbnails(start, count) {
|
addThumbnails(start, count) {
|
||||||
@ -1408,4 +1418,8 @@ var ThumbnailsBox = GObject.registerClass({
|
|||||||
childBox.y2 += indicatorBottomFullBorder;
|
childBox.y2 += indicatorBottomFullBorder;
|
||||||
this._indicator.allocate(childBox);
|
this._indicator.allocate(childBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get shouldShow() {
|
||||||
|
return this._shouldShow;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user