Skip to content

Commit

Permalink
Merge pull request #9 from akiirui/45
Browse files Browse the repository at this point in the history
Port to GNOME Shell 45
  • Loading branch information
AlynxZhou authored Oct 10, 2023
2 parents ba94fd9 + 6725548 commit c098387
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 29 deletions.
51 changes: 24 additions & 27 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
3 changes: 1 addition & 2 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
"description": "Always show workspace thumbnails even there is only one workspace.",
"uuid": "[email protected]",
"url": "https://github.com/AlynxZhou/gnome-shell-extension-always-show-workspace-thumbnails/",
"version": 5,
"shell-version": ["40", "41", "42", "43", "44"]
"shell-version": ["45"]
}

0 comments on commit c098387

Please sign in to comment.