-
Notifications
You must be signed in to change notification settings - Fork 0
/
extension.js
64 lines (50 loc) · 1.61 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
const Lang = imports.lang;
const Mainloop = imports.mainloop;
const St = imports.gi.St;
const Main = imports.ui.main;
const Tweener = imports.ui.tweener;
let text, button;
function _hideMessage() {
Main.uiGroup.remove_actor(text);
text = null;
}
function _showMessage() {
if (!text) {
text = new St.Label({ style_class: 'helloworld-label',
text: "Lorem ispum!" });
Main.uiGroup.add_actor(text);
}
text.opacity = 255;
let monitor = Main.layoutManager.primaryMonitor;
text.set_position(Math.floor(monitor.width / 2 - text.width / 2),
Math.floor(monitor.height / 2 - text.height / 2));
Tweener.addTween(text,
{ opacity: 0,
time: 0.5,
transition: 'easeOutQuad',
onComplete: _hideMessage });
}
function init() {
button = new St.Bin({ style_class: 'panel-button',
reactive: true,
can_focus: true,
x_fill: true,
y_fill: false,
track_hover: true });
let icon = new St.Icon({ icon_name: 'system-run',
icon_type: St.IconType.SYMBOLIC,
style_class: 'system-status-icon' });
button.set_child(icon);
// refreshTimer();
// button.connect('button-press-event', _showHello);
}
function refreshTimer() {
_showMessage();
Mainloop.timeout_add_seconds(1, refreshTimer);
}
function enable() {
Main.panel._rightBox.insert_actor(button, 0);
}
function disable() {
Main.panel._rightBox.remove_actor(button);
}