forked from Thoma5/gnome-shell-extension-bottompanel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextension.js
38 lines (31 loc) · 1.07 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
const Main = imports.ui.main;
const PanelBox = Main.layoutManager.panelBox;
let MonitorsChangedListener = null;
let HeightNotifyListener = null;
function _toTop() {
let monitor = Main.layoutManager.primaryMonitor;
PanelBox.set_pivot_point(0,0);
PanelBox.set_position(0,0);
}
function _toBottom() {
let monitor = Main.layoutManager.primaryMonitor;
PanelBox.set_pivot_point(0,(-1)*(monitor.height-PanelBox.height));
PanelBox.set_position(0,(monitor.height-PanelBox.height));
}
function init() { }
function enable() {
MonitorsChangedListener = Main.layoutManager.connect("monitors-changed", _toBottom);
HeightNotifyListener = PanelBox.connect("notify::height", _toBottom);
_toBottom();
Main.panel.actor.add_style_class_name("popup-menu");
}
function disable() {
if(HeightNotifyListener !== null) {
PanelBox.disconnect(HeightNotifyListener);
}
if(MonitorsChangedListener !== null) {
Main.layoutManager.disconnect(MonitorsChangedListener);
}
_toTop();
Main.panel.actor.remove_style_class_name("popup-menu");
}