mirror of
https://github.com/morgan9e/dash-to-panel
synced 2026-04-14 00:04:17 +09:00
Animate only peeked window workspace
This commit is contained in:
9
utils.js
9
utils.js
@@ -426,12 +426,11 @@ var activateSiblingWindow = function(windows, direction, startWindow) {
|
||||
};
|
||||
|
||||
var animateWindowOpacity = function(window, tweenOpts) {
|
||||
//there is a mutter bug with the windowactor opacity, starting with 3.34 and ending with 3.36.1
|
||||
//there currently is a mutter bug with the windowactor opacity, starting with 3.34
|
||||
//https://gitlab.gnome.org/GNOME/mutter/issues/836
|
||||
let shellVersion = Config.PACKAGE_VERSION;
|
||||
|
||||
if (shellVersion > '3.35' && shellVersion < '3.36.1') {
|
||||
//on <= 3.36, a workaround is to use the windowactor's child for the fade animation
|
||||
if (Config.PACKAGE_VERSION > '3.35') {
|
||||
//on 3.36, a workaround is to use the windowactor's child for the fade animation
|
||||
//this leaves a "shadow" on the desktop, so the windowactor needs to be hidden
|
||||
//when the animation is complete
|
||||
let visible = tweenOpts.opacity > 0;
|
||||
@@ -443,7 +442,7 @@ var animateWindowOpacity = function(window, tweenOpts) {
|
||||
|
||||
window = windowActor.get_first_child() || windowActor;
|
||||
tweenOpts.onComplete = () => windowActor.visible = visible;
|
||||
} else if (shellVersion > '3.33' && shellVersion < '3.35') {
|
||||
} else if (Config.PACKAGE_VERSION > '3.33') {
|
||||
//the workaround only works on 3.35+, so on 3.34, let's just hide the
|
||||
//window without animation
|
||||
return window.visible = (tweenOpts.opacity == 255);
|
||||
|
||||
@@ -611,9 +611,10 @@ var PreviewMenu = Utils.defineClass({
|
||||
this._timeoutsHandler.remove(T3);
|
||||
|
||||
if (this._peekedWindow) {
|
||||
this._restorePeekedWindowStack();
|
||||
let immediate = !stayHere && this.peekInitialWorkspaceIndex != Utils.getCurrentWorkspace().index();
|
||||
|
||||
this._focusMetaWindow(255);
|
||||
this._restorePeekedWindowStack();
|
||||
this._focusMetaWindow(255, this._peekedWindow, immediate);
|
||||
this._peekedWindow = null;
|
||||
|
||||
if (!stayHere) {
|
||||
@@ -629,7 +630,7 @@ var PreviewMenu = Utils.defineClass({
|
||||
let shouldAnimate = Main.wm._shouldAnimate;
|
||||
|
||||
if (!workspace || (!workspace.list_windows().length &&
|
||||
workspaceIndex < Utils.getWorkspaceCount() -1)) {
|
||||
workspaceIndex < Utils.getWorkspaceCount() - 1)) {
|
||||
workspace = Utils.getCurrentWorkspace();
|
||||
}
|
||||
|
||||
@@ -638,16 +639,16 @@ var PreviewMenu = Utils.defineClass({
|
||||
Main.wm._shouldAnimate = shouldAnimate;
|
||||
},
|
||||
|
||||
_focusMetaWindow: function(dimOpacity, window) {
|
||||
_focusMetaWindow: function(dimOpacity, window, immediate) {
|
||||
if (Main.overview.visibleTarget) {
|
||||
return;
|
||||
}
|
||||
|
||||
global.get_window_actors().forEach(wa => {
|
||||
let mw = wa.meta_window;
|
||||
window.get_workspace().list_windows().forEach(mw => {
|
||||
let wa = mw.get_compositor_private();
|
||||
let isFocused = mw == window;
|
||||
|
||||
if (mw) {
|
||||
if (wa) {
|
||||
if (isFocused) {
|
||||
mw[PEEK_INDEX_PROP] = wa.get_parent().get_children().indexOf(wa);
|
||||
wa.get_parent().set_child_above_sibling(wa, null);
|
||||
@@ -658,7 +659,13 @@ var PreviewMenu = Utils.defineClass({
|
||||
}
|
||||
|
||||
if (!mw.minimized) {
|
||||
Utils.animateWindowOpacity(wa, getTweenOpts({ opacity: isFocused ? 255 : dimOpacity }));
|
||||
let tweenOpts = getTweenOpts({ opacity: isFocused ? 255 : dimOpacity });
|
||||
|
||||
if (immediate && !mw.is_on_all_workspaces()) {
|
||||
tweenOpts.time = 0;
|
||||
}
|
||||
|
||||
Utils.animateWindowOpacity(wa, tweenOpts);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user