Skip to content

Commit

Permalink
Restore workspace thumbnails background. fixes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
axxapy committed Apr 13, 2021
1 parent 49bb730 commit b827e2d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Simple [gnome-shell](https://wiki.gnome.org/Projects/GnomeShell) (v40.0) extensi
## Changes
- Search textbox is hidden by default and shown only when user begins to type-to-search
- Scale of workspaces thumbnails increased 2x
- Restores background image for workspace thumbnails

## Screenshot

Expand Down
41 changes: 38 additions & 3 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,37 @@ class Extension {
}

enable() {
// Thumbnails
this.bkp.MAX_THUMBNAIL_SCALE = workspaceThumbnail.MAX_THUMBNAIL_SCALE
workspaceThumbnail.MAX_THUMBNAIL_SCALE = 0.1

this.bkp.thumb_init = workspaceThumbnail.WorkspaceThumbnail.prototype._init;
const _init = this.bkp.thumb_init
workspaceThumbnail.WorkspaceThumbnail.prototype._init = function(metaWorkspace, monitorIndex) {
_init.call(this, metaWorkspace, monitorIndex)
this._bgManager = new imports.ui.background.BackgroundManager({
monitorIndex: Main.layoutManager.primaryIndex,
container: this._contents,
vignette: false
});
}

this.bkp.thumb_onDestroy = workspaceThumbnail.WorkspaceThumbnail.prototype._onDestroy;
const _onDestroy = this.bkp.thumb_onDestroy
workspaceThumbnail.WorkspaceThumbnail.prototype._onDestroy = function() {
_onDestroy.call(this)
if (this._bgManager) {
this._bgManager.destroy();
this._bgManager = null;
}
}

// Search input
this.c = {
searchEntry: Main.overview.searchEntry,
searchController: Main.overview._overview.controls._searchController,
}

this.bkp.MAX_THUMBNAIL_SCALE = workspaceThumbnail.MAX_THUMBNAIL_SCALE
workspaceThumbnail.MAX_THUMBNAIL_SCALE = 0.1

this.c.searchEntry.hide()

this.connectedId = this.c.searchController.connect('notify::search-active', () => {
Expand All @@ -32,11 +55,23 @@ class Extension {
}

disable() {
// Thumbnails
if (this.bkp.MAX_THUMBNAIL_SCALE) {
workspaceThumbnail.MAX_THUMBNAIL_SCALE = this.bkp.MAX_THUMBNAIL_SCALE
delete(this.bkp.MAX_THUMBNAIL_SCALE)
}

if (this.bkp.thumb_init) {
workspaceThumbnail.WorkspaceThumbnail.prototype._init = this.bkp.thumb_init
delete(this.bkp.thumb_init)
}

if (this.bkp.thumb_onDestroy) {
workspaceThumbnail.WorkspaceThumbnail.prototype._onDestroy = this.bkp.thumb_onDestroy
delete(this.bkp.thumb_onDestroy)
}

// Search input
if (this.connectedId) {
this.c.searchController.disconnect(this.connectedId)
delete(this.connectedId)
Expand Down

0 comments on commit b827e2d

Please sign in to comment.