1
0
Fork 0

Adding 45/vertical-workspaces version 37+20240412 [9b05a79].

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-03-24 19:43:11 +01:00
parent 155878f41e
commit 9a6f4265d9
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
37 changed files with 3192 additions and 3142 deletions

View file

@ -3,7 +3,7 @@
* overviewControls.js
*
* @author GdH <G-dH@github.com>
* @copyright 2022 - 2023
* @copyright 2022 - 2024
* @license GPL-3.0
*
*/
@ -118,7 +118,7 @@ export const OverviewControlsModule = class {
}
_replaceOnSearchChanged(reset) {
const searchController = Main.overview._overview.controls._searchController;
const searchController = Main.overview.searchController;
if (reset) {
if (_searchControllerSigId) {
searchController.disconnect(_searchControllerSigId);
@ -128,8 +128,8 @@ export const OverviewControlsModule = class {
searchController.unblock_signal_handler(_originalSearchControllerSigId);
_originalSearchControllerSigId = 0;
}
Main.overview._overview._controls.layoutManager._searchController._searchResults.translation_x = 0;
Main.overview._overview._controls.layoutManager._searchController._searchResults.translation_y = 0;
Main.overview.searchController._searchResults.translation_x = 0;
Main.overview.searchController._searchResults.translation_y = 0;
Main.overview.searchEntry.visible = true;
Main.overview.searchEntry.opacity = 255;
} else {
@ -320,6 +320,9 @@ const ControlsManagerCommon = {
},
_onSearchChanged() {
// something is somewhere setting the opacity to 0 if V-Shell is rebased while in overview / search
this._searchController.opacity = 255;
const { finalState, currentState } = this._stateAdjustment.getStateTransitionParams();
const { searchActive } = this._searchController;
@ -366,14 +369,12 @@ const ControlsManagerCommon = {
this._searchController._searchResults.translation_x = 0;
this._searchController._searchResults.translation_y = 0;
this._searchController.opacity = 255;
this._searchController.visible = true;
if (opt.SEARCH_VIEW_ANIMATION && ![4, 8].includes(opt.WS_TMB_POSITION)) {
this._updateAppDisplayVisibility();
this.layoutManager._searchController._searchResults._statusBin.opacity = 1;
this._searchController._searchResults._statusBin.opacity = 1;
this._searchController.opacity = searchActive ? 255 : 0;
let translationX = 0;
let translationY = 0;
const geometry = global.display.get_monitor_geometry(global.display.get_primary_monitor());
@ -407,6 +408,8 @@ const ControlsManagerCommon = {
}
this._searchController._searchResults.ease({
delay: 150, // wait for results
opacity: searchActive ? 255 : 0,
translation_x: searchActive ? 0 : translationX,
translation_y: searchActive ? 0 : translationY,
duration: SIDE_CONTROLS_ANIMATION_TIME,
@ -414,7 +417,7 @@ const ControlsManagerCommon = {
onComplete: () => {
this._searchController.visible = searchActive;
this._searchTransition = false;
this.layoutManager._searchController._searchResults._statusBin.opacity = 255;
this._searchController._searchResults._statusBin.opacity = 255;
},
});
@ -431,10 +434,9 @@ const ControlsManagerCommon = {
this._workspacesDisplay.setPrimaryWorkspaceVisible(true);
this._searchController.opacity = searchActive ? 0 : 255;
this._searchController.ease({
this._searchController._searchResults.ease({
opacity: searchActive ? 255 : 0,
duration: searchActive ? SIDE_CONTROLS_ANIMATION_TIME : 0,
duration: searchActive ? SIDE_CONTROLS_ANIMATION_TIME / 2 : 0,
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
onComplete: () => (this._searchController.visible = searchActive),
});
@ -442,10 +444,10 @@ const ControlsManagerCommon = {
// reuse already tuned overview transition, just replace APP_GRID with the search view
if (!(opt.OVERVIEW_MODE2 && !opt.WORKSPACE_MODE) && !Main.overview._animationInProgress && finalState !== ControlsState.HIDDEN && !this.dash.showAppsButton.checked) {
Main.overview._overview._controls.layoutManager._searchController._searchResults._content.remove_style_class_name('search-section-content-bg-om2');
Main.overview._overview._controls.layoutManager._searchController._searchResults._content.add_style_class_name('search-section-content-bg');
Main.overview.searchEntry.remove_style_class_name('search-entry-om2');
const duration = opt.SEARCH_VIEW_ANIMATION ? 150 : 0;
this._searchController._searchResults._content.remove_style_class_name('search-section-content-bg-om2');
this._searchController._searchResults._content.add_style_class_name('search-section-content-bg');
this._searchEntry.remove_style_class_name('search-entry-om2');
const duration = opt.SEARCH_VIEW_ANIMATION ? 140 : 0;
this._stateAdjustment.ease(searchActive ? ControlsState.APP_GRID : ControlsState.WINDOW_PICKER, {
// shorter animation time when entering search view can avoid stuttering in transition
// collecting search results take some time and the problematic part is the realization of the object on the screen
@ -455,17 +457,20 @@ const ControlsManagerCommon = {
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
onComplete: () => {
this._workspacesDisplay.setPrimaryWorkspaceVisible(!searchActive);
// Set the delay before processing a new search entry to 150 on deactivation, so search providers can't make make the workspace animation stuttering
// set it back to 0 after in-animation, so the search can be snappy
opt.SEARCH_DELAY = searchActive || !opt.SEARCH_VIEW_ANIMATION ? 0 : 150;
},
});
} else if (opt.OVERVIEW_MODE2 && !(opt.WORKSPACE_MODE || this.dash.showAppsButton.checked)) {
// add background to search results and make searchEntry border thicker for better visibility
Main.overview._overview._controls.layoutManager._searchController._searchResults._content.remove_style_class_name('search-section-content-bg');
Main.overview._overview._controls.layoutManager._searchController._searchResults._content.add_style_class_name('search-section-content-bg-om2');
this._searchController._searchResults._content.remove_style_class_name('search-section-content-bg');
this._searchController._searchResults._content.add_style_class_name('search-section-content-bg-om2');
Main.overview.searchEntry.add_style_class_name('search-entry-om2');
} else {
Main.overview._overview._controls.layoutManager._searchController._searchResults._content.add_style_class_name('search-section-content-bg');
Main.overview._overview._controls.layoutManager._searchController._searchResults._content.remove_style_class_name('search-section-content-bg-om2');
Main.overview.searchEntry.remove_style_class_name('search-entry-om2');
this._searchController._searchResults._content.add_style_class_name('search-section-content-bg');
this._searchController._searchResults._content.remove_style_class_name('search-section-content-bg-om2');
this._searchEntry.remove_style_class_name('search-entry-om2');
}
},
@ -662,7 +667,7 @@ const ControlsManagerCommon = {
_getOverviewTranslations(dash, tmbBox, searchEntryBin) {
// const tmbBox = Main.overview._overview._controls._thumbnailsBox;
const animationsDisabled = !St.Settings.get().enable_animations || (opt.SHOW_WS_PREVIEW_BG && !opt.OVERVIEW_MODE2);
const animationsDisabled = !St.Settings.get().enable_animations || ((opt.SHOW_WS_PREVIEW_BG && !opt.OVERVIEW_MODE2) && !Main.layoutManager._startingUp);
if (animationsDisabled)
return [0, 0, 0, 0, 0];
@ -840,13 +845,16 @@ const ControlsManagerCommon = {
if (!blurEffect) {
blurEffect = new Shell.BlurEffect({
brightness: 1,
sigma: 0,
mode: Shell.BlurMode.ACTOR,
});
bgManager.backgroundActor.add_effect_with_name('blur', blurEffect);
}
const searchActive = Main.overview._overview.controls._searchController.searchActive;
// In GNOME 46 the "sigma" property has been renamed to "radius"
const radius = blurEffect.sigma !== undefined ? 'sigma' : 'radius';
blurEffect[radius] = 0;
const searchActive = this._searchController.searchActive;
if (searchActive)
BRIGHTNESS = opt.SEARCH_BG_BRIGHTNESS;
@ -877,48 +885,61 @@ const ControlsManagerCommon = {
const step = opt.SMOOTH_BLUR_TRANSITIONS ? 0.05 : 0.2;
const progress = stateValue - (stateValue % step);
if (opt.SHOW_WS_PREVIEW_BG && stateValue < 1 && !searchActive) { // no need to animate transition, unless appGrid state is involved, static bg is covered by the ws preview bg
if (blurEffect.sigma !== opt.OVERVIEW_BG_BLUR_SIGMA)
blurEffect.sigma = opt.OVERVIEW_BG_BLUR_SIGMA;
if (blurEffect[radius] !== opt.OVERVIEW_BG_BLUR_SIGMA)
blurEffect[radius] = opt.OVERVIEW_BG_BLUR_SIGMA;
} else if (stateValue < 1 && !searchActive && !(opt.OVERVIEW_MODE2 && !opt.WORKSPACE_MODE)) {
const sigma = Math.round(Util.lerp(0, opt.OVERVIEW_BG_BLUR_SIGMA, progress));
if (sigma !== blurEffect.sigma)
blurEffect.sigma = sigma;
} else if (stateValue < 1 && !searchActive && (opt.OVERVIEW_MODE2 && !opt.WORKSPACE_MODE && blurEffect.sigma)) {
if (sigma !== blurEffect[radius])
blurEffect[radius] = sigma;
} else if (stateValue < 1 && !searchActive && (opt.OVERVIEW_MODE2 && !opt.WORKSPACE_MODE && blurEffect[radius])) {
const sigma = Math.round(Util.lerp(0, opt.OVERVIEW_BG_BLUR_SIGMA, progress));
if (sigma !== blurEffect.sigma)
blurEffect.sigma = sigma;
if (sigma !== blurEffect[radius])
blurEffect[radius] = sigma;
} else if (stateValue > 1 && !searchActive && (opt.OVERVIEW_MODE2 && !opt.WORKSPACE_MODE && finalState === 1)) {
const sigma = Math.round(Util.lerp(0, opt.OVERVIEW_BG_BLUR_SIGMA, progress % 1));
if (sigma !== blurEffect.sigma)
blurEffect.sigma = sigma;
if (sigma !== blurEffect[radius])
blurEffect[radius] = sigma;
} else if ((stateValue > 1 && bgManager._primary) || searchActive) {
const sigma = Math.round(Util.lerp(opt.OVERVIEW_BG_BLUR_SIGMA, opt.APP_GRID_BG_BLUR_SIGMA, progress % 1));
if (sigma !== blurEffect.sigma)
blurEffect.sigma = sigma;
if (sigma !== blurEffect[radius])
blurEffect[radius] = sigma;
} else if (stateValue === 1 && !(opt.OVERVIEW_MODE2 && !opt.WORKSPACE_MODE)) {
blurEffect.sigma = opt.OVERVIEW_BG_BLUR_SIGMA;
blurEffect[radius] = opt.OVERVIEW_BG_BLUR_SIGMA;
} else if (stateValue === 0 || (stateValue === 1 && (opt.OVERVIEW_MODE2 && !opt.WORKSPACE_MODE))) {
blurEffect.sigma = 0;
blurEffect[radius] = 0;
}
}
}
},
_updatePositionFromDashToDock() {
// update variables that cannot be processed within settings
const dash = Main.overview.dash;
opt.DASH_POSITION = dash._position;
opt.DASH_TOP = opt.DASH_POSITION === 0;
opt.DASH_RIGHT = opt.DASH_POSITION === 1;
opt.DASH_BOTTOM = opt.DASH_POSITION === 2;
opt.DASH_LEFT = opt.DASH_POSITION === 3;
opt.DASH_VERTICAL = opt.DASH_LEFT || opt.DASH_RIGHT;
},
};
const ControlsManagerLayoutVertical = {
_computeWorkspacesBoxForState(state, box, workAreaBox, dashWidth, dashHeight, thumbnailsWidth, thumbnailsHeight, searchHeight, startY) {
// in case the function is called from the DtD
if (startY === undefined) {
if (startY === undefined)
workAreaBox = box;
}
const workspaceBox = box.copy();
let [width, height] = workspaceBox.get_size();
const { spacing } = this;
const spacing = 12;
const dash = Main.overview.dash;
// including Dash to Dock and clones properties for compatibility
if (Me.Util.dashIsDashToDock()) {
// ensure or position variables are updated
ControlsManagerCommon._updatePositionFromDashToDock();
// Dash to Dock also always affects workAreaBox
Main.layoutManager._trackedActors.forEach(actor => {
if (actor.affectsStruts && actor.actor.width === dash.width) {
@ -1028,15 +1049,15 @@ const ControlsManagerLayoutVertical = {
_getAppDisplayBoxForState(state, box, workAreaBox, searchHeight, dashWidth, dashHeight, thumbnailsWidth, startY) {
// in case the function is called from the DtD
if (startY === undefined) {
if (startY === undefined)
workAreaBox = box;
}
const [width] = box.get_size();
const { x1: startX } = workAreaBox;
// const { y1: startY } = workAreaBox;
let height = workAreaBox.get_height();
const appDisplayBox = new Clutter.ActorBox();
const { spacing } = this;
const spacing = 12;
searchHeight = opt.SHOW_SEARCH_ENTRY ? searchHeight : 0;
const xOffsetL = (opt.WS_TMB_LEFT ? thumbnailsWidth : 0) + (opt.DASH_LEFT ? dashWidth : 0);
@ -1083,7 +1104,7 @@ const ControlsManagerLayoutVertical = {
vfunc_allocate(container, box) {
const childBox = new Clutter.ActorBox();
const transitionParams = this._stateAdjustment.getStateTransitionParams();
const { spacing } = this;
const spacing = 12;
const halfSpacing = spacing / 2;
const monitor = Main.layoutManager.findMonitorForActor(this._container);
const workArea = Main.layoutManager.getWorkAreaForMonitor(monitor.index);
@ -1111,6 +1132,8 @@ const ControlsManagerLayoutVertical = {
// dash cloud be overridden by the Dash to Dock clone
const dash = Main.overview.dash;
if (Me.Util.dashIsDashToDock()) {
// ensure our position variables are updated
ControlsManagerCommon._updatePositionFromDashToDock();
// if Dash to Dock replaced the default dash and its inteli-hide is disabled we need to compensate for affected startY
if (!Main.overview.dash.get_parent()?.get_parent()?.get_parent()?._intellihideIsEnabled) {
if (Main.panel.y === monitor.y)
@ -1320,16 +1343,18 @@ const ControlsManagerLayoutVertical = {
const ControlsManagerLayoutHorizontal = {
_computeWorkspacesBoxForState(state, box, workAreaBox, dashWidth, dashHeight, thumbnailWidth, thumbnailsHeight, searchHeight, startY) {
// in case the function is called from the DtD
if (startY === undefined) {
if (startY === undefined)
workAreaBox = box;
}
const workspaceBox = box.copy();
let [width, height] = workspaceBox.get_size();
const { spacing } = this;
const spacing = 12;
const dash = Main.overview.dash;
// including Dash to Dock and clones properties for compatibility
if (Me.Util.dashIsDashToDock()) {
// ensure our position variables are updated
ControlsManagerCommon._updatePositionFromDashToDock();
// Dash to Dock always affects workAreaBox
Main.layoutManager._trackedActors.forEach(actor => {
if (actor.affectsStruts && actor.actor.width === dash.width) {
@ -1448,7 +1473,7 @@ const ControlsManagerLayoutHorizontal = {
// const { y1: startY } = workAreaBox;
let height = workAreaBox.get_height();
const appDisplayBox = new Clutter.ActorBox();
const { spacing } = this;
const spacing = 12;
const yOffsetT = (opt.WS_TMB_TOP ? thumbnailsHeight + spacing : 0) + (opt.DASH_TOP ? dashHeight : 0) + (opt.SHOW_SEARCH_ENTRY ? searchHeight : 0);
const yOffsetB = (opt.WS_TMB_BOTTOM ? thumbnailsHeight + spacing : 0) + (opt.DASH_BOTTOM ? dashHeight : 0);
@ -1495,7 +1520,7 @@ const ControlsManagerLayoutHorizontal = {
vfunc_allocate(container, box) {
const transitionParams = this._stateAdjustment.getStateTransitionParams();
const childBox = new Clutter.ActorBox();
const { spacing } = this;
const spacing = 12;
const halfSpacing = spacing / 2;
const monitor = Main.layoutManager.findMonitorForActor(this._container);
const workArea = Main.layoutManager.getWorkAreaForMonitor(monitor.index);
@ -1528,7 +1553,7 @@ const ControlsManagerLayoutHorizontal = {
// if (Main.panel.y === monitor.y)
// startY = Main.panel.height + spacing;
}
dashHeight = dash.height;
dashHeight = dash.height + halfSpacing;
dashWidth = dash.width;
opt.DASH_TOP = dash._position === 0;
opt.DASH_VERTICAL = [1, 3].includes(dash._position);
@ -1587,9 +1612,13 @@ const ControlsManagerLayoutHorizontal = {
else
wsTmbY = Math.round(startY + height - (opt.DASH_BOTTOM ? dashHeight : halfSpacing) - wsTmbHeight);
let wstOffset = (width - wsTmbWidth - dashWidthReservation) / 2;
let wstOffset = (width - wsTmbWidth) / 2;
wstOffset -= opt.WS_TMB_POSITION_ADJUSTMENT * wstOffset;
let wsTmbX = Math.round(startX + (opt.DASH_LEFT ? dashWidthReservation : 0) + wstOffset);
let wsTmbX = Math.round(startX + wstOffset);
if (opt.DASH_LEFT)
wsTmbX = Math.max(wsTmbX, startX + dashWidthReservation);
else if (opt.DASH_RIGHT)
wsTmbX = Math.min(wsTmbX, startX + width - wsTmbWidth - dashWidthReservation);
childBox.set_origin(wsTmbX, wsTmbY);
childBox.set_size(Math.max(wsTmbWidth, 1), Math.max(wsTmbHeight, 1));
@ -1748,8 +1777,10 @@ function _getFitModeForState(state) {
const LayoutManager = {
_startupAnimation() {
if (Me.Util.dashIsDashToDock() && !Meta.is_restart()) {
// DtD breaks overview on startup
const dtdEnabled = !!((Me.Util.getEnabledExtensions('dash-to-dock').length && !Me.Util.getEnabledExtensions('dash-to-dock-vshell').length) ||
Me.Util.getEnabledExtensions('ubuntu-dock').length);
if (dtdEnabled && !Meta.is_restart()) {
// DtD without V-Shell patch breaks overview on startup
// Skip animation to hide the mess
this._startupAnimationComplete();
Main.overview._overview.controls._finishStartupSequence();