From 6725548424dc75e8eefb65c7aa4367716899e1fe Mon Sep 17 00:00:00 2001 From: Akatsuki Rui <3736910+akiirui@users.noreply.github.com> Date: Wed, 6 Sep 2023 14:30:39 +0800 Subject: [PATCH] Port to GNOME Shell 45 --- extension.js | 51 ++++++++++++++++++++++++--------------------------- metadata.json | 3 +-- 2 files changed, 25 insertions(+), 29 deletions(-) diff --git a/extension.js b/extension.js index e26a213..208a1e2 100644 --- a/extension.js +++ b/extension.js @@ -18,38 +18,35 @@ /* exported init, enable, disable */ -const {ThumbnailsBox} = imports.ui.workspaceThumbnail; +import { ThumbnailsBox } from "resource:///org/gnome/shell/ui/workspaceThumbnail.js"; -function init() { - // This extension does not use init function. -} - -function enable() { - ThumbnailsBox.prototype._updateShouldShowOrig = - ThumbnailsBox.prototype._updateShouldShow; - // Just set true, so we can always show ThumbnailsBox. - ThumbnailsBox.prototype._updateShouldShow = function () { - /* - const { nWorkspaces } = global.workspace_manager; - const shouldShow = this._settings.get_boolean('dynamic-workspaces') +export default class AlwaysShowWorkspaceThumbnails { + enable() { + ThumbnailsBox.prototype._updateShouldShowOrig = + ThumbnailsBox.prototype._updateShouldShow; + // Just set true, so we can always show ThumbnailsBox. + ThumbnailsBox.prototype._updateShouldShow = function () { + /* + const { nWorkspaces } = global.workspace_manager; + const shouldShow = this._settings.get_boolean('dynamic-workspaces') ? nWorkspaces > NUM_WORKSPACES_THRESHOLD : nWorkspaces > 1; - */ + */ - // if (this._shouldShow === shouldShow) - if (this._shouldShow === true) - return; + // if (this._shouldShow === shouldShow) + if (this._shouldShow === true) return; - // this._shouldShow = shouldShow; - this._shouldShow = true; - this.notify('should-show'); - }; -} + // this._shouldShow = shouldShow; + this._shouldShow = true; + this.notify("should-show"); + }; + } -function disable () { - if (ThumbnailsBox.prototype._updateShouldShowOrig instanceof Function) { - ThumbnailsBox.prototype._updateShouldShow = - ThumbnailsBox.prototype._updateShouldShowOrig; - ThumbnailsBox.prototype._updateShouldShowOrig = undefined; + disable() { + if (ThumbnailsBox.prototype._updateShouldShowOrig instanceof Function) { + ThumbnailsBox.prototype._updateShouldShow = + ThumbnailsBox.prototype._updateShouldShowOrig; + ThumbnailsBox.prototype._updateShouldShowOrig = undefined; + } } } diff --git a/metadata.json b/metadata.json index ef81088..11e4b4b 100644 --- a/metadata.json +++ b/metadata.json @@ -3,6 +3,5 @@ "description": "Always show workspace thumbnails even there is only one workspace.", "uuid": "alwaysshowworkspacethumbnails@alynx.one", "url": "https://github.com/AlynxZhou/gnome-shell-extension-always-show-workspace-thumbnails/", - "version": 5, - "shell-version": ["40", "41", "42", "43", "44"] + "shell-version": ["45"] }