File: extension.js

package info (click to toggle)
gnome-shell-extension-no-annoyance 0%2B20210717-12dc667-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 80 kB
  • sloc: javascript: 32; makefile: 2
file content (40 lines) | stat: -rw-r--r-- 1,475 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const Main = imports.ui.main;

function DontAnnoy() {
    this._init();
}

DontAnnoy.prototype = {
    _init : function() {
        global.display.disconnect(Main.windowAttentionHandler._windowDemandsAttentionId);
        global.display.disconnect(Main.windowAttentionHandler._windowMarkedUrgentId);
        this._windowDemandsAttentionId = global.display.connect('window-demands-attention',
                                         this._onWindowDemandsAttention.bind(this));
        this._windowMarkedUrgentId = global.display.connect('window-marked-urgent',
                                         this._onWindowDemandsAttention.bind(this));
    },

    _onWindowDemandsAttention: function(display, window) { },

    destroy: function() {
        global.display.disconnect(this._windowDemandsAttentionId);
        global.display.disconnect(this._windowMarkedUrgentId);
        Main.windowAttentionHandler._windowDemandsAttentionId = global.display.connect('window-demands-attention',
                         Main.windowAttentionHandler._onWindowDemandsAttention.bind(Main.windowAttentionHandler));
        Main.windowAttentionHandler._windowMarkedUrgentId = global.display.connect('window-marked-urgent',
                         Main.windowAttentionHandler._onWindowDemandsAttention.bind(Main.windowAttentionHandler));
    }
}

let dontannoy;

function init() {
}

function enable() {
    dontannoy = new DontAnnoy();
}

function disable() {
    dontannoy.destroy();
}