RensAlthuis / vertical-overview

Gnome has had vertically stacked workspaces for a long time. The Gnome 40 update unfortunately made the switch to a horizontal layout. A choice that many Gnome users disagree with. This extension completely replaces the new Gnome overview with something that resembles the old style.
GNU General Public License v3.0
311 stars 29 forks source link

Thumbnails: show wallpaper #4

Closed romgrk closed 3 years ago

romgrk commented 3 years ago

Current thumbnails have a grey background instead of the wallpaper.

RensAlthuis commented 3 years ago

I've already looked into this a bit, apparently not as straight forward as I'd hoped. But it's high on the list of things to fix.

romgrk commented 3 years ago

That would need to be done in workspaceThumbnails.js, right? I'll try to take a look at it later.

RensAlthuis commented 3 years ago

Yeah, you'd need to figure out how to load the background image and display it on each thumbnail behind the windows.

romgrk commented 3 years ago

Yeah ok so you know what I've looked at this and it's not as easy as it seems.

romgrk commented 3 years ago

Ok, I think I got it, see the PR there.

blipk commented 3 years ago

I've been using this with my extension Customised Workspaces https://github.com/blipk/Customised-Workspaces which restores the wallpaper and allows setting a different one for each workspace.

It's enough to change _addWindowClone:

this.addInjection('workspaceThumbnail.ThumbnailsBox.prototype._addWindowClone',
  function(win) {
    let clone = new workspaceThumbnail.ThumbnailsBox.WindowClone(win);
    clone.connect('selected', (o, time) => { this.activate(time); });
    clone.connect('drag-begin', () => { Main.overview.beginWindowDrag(clone.metaWindow); });
    clone.connect('drag-cancelled', () => { Main.overview.cancelledWindowDrag(clone.metaWindow); });
    clone.connect('drag-end', () => { Main.overview.endWindowDrag(clone.metaWindow); });
    clone.connect('destroy', () => { this._removeWindowClone(clone.metaWindow); });
    this._contents.add_actor(clone);
    if (this._windows.length == 0) clone.setStackAbove(this._bgManager.backgroundActor);
    else clone.setStackAbove(this._windows[this._windows.length - 1]);
    this._windows.push(clone);
  return clone;        
});

Then something like the following in workspaceThumbnail.ThumbnailsBox.prototype.addThumbnails

_newbg = new Meta.Background({ meta_display: global.screen || global.display });
let bg = extensionUtils.getSettings('org.gnome.desktop.background').get_string('picture-uri').replace("file://", "");
_newbg.set_file(Gio.file_new_for_path(bg), imports.gi.GDesktopEnums.BackgroundStyle.ZOOM);

if (!thumbnailBox._bgManager)
    thumbnailBox._bgManager = new background.BackgroundManager({ monitorIndex: Main.layoutManager.primaryIndex,
                                                                    container: thumbnailBox._contents,
                                                                    vignette: false });

thumbnailBox._bgManager.backgroundActor.content.background = thumbnailBox._newbg;