-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextension.js
43 lines (34 loc) · 1.2 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
const panel = imports.ui.main.panel;
const layoutManager = imports.ui.main.layoutManager;
const panelBox = imports.ui.main.layoutManager.panelBox;
var [
heightNotifyListener,
monitorsChangedListener,
] = [null, null];
function moveToTop() {
const m = layoutManager.primaryMonitor;
const [x, y, w] = [m.x - 1, m.y, m.width + 1];
panelBox.set_pivot_point(x, -y);
panelBox.set_position(x, y);
panelBox.set_size(w, -1);
}
function moveToBottom() {
const m = layoutManager.primaryMonitor;
const [x, y, w] = [m.x - 1, m.y + m.height - panelBox.height, m.width + 1];
panelBox.set_pivot_point(x, -y);
panelBox.set_position(x, y);
panelBox.set_size(w, -1);
}
function init() { }
function enable() {
heightNotifyListener = panelBox.connect("notify::height", moveToBottom);
monitorsChangedListener = layoutManager.connect("monitors-changed", moveToBottom);
moveToBottom();
panel.actor.add_style_class_name("popup-menu");
}
function disable() {
heightNotifyListener && panelBox.disconnect(heightNotifyListener);
monitorsChangedListener && layoutManager.disconnect(monitorsChangedListener);
moveToTop();
panel.actor.remove_style_class_name("popup-menu");
}