Re: Turning off the screen shield in gnome-shell 3.8



On Fri, Apr 26, 2013 at 12:18 AM, Reuben Thomas <rrt sc3d org> wrote:
Thanks very much, that looks good. But is there no way to write this as a
shell extension?

Of course:

const ScreenShield = imports.ui.screenShield;

let _onUserBecameActiveOrig;

function _onUserBecameActiveInjected() {
    this.idleMonitor.remove_watch(this._becameActiveId);
    this._becameActiveId = 0;

    let lightboxWasShown = this._lightbox.shown;
    this._lightbox.hide();

    // Shortcircuit in case the mouse was moved before the fade completed
    // or the screen is not locked
    if (!lightboxWasShown || !this._isLocked) {
        this.deactivate(false);
        return;
    }
}

function init() {
}

function enable() {
    _onUserBecameActiveOrig =
ScreenShield.ScreenShield.prototype._onUserBecameActive;
    ScreenShield.ScreenShield.prototype._onUserBecameActive =
_onUserBecameActiveInjected;
}

function disable() {
    ScreenShield.ScreenShield.prototype._onUserBecameActive =
_onUserBecameActiveOrig;
}


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