🔀 Merge branch 'main' into feature/matrix

This commit is contained in:
Simon Schneegans
2021-12-25 13:44:18 +01:00
5 changed files with 110 additions and 7 deletions
+24 -6
View File
@@ -13,7 +13,7 @@
'use strict';
const {Clutter, Gio} = imports.gi;
const {Clutter, Gio, Meta} = imports.gi;
const Workspace = imports.ui.workspace.Workspace;
const WindowManager = imports.ui.windowManager.WindowManager;
@@ -53,14 +53,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
@@ -72,7 +80,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
@@ -112,11 +120,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) => {
@@ -169,13 +184,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) {
@@ -183,7 +201,7 @@ class Extension {
}
const actor = workspace._windows[index]._windowActor;
if (!actor.get_transition('opacity')) {
if (!actor.get_transition('scale-y')) {
return true;
}
+2 -1
View File
@@ -43,8 +43,9 @@ var PreferencesDialog = class PreferencesDialog {
this._settings = ExtensionUtils.getSettings();
// Bind all properties.
this._bindAdjustment('destroy-animation-time');
this._bindCombobox('close-animation');
this._bindAdjustment('destroy-animation-time');
this._bindSwitch('destroy-dialogs');
this._bindAdjustment('flame-movement-speed');
this._bindAdjustment('flame-scale');
this._bindColorButton('fire-color-1');
+44
View File
@@ -189,6 +189,50 @@
</object>
</child>
<child>
<object class="GtkListBoxRow">
<property name="margin-start">10</property>
<property name="margin-end">10</property>
<property name="margin-top">10</property>
<property name="margin-bottom">10</property>
<property name="activatable">0</property>
<child>
<object class="GtkBox">
<property name="spacing">8</property>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Also Burn Dialogs</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
</object>
</child>
<child>
<object class="GtkSwitch" id="destroy-dialogs">
<property name="halign">end</property>
<property name="valign">center</property>
</object>
</child>
<child>
<object class="GtkButton" id="reset-destroy-dialogs">
<child>
<object class="GtkImage">
<property name="icon-name">edit-clear-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<property name="tooltip-text">Reset to Default Value</property>
<style>
<class name="flat" />
</style>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
+34
View File
@@ -147,6 +147,40 @@
</object>
</child>
<child>
<object class="GtkListBoxRow">
<property name="activatable">0</property>
<child>
<object class="GtkBox">
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Also Burn Dialogs</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
</object>
</child>
<child>
<object class="GtkSwitch" id="destroy-dialogs">
<property name="halign">end</property>
<property name="valign">center</property>
</object>
</child>
<child>
<object class="GtkButton" id="reset-destroy-dialogs">
<property name="icon-name">edit-clear-symbolic</property>
<property name="tooltip-text">Reset to Default Value</property>
<style>
<class name="flat" />
</style>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
@@ -21,6 +21,12 @@
<description>The time it takes to burn the windows.</description>
</key>
<key name="destroy-dialogs" type="b">
<default>true</default>
<summary>Destroy Dialogs</summary>
<description>Set to true to burn dialogs as well.</description>
</key>
<key name="flame-movement-speed" type="d">
<default>0.5</default>
<summary>Flame Movement Speed</summary>