Updating 44/vertical-workspaces to version 37+20231208 [0d82192].
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
975b88c6bb
commit
07381ac119
37 changed files with 9559 additions and 4338 deletions
|
@ -10,62 +10,92 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
const { GObject, Clutter, Meta, St } = imports.gi;
|
||||
const Clutter = imports.gi.Clutter;
|
||||
const GObject = imports.gi.GObject;
|
||||
const Meta = imports.gi.Meta;
|
||||
const St = imports.gi.St;
|
||||
|
||||
const Main = imports.ui.main;
|
||||
const Util = imports.misc.util;
|
||||
const OverviewControls = imports.ui.overviewControls;
|
||||
const WorkspacesView = imports.ui.workspacesView;
|
||||
// first reference to constant defined using const in other module returns undefined, the SecondaryMonitorDisplay const will remain empty and unused
|
||||
const SecondaryMonitorDisplay = WorkspacesView.SecondaryMonitorDisplay;
|
||||
const ControlsState = imports.ui.overviewControls.ControlsState;
|
||||
const FitMode = imports.ui.workspacesView.FitMode;
|
||||
|
||||
const SIDE_CONTROLS_ANIMATION_TIME = imports.ui.overview.ANIMATION_TIME;
|
||||
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const SEARCH_WINDOWS_PREFIX = Me.imports.lib.windowSearchProvider.prefix;
|
||||
const SEARCH_RECENT_FILES_PREFIX = Me.imports.lib.recentFilesSearchProvider.prefix;
|
||||
|
||||
const _Util = Me.imports.lib.util;
|
||||
let _overrides;
|
||||
const Util = imports.misc.util;
|
||||
|
||||
let Me;
|
||||
let opt;
|
||||
|
||||
const ControlsState = OverviewControls.ControlsState;
|
||||
const FitMode = WorkspacesView.FitMode;
|
||||
|
||||
function update(reset = false) {
|
||||
opt = Me.imports.lib.settings.opt;
|
||||
opt.DESKTOP_CUBE_ENABLED = Main.extensionManager._enabledExtensions.includes('desktop-cube@schneegans.github.com');
|
||||
const cubeSupported = opt.DESKTOP_CUBE_ENABLED && !opt.ORIENTATION && !opt.OVERVIEW_MODE;
|
||||
var WorkspacesViewModule = class {
|
||||
constructor(me) {
|
||||
// first reference to constant defined using const in other module returns undefined, the SecondaryMonitorDisplay const will remain empty and unused
|
||||
this.dummy = WorkspacesView.SecondaryMonitorDisplay;
|
||||
|
||||
// if desktop cube extension is enabled while V-Shell is loaded, removeAll() would override its code
|
||||
if (_overrides && !cubeSupported) {
|
||||
_overrides.removeAll();
|
||||
global.workspace_manager.override_workspace_layout(Meta.DisplayCorner.TOPLEFT, false, 1, -1);
|
||||
Me = me;
|
||||
opt = Me.opt;
|
||||
|
||||
this._firstActivation = true;
|
||||
this.moduleEnabled = false;
|
||||
this._overrides = null;
|
||||
}
|
||||
|
||||
if (reset) {
|
||||
_overrides = null;
|
||||
cleanGlobals() {
|
||||
Me = null;
|
||||
opt = null;
|
||||
return;
|
||||
}
|
||||
|
||||
update(reset) {
|
||||
this.moduleEnabled = true;
|
||||
const conflict = false;
|
||||
|
||||
_overrides = new _Util.Overrides();
|
||||
reset = reset || !this.moduleEnabled || conflict;
|
||||
|
||||
if (!cubeSupported)
|
||||
_overrides.addOverride('WorkspacesView', WorkspacesView.WorkspacesView.prototype, WorkspacesViewCommon);
|
||||
|
||||
_overrides.addOverride('WorkspacesDisplay', WorkspacesView.WorkspacesDisplay.prototype, WorkspacesDisplay);
|
||||
_overrides.addOverride('ExtraWorkspaceView', WorkspacesView.ExtraWorkspaceView.prototype, ExtraWorkspaceView);
|
||||
|
||||
if (opt.ORIENTATION) {
|
||||
// switch internal workspace orientation in GS
|
||||
global.workspace_manager.override_workspace_layout(Meta.DisplayCorner.TOPLEFT, false, -1, 1);
|
||||
_overrides.addOverride('SecondaryMonitorDisplay', WorkspacesView.SecondaryMonitorDisplay.prototype, SecondaryMonitorDisplayVertical);
|
||||
} else {
|
||||
_overrides.addOverride('SecondaryMonitorDisplay', WorkspacesView.SecondaryMonitorDisplay.prototype, SecondaryMonitorDisplayHorizontal);
|
||||
// don't touch the original code if module disabled
|
||||
if (reset && !this._firstActivation) {
|
||||
this._disableModule();
|
||||
} else if (!reset) {
|
||||
this._firstActivation = false;
|
||||
this._activateModule();
|
||||
}
|
||||
if (reset && this._firstActivation)
|
||||
console.debug(' WorkspacesViewModule - Keeping untouched');
|
||||
}
|
||||
}
|
||||
|
||||
_activateModule() {
|
||||
if (!this._overrides)
|
||||
this._overrides = new Me.Util.Overrides();
|
||||
|
||||
const desktopCubeEnabled = Me.Util.getEnabledExtensions('desktop-cube@schneegans.github.com').length;
|
||||
const desktopCubeConflict = desktopCubeEnabled && !opt.ORIENTATION && !opt.OVERVIEW_MODE;
|
||||
|
||||
if (!desktopCubeConflict)
|
||||
this._overrides.addOverride('WorkspacesView', WorkspacesView.WorkspacesView.prototype, WorkspacesViewCommon);
|
||||
|
||||
this._overrides.addOverride('WorkspacesDisplay', WorkspacesView.WorkspacesDisplay.prototype, WorkspacesDisplayCommon);
|
||||
this._overrides.addOverride('ExtraWorkspaceView', WorkspacesView.ExtraWorkspaceView.prototype, ExtraWorkspaceViewCommon);
|
||||
this._overrides.addOverride('SecondaryMonitorDisplayCommon', WorkspacesView.SecondaryMonitorDisplay.prototype, SecondaryMonitorDisplayCommon);
|
||||
|
||||
if (opt.ORIENTATION) {
|
||||
// switch internal workspace orientation in GS
|
||||
global.workspace_manager.override_workspace_layout(Meta.DisplayCorner.TOPLEFT, false, -1, 1);
|
||||
this._overrides.addOverride('SecondaryMonitorDisplay', WorkspacesView.SecondaryMonitorDisplay.prototype, SecondaryMonitorDisplayVertical);
|
||||
} else {
|
||||
global.workspace_manager.override_workspace_layout(Meta.DisplayCorner.TOPLEFT, false, 1, -1);
|
||||
this._overrides.addOverride('SecondaryMonitorDisplay', WorkspacesView.SecondaryMonitorDisplay.prototype, SecondaryMonitorDisplayHorizontal);
|
||||
}
|
||||
|
||||
console.debug(' WorkspacesViewModule - Activated');
|
||||
}
|
||||
|
||||
_disableModule() {
|
||||
global.workspace_manager.override_workspace_layout(Meta.DisplayCorner.TOPLEFT, false, 1, -1);
|
||||
if (this._overrides)
|
||||
this._overrides.removeAll();
|
||||
this._overrides = null;
|
||||
|
||||
console.debug(' WorkspacesViewModule - Disabled');
|
||||
}
|
||||
};
|
||||
|
||||
const WorkspacesViewCommon = {
|
||||
_getFirstFitSingleWorkspaceBox(box, spacing, vertical) {
|
||||
|
@ -91,7 +121,6 @@ const WorkspacesViewCommon = {
|
|||
}
|
||||
|
||||
const fitSingleBox = new Clutter.ActorBox({ x1, y1 });
|
||||
|
||||
fitSingleBox.set_size(workspaceWidth, workspaceHeight);
|
||||
|
||||
return fitSingleBox;
|
||||
|
@ -143,21 +172,7 @@ const WorkspacesViewCommon = {
|
|||
},
|
||||
|
||||
_updateVisibility() {
|
||||
// replaced in _updateWorkspacesState
|
||||
/* let workspaceManager = global.workspace_manager;
|
||||
let active = workspaceManager.get_active_workspace_index();
|
||||
|
||||
const fitMode = this._fitModeAdjustment.value;
|
||||
const singleFitMode = fitMode === FitMode.SINGLE;
|
||||
|
||||
for (let w = 0; w < this._workspaces.length; w++) {
|
||||
let workspace = this._workspaces[w];
|
||||
|
||||
if (this._animating || this._gestureActive || !singleFitMode)
|
||||
workspace.show();
|
||||
else
|
||||
workspace.visible = Math.abs(w - active) <= opt.NUMBER_OF_VISIBLE_NEIGHBORS;
|
||||
}*/
|
||||
// visibility handles _updateWorkspacesState()
|
||||
},
|
||||
|
||||
// disable scaling and hide inactive workspaces
|
||||
|
@ -175,27 +190,21 @@ const WorkspacesViewCommon = {
|
|||
|
||||
const primaryMonitor = Main.layoutManager.primaryMonitor.index;
|
||||
|
||||
// define the transition values here to save time in each ws
|
||||
let scaleX, scaleY;
|
||||
if (opt.ORIENTATION) { // vertical 1 / horizontal 0
|
||||
scaleX = 1;
|
||||
scaleY = 0.1;
|
||||
} else {
|
||||
scaleX = 0.1;
|
||||
scaleY = 1;
|
||||
}
|
||||
|
||||
const wsScrollProgress = adj.value % 1;
|
||||
const secondaryMonitor = this._monitorIndex !== global.display.get_primary_monitor();
|
||||
const blockSecondaryAppGrid = opt.OVERVIEW_MODE && currentState > 1;
|
||||
|
||||
// Hide inactive workspaces
|
||||
this._workspaces.forEach((w, index) => {
|
||||
if (!(blockSecondaryAppGrid && secondaryMonitor))
|
||||
w.stateAdjustment.value = workspaceMode;
|
||||
|
||||
const distanceToCurrentWorkspace = Math.abs(adj.value - index);
|
||||
let distance = adj.value - index;
|
||||
const distanceToCurrentWorkspace = Math.abs(distance);
|
||||
|
||||
const scaleProgress = 1 - Math.clamp(distanceToCurrentWorkspace, 0, 1);
|
||||
// const scale = Util.lerp(0.94, 1, scaleProgress);
|
||||
// w.set_scale(scale, scale);
|
||||
|
||||
// if we disable workspaces that we can't or don't need to see, transition animations will be noticeably smoother
|
||||
// only the current ws needs to be visible during overview transition animations
|
||||
|
@ -210,22 +219,28 @@ const WorkspacesViewCommon = {
|
|||
// after transition from APP_GRID to WINDOW_PICKER state,
|
||||
// adjacent workspaces are hidden and we need them to show up
|
||||
// make them visible during animation can impact smoothness of the animation
|
||||
// so we show them after the animation finished, scaling animation will make impression that they move in from outside the monitor
|
||||
// so we show them after the animation finished, move them to their position from outside of the monitor
|
||||
if (!w.visible && distanceToCurrentWorkspace === 1 && initialState === ControlsState.APP_GRID && currentState === ControlsState.WINDOW_PICKER) {
|
||||
w.scale_x = scaleX;
|
||||
w.scale_y = scaleY;
|
||||
w.visible = true;
|
||||
const directionNext = distance > 0;
|
||||
if (!opt.ORIENTATION) {
|
||||
const width = w.width * 0.6 * opt.WS_PREVIEW_SCALE;
|
||||
w.translation_x = directionNext ? -width : width;
|
||||
}
|
||||
if (opt.ORIENTATION) {
|
||||
const height = w.height * 0.6 * opt.WS_PREVIEW_SCALE;
|
||||
w.translation_y = directionNext ? -height : height;
|
||||
}
|
||||
|
||||
w.opacity = 10;
|
||||
w.get_parent().set_child_below_sibling(w, null);
|
||||
w.ease({
|
||||
duration: 100,
|
||||
scale_x: 1,
|
||||
scale_y: 1,
|
||||
duration: 300,
|
||||
translation_x: 0,
|
||||
translation_y: 0,
|
||||
opacity: 255,
|
||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
});
|
||||
} else if (!w.visible && distanceToCurrentWorkspace <= opt.NUMBER_OF_VISIBLE_NEIGHBORS && currentState === ControlsState.WINDOW_PICKER) {
|
||||
w.set({
|
||||
scale_x: 1,
|
||||
scale_y: 1,
|
||||
});
|
||||
}
|
||||
|
||||
// force ws preview bg corner radiuses where GS doesn't do it
|
||||
|
@ -238,9 +253,40 @@ const WorkspacesViewCommon = {
|
|||
w._background.opacity = 0;
|
||||
});
|
||||
},
|
||||
|
||||
exposeWindows(workspaceIndex = null, callback) {
|
||||
let adjustments = [];
|
||||
if (workspaceIndex === null) {
|
||||
this._workspaces.forEach(ws => {
|
||||
adjustments.push(ws._background._stateAdjustment);
|
||||
});
|
||||
} else {
|
||||
adjustments.push(this._workspaces[workspaceIndex]._background._stateAdjustment);
|
||||
}
|
||||
|
||||
adjustments.forEach(adj => {
|
||||
if (adj.value === 0) {
|
||||
adj.value = 0;
|
||||
adj.ease(1, {
|
||||
duration: 200,
|
||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
onComplete: () => {
|
||||
opt.WORKSPACE_MODE = 1;
|
||||
if (callback)
|
||||
callback();
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
const SecondaryMonitorDisplayCommon = {
|
||||
exposeWindows(...args) {
|
||||
this._workspacesView.exposeWindows(...args);
|
||||
},
|
||||
};
|
||||
|
||||
// SecondaryMonitorDisplay Vertical
|
||||
const SecondaryMonitorDisplayVertical = {
|
||||
_getThumbnailParamsForState(state) {
|
||||
|
||||
|
@ -270,24 +316,6 @@ const SecondaryMonitorDisplayVertical = {
|
|||
return { opacity, scale, translationX };
|
||||
},
|
||||
|
||||
_getThumbnailsWidth(box, spacing) {
|
||||
if (opt.SEC_WS_TMB_HIDDEN)
|
||||
return 0;
|
||||
|
||||
const [width, height] = box.get_size();
|
||||
const { expandFraction } = this._thumbnails;
|
||||
const [, thumbnailsWidth] = this._thumbnails.get_preferred_custom_width(height - 2 * spacing);
|
||||
let scaledWidth;
|
||||
if (opt.SEC_WS_PREVIEW_SHIFT && !opt.PANEL_DISABLED)
|
||||
scaledWidth = ((height - Main.panel.height) * opt.SEC_MAX_THUMBNAIL_SCALE) * (width / height);
|
||||
else
|
||||
scaledWidth = width * opt.SEC_MAX_THUMBNAIL_SCALE;
|
||||
|
||||
return Math.min(
|
||||
thumbnailsWidth * expandFraction,
|
||||
Math.round(scaledWidth));
|
||||
},
|
||||
|
||||
_getWorkspacesBoxForState(state, box, padding, thumbnailsWidth, spacing) {
|
||||
// const { ControlsState } = OverviewControls;
|
||||
const workspaceBox = box.copy();
|
||||
|
@ -303,7 +331,7 @@ const SecondaryMonitorDisplayVertical = {
|
|||
break;
|
||||
|
||||
yShift = 0;
|
||||
if (opt.SEC_WS_PREVIEW_SHIFT && !opt.PANEL_DISABLED) {
|
||||
if (opt.SEC_WS_PREVIEW_SHIFT && Main.panel.visible) {
|
||||
if (opt.PANEL_POSITION_TOP)
|
||||
yShift = Main.panel.height;
|
||||
else
|
||||
|
@ -341,26 +369,40 @@ const SecondaryMonitorDisplayVertical = {
|
|||
const spacing = themeNode.get_length('spacing') * expandFraction;
|
||||
const padding = Math.round(0.1 * height);
|
||||
|
||||
let thumbnailsWidth = this._getThumbnailsWidth(contentBox, spacing);
|
||||
let [, thumbnailsHeight] = this._thumbnails.get_preferred_custom_height(thumbnailsWidth);
|
||||
thumbnailsHeight = Math.min(thumbnailsHeight, height - 2 * spacing);
|
||||
|
||||
let thumbnailsWidth = 0;
|
||||
let thumbnailsHeight = 0;
|
||||
this._thumbnails.visible = !opt.SEC_WS_TMB_HIDDEN;
|
||||
if (this._thumbnails.visible) {
|
||||
const reduceBoxHeight = opt.SEC_WS_PREVIEW_SHIFT && Main.panel.visible ? Main.panel.height : 0;
|
||||
|
||||
thumbnailsWidth = width * opt.SEC_MAX_THUMBNAIL_SCALE;
|
||||
|
||||
let totalTmbSpacing;
|
||||
[totalTmbSpacing, thumbnailsHeight] = this._thumbnails.get_preferred_height(thumbnailsWidth);
|
||||
thumbnailsHeight = Math.round(thumbnailsHeight + totalTmbSpacing);
|
||||
|
||||
const thumbnailsHeightMax = height - spacing - reduceBoxHeight;
|
||||
|
||||
if (thumbnailsHeight > thumbnailsHeightMax) {
|
||||
thumbnailsHeight = thumbnailsHeightMax;
|
||||
thumbnailsWidth = Math.round(this._thumbnails.get_preferred_width(thumbnailsHeight)[1]);
|
||||
}
|
||||
|
||||
let wsTmbX;
|
||||
if (opt.SEC_WS_TMB_LEFT) { // left
|
||||
wsTmbX = Math.round(spacing / 4);
|
||||
wsTmbX = spacing / 2;
|
||||
this._thumbnails._positionLeft = true;
|
||||
} else {
|
||||
wsTmbX = Math.round(width - spacing / 4 - thumbnailsWidth);
|
||||
wsTmbX = width - spacing / 2 - thumbnailsWidth;
|
||||
this._thumbnails._positionLeft = false;
|
||||
}
|
||||
|
||||
const childBox = new Clutter.ActorBox();
|
||||
const availSpace = height - thumbnailsHeight - 2 * spacing;
|
||||
const availSpace = height - thumbnailsHeight;
|
||||
|
||||
let wsTmbY = availSpace / 2;
|
||||
wsTmbY -= opt.SEC_WS_TMB_POSITION_ADJUSTMENT * wsTmbY - spacing;
|
||||
wsTmbY -= opt.SEC_WS_TMB_POSITION_ADJUSTMENT * wsTmbY;
|
||||
wsTmbY += opt.SEC_WS_PREVIEW_SHIFT && Main.panel.visible ? Main.panel.height : 0;
|
||||
|
||||
childBox.set_origin(Math.round(wsTmbX), Math.round(wsTmbY));
|
||||
childBox.set_size(thumbnailsWidth, thumbnailsHeight);
|
||||
|
@ -390,22 +432,14 @@ const SecondaryMonitorDisplayVertical = {
|
|||
if (opt.OVERVIEW_MODE2)
|
||||
this.set_child_above_sibling(this._thumbnails, null);
|
||||
|
||||
|
||||
const visible = !opt.SEC_WS_TMB_HIDDEN;
|
||||
|
||||
if (this._thumbnails.visible === visible)
|
||||
return;
|
||||
|
||||
this._thumbnails.show();
|
||||
this._thumbnails.visible = visible;
|
||||
this._updateThumbnailParams();
|
||||
this._thumbnails.ease_property('expand-fraction', visible ? 1 : 0, {
|
||||
duration: SIDE_CONTROLS_ANIMATION_TIME,
|
||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
onComplete: () => {
|
||||
this._thumbnails.visible = visible;
|
||||
this._thumbnails._indicator.visible = visible;
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
_updateThumbnailParams() {
|
||||
|
@ -417,7 +451,6 @@ const SecondaryMonitorDisplayVertical = {
|
|||
if (!this._thumbnails._thumbnails.length)
|
||||
this._thumbnails._createThumbnails();
|
||||
|
||||
|
||||
const { initialState, finalState, progress } =
|
||||
this._overviewAdjustment.getStateTransitionParams();
|
||||
|
||||
|
@ -474,7 +507,6 @@ const SecondaryMonitorDisplayVertical = {
|
|||
},
|
||||
};
|
||||
|
||||
// SecondaryMonitorDisplay Horizontal
|
||||
const SecondaryMonitorDisplayHorizontal = {
|
||||
_getThumbnailParamsForState(state) {
|
||||
// const { ControlsState } = OverviewControls;
|
||||
|
@ -520,7 +552,7 @@ const SecondaryMonitorDisplayHorizontal = {
|
|||
break;
|
||||
|
||||
yShift = 0;
|
||||
if (opt.SEC_WS_PREVIEW_SHIFT && !opt.PANEL_DISABLED) {
|
||||
if (opt.SEC_WS_PREVIEW_SHIFT && Main.panel.visible) {
|
||||
if (opt.PANEL_POSITION_TOP)
|
||||
yShift = Main.panel.height;
|
||||
else
|
||||
|
@ -571,24 +603,36 @@ const SecondaryMonitorDisplayHorizontal = {
|
|||
const spacing = themeNode.get_length('spacing') * expandFraction;
|
||||
const padding = Math.round(0.1 * height);
|
||||
|
||||
let thumbnailsHeight = this._getThumbnailsHeight(contentBox);
|
||||
let [, thumbnailsWidth] = this._thumbnails.get_preferred_custom_width(thumbnailsHeight);
|
||||
thumbnailsWidth = Math.min(thumbnailsWidth, width - 2 * spacing);
|
||||
|
||||
let thumbnailsWidth = 0;
|
||||
let thumbnailsHeight = 0;
|
||||
this._thumbnails.visible = !opt.SEC_WS_TMB_HIDDEN;
|
||||
if (this._thumbnails.visible) {
|
||||
const reservedHeight = opt.SEC_WS_PREVIEW_SHIFT && Main.panel.visible ? Main.panel.height : 0;
|
||||
|
||||
thumbnailsHeight = height * opt.SEC_MAX_THUMBNAIL_SCALE;
|
||||
|
||||
let totalTmbSpacing;
|
||||
[totalTmbSpacing, thumbnailsWidth] = this._thumbnails.get_preferred_width(thumbnailsHeight);
|
||||
thumbnailsWidth = Math.round(thumbnailsWidth + totalTmbSpacing);
|
||||
|
||||
const thumbnailsWidthMax = width - spacing;
|
||||
|
||||
if (thumbnailsWidth > thumbnailsWidthMax) {
|
||||
thumbnailsWidth = thumbnailsWidthMax;
|
||||
thumbnailsHeight = Math.round(this._thumbnails.get_preferred_height(thumbnailsWidth)[1]);
|
||||
}
|
||||
|
||||
let wsTmbY;
|
||||
if (opt.SEC_WS_TMB_TOP)
|
||||
wsTmbY = Math.round(spacing / 4);
|
||||
wsTmbY = spacing / 2 + reservedHeight;
|
||||
else
|
||||
wsTmbY = Math.round(height - spacing / 4 - thumbnailsHeight);
|
||||
|
||||
wsTmbY = height - spacing / 2 - thumbnailsHeight;
|
||||
|
||||
const childBox = new Clutter.ActorBox();
|
||||
const availSpace = width - thumbnailsWidth - 2 * spacing;
|
||||
const availSpace = width - thumbnailsWidth;
|
||||
|
||||
let wsTmbX = availSpace / 2;
|
||||
wsTmbX -= opt.SEC_WS_TMB_POSITION_ADJUSTMENT * wsTmbX - spacing;
|
||||
wsTmbX -= opt.SEC_WS_TMB_POSITION_ADJUSTMENT * wsTmbX;
|
||||
|
||||
childBox.set_origin(Math.round(wsTmbX), Math.round(wsTmbY));
|
||||
childBox.set_size(thumbnailsWidth, thumbnailsHeight);
|
||||
|
@ -625,7 +669,6 @@ const SecondaryMonitorDisplayHorizontal = {
|
|||
if (!this._thumbnails._thumbnails.length)
|
||||
this._thumbnails._createThumbnails();
|
||||
|
||||
|
||||
const { initialState, finalState, progress } =
|
||||
this._overviewAdjustment.getStateTransitionParams();
|
||||
|
||||
|
@ -682,7 +725,7 @@ const SecondaryMonitorDisplayHorizontal = {
|
|||
},
|
||||
};
|
||||
|
||||
const ExtraWorkspaceView = {
|
||||
const ExtraWorkspaceViewCommon = {
|
||||
_updateWorkspaceMode() {
|
||||
const overviewState = this._overviewAdjustment.value;
|
||||
|
||||
|
@ -701,9 +744,23 @@ const ExtraWorkspaceView = {
|
|||
if (!opt.SHOW_WS_PREVIEW_BG && this._workspace._background.opacity)
|
||||
this._workspace._background.opacity = 0;
|
||||
},
|
||||
|
||||
exposeWindows() {
|
||||
const adjustment = this._workspace._background._stateAdjustment;
|
||||
if (adjustment.value === 0) {
|
||||
adjustment.value = 0;
|
||||
adjustment.ease(1, {
|
||||
duration: 200,
|
||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
onComplete: () => {
|
||||
opt.WORKSPACE_MODE = 1;
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
const WorkspacesDisplay = {
|
||||
const WorkspacesDisplayCommon = {
|
||||
_updateWorkspacesViews() {
|
||||
for (let i = 0; i < this._workspacesViews.length; i++)
|
||||
this._workspacesViews[i].destroy();
|
||||
|
@ -761,8 +818,8 @@ const WorkspacesDisplay = {
|
|||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
|
||||
if (_Util.isShiftPressed()) {
|
||||
let direction = _Util.getScrollDirection(event);
|
||||
if (Me.Util.isShiftPressed()) {
|
||||
let direction = Me.Util.getScrollDirection(event);
|
||||
if (direction === null || (Date.now() - this._lastScrollTime) < 150)
|
||||
return Clutter.EVENT_STOP;
|
||||
this._lastScrollTime = Date.now();
|
||||
|
@ -775,11 +832,11 @@ const WorkspacesDisplay = {
|
|||
else
|
||||
direction = 0;
|
||||
|
||||
|
||||
if (direction) {
|
||||
_Util.reorderWorkspace(direction);
|
||||
Me.Util.reorderWorkspace(direction);
|
||||
// make all workspaces on primary monitor visible for case the new position is hidden
|
||||
Main.overview._overview._controls._workspacesDisplay._workspacesViews[0]._workspaces.forEach(w => {
|
||||
const primaryMonitorIndex = global.display.get_primary_monitor();
|
||||
Main.overview._overview._controls._workspacesDisplay._workspacesViews[primaryMonitorIndex]._workspaces.forEach(w => {
|
||||
w.visible = true;
|
||||
});
|
||||
return Clutter.EVENT_STOP;
|
||||
|
@ -806,7 +863,7 @@ const WorkspacesDisplay = {
|
|||
switch (symbol) {
|
||||
case Clutter.KEY_Return:
|
||||
case Clutter.KEY_KP_Enter:
|
||||
if (_Util.isCtrlPressed()) {
|
||||
if (Me.Util.isCtrlPressed()) {
|
||||
Main.ctrlAltTabManager._items.forEach(i => {
|
||||
if (i.sortGroup === 1 && i.name === 'Dash')
|
||||
Main.ctrlAltTabManager.focusGroup(i);
|
||||
|
@ -836,17 +893,17 @@ const WorkspacesDisplay = {
|
|||
which = workspaceManager.n_workspaces - 1;
|
||||
break;
|
||||
case Clutter.KEY_space:
|
||||
if (_Util.isCtrlPressed() && _Util.isShiftPressed()) {
|
||||
_Util.openPreferences();
|
||||
} else if (_Util.isAltPressed()) {
|
||||
if (Me.Util.isCtrlPressed() && Me.Util.isShiftPressed()) {
|
||||
Me.Util.activateSearchProvider(Me.ESP_PREFIX);
|
||||
} else if (Me.Util.isAltPressed()) {
|
||||
Main.ctrlAltTabManager._items.forEach(i => {
|
||||
if (i.sortGroup === 1 && i.name === 'Dash')
|
||||
Main.ctrlAltTabManager.focusGroup(i);
|
||||
});
|
||||
} else if (opt.RECENT_FILES_SEARCH_PROVIDER_ENABLED && _Util.isCtrlPressed()) {
|
||||
_Util.activateSearchProvider(SEARCH_RECENT_FILES_PREFIX);
|
||||
} else if (opt.WINDOW_SEARCH_PROVIDER_ENABLED) {
|
||||
_Util.activateSearchProvider(SEARCH_WINDOWS_PREFIX);
|
||||
} else if (opt.get('recentFilesSearchProviderModule') && Me.Util.isCtrlPressed()) {
|
||||
Me.Util.activateSearchProvider(Me.RFSP_PREFIX);
|
||||
} else if (opt.get('windowSearchProviderModule')) {
|
||||
Me.Util.activateSearchProvider(Me.WSP_PREFIX);
|
||||
}
|
||||
|
||||
return Clutter.EVENT_STOP;
|
||||
|
@ -867,16 +924,18 @@ const WorkspacesDisplay = {
|
|||
});
|
||||
} else if (opt.OVERVIEW_MODE && !opt.WORKSPACE_MODE && state === 1) {
|
||||
// expose windows for OVERVIEW_MODE 1
|
||||
const adjustment = this._workspacesViews[0]._workspaces[global.workspace_manager.get_active_workspace().index()]._background._stateAdjustment;
|
||||
opt.WORKSPACE_MODE = 1;
|
||||
_Util.exposeWindows(adjustment, true);
|
||||
const wsIndex = global.workspace_manager.get_active_workspace().index();
|
||||
// after expose animation activate keyboard for window selection
|
||||
const callback = Me.Util.activateKeyboardForWorkspaceView;
|
||||
this._workspacesViews.forEach(
|
||||
view => {
|
||||
view.exposeWindows(wsIndex, callback);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
if (state === 2)
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
Main.ctrlAltTabManager._items.forEach(i => {
|
||||
if (i.sortGroup === 1 && i.name === 'Windows')
|
||||
Main.ctrlAltTabManager.focusGroup(i);
|
||||
});
|
||||
Me.Util.activateKeyboardForWorkspaceView();
|
||||
}
|
||||
|
||||
return Clutter.EVENT_STOP;
|
||||
|
@ -895,14 +954,14 @@ const WorkspacesDisplay = {
|
|||
// Otherwise it is a workspace index
|
||||
ws = workspaceManager.get_workspace_by_index(which);
|
||||
|
||||
if (_Util.isShiftPressed()) {
|
||||
if (Me.Util.isShiftPressed()) {
|
||||
let direction;
|
||||
if (which === Meta.MotionDirection.UP || which === Meta.MotionDirection.LEFT)
|
||||
direction = -1;
|
||||
else if (which === Meta.MotionDirection.DOWN || which === Meta.MotionDirection.RIGHT)
|
||||
direction = 1;
|
||||
if (direction)
|
||||
_Util.reorderWorkspace(direction);
|
||||
Me.Util.reorderWorkspace(direction);
|
||||
// make all workspaces on primary monitor visible for case the new position is hidden
|
||||
Main.overview._overview._controls._workspacesDisplay._workspacesViews[0]._workspaces.forEach(w => {
|
||||
w.visible = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue