On 25 April 2013 23:35, Florian Müllner <fmuell...@gnome.org> wrote:

> On Fri, Apr 26, 2013 at 12:18 AM, Reuben Thomas <r...@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;
> }
>

This code is now available in an extension on
extensions.gnome.org(actually, as two identical extensions, but that's
another matter, about
which I've filed a bug report!):

https://extensions.gnome.org/extension/672/disable-screen-shield/

I've been using it just for a few days, since I finally have a) upgraded to
GNOME 3.8 and b) managed to stop using xscreensaver.

Unfortunately, the code appears to have a problem: often when I come back
to my computer and press a key or waggle the mouse, the screen switches on
and the cursor appears (as it should, and normally does), but when I then
press another key or waggle the mouse some more, the display is not
restored: I am instead left looking at a black screen with just a mouse
cursor.

If I disable the extension, then the screen shield comes back, of course,
but works entirely reliably. (It's just a PITA that the display doesn't
come back straight away, hence my desire to have the extension in the first
place).

I am writing back to you, rather than filing a bug report against the
extension, because as the extension's author admits, he just used your code
verbatim.

I am conscious that I'm not using the latest GNOME release, but this looks
likely to be the case for a long time for many users, as Ubuntu Trusty (the
next Long-Term Support Release, due next April and supported until 2017)
will also use GNOME 3.8. Hence, bug-fixing extensions for 3.8 is, I
suggest, a valuable thing!

If you have any pointers as to how I might go about finding out what goes
wrong, I'd be happy to look into the problem further.

-- 
http://rrt.sc3d.org
_______________________________________________
gnome-shell-list mailing list
gnome-shell-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gnome-shell-list

Reply via email to