-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathextension.js
61 lines (49 loc) · 1.55 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
const Lang = imports.lang;
const Main = imports.ui.main;
const PopupMenu = imports.ui.popupMenu;
const Util = imports.misc.util;
const EqualizerIcon = 'equalizer-symbolic';
const QpaeqSubMenu = new Lang.Class({
Name: 'QpaeqSubMenu',
Extends: PopupMenu.PopupSubMenuMenuItem,
_init: function() {
this.parent('qpaeq launcher: loading...', true);
this.icon.style_class = 'system-status-icon';
this.icon.icon_name = EqualizerIcon;
this.label.set_text("equalizer");
this.item = new PopupMenu.PopupMenuItem('qpaeq');
this.item.connect('activate', Lang.bind(this, this._launch));
this.menu.addMenuItem(this.item);
},
_launch: function() {
Util.spawn(['qpaeq'])
},
destroy: function() {
this.parent();
}
});
let qpaeqSubMenu = null;
function init(extensionMeta) {
// add icons path to the theme search path
let theme = imports.gi.Gtk.IconTheme.get_default();
theme.append_search_path(extensionMeta.path + "/icons");
}
function enable() {
if (qpaeqSubMenu != null)
return;
qpaeqSubMenu = new QpaeqSubMenu();
// Try to add the output-switcher right below the output slider...
let volMen = Main.panel.statusArea.aggregateMenu._volume._volumeMenu;
let items = volMen._getMenuItems();
let i = 0;
while (i < items.length)
if (items[i] === volMen._output.item)
break;
else
i++;
volMen.addMenuItem(qpaeqSubMenu, i+1);
}
function disable() {
qpaeqSubMenu.destroy();
qpaeqSubMenu = null;
}