-
Notifications
You must be signed in to change notification settings - Fork 7
/
extension.js
121 lines (100 loc) · 3.15 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/*****************************************************
* Statuc Icon Settings
****************************************************/
//
// Add application you want it shows thier notification status
// icon on top bar to the following list.
//
// You may use top/htop to find out the name of application.
//
var notification = [
'deadbeef', // Deadbeef Music Player
'pidgin', // Pidgin IM Client
'gcin', // GCIN Chinese Input Method
'hime', // HIME Imput Method Editor
'dropbox', // Drop Box
'thunderbird-bin', // Thunderbird-bin (Gentoo binary package)
'thunderbird', // Thunderbird
'transmission', //Transmission
'firefox', // Firefox with FireTray
'firefox-bin', // Firefox-bin (Gentoo binary package)
'workrave', // Workrave
'gajim', // Gajim
'wicd-client.py', // Wicd-gtk
'skype' // Skype
]
// Add which built-in status icon you want to remove in the
// following list.
//
var removeStatusIcon = [
'a11y', // Accessibility
// 'volume',
// 'battery',
// 'keyboard',
// 'bluetooth',
// 'network'
]
/******************************************************
* Don't touch anything below!
*****************************************************/
const StatusIconDispatcher = imports.ui.statusIconDispatcher;
const Panel = imports.ui.panel;
const Main = imports.ui.main;
/**
* Hide built-in status icon.
*/
function hideStatusIcon(name)
{
for (var i = 0; i < Main.panel._rightBox.get_children().length; i++) {
if (Main.panel._statusArea[name] ==
Main.panel._rightBox.get_children()[i]._delegate) {
global.log("HIDE:" + name);
Main.panel._rightBox.get_children()[i].hide();
break;
}
}
}
/**
* Show built-in status icon again.
*/
function showStatusIcon(name)
{
for (var i = 0; i < Main.panel._rightBox.get_children().length; i++) {
if (Main.panel._statusArea[name] ==
Main.panel._rightBox.get_children()[i]._delegate) {
global.log("SHOW:" + name);
Main.panel._rightBox.get_children()[i].show();
break;
}
}
}
function removeFromTopBar(wmClass)
{
delete StatusIconDispatcher.STANDARD_TRAY_ICON_IMPLEMENTATIONS[wmClass];
}
function addToTopBar(wmClass)
{
StatusIconDispatcher.STANDARD_TRAY_ICON_IMPLEMENTATIONS[wmClass] = wmClass;
}
function init() {
}
function enable() {
for (var i = 0; i < notification.length; i++) {
global.log('Add ' + notification[i] + " to top bar");
addToTopBar(notification[i]);
}
for (var i = 0; i < removeStatusIcon.length; i++) {
global.log('Remove ' + removeStatusIcon[i] + " from top bar");
hideStatusIcon(removeStatusIcon[i]);
}
}
function disable() {
for (var i = 0; i < notification.length; i++) {
global.log('Remove ' + notification[i] + " from top bar");
removeFromTopBar(notification[i]);
}
for (var i = 0; i < removeStatusIcon.length; i++) {
global.log('Restore ' + removeStatusIcon[i] + " to top bar");
showStatusIcon(removeStatusIcon[i]);
}
}