diff --git a/extension.js b/extension.js index 86c340e..c9569ed 100644 --- a/extension.js +++ b/extension.js @@ -72,6 +72,10 @@ class Extension { this._origAddWindowClone = Workspace.prototype._addWindowClone; this._origShouldAnimateActor = WindowManager.prototype._shouldAnimateActor; + // We will also override these animation times. + this._origWindowTime = imports.ui.windowManager.DESTROY_WINDOW_ANIMATION_TIME; + this._origDialogTime = imports.ui.windowManager.DIALOG_DESTROY_WINDOW_ANIMATION_TIME; + // We will use extensionThis to refer to the extension inside the patched methods of // the WorkspacesView. const extensionThis = this; @@ -152,9 +156,11 @@ class Extension { } // We do nothing if a dialog got closed and we should not burn them. - if (!this._settings.get_boolean('destroy-dialogs') && - (actor.meta_window.window_type == Meta.WindowType.MODAL_DIALOG || - actor.meta_window.window_type == Meta.WindowType.DIALOG)) { + const isDialogWindow = + actor.meta_window.window_type == Meta.WindowType.MODAL_DIALOG || + actor.meta_window.window_type == Meta.WindowType.DIALOG; + + if (!this._settings.get_boolean('destroy-dialogs') && isDialogWindow) { return; } @@ -188,6 +194,20 @@ class Extension { shader.set_uniform_value('uSizeY', actor.height); }); } + + // The code below is not necessary for Burn-My-Windows to function. However, there + // are some extensions such as "Show Application View When Workspace Empty" + // https://extensions.gnome.org/extension/2036/show-application-view-when-workspace-empty/ + // which do something *after* a window was closed. As the window-close animation + // duration depends on the used effect, this may vary each time a window is closed. + // We set the currently used time here, so that others can get an idea how long this + // will take... + const duration = transition.get_duration(); + if (isDialogWindow) { + imports.ui.windowManager.DIALOG_DESTROY_WINDOW_ANIMATION_TIME = duration; + } else { + imports.ui.windowManager.DESTROY_WINDOW_ANIMATION_TIME = duration; + } }); } @@ -206,6 +226,9 @@ class Extension { Workspace.prototype._addWindowClone = this._origAddWindowClone; WindowManager.prototype._shouldAnimateActor = this._origShouldAnimateActor; + imports.ui.windowManager.DESTROY_WINDOW_ANIMATION_TIME = this._origWindowTime; + imports.ui.windowManager.DIALOG_DESTROY_WINDOW_ANIMATION_TIME = this._origDialogTime; + if (WindowPreview) { WindowPreview.prototype._deleteAll = this._origDeleteAll; }