4

I do my first steps in developing gnome 3 shell extensions. Actually I try to realize this simple thing: I want to suppress the annoying "Application xyz is ready" notification. After a bit of research I found out, that this class is responsible:

WindowAttentionHandler from /usr/share/gnome-shell/js/ui/windowAttentionHandler.js

This includes an event handler method called "_onWindowDemandsAttention" which sends the notification. A quick and dirty test by commenting out the responsible code in this method leads to what I want: no more "Application xyz is ready" notification any longer.

For not to be such dirty by hacking the original sources I want to write a little shell extension which overloads the "WindowAttentionHandler._onWindowDemandsAttention" method with nothing more than a simple "return".

It can be read here - under "How extends functionality" that one can simply overload a function by using the .prototype. After researching the correct syntax I now have an extension with this simple code in extension.js just for testing if it works:

const WindowAttentionHandler = imports.ui.windowAttentionHandler;

function init() {
}

function enable() {
WindowAttentionHandler.WindowAttentionHandler.prototype._onWindowDemandsAttention=function(display, window) { 
                return;
        }
}

function disable() {
}

Enabling the extension and restarting gnome shell raises no error (nothing in gnome session logs or in LookingGlass) BUT it doesn't work either: The "Application xyz is ready" notifications are still appearing.

I can make sure that the extension is really loaded by adding some debug output ( log("BLAA") ) in the "init" or "enable" functions.

Any hint what I am doing wrong? Or do I have to use a different solution?

  • N.B. the notification is likely caused by the line StartupNotify=true in the launcher .desktop files (in /usr/share/applications and elsewhere. Changing, commenting out, or removing the line would probably solve the issue. Great idea though! :) – Wilf Oct 12 '14 at 18:07
0

Most likely the handler is already instantiated at the time your extension overrides the template from which it was already constructed. You will need to hunt down the running instance and override that, not the library template.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.