Remove close button from previews having transient

This commit is contained in:
Charles Gagnon
2019-06-04 14:12:18 -04:00
parent 68ef3683bf
commit 89c33ef844
2 changed files with 13 additions and 1 deletions

View File

@@ -283,6 +283,14 @@ var getWorkspaceCount = function() {
return DisplayWrapper.getWorkspaceManager().n_workspaces;
};
var checkIfWindowHasTransient = function(window) {
let hasTransient;
window.foreach_transient(t => !(hasTransient = true));
return hasTransient;
};
var findIndex = function(array, predicate) {
if (Array.prototype.findIndex) {
return array.findIndex(predicate);

View File

@@ -597,6 +597,7 @@ var Preview = Utils.defineClass({
});
this.window = null;
this._needsCloseButton = true;
this.cloneWidth = this.cloneHeight = 0;
this._panelWrapper = panelWrapper;
this._previewMenu = previewMenu;
@@ -702,6 +703,7 @@ var Preview = Utils.defineClass({
this._removeWindowSignals();
this.window = window;
this._needsCloseButton = window.can_close() && !Utils.checkIfWindowHasTransient(window);
this._updateHeader();
},
@@ -853,7 +855,9 @@ var Preview = Utils.defineClass({
},
_hideOrShowCloseButton: function(hide) {
Tweener.addTween(this._closeButtonBin, getTweenOpts({ opacity: hide ? 0 : 255 }));
if (this._needsCloseButton) {
Tweener.addTween(this._closeButtonBin, getTweenOpts({ opacity: hide ? 0 : 255 }));
}
},
_getBackgroundColor: function(offset, alpha) {