Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regression touchscreen support #759

Merged
merged 6 commits into from
Jan 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
FIX: for case where switchWorkspace by clicking link (which opens window
in another space on another monitor) - if space is shown on that monitor
don't do gnome workspace switch animation.
jtaala committed Jan 26, 2024
commit b7a926a0b52eb221a5536d245afe5405f2c0cddc
46 changes: 36 additions & 10 deletions patches.js
Original file line number Diff line number Diff line change
@@ -140,21 +140,47 @@ export function setupOverrides() {
// WorkspaceAnimation.WorkspaceAnimationController.animateSwitch
// Disable the workspace switching animation in Gnome 40+
function (_from, _to, _direction, onComplete) {
// ensure swipeTrackers are disabled after this
const reset = () => {
// gnome windows switch animation time = 250, do that plus a little more
pillSwipeTimer = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 300, () => {
swipeTrackers.forEach(t => {
t.enabled = false;
});
pillSwipeTimer = null;
return false; // on return false destroys timeout
});
};

if (Tiling.inPreview) {
onComplete();
reset();
return;
}

// if using PaperWM workspace switch animation, just do complete here
if (Tiling.inPreview || !Tiling.spaces.space_defaultAnimation) {
if (!Tiling.spaces.space_defaultAnimation) {
onComplete();
reset();
return;
}
else {
const saved = getSavedPrototype(WorkspaceAnimation.WorkspaceAnimationController, 'animateSwitch');
saved.call(this, _from, _to, _direction, onComplete);

// if switching to a paperwm space that is already shown on a monitor
// from / to are workspace indices
const toSpace = Tiling.spaces.spaceOfIndex(_to);

const spaces = Array.from(Tiling.spaces.monitors.values());
const toOnMonitor = spaces.some(space => space === toSpace);
if (toOnMonitor) {
onComplete();
reset();
return;
}

// ensure swipeTrackers are disabled after this
pillSwipeTimer = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 500, () => {
swipeTrackers.forEach(t => t.enabled = false);
pillSwipeTimer = null;
return false; // on return false destroys timeout
});
// standard gnome switch animation
const saved = getSavedPrototype(WorkspaceAnimation.WorkspaceAnimationController, 'animateSwitch');
saved.call(this, _from, _to, _direction, onComplete);
reset();
});

registerOverridePrototype(WorkspaceAnimation.WorkspaceAnimationController, '_prepareWorkspaceSwitch',