-
Notifications
You must be signed in to change notification settings - Fork 47
/
overview.js
86 lines (79 loc) · 2.33 KB
/
overview.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
const ExtensionUtils = imports.misc.extensionUtils;
const extension = ExtensionUtils.getCurrentExtension();
const Main = imports.ui.main;
const OverviewControls = imports.ui.overviewControls;
var applications = extension.imports.applications;
function with_pop_shell(callback) {
let pop_shell = Main.extensionManager.lookup("[email protected]");
if (pop_shell && pop_shell.stateObj) {
let ext = pop_shell.stateObj.ext;
if (ext) {
return callback(ext);
}
}
}
var OVERVIEW_WORKSPACES = 0;
var OVERVIEW_APPLICATIONS = 1;
var OVERVIEW_LAUNCHER = 2;
function overview_visible(kind) {
if (kind == OVERVIEW_WORKSPACES) {
if (Main.overview.visibleTarget) {
if (!Main.overview.dash.showAppsButton.checked) {
return true;
}
}
} else if (kind == OVERVIEW_APPLICATIONS) {
return applications.visible();
} else if (kind == OVERVIEW_LAUNCHER) {
if (with_pop_shell((ext) => {
return ext.window_search.dialog.visible;
}) === true) {
return true;
}
} else {
if (Main.overview.visibleTarget) {
return true;
}
}
return false;
}
function overview_show(kind) {
if (kind == OVERVIEW_WORKSPACES) {
if (Main.overview.visible) {
Main.overview.dash.showAppsButton.checked = false;
} else {
Main.overview.show(OverviewControls.ControlsState.WINDOW_PICKER);
}
} else if (kind == OVERVIEW_APPLICATIONS) {
applications.show();
} else if (kind == OVERVIEW_LAUNCHER) {
Main.overview.hide();
with_pop_shell((ext) => {
ext.tiler.exit(ext);
ext.window_search.load_desktop_files();
ext.window_search.open(ext);
});
} else {
Main.overview.show();
}
}
function overview_hide(kind) {
if (kind == OVERVIEW_LAUNCHER) {
with_pop_shell((ext) => {
ext.exit_modes();
});
} else if (kind == OVERVIEW_APPLICATIONS) {
applications.hide();
} else {
Main.overview.hide();
}
}
function overview_toggle(kind) {
if (Main.overview.animationInProgress) {
// prevent accidental re-show
} else if (overview_visible(kind)) {
overview_hide(kind);
} else {
overview_show(kind);
}
}