overridding WorkspacesDisplay



Hi all,

For some reason, I can't seem to patch WorkspacesDisplay. (I'm trying
to define what happens when you scroll your mouse button over the
workspace thumbnail sidebar in the overview):

const WorkspacesView = imports.ui.workspacesView;
const WDproto = WorkspacesView.WorkspacesView.prototype;

let storage;
function enable () {
    storage._onScrollEvent = WDproto._onScrollEvent; // store the original
    WDproto._onScrollEvent = function () {
        log('stole the scroll event');
    };
}

When I put this into an extension (with corresponding disable() and
init()), it doesn't work - scrolling over the workspace thumbnail
sidebar just does the usual (changes the workspace) rather than
logging 'stole the scroll event' to the terminal.

(And to verify that I have chosen to override the right function, if I
sudo modify ._onScrollEvent in
/usr/share/gnome-shell/js/ui/workspacesView.js to log to the terminal,
it works).

I had similar problems overridding ._getPreferredHeight,
._getPreferredWidth and ._allocate of
imports.ui.workspaceThumbnails.ThumbnailsBox.

Can anyone tell me what's going on here?

cheers.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]