🎉 Allow setting actor transitions in overview

This commit is contained in:
Simon Schneegans
2022-01-21 20:17:24 +01:00
parent 156cefcd1d
commit 8f8f4dc7c0
9 changed files with 113 additions and 151 deletions
+8 -21
View File
@@ -27,9 +27,10 @@ const utils = Me.imports.src.utils;
// The shader class for this effect is registered further down in this file.
let Shader = null;
// The effect class is completely static. It can be used to get some metadata (like the
// effect's name or supported GNOME Shell versions), to initialize the respective page of
// the settings dialog, as well as to create the actual shader for the effect.
// This will be called in various places where a unique identifier for this effect is
// required. It should match the prefix of the settings keys which store whether the
// effect is enabled currently (e.g. '*-close-effect'), and its animation time
// (e.g. '*-animation-time').
var Wisps = class Wisps {
// ---------------------------------------------------------------------------- metadata
@@ -80,25 +81,11 @@ var Wisps = class Wisps {
return new Shader(settings);
}
// This is also called from extension.js. It is used to tweak the ongoing transitions of
// This is also called from extension.js. It is used to tweak the ongoing transition of
// the actor - usually windows are faded to transparency and scaled down slightly by
// GNOME Shell. Here, we modify this behavior as well as the transition duration.
static tweakTransitions(actor, settings) {
const animationTime = settings.get_int('wisps-animation-time');
const tweakTransition = (property, value) => {
const transition = actor.get_transition(property);
if (transition) {
transition.set_to(value);
transition.set_duration(animationTime);
}
};
// We re-target these transitions so that the window is not faded but scaled down a
// tiny bit.
tweakTransition('opacity', 255);
tweakTransition('scale-x', 0.9);
tweakTransition('scale-y', 0.9);
// GNOME Shell. For this effect, windows should be scaled down slightly but not faded.
static getCloseTransition(actor, settings) {
return {'opacity': {to: 255}, 'scale-x': {to: 0.9}, 'scale-y': {to: 0.9}};
}
}