-
Notifications
You must be signed in to change notification settings - Fork 0
/
extension.js
59 lines (44 loc) · 1.38 KB
/
extension.js
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
"use strict";
const { Gio } = imports.gi;
const Main = imports.ui.main;
const ExtensionUtils = imports.misc.extensionUtils;
const ExtensionManager = Main.extensionManager;
const Me = ExtensionUtils.getCurrentExtension();
const Util = Me.imports.util;
const Indicator = Me.imports.indicator;
const Overlay = Me.imports.overlay;
const MonitorManager = Me.imports.monitors.monitorManager;
const Gettext = imports.gettext;
const Domain = Gettext.domain(Me.metadata.uuid);
const _ = Domain.gettext;
const ngettext = Domain.ngettext;
function init()
{
log(`${Me.metadata.uuid}: Initializing`);
ExtensionUtils.initTranslations(Me.metadata.uuid);
return new Extension();
}
class Extension
{
enable()
{
log(_(`${Me.metadata.uuid}: Enabling`));
this.settings = ExtensionUtils.getSettings();
this.cancellable = new Gio.Cancellable();
MonitorManager.init();
MonitorManager.start(this.cancellable);
this.indicator = new Indicator.Indicator();
this.overlay = new Overlay.Overlay();
}
disable()
{
log(_(`${Me.metadata.uuid}: Disabling`));
this.cancellable.cancel();
MonitorManager.destroy();
this.settings = null;
if (this.indicator) this.indicator.destroy();
this.indicator = null;
if (this.overlay) this.overlay.destroy();
this.overlay = null;
}
}