Skip to content

Commit

Permalink
Restore opacity peeking window different workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesg99 committed Apr 2, 2022
1 parent c1c30ce commit f6fecbc
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 13 deletions.
2 changes: 1 addition & 1 deletion panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -1325,7 +1325,7 @@ var Panel = GObject.registerClass({
transition: 'easeOutQuad'
};

Utils.animateWindowOpacity(w.get_compositor_private(), tweenOpts);
Utils.animateWindowOpacity(w.get_compositor_private(), tweenOpts, true);
}
});
}
Expand Down
4 changes: 2 additions & 2 deletions utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ var activateSiblingWindow = function(windows, direction, startWindow) {
}
};

var animateWindowOpacity = function(window, tweenOpts) {
var animateWindowOpacity = function(window, tweenOpts, adjustVisibility) {
//there currently is a mutter bug with the windowactor opacity, starting with 3.34
//https://gitlab.gnome.org/GNOME/mutter/issues/836

Expand All @@ -433,7 +433,7 @@ var animateWindowOpacity = function(window, tweenOpts) {

window = windowActor.get_first_child() || windowActor;

if (!windowActor.visible && visible) {
if (!windowActor.visible && visible && adjustVisibility) {
window.opacity = 0;
windowActor.visible = visible;
}
Expand Down
31 changes: 21 additions & 10 deletions windowPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,11 @@ var PreviewMenu = GObject.registerClass({
let focusWindow = () => this._focusMetaWindow(Me.settings.get_int('peek-mode-opacity'), window);

this._restorePeekedWindowStack();

if (this._peekedWindow && windowWorkspace != currentWorkspace) {
currentWorkspace.list_windows().forEach(mw => this.animateWindowOpacity(mw, null, 255))
}

this._peekedWindow = window;

if (currentWorkspace != windowWorkspace) {
Expand Down Expand Up @@ -650,20 +655,26 @@ var PreviewMenu = GObject.registerClass({
if (isFocused && mw.minimized) {
wa.show();
}

if (!mw.minimized) {
let tweenOpts = getTweenOpts({ opacity: isFocused ? 255 : dimOpacity });

if (immediate && !mw.is_on_all_workspaces()) {
tweenOpts.time = 0;
}

Utils.animateWindowOpacity(wa, tweenOpts);
}

this.animateWindowOpacity(mw, wa, isFocused ? 255 : dimOpacity, immediate)
}
});
}

animateWindowOpacity(metaWindow, windowActor, opacity, immediate) {
windowActor = windowActor || metaWindow.get_compositor_private();

if (windowActor && !metaWindow.minimized) {
let tweenOpts = getTweenOpts({ opacity });

if (immediate && !metaWindow.is_on_all_workspaces()) {
tweenOpts.time = 0;
}

Utils.animateWindowOpacity(windowActor, tweenOpts);
}
}

_restorePeekedWindowStack() {
let windowActor = this._peekedWindow ? this._peekedWindow.get_compositor_private() : null;

Expand Down

0 comments on commit f6fecbc

Please sign in to comment.