From f8e5fb901d57c8d1956e4dfaacec774a1597ffd4 Mon Sep 17 00:00:00 2001 From: Anders Johansson Date: Thu, 28 Mar 2024 10:01:49 +0100 Subject: [PATCH 1/4] Minor changes for gnome 46. Overview not working! --- wsmatrix@martin.zurowietz.de/metadata.json | 2 +- wsmatrix@martin.zurowietz.de/overview/thumbnailsBox.js | 2 +- .../workspacePopup/workspaceSwitcherPopupList.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wsmatrix@martin.zurowietz.de/metadata.json b/wsmatrix@martin.zurowietz.de/metadata.json index 11f1f8b..04e6644 100644 --- a/wsmatrix@martin.zurowietz.de/metadata.json +++ b/wsmatrix@martin.zurowietz.de/metadata.json @@ -1,6 +1,6 @@ { "shell-version": [ - "45" + "46" ], "uuid": "wsmatrix@martin.zurowietz.de", "url": "https://github.com/mzur/gnome-shell-wsmatrix", diff --git a/wsmatrix@martin.zurowietz.de/overview/thumbnailsBox.js b/wsmatrix@martin.zurowietz.de/overview/thumbnailsBox.js index b577764..76ca4cb 100644 --- a/wsmatrix@martin.zurowietz.de/overview/thumbnailsBox.js +++ b/wsmatrix@martin.zurowietz.de/overview/thumbnailsBox.js @@ -19,7 +19,7 @@ const addThumbnails = function (start, count) { this._porthole.x, this._porthole.y, this._porthole.width, this._porthole.height); this._thumbnails.push(thumbnail); - this.add_actor(thumbnail); + this.add_child(thumbnail); if (this._shouldShow && start > 0 && this._spliceIndex === -1) { // not the initial fill, and not splicing via DND diff --git a/wsmatrix@martin.zurowietz.de/workspacePopup/workspaceSwitcherPopupList.js b/wsmatrix@martin.zurowietz.de/workspacePopup/workspaceSwitcherPopupList.js index 6ec8d3f..011b6fa 100644 --- a/wsmatrix@martin.zurowietz.de/workspacePopup/workspaceSwitcherPopupList.js +++ b/wsmatrix@martin.zurowietz.de/workspacePopup/workspaceSwitcherPopupList.js @@ -63,7 +63,7 @@ export default GObject.registerClass({ this.redisplay(); }); - this.add_actor(workspacesRow); + this.add_child(workspacesRow); this._lists.push(workspacesRow); } @@ -113,7 +113,7 @@ export default GObject.registerClass({ } bbox.set_child(container); - list.add_actor(bbox); + list.add_child(bbox); bbox.connect('clicked', () => this._onItemClicked(bbox)); bbox.connect('motion-event', () => this._onItemEnter(bbox)); From 1f90a3a3b23af82d6b3651a183e2fe90e739b04d Mon Sep 17 00:00:00 2001 From: Martin Zurowietz Date: Sat, 6 Apr 2024 21:10:42 +0200 Subject: [PATCH 2/4] Apply changes for GNOME 46 --- .../overview/controlsManagerLayout.js | 15 ++++--- .../overview/overviewManager.js | 17 ++------ .../overview/thumbnailsBox.js | 6 +-- .../workspaceManagerOverride.js | 39 +++++-------------- .../workspaceSwitcherPopupList.js | 4 +- 5 files changed, 24 insertions(+), 57 deletions(-) diff --git a/wsmatrix@martin.zurowietz.de/overview/controlsManagerLayout.js b/wsmatrix@martin.zurowietz.de/overview/controlsManagerLayout.js index 6a705e8..ccc6f42 100644 --- a/wsmatrix@martin.zurowietz.de/overview/controlsManagerLayout.js +++ b/wsmatrix@martin.zurowietz.de/overview/controlsManagerLayout.js @@ -5,8 +5,7 @@ import {SMALL_WORKSPACE_RATIO, ControlsState} from 'resource:///org/gnome/shell/ const _computeWorkspacesBoxForState = function(state, box, searchHeight, dashHeight, thumbnailsHeight) { const workspaceBox = box.copy(); const [width, height] = workspaceBox.get_size(); - const { y1: startY } = this._workAreaBox; - const {spacing} = this; + const {y1: startY} = this._workAreaBox; const {expandFraction} = this._workspacesThumbnails; const workspaceManager = global.workspace_manager; @@ -19,16 +18,16 @@ const _computeWorkspacesBoxForState = function(state, box, searchHeight, dashHei break; case ControlsState.WINDOW_PICKER: workspaceBox.set_origin(0, - startY + searchHeight + spacing + - thumbnailsHeight * rows + spacing * expandFraction); + startY + searchHeight + this._spacing + + thumbnailsHeight * rows + this._spacing * expandFraction); workspaceBox.set_size(width, height - - dashHeight - spacing - - searchHeight - spacing - - thumbnailsHeight * rows - spacing * expandFraction); + dashHeight - this._spacing - + searchHeight - this._spacing - + thumbnailsHeight * rows - this._spacing * expandFraction); break; case ControlsState.APP_GRID: - workspaceBox.set_origin(0, startY + searchHeight + spacing); + workspaceBox.set_origin(0, startY + searchHeight + this._spacing); workspaceBox.set_size( width, Math.round(height * rows * SMALL_WORKSPACE_RATIO)); diff --git a/wsmatrix@martin.zurowietz.de/overview/overviewManager.js b/wsmatrix@martin.zurowietz.de/overview/overviewManager.js index 607c5eb..3ee20af 100644 --- a/wsmatrix@martin.zurowietz.de/overview/overviewManager.js +++ b/wsmatrix@martin.zurowietz.de/overview/overviewManager.js @@ -1,8 +1,7 @@ -// import ControlsManagerLayout from './controlsManagerLayout.js'; +import ControlsManagerLayout from './controlsManagerLayout.js'; import SecondaryMonitorDisplay from './secondaryMonitorDisplay.js'; -// import ThumbnailsBox from './thumbnailsBox.js'; +import ThumbnailsBox from './thumbnailsBox.js'; import WorkspacesView from './workspacesView.js'; -import {GNOMEversionCompare} from 'resource:///org/gnome/shell/misc/util.js'; import {PACKAGE_VERSION} from 'resource:///org/gnome/shell/misc/config.js'; export default class OverviewManager { @@ -22,17 +21,9 @@ export default class OverviewManager { this._overrides = [ new WorkspacesView(), new SecondaryMonitorDisplay(), - // new ThumbnailsBox(), - // new ControlsManagerLayout(), + new ThumbnailsBox(), + new ControlsManagerLayout(), ]; - - // This only works starting in GNOME Shell 45.1 and up. - if (GNOMEversionCompare(PACKAGE_VERSION, '45.1') >= 0) { - const {default: ThumbnailsBox} = await import('./thumbnailsBox.js'); - this._overrides.push(new ThumbnailsBox()); - const {default: ControlsManagerLayout} = await import('./controlsManagerLayout.js'); - this._overrides.push(new ControlsManagerLayout()); - } } _connectSettings() { diff --git a/wsmatrix@martin.zurowietz.de/overview/thumbnailsBox.js b/wsmatrix@martin.zurowietz.de/overview/thumbnailsBox.js index 76ca4cb..66aa87c 100644 --- a/wsmatrix@martin.zurowietz.de/overview/thumbnailsBox.js +++ b/wsmatrix@martin.zurowietz.de/overview/thumbnailsBox.js @@ -105,10 +105,8 @@ const vfunc_allocate = function(box) { let rtl = Clutter.get_default_text_direction() == Clutter.TextDirection.RTL; - if (this._thumbnails.length == 0) { - // not visible - return; - } + if (this._thumbnails.length === 0) // not visible + return; let themeNode = this.get_theme_node(); box = themeNode.get_content_box(box); diff --git a/wsmatrix@martin.zurowietz.de/workspacePopup/workspaceManagerOverride.js b/wsmatrix@martin.zurowietz.de/workspacePopup/workspaceManagerOverride.js index 1176b6a..d0eb65f 100644 --- a/wsmatrix@martin.zurowietz.de/workspacePopup/workspaceManagerOverride.js +++ b/wsmatrix@martin.zurowietz.de/workspacePopup/workspaceManagerOverride.js @@ -5,18 +5,10 @@ import GLib from 'gi://GLib'; import Meta from 'gi://Meta'; import Shell from 'gi://Shell'; import WorkspaceSwitcherPopup from "./workspaceSwitcherPopup.js"; -// import {SCROLL_TIMEOUT_TIME} from 'resource:///org/gnome/shell/ui/windowManager.js'; -// import {WorkspaceAnimationController} from "./workspaceAnimation.js"; -import {GNOMEversionCompare} from 'resource:///org/gnome/shell/misc/util.js'; +import {SCROLL_TIMEOUT_TIME} from 'resource:///org/gnome/shell/ui/windowManager.js'; +import {WorkspaceAnimationController} from "./workspaceAnimation.js"; import {PACKAGE_VERSION} from 'resource:///org/gnome/shell/misc/config.js'; -let SCROLL_TIMEOUT_TIME = 150; -if (GNOMEversionCompare(PACKAGE_VERSION, '45.1') >= 0) { - import('resource:///org/gnome/shell/ui/windowManager.js').then((mod) => { - SCROLL_TIMEOUT_TIME = mod.SCROLL_TIMEOUT_TIME; - }); -} - const WraparoundMode = { NONE: 0, NEXT_PREV: 1, @@ -36,11 +28,15 @@ export default class WorkspaceManagerOverride { this._keybindings = keybindings; this._overviewKeybindingActions = {}; this.monitors = []; - } - async enable() { - await this._initOverrides() + this._workspaceAnimation = new WorkspaceAnimationController(); + this.overrideProperties = [ + '_workspaceAnimation', + 'handleWorkspaceScroll', + ]; + } + enable() { this._overrideDynamicWorkspaces(); this._overrideKeybindingHandlers(); this._overrideOriginalProperties(); @@ -53,23 +49,6 @@ export default class WorkspaceManagerOverride { this._connectLayoutManager(); } - // This can be moved to the constructor again if there is no need for the conditional - // import any more. - async _initOverrides() { - // this._workspaceAnimation = new WorkspaceAnimationController(); - this.overrideProperties = [ - // '_workspaceAnimation', - 'handleWorkspaceScroll', - ]; - - // This only works starting in GNOME Shell 45.1 and up. - if (GNOMEversionCompare(PACKAGE_VERSION, '45.1') >= 0) { - const {WorkspaceAnimationController} = await import("./workspaceAnimation.js"); - this._workspaceAnimation = new WorkspaceAnimationController(); - this.overrideProperties.push('_workspaceAnimation'); - } - } - disable() { this._destroyWorkspaceSwitcherPopup(); this._restoreLayout(); diff --git a/wsmatrix@martin.zurowietz.de/workspacePopup/workspaceSwitcherPopupList.js b/wsmatrix@martin.zurowietz.de/workspacePopup/workspaceSwitcherPopupList.js index 011b6fa..59e44b1 100644 --- a/wsmatrix@martin.zurowietz.de/workspacePopup/workspaceSwitcherPopupList.js +++ b/wsmatrix@martin.zurowietz.de/workspacePopup/workspaceSwitcherPopupList.js @@ -169,12 +169,12 @@ export default GObject.registerClass({ highlight(index, justOutline) { if (this._items[this._highlighted]) { - this._items[this._highlighted].remove_style_pseudo_class('outlined'); + this._items[this._highlighted].remove_style_pseudo_class('highlighted'); this._items[this._highlighted].remove_style_pseudo_class('selected'); } if (this._items[index]) { - this._items[index].add_style_pseudo_class(justOutline ? 'outlined' : 'selected'); + this._items[index].add_style_pseudo_class(justOutline ? 'highlighted' : 'selected'); } this._highlighted = index; From 604199ea64346c2a3a04774015cfcf37e9f4895d Mon Sep 17 00:00:00 2001 From: Martin Zurowietz Date: Sat, 6 Apr 2024 21:19:40 +0200 Subject: [PATCH 3/4] Remove async/await for overrides again --- .../overview/overviewManager.js | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/wsmatrix@martin.zurowietz.de/overview/overviewManager.js b/wsmatrix@martin.zurowietz.de/overview/overviewManager.js index 3ee20af..fedb4de 100644 --- a/wsmatrix@martin.zurowietz.de/overview/overviewManager.js +++ b/wsmatrix@martin.zurowietz.de/overview/overviewManager.js @@ -7,17 +7,6 @@ import {PACKAGE_VERSION} from 'resource:///org/gnome/shell/misc/config.js'; export default class OverviewManager { constructor(settings) { this._settings = settings; - } - - async enable() { - this._connectSettings(); - await this._initOverrides(); - this._handleShowOverviewGridChanged(); - } - - // This can be moved to the constructor again if there is no need for the conditional - // import any more. - async _initOverrides() { this._overrides = [ new WorkspacesView(), new SecondaryMonitorDisplay(), @@ -26,6 +15,11 @@ export default class OverviewManager { ]; } + enable() { + this._connectSettings(); + this._handleShowOverviewGridChanged(); + } + _connectSettings() { this.settingsHandlerShowOverviewGrid = this._settings.connect( 'changed::show-overview-grid', From f33dd779b798f841fd1411ff2ffcc68ddeb43922 Mon Sep 17 00:00:00 2001 From: Martin Zurowietz Date: Tue, 9 Apr 2024 21:35:48 +0200 Subject: [PATCH 4/4] Remove banner from preferences --- wsmatrix@martin.zurowietz.de/prefs.js | 40 --------------------------- 1 file changed, 40 deletions(-) diff --git a/wsmatrix@martin.zurowietz.de/prefs.js b/wsmatrix@martin.zurowietz.de/prefs.js index e6c904c..0404851 100644 --- a/wsmatrix@martin.zurowietz.de/prefs.js +++ b/wsmatrix@martin.zurowietz.de/prefs.js @@ -2,35 +2,6 @@ import Adw from 'gi://Adw'; import Gio from 'gi://Gio'; import Gtk from 'gi://Gtk'; import {ExtensionPreferences, gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js'; -import {PACKAGE_VERSION} from 'resource:///org/gnome/Shell/Extensions/js/misc/config.js'; - -// From js/misc/utils.js which can't be imported. -function _GNOMEversionToNumber(version) { - let ret = Number(version); - if (!isNaN(ret)) - return ret; - if (version === 'alpha') - return -2; - if (version === 'beta') - return -1; - return ret; -} - -function GNOMEversionCompare(version1, version2) { - const v1Array = version1.split('.'); - const v2Array = version2.split('.'); - - for (let i = 0; i < Math.max(v1Array.length, v2Array.length); i++) { - let elemV1 = _GNOMEversionToNumber(v1Array[i] || '0'); - let elemV2 = _GNOMEversionToNumber(v2Array[i] || '0'); - if (elemV1 < elemV2) - return -1; - if (elemV1 > elemV2) - return 1; - } - - return 0; -} export default class Prefs extends ExtensionPreferences { fillPreferencesWindow(window) { @@ -40,17 +11,6 @@ export default class Prefs extends ExtensionPreferences { const page = new Adw.PreferencesPage(); - if (GNOMEversionCompare(PACKAGE_VERSION, '45.1') < 0) { - // window.add_toast(new Adw.Toast({title: 'Test'})); - let group = new Adw.PreferencesGroup(); - let banner = new Adw.Banner({ - title: _('Some features of the extension are disabled until GNOME Shell 45.1.'), - revealed: true, - }); - group.add(banner); - page.add(group); - } - let group = new Adw.PreferencesGroup({ title: _('General Settings'), });