windowManager: Keep a minimum number of workspaces
The scaled down workspace in the window picker looks lonely when there's no adjacent workspace peeking in. Avoid that by always keeping a minimum of two workspaces. https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3739 Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1696>
This commit is contained in:
parent
2fdee8e444
commit
ece5220b42
@ -35,6 +35,8 @@ var APP_MOTION_THRESHOLD = 30;
|
|||||||
|
|
||||||
var ONE_SECOND = 1000; // in ms
|
var ONE_SECOND = 1000; // in ms
|
||||||
|
|
||||||
|
var MIN_NUM_WORKSPACES = 2;
|
||||||
|
|
||||||
const GSD_WACOM_BUS_NAME = 'org.gnome.SettingsDaemon.Wacom';
|
const GSD_WACOM_BUS_NAME = 'org.gnome.SettingsDaemon.Wacom';
|
||||||
const GSD_WACOM_OBJECT_PATH = '/org/gnome/SettingsDaemon/Wacom';
|
const GSD_WACOM_OBJECT_PATH = '/org/gnome/SettingsDaemon/Wacom';
|
||||||
|
|
||||||
@ -269,6 +271,12 @@ var WorkspaceTracker = class {
|
|||||||
emptyWorkspaces.push(true);
|
emptyWorkspaces.push(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enforce minimum number of workspaces
|
||||||
|
while (emptyWorkspaces.length < MIN_NUM_WORKSPACES) {
|
||||||
|
workspaceManager.append_new_workspace(false, global.get_current_time());
|
||||||
|
emptyWorkspaces.push(true);
|
||||||
|
}
|
||||||
|
|
||||||
let lastIndex = emptyWorkspaces.length - 1;
|
let lastIndex = emptyWorkspaces.length - 1;
|
||||||
let lastEmptyIndex = emptyWorkspaces.lastIndexOf(false) + 1;
|
let lastEmptyIndex = emptyWorkspaces.lastIndexOf(false) + 1;
|
||||||
let activeWorkspaceIndex = workspaceManager.get_active_workspace_index();
|
let activeWorkspaceIndex = workspaceManager.get_active_workspace_index();
|
||||||
@ -277,6 +285,8 @@ var WorkspaceTracker = class {
|
|||||||
// Delete empty workspaces except for the last one; do it from the end
|
// Delete empty workspaces except for the last one; do it from the end
|
||||||
// to avoid index changes
|
// to avoid index changes
|
||||||
for (i = lastIndex; i >= 0; i--) {
|
for (i = lastIndex; i >= 0; i--) {
|
||||||
|
if (workspaceManager.n_workspaces === MIN_NUM_WORKSPACES)
|
||||||
|
break;
|
||||||
if (emptyWorkspaces[i] && i != lastEmptyIndex)
|
if (emptyWorkspaces[i] && i != lastEmptyIndex)
|
||||||
workspaceManager.remove_workspace(this._workspaces[i], global.get_current_time());
|
workspaceManager.remove_workspace(this._workspaces[i], global.get_current_time());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user