diff --git a/extension.js b/extension.js index 1d1dee7..957c471 100644 --- a/extension.js +++ b/extension.js @@ -13,7 +13,7 @@ 'use strict'; -const {Clutter} = imports.gi; +const {Clutter, Meta} = imports.gi; const Workspace = imports.ui.workspace.Workspace; const WindowManager = imports.ui.windowManager.WindowManager; @@ -48,14 +48,22 @@ class Extension { this._origShouldAnimateActor = WindowManager.prototype._shouldAnimateActor; // We may also override these animation times. - this._origDestroyTime = imports.ui.windowManager.DESTROY_WINDOW_ANIMATION_TIME; + this._origWindowTime = imports.ui.windowManager.DESTROY_WINDOW_ANIMATION_TIME; + this._origDialogTime = imports.ui.windowManager.DIALOG_DESTROY_WINDOW_ANIMATION_TIME; + // Update animation times if the respective settings are changed. const loadAnimationTimes = () => { imports.ui.windowManager.DESTROY_WINDOW_ANIMATION_TIME = this._settings.get_int('destroy-animation-time'); + + imports.ui.windowManager.DIALOG_DESTROY_WINDOW_ANIMATION_TIME = + this._settings.get_boolean('destroy-dialogs') ? + this._settings.get_int('destroy-animation-time') : + this._origDialogTime; }; this._settings.connect('changed::destroy-animation-time', loadAnimationTimes); + this._settings.connect('changed::destroy-dialogs', loadAnimationTimes); loadAnimationTimes(); // We will use extensionThis to refer to the extension inside the patched methods of @@ -67,7 +75,7 @@ class Extension { // from the overview (why?). With these overrides we make sure that they are actually // faded out. To do this, _windowRemoved and _doRemoveWindow now check whether there // is a transition ongoing (via extensionThis._shouldDestroy). If that's the case, - // they methods do nothing. Are the actors removed in the end? I hope so. The + // these methods do nothing. Are the actors removed in the end? I hope so. The // _destroyWindow of the WindowManager sets the transitions up and should take care of // removing the actors at the end of the transitions. // https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/workspace.js#L1299 @@ -107,11 +115,18 @@ class Extension { // one, set up the window close animation. This usually fades-out the window and // scales it a bit down. If no transition is in progress, something unexpected // happened. We rather try not to burn the window! - const transition = actor.get_transition('opacity'); + const transition = actor.get_transition('scale-y'); if (!transition) { return; } + // 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)) { + return; + } + // If there's a transition in progress, we re-target these transitions so that the // window is neither scaled nor faded. const tweakTransition = (property, value) => { @@ -151,13 +166,16 @@ class Extension { Workspace.prototype._doRemoveWindow = this._origDoRemoveWindow; WindowManager.prototype._shouldAnimateActor = this._origShouldAnimateActor; - imports.ui.windowManager.DESTROY_WINDOW_ANIMATION_TIME = this._origDestroyTime; + imports.ui.windowManager.DESTROY_WINDOW_ANIMATION_TIME = this._origWindowTime; + imports.ui.windowManager.DIALOG_DESTROY_WINDOW_ANIMATION_TIME = this._origDialogTime; this._settings = null; } // ----------------------------------------------------------------------- private stuff + // This is required to enable window-close animations in the overview. See the comment + // for Workspace.prototype._windowRemoved above for an explanation. _shouldDestroy(workspace, metaWindow) { const index = workspace._lookupIndex(metaWindow); if (index == -1) { @@ -165,7 +183,7 @@ class Extension { } const actor = workspace._windows[index]._windowActor; - if (!actor.get_transition('opacity')) { + if (!actor.get_transition('scale-y')) { return true; } diff --git a/prefs.js b/prefs.js index df91abc..0d7eaee 100644 --- a/prefs.js +++ b/prefs.js @@ -44,6 +44,7 @@ var PreferencesDialog = class PreferencesDialog { // Bind all properties. this._bindAdjustment('destroy-animation-time'); + this._bindSwitch('destroy-dialogs'); this._bindAdjustment('flame-movement-speed'); this._bindAdjustment('flame-scale'); this._bindColorButton('fire-color-1'); diff --git a/resources/ui/gtk3.ui b/resources/ui/gtk3.ui index b45ec41..3809546 100644 --- a/resources/ui/gtk3.ui +++ b/resources/ui/gtk3.ui @@ -106,6 +106,50 @@ + + + 10 + 10 + 10 + 10 + 0 + + + 8 + + + Also Burn Dialogs + 0 + start + center + 1 + + + + + end + center + + + + + + + edit-clear-symbolic + 1 + + + Reset to Default Value + + + + + + + + diff --git a/resources/ui/gtk4.ui b/resources/ui/gtk4.ui index 170b315..e44b622 100644 --- a/resources/ui/gtk4.ui +++ b/resources/ui/gtk4.ui @@ -88,6 +88,40 @@ + + + 0 + + + + + Also Burn Dialogs + 0 + start + center + 1 + + + + + end + center + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + diff --git a/schemas/org.gnome.shell.extensions.burn-my-windows.gschema.xml b/schemas/org.gnome.shell.extensions.burn-my-windows.gschema.xml index dc4e287..0ad1dc5 100644 --- a/schemas/org.gnome.shell.extensions.burn-my-windows.gschema.xml +++ b/schemas/org.gnome.shell.extensions.burn-my-windows.gschema.xml @@ -9,6 +9,12 @@ The time it takes to burn the windows. + + true + Destroy Dialogs + Set to true to burn dialogs as well. + + 0.5 Flame Movement Speed