From 80c3792ad8a5f87646a8bd9ff84fddcdfe06b8b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Hedin=20Br=C3=B8nner?= Date: Thu, 10 Oct 2019 12:46:24 +0200 Subject: [PATCH] kludges: disable 4-finger workspace switching We still aren't able capture the events, but we can override `_checkActivated` to always return false, making the gesture always ineffectual. --- kludges.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/kludges.js b/kludges.js index 4bd4bdb..5890886 100644 --- a/kludges.js +++ b/kludges.js @@ -16,6 +16,7 @@ var Meta = imports.gi.Meta; var Main = imports.ui.main; var Mainloop = imports.mainloop; var Workspace = imports.ui.workspace; +var WindowManager = imports.ui.windowManager; var Shell = imports.gi.Shell; var utils = Extension.imports.utils; @@ -249,12 +250,13 @@ var signals; function init() { savedMethods = new Map(); saveMethod(imports.ui.messageTray.MessageTray.prototype, '_updateState'); - saveMethod(imports.ui.windowManager.WindowManager.prototype, '_prepareWorkspaceSwitch'); + saveMethod(WindowManager.WindowManager.prototype, '_prepareWorkspaceSwitch'); saveMethod(Workspace.Workspace.prototype, '_isOverviewWindow'); saveMethod(Workspace.WindowClone.prototype, 'getOriginalPosition'); saveMethod(Workspace.Workspace.prototype, '_realRecalculateWindowPositions'); saveMethod(Workspace.UnalignedLayoutStrategy.prototype, '_sortRow'); - saveMethod(imports.ui.windowManager.WorkspaceTracker.prototype, '_checkWorkspaces'); + saveMethod(WindowManager.WorkspaceTracker.prototype, '_checkWorkspaces'); + saveMethod(WindowManager.TouchpadWorkspaceSwitchAction.prototype, '_checkActivated'); signals = new utils.Signals(); } @@ -265,7 +267,6 @@ function enable() { disableHotcorners); disableHotcorners(); - function onlyScratchInOverview() { let obj = Workspace.Workspace.prototype; let name = '_isOverviewWindow'; @@ -282,10 +283,13 @@ function enable() { onlyScratchInOverview); onlyScratchInOverview(); + + // Disable switching the workspace after 4 finger swipe. + WindowManager.TouchpadWorkspaceSwitchAction.prototype._checkActivated = () => false; /* The «native» workspace animation can be now (3.30) be disabled as it calls out of the function bound to the `switch-workspace` signal. */ - imports.ui.windowManager.WindowManager.prototype._prepareWorkspaceSwitch = + WindowManager.WindowManager.prototype._prepareWorkspaceSwitch = function (from, to, direction) { if (this._switchData) return; @@ -376,7 +380,7 @@ function enable() { }; } - imports.ui.windowManager.WorkspaceTracker.prototype._checkWorkspaces = function () { + WindowManager.WorkspaceTracker.prototype._checkWorkspaces = function () { let workspaceManager = global.workspace_manager; let i; let emptyWorkspaces = [];