From 149b1f5d1bc2e37b85ea0a361858161b33512ac2 Mon Sep 17 00:00:00 2001 From: taoky Date: Sun, 17 Mar 2024 03:33:08 +0800 Subject: [PATCH] docking: fix window picker space for multi-monitor enviroments --- docking.js | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/docking.js b/docking.js index 8f2e602ea..82bd2b3af 100644 --- a/docking.js +++ b/docking.js @@ -2410,7 +2410,31 @@ export class DockManager { return originalFunction.call(this, state, ...args); const box = workspaceBoxOriginFixer.call(this, originalFunction, state, ...args); - return maybeAdjustBoxSize(state, box, this.spacing); + const dock = DockManager.getDefault().getDockByMonitor(Main.layoutManager.primaryIndex); + if (!dock) + return box; + else + return maybeAdjustBoxSize(state, box, this.spacing); + /* eslint-enable no-invalid-this */ + }, + ], [ + WorkspacesView.SecondaryMonitorDisplay.prototype, + '_getWorkspacesBoxForState', + function (originalFunction, state, ...args) { + /* eslint-disable no-invalid-this */ + if (state === OverviewControls.ControlsState.HIDDEN) + return originalFunction.call(this, state, ...args); + + const box = workspaceBoxOriginFixer.call(this, originalFunction, state, ...args); + const dock = DockManager.getDefault().getDockByMonitor(this._monitorIndex); + if (!dock) + return box; + if (state === OverviewControls.ControlsState.WINDOW_PICKER && + dock.position === St.Side.BOTTOM) { + const [, preferredHeight] = dock.get_preferred_height(box.get_width()); + box.y2 -= preferredHeight; + } + return box; /* eslint-enable no-invalid-this */ }, ], [