-
-
Notifications
You must be signed in to change notification settings - Fork 88
/
extension.js
68 lines (58 loc) · 2.14 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
60
61
62
63
64
65
66
67
68
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Cinnamon/Gnome-Shell extension specific routines.
*
* Create the correct manager and enable/disable it.
*/
const Config = imports.misc.config;
const PACKAGE_NAME = Config.PACKAGE_NAME;
const PACKAGE_VERSION = Config.PACKAGE_VERSION;
let ExtensionImports;
let HAS_META_KEYBIND_API;
if(PACKAGE_NAME == 'cinnamon') {
HAS_META_KEYBIND_API = !(PACKAGE_VERSION <= "1.4.0");
ExtensionImports = imports.ui.extensionSystem.extensions["CoverflowAltTab@dmo60.de"];
}
else {
HAS_META_KEYBIND_API = true;
ExtensionImports = imports.misc.extensionUtils.getCurrentExtension().imports;
}
const Manager = ExtensionImports.manager;
const Platform = ExtensionImports.platform;
const Keybinder = ExtensionImports.keybinder;
let manager = null;
function init() {
}
function enable() {
if (!manager) {
let platform, keybinder;
if(PACKAGE_NAME == 'cinnamon') {
if(PACKAGE_VERSION <= "1.7.2")
platform = new Platform.PlatformCinnamon();
else
platform = new Platform.PlatformCinnamon18();
keybinder = HAS_META_KEYBIND_API ? new Keybinder.KeybinderNewApi() : new Keybinder.KeybinderOldApi();
} else {
if(parseInt(PACKAGE_VERSION.split(".")[1]) >= 14 && PACKAGE_VERSION >= "3.14.0") {
platform = new Platform.PlatformGnomeShell314();
keybinder = new Keybinder.KeybinderNewGSApi();
} else if(parseInt(PACKAGE_VERSION.split(".")[1]) >= 10 && PACKAGE_VERSION >= "3.10.0") {
platform = new Platform.PlatformGnomeShell310();
keybinder = new Keybinder.KeybinderNewGSApi();
} else if(PACKAGE_VERSION >= "3.8.0") {
platform = new Platform.PlatformGnomeShell38();
keybinder = new Keybinder.KeybinderNewGSApi();
} else {
platform = new Platform.PlatformGnomeShell();
keybinder = new Keybinder.KeybinderNewApi();
}
}
manager = new Manager.Manager(platform, keybinder);
}
manager.enable();
}
function disable() {
if (manager) {
manager.disable();
}
}