summaryrefslogtreecommitdiffstats
path: root/extensions/vertical-workspaces/extension.js
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/vertical-workspaces/extension.js')
-rw-r--r--extensions/vertical-workspaces/extension.js380
1 files changed, 240 insertions, 140 deletions
diff --git a/extensions/vertical-workspaces/extension.js b/extensions/vertical-workspaces/extension.js
index dc05349..0a22994 100644
--- a/extensions/vertical-workspaces/extension.js
+++ b/extensions/vertical-workspaces/extension.js
@@ -1,5 +1,5 @@
/**
- * Vertical Workspaces
+ * V-Shell (Vertical Workspaces)
* extension.js
*
* @author GdH <G-dH@github.com>
@@ -10,7 +10,7 @@
'use strict';
-const { GLib, GObject, Meta, Shell, St } = imports.gi;
+const { GLib, Shell, St } = imports.gi;
const Main = imports.ui.main;
@@ -19,33 +19,36 @@ const Background = imports.ui.background;
const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
-const Settings = Me.imports.settings;
-const _Util = Me.imports.util;
-
-const WindowSearchProvider = Me.imports.windowSearchProvider;
-const RecentFilesSearchProvider = Me.imports.recentFilesSearchProvider;
-const LayoutOverride = Me.imports.layout;
-const AppDisplayOverride = Me.imports.appDisplay;
-const WorkspaceThumbnailOverride = Me.imports.workspaceThumbnail;
-const WorkspaceOverride = Me.imports.workspace;
-const WorkspacesViewOverride = Me.imports.workspacesView;
-const WindowPreviewOverride = Me.imports.windowPreview;
-const IconGridOverride = Me.imports.iconGrid;
-const WorkspaceAnimationOverride = Me.imports.workspaceAnimation;
-const WindowManagerOverride = Me.imports.windowManager;
-const OverviewOverride = Me.imports.overview;
-const OverviewControlsOverride = Me.imports.overviewControls;
-const SwipeTrackerOverride = Me.imports.swipeTracker;
-const WorkspaceSwitcherPopupOverride = Me.imports.workspaceSwitcherPopup;
-const SearchOverride = Me.imports.search;
-const PanelOverride = Me.imports.panel;
-const DashOverride = Me.imports.dash;
-
-
-let opt = null;
+const Settings = Me.imports.lib.settings;
+const _Util = Me.imports.lib.util;
+
+const WindowSearchProvider = Me.imports.lib.windowSearchProvider;
+const RecentFilesSearchProvider = Me.imports.lib.recentFilesSearchProvider;
+const LayoutOverride = Me.imports.lib.layout;
+const AppDisplayOverride = Me.imports.lib.appDisplay;
+const WorkspaceThumbnailOverride = Me.imports.lib.workspaceThumbnail;
+const WorkspaceOverride = Me.imports.lib.workspace;
+const WorkspacesViewOverride = Me.imports.lib.workspacesView;
+const WindowPreviewOverride = Me.imports.lib.windowPreview;
+const IconGridOverride = Me.imports.lib.iconGrid;
+const WorkspaceAnimationOverride = Me.imports.lib.workspaceAnimation;
+const WindowManagerOverride = Me.imports.lib.windowManager;
+const OverviewOverride = Me.imports.lib.overview;
+const OverviewControlsOverride = Me.imports.lib.overviewControls;
+const SwipeTrackerOverride = Me.imports.lib.swipeTracker;
+const WorkspaceSwitcherPopupOverride = Me.imports.lib.workspaceSwitcherPopup;
+const SearchOverride = Me.imports.lib.search;
+const PanelOverride = Me.imports.lib.panel;
+const DashOverride = Me.imports.lib.dash;
+const WindowAttentionHandlerOverride = Me.imports.lib.windowAttentionHandler;
+const AppFavoritesOverride = Me.imports.lib.appFavorites;
+const MessageTrayOverride = Me.imports.lib.messageTray;
+const OsdWindowOverride = Me.imports.lib.osdWindow;
+const OverlayKey = Me.imports.lib.overlayKey;
+
+let opt;
let _bgManagers;
-let _shellSettings;
let _enabled;
let _resetExtensionIfEnabled;
@@ -53,18 +56,13 @@ let _prevDash;
let _showingOverviewConId;
let _monitorsChangedSigId;
+let _loadingProfileTimeoutId;
let _watchDockSigId;
let _resetTimeoutId;
-// drop control for app grid sorting modes
-let _appSystemStateSigId;
-let _origAppViewItemAcceptDrop;
-let _origAppViewItemHandleDragOver;
-let _origAppDisplayAcceptDrop;
-
let _enableTimeoutId = 0;
-
+let _sessionLockActive = false;
function init() {
@@ -77,9 +75,11 @@ function enable() {
_enableTimeoutId = GLib.timeout_add(
GLib.PRIORITY_DEFAULT,
- 200,
+ 400,
() => {
- activate();
+ activateVShell();
+ // unlock after modules update to avoid unnecessary appGrid rebuild
+ _sessionLockActive = Main.sessionMode.isLocked;
log(`${Me.metadata.name}: enabled`);
_enableTimeoutId = 0;
return GLib.SOURCE_REMOVE;
@@ -88,19 +88,21 @@ function enable() {
}
function disable() {
+ _sessionLockActive = Main.sessionMode.isLocked;
if (_enableTimeoutId) {
GLib.source_remove(_enableTimeoutId);
_enableTimeoutId = 0;
} else {
- reset();
+ resetVShell();
}
+
global.verticalWorkspacesEnabled = undefined;
- log(`${Me.metadata.name}: disabled`);
+ log(`${Me.metadata.name}: ${_sessionLockActive ? 'suspended' : 'disabled'}`);
}
-//------------------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------------------
-function activate() {
+function activateVShell() {
_enabled = true;
_bgManagers = [];
@@ -119,12 +121,19 @@ function activate() {
_prevDash.dash = dash;
_prevDash.position = dash.position;
- _monitorsChangedSigId = Main.layoutManager.connect('monitors-changed', () => _resetExtension(3000));
+ _monitorsChangedSigId = Main.layoutManager.connect('monitors-changed', () => _resetExtension(2000));
// static bg animations conflict with startup animation
// enable it on first hiding from the overview and disconnect the signal
_showingOverviewConId = Main.overview.connect('showing', _onShowingOverview);
+ // switch PageUp/PageDown workspace switcher shortcuts
+ _switchPageShortcuts();
+ _setStaticBackground();
+
+ // fix for upstream bug - overview always shows workspace 1 instead of the active one after restart
+ Main.overview._overview.controls._workspaceAdjustment.set_value(global.workspace_manager.get_active_workspace_index());
+
// if Dash to Dock detected force enable "Fix for DtD" option
if (_Util.dashIsDashToDock()) {
opt.set('fixUbuntuDock', true);
@@ -132,13 +141,9 @@ function activate() {
} else {
_fixUbuntuDock(opt.get('fixUbuntuDock'));
}
-
- // switch PageUp/PageDown workspace switcher shortcuts
- _switchPageShortcuts();
- _setStaticBackground(!opt.SHOW_BG_IN_OVERVIEW);
}
-function reset() {
+function resetVShell() {
_enabled = 0;
_fixUbuntuDock(false);
@@ -174,6 +179,11 @@ function reset() {
_showingOverviewConId = 0;
}
+ if (_loadingProfileTimeoutId) {
+ GLib.source_remove(_loadingProfileTimeoutId);
+ _loadingProfileTimeoutId = 0;
+ }
+
St.Settings.get().slow_down_factor = 1;
Main.overview.dash._background.set_style('');
@@ -185,14 +195,13 @@ function reset() {
function _updateOverrides(reset = false) {
WorkspacesViewOverride.update(reset);
WorkspaceThumbnailOverride.update(reset);
- OverviewControlsOverride.update(reset);
OverviewOverride.update(reset);
+ OverviewControlsOverride.update(reset);
WorkspaceOverride.update(reset);
WindowPreviewOverride.update(reset);
WindowManagerOverride.update(reset);
-
- AppDisplayOverride.update(reset);
+
LayoutOverride.update(reset);
DashOverride.update(reset);
PanelOverride.update(reset);
@@ -205,6 +214,19 @@ function _updateOverrides(reset = false) {
SearchOverride.update(reset);
WindowSearchProvider.update(reset);
RecentFilesSearchProvider.update(reset);
+
+ // don't rebuild app grid on every screen lock
+ if (!_sessionLockActive) {
+ // IconGrid needs to be patched before AppDisplay
+ IconGridOverride.update(reset);
+ AppDisplayOverride.update(reset);
+ }
+
+ WindowAttentionHandlerOverride.update(reset);
+ AppFavoritesOverride.update(reset);
+ MessageTrayOverride.update(reset);
+ OsdWindowOverride.update(reset);
+ OverlayKey.update(reset);
}
function _onShowingOverview() {
@@ -214,9 +236,8 @@ function _onShowingOverview() {
if (opt.FIX_UBUNTU_DOCK) {
// workaround for Ubuntu Dock breaking overview allocations after changing position
const dash = Main.overview.dash;
- if (_prevDash.dash !== dash || _prevDash.position !== dash._position) {
+ if (_prevDash.dash !== dash || _prevDash.position !== dash._position)
_resetExtensionIfEnabled(0);
- }
}
}
@@ -228,18 +249,18 @@ function _resetExtension(timeout = 200) {
timeout,
() => {
if (!_enabled)
- return;
+ return GLib.SOURCE_REMOVE;
const dash = Main.overview.dash;
if (!timeout && _prevDash.dash && dash !== _prevDash.dash) { // !timeout means DtD workaround callback
_prevDash.dash = dash;
log(`[${Me.metadata.name}]: Dash has been replaced, resetting extension...`);
- reset();
- activate();
+ resetVShell();
+ activateVShell();
} else if (timeout) {
log(`[${Me.metadata.name}]: resetting extension...`);
- reset();
- activate();
+ resetVShell();
+ activateVShell();
}
_resetTimeoutId = 0;
return GLib.SOURCE_REMOVE;
@@ -247,15 +268,12 @@ function _resetExtension(timeout = 200) {
);
}
-//-----------------------------------------------------
-
function _fixUbuntuDock(activate = true) {
// Workaround for Ubuntu Dock breaking overview allocations after changing monitor configuration and deactivating dock
- if (_shellSettings && _watchDockSigId) {
- _shellSettings.disconnect(_watchDockSigId);
+ if (_watchDockSigId) {
+ global.settings.disconnect(_watchDockSigId);
_watchDockSigId = 0;
}
- _shellSettings = null;
if (_resetTimeoutId) {
GLib.source_remove(_resetTimeoutId);
@@ -264,16 +282,33 @@ function _fixUbuntuDock(activate = true) {
_resetExtensionIfEnabled = () => {};
- if (!activate) {
+ if (!activate)
return;
- }
- _shellSettings = ExtensionUtils.getSettings( 'org.gnome.shell');
- _watchDockSigId = _shellSettings.connect('changed::enabled-extensions', () => _resetExtension());
+ _watchDockSigId = global.settings.connect('changed::enabled-extensions', () => _resetExtension());
_resetExtensionIfEnabled = _resetExtension;
}
function _updateSettings(settings, key) {
+ if (key?.includes('profile-data')) {
+ const index = key.replace('profile-data-', '');
+ Main.notify(`${Me.metadata.name}`, `Profile ${index} has been saved`);
+ }
+ // avoid overload while loading profile - update only once
+ // delayed gsettings writes are processed alphabetically
+ if (key === 'aaa-loading-profile') {
+ Main.notify(`${Me.metadata.name}`, 'Profile has been loaded');
+ if (_loadingProfileTimeoutId)
+ GLib.source_remove(_loadingProfileTimeoutId);
+ _loadingProfileTimeoutId = GLib.timeout_add(100, 0, () => {
+ _resetExtension();
+ _loadingProfileTimeoutId = 0;
+ return GLib.SOURCE_REMOVE;
+ });
+ }
+ if (_loadingProfileTimeoutId)
+ return;
+
opt._updateSettings();
opt.WORKSPACE_MIN_SPACING = Main.overview._overview._controls._thumbnailsBox.get_theme_node().get_length('spacing');
@@ -281,35 +316,43 @@ function _updateSettings(settings, key) {
const dash = Main.overview.dash;
if (_Util.dashIsDashToDock()) {
opt.DASH_POSITION = dash._position;
- opt.DASH_TOP = DASH_POSITION === 0;
- opt.DASH_RIGHT = DASH_POSITION === 1;
- opt.DASH_BOTTOM = DASH_POSITION === 2;
- opt.DASH_LEFT = DASH_POSITION === 3;
- opt.DASH_VERTICAL = DASH_LEFT || DASH_RIGHT;
+ 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;
}
+ opt.DASH_VISIBLE = opt.DASH_VISIBLE && !_Util.getEnabledExtensions('dash-to-panel@jderose9.github.com').length;
+
opt.MAX_ICON_SIZE = opt.get('dashMaxIconSize', true);
if (opt.MAX_ICON_SIZE < 16) {
opt.MAX_ICON_SIZE = 64;
opt.set('dashMaxIconSize', 64);
}
- imports.ui.workspace.WINDOW_PREVIEW_MAXIMUM_SCALE = 0.95;
+ const monitorWidth = global.display.get_monitor_geometry(global.display.get_primary_monitor()).width;
+ if (monitorWidth < 1600) {
+ opt.APP_GRID_ICON_SIZE_DEFAULT = opt.APP_GRID_ACTIVE_PREVIEW ? 128 : 64;
+ opt.APP_GRID_FOLDER_ICON_SIZE_DEFAULT = 64;
+ }
+
+ imports.ui.workspace.WINDOW_PREVIEW_MAXIMUM_SCALE = opt.OVERVIEW_MODE === 1 ? 0.1 : 0.95;
- if (!_Util.dashIsDashToDock()) {// DtD has its own opacity control
+ if (!_Util.dashIsDashToDock()) { // DtD has its own opacity control
Main.overview.dash._background.opacity = Math.round(opt.get('dashBgOpacity', true) * 2.5); // conversion % to 0-255
const radius = opt.get('dashBgRadius', true);
if (radius) {
let style;
switch (opt.DASH_POSITION) {
case 1:
- style = `border-radius: ${radius}px 0 0 ${radius}px;`
+ style = `border-radius: ${radius}px 0 0 ${radius}px;`;
break;
case 3:
- style = `border-radius: 0 ${radius}px ${radius}px 0;`
+ style = `border-radius: 0 ${radius}px ${radius}px 0;`;
break;
default:
- style = `border-radius: ${radius}px;`
+ style = `border-radius: ${radius}px;`;
}
Main.overview.dash._background.set_style(style);
} else {
@@ -317,38 +360,80 @@ function _updateSettings(settings, key) {
}
}
+ // adjust search entry style for OM2
+ if (opt.OVERVIEW_MODE2)
+ Main.overview.searchEntry.add_style_class_name('search-entry-om2');
+ else
+ Main.overview.searchEntry.remove_style_class_name('search-entry-om2');
+
Main.overview.searchEntry.visible = opt.SHOW_SEARCH_ENTRY;
St.Settings.get().slow_down_factor = opt.ANIMATION_TIME_FACTOR;
imports.ui.search.MAX_LIST_SEARCH_RESULTS_ROWS = opt.SEARCH_MAX_ROWS;
- opt.START_Y_OFFSET = (opt.PANEL_MODE === 1 && opt.PANEL_POSITION_TOP) ? Main.panel.height : 0;
-
+
+ opt.START_Y_OFFSET = (opt.get('panelModule', true) && opt.PANEL_OVERVIEW_ONLY && opt.PANEL_POSITION_TOP) ||
+ // better to add unnecessary space than to have a panel overlapping other objects
+ _Util.getEnabledExtensions('hidetopbar@mathieu.bidon.ca').length
+ ? Main.panel.height
+ : 0;
+
if (settings)
_applySettings(key);
}
function _applySettings(key) {
- _setStaticBackground(!opt.SHOW_BG_IN_OVERVIEW);
+ if (key?.endsWith('-module')) {
+ _updateOverrides();
+ return;
+ }
+
+ _setStaticBackground();
_updateOverviewTranslations();
_switchPageShortcuts();
- if (key === 'fix-ubuntu-dock')
- _fixUbuntuDock(opt.get('fixUbuntuDock', true));
- if (key === 'ws-thumbnails-position') {
- OverviewControlsOverride.update();
- WorkspaceThumbnailOverride.update();
- WorkspacesViewOverride.update();
- }
if (key?.includes('app-grid')) {
AppDisplayOverride.update();
+ return;
}
- if (key?.includes('panel')) {
+
+ if (key?.includes('panel'))
PanelOverride.update();
- }
- if (key?.includes('dash') || key?.includes('app')) {
+
+ if (key?.includes('dash') || key?.includes('search') || key?.includes('icon'))
DashOverride.update();
- }
- if (key === 'workspace-animation') {
+
+ if (key?.includes('hot-corner') || key?.includes('dash'))
+ LayoutOverride.update();
+
+ switch (key) {
+ case 'fix-ubuntu-dock':
+ _fixUbuntuDock(opt.get('fixUbuntuDock', true));
+ break;
+ case 'ws-thumbnails-position':
+ _updateOverrides();
+ break;
+ case 'workspace-switcher-animation':
WorkspaceAnimationOverride.update();
+ break;
+ case 'search-width-scale':
+ SearchOverride.update();
+ break;
+ case 'favorites-notify':
+ AppFavoritesOverride.update();
+ break;
+ case 'window-attention-mode':
+ WindowAttentionHandlerOverride.update();
+ break;
+ case 'show-ws-preview-bg':
+ PanelOverride.update();
+ break;
+ case 'notification-position':
+ MessageTrayOverride.update();
+ break;
+ case 'osd-position':
+ OsdWindowOverride.update();
+ break;
+ case 'overlay-key':
+ OverlayKey.update();
}
}
@@ -357,7 +442,7 @@ function _switchPageShortcuts() {
return;
const vertical = global.workspaceManager.layout_rows === -1;
- const schema = 'org.gnome.desktop.wm.keybindings';
+ const schema = 'org.gnome.desktop.wm.keybindings';
const settings = ExtensionUtils.getSettings(schema);
const keyLeft = 'switch-to-workspace-left';
@@ -386,25 +471,41 @@ function _switchPageShortcuts() {
let moveDown = settings.get_strv(keyMoveDown);
if (vertical) {
- switchLeft.includes(switchPrevSc) && switchLeft.splice(switchLeft.indexOf(switchPrevSc), 1);
- switchRight.includes(switchNextSc) && switchRight.splice(switchRight.indexOf(switchNextSc), 1);
- moveLeft.includes(movePrevSc) && moveLeft.splice(moveLeft.indexOf(movePrevSc), 1);
- moveRight.includes(moveNextSc) && moveRight.splice(moveRight.indexOf(moveNextSc), 1);
-
- switchUp.includes(switchPrevSc) || switchUp.push(switchPrevSc);
- switchDown.includes(switchNextSc) || switchDown.push(switchNextSc);
- moveUp.includes(movePrevSc) || moveUp.push(movePrevSc);
- moveDown.includes(moveNextSc) || moveDown.push(moveNextSc);
+ if (switchLeft.includes(switchPrevSc))
+ switchLeft.splice(switchLeft.indexOf(switchPrevSc), 1);
+ if (switchRight.includes(switchNextSc))
+ switchRight.splice(switchRight.indexOf(switchNextSc), 1);
+ if (moveLeft.includes(movePrevSc))
+ moveLeft.splice(moveLeft.indexOf(movePrevSc), 1);
+ if (moveRight.includes(moveNextSc))
+ moveRight.splice(moveRight.indexOf(moveNextSc), 1);
+
+ if (!switchUp.includes(switchPrevSc))
+ switchUp.push(switchPrevSc);
+ if (!switchDown.includes(switchNextSc))
+ switchDown.push(switchNextSc);
+ if (!moveUp.includes(movePrevSc))
+ moveUp.push(movePrevSc);
+ if (!moveDown.includes(moveNextSc))
+ moveDown.push(moveNextSc);
} else {
- switchLeft.includes(switchPrevSc) || switchLeft.push(switchPrevSc);
- switchRight.includes(switchNextSc) || switchRight.push(switchNextSc);
- moveLeft.includes(movePrevSc) || moveLeft.push(movePrevSc);
- moveRight.includes(moveNextSc) || moveRight.push(moveNextSc);
-
- switchUp.includes(switchPrevSc) && switchUp.splice(switchUp.indexOf(switchPrevSc), 1);
- switchDown.includes(switchNextSc) && switchDown.splice(switchDown.indexOf(switchNextSc), 1);
- moveUp.includes(movePrevSc) && moveUp.splice(moveUp.indexOf(movePrevSc), 1);
- moveDown.includes(moveNextSc) && moveDown.splice(moveDown.indexOf(moveNextSc), 1);
+ if (!switchLeft.includes(switchPrevSc))
+ switchLeft.push(switchPrevSc);
+ if (!switchRight.includes(switchNextSc))
+ switchRight.push(switchNextSc);
+ if (!moveLeft.includes(movePrevSc))
+ moveLeft.push(movePrevSc);
+ if (!moveRight.includes(moveNextSc))
+ moveRight.push(moveNextSc);
+
+ if (switchUp.includes(switchPrevSc))
+ switchUp.splice(switchUp.indexOf(switchPrevSc), 1);
+ if (switchDown.includes(switchNextSc))
+ switchDown.splice(switchDown.indexOf(switchNextSc), 1);
+ if (moveUp.includes(movePrevSc))
+ moveUp.splice(moveUp.indexOf(movePrevSc), 1);
+ if (moveDown.includes(moveNextSc))
+ moveDown.splice(moveDown.indexOf(moveNextSc), 1);
}
settings.set_strv(keyLeft, switchLeft);
@@ -438,41 +539,41 @@ function _updateOverviewTranslations(dash = null, tmbBox = null, searchEntryBin
return;
}
- const [tmbTranslation_x, tmbTranslation_y, dashTranslation_x, dashTranslation_y, searchTranslation_y] = _Util.getOverviewTranslations(opt, dash, tmbBox, searchEntryBin);
- tmbBox.translation_x = tmbTranslation_x;
- tmbBox.translation_y = tmbTranslation_y;
+ const [tmbTranslationX, tmbTranslationY, dashTranslationX, dashTranslationY, searchTranslationY] = _Util.getOverviewTranslations(opt, dash, tmbBox, searchEntryBin);
+ tmbBox.translation_x = tmbTranslationX;
+ tmbBox.translation_y = tmbTranslationY;
if (!_Util.dashNotDefault()) { // only if dash is not dash to dock
- dash.translation_x = dashTranslation_x;
- dash.translation_y = dashTranslation_y;
+ dash.translation_x = dashTranslationX;
+ dash.translation_y = dashTranslationY;
}
- searchEntryBin.translation_y = searchTranslation_y;
+ searchEntryBin.translation_y = searchTranslationY;
}
function _setStaticBackground(reset = false) {
- _bgManagers.forEach((bg)=> {
+ _bgManagers.forEach(bg => {
Main.overview._overview._controls._stateAdjustment.disconnect(bg._fadeSignal);
bg.destroy();
});
_bgManagers = [];
- // if (!SHOW_BG_IN_OVERVIEW && SHOW_WS_PREVIEW_BG) the background is used for static transition from wallpaper to empty bg in the overview
+ // if (!SHOW_BG_IN_OVERVIEW && !SHOW_WS_PREVIEW_BG) the background is used for static transition from wallpaper to empty bg in the overview
if (reset || (!opt.SHOW_BG_IN_OVERVIEW && opt.SHOW_WS_PREVIEW_BG))
return;
for (const monitor of Main.layoutManager.monitors) {
- const bgManager = new Background.BackgroundManager({
- monitorIndex: monitor.index,
- container: Main.layoutManager.overviewGroup,
- vignette: true,
- });
+ const bgManager = new Background.BackgroundManager({
+ monitorIndex: monitor.index,
+ container: Main.layoutManager.overviewGroup,
+ vignette: true,
+ });
bgManager.backgroundActor.content.vignette_sharpness = 0;
bgManager.backgroundActor.content.brightness = 1;
- bgManager._fadeSignal = Main.overview._overview._controls._stateAdjustment.connect('notify::value', (v) => {
+ bgManager._fadeSignal = Main.overview._overview._controls._stateAdjustment.connect('notify::value', v => {
_updateStaticBackground(bgManager, v.value, v);
- });
+ });
if (monitor.index === global.display.get_primary_monitor()) {
bgManager._primary = true;
@@ -497,12 +598,11 @@ function _updateStaticBackground(bgManager, stateValue, stateAdjustment = null)
bgValue = stateValue;
} else {
VIGNETTE = 0.2;
- BRIGHTNESS = 0.95;
- if (opt.OVERVIEW_MODE2 && stateValue > 1 && !opt.WORKSPACE_MODE) {
+ BRIGHTNESS = opt.OVERVIEW_BG_BRIGHTNESS;
+ if (opt.OVERVIEW_MODE2 && stateValue > 1 && !opt.WORKSPACE_MODE)
bgValue = stateValue - 1;
- } else {
+ else
bgValue = stateValue;
- }
}
let blurEffect = bgManager.backgroundActor.get_effect('blur');
@@ -511,22 +611,22 @@ function _updateStaticBackground(bgManager, stateValue, stateAdjustment = null)
brightness: 1,
sigma: 0,
mode: Shell.BlurMode.ACTOR,
- })
+ });
bgManager.backgroundActor.add_effect_with_name('blur', blurEffect);
}
bgManager.backgroundActor.content.vignette_sharpness = VIGNETTE;
bgManager.backgroundActor.content.brightness = BRIGHTNESS;
- let vignetteInit, brightnessInit, sigmaInit;
+ let vignetteInit, brightnessInit;// , sigmaInit;
if (opt.SHOW_BG_IN_OVERVIEW && opt.SHOW_WS_PREVIEW_BG) {
vignetteInit = VIGNETTE;
brightnessInit = BRIGHTNESS;
- sigmaInit = opt.OVERVIEW_BG_BLUR_SIGMA;
+ // sigmaInit = opt.OVERVIEW_BG_BLUR_SIGMA;
} else {
vignetteInit = 0;
brightnessInit = 1;
- sigmaInit = 0
+ // sigmaInit = 0;
}
if (opt.OVERVIEW_MODE2) {
@@ -540,20 +640,19 @@ function _updateStaticBackground(bgManager, stateValue, stateAdjustment = null)
if (opt.OVERVIEW_BG_BLUR_SIGMA || opt.APP_GRID_BG_BLUR_SIGMA) {
// reduce number of steps of blur transition to improve performance
const step = opt.SMOOTH_BLUR_TRANSITIONS ? 0.05 : 0.2;
+ const searchActive = Main.overview._overview.controls._searchController.searchActive;
const progress = stateValue - (stateValue % step);
- if (opt.SHOW_WS_PREVIEW_BG && stateValue < 1) { // no need to animate transition, unless appGrid state is involved, static bg is covered by the ws preview bg
+ 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;
- } else if (stateValue < 1) {
+ } else if (stateValue < 1 && !searchActive) {
const sigma = Math.round(Util.lerp(0, opt.OVERVIEW_BG_BLUR_SIGMA, progress));
- if (sigma !== blurEffect.sigma) {
+ if (sigma !== blurEffect.sigma)
blurEffect.sigma = sigma;
- }
- } else if (stateValue > 1 && bgManager._primary) {
- const sigma = Math.round(Util.lerp(opt.OVERVIEW_BG_BLUR_SIGMA, opt.APP_GRID_BG_BLUR_SIGMA, progress - 1));
- if (sigma !== blurEffect.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;
- }
} else if (stateValue === 1) {
blurEffect.sigma = opt.OVERVIEW_BG_BLUR_SIGMA;
} else if (stateValue === 0) {
@@ -562,3 +661,4 @@ function _updateStaticBackground(bgManager, stateValue, stateAdjustment = null)
}
}
}
+