Skip to content

Commit

Permalink
cleaning code for #45
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Christophe Baptiste committed Jan 15, 2017
1 parent 53dd963 commit 7cd6989
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 30 deletions.
45 changes: 16 additions & 29 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ function disable() {

function onTrayIconAdded(o, icon, role, delay=1000) {

// loop through the array and hide the extension if extension X is enabled and corresponding application is running
let wmClass = icon.wm_class ? icon.wm_class.toLowerCase() : '';
for (let i = 0; i < blacklist.length; i++) {
if (ExtensionUtils.extensions[blacklist[i+1]] !== undefined && ExtensionUtils.extensions[blacklist[i+1]].state === 1 && wmClass === blacklist[i])
return;
}

let iconContainer = new St.Button({child: icon, visible: false});

icon.connect("destroy", function() {
Expand All @@ -78,35 +85,15 @@ function onTrayIconAdded(o, icon, role, delay=1000) {
icon.click(event);
});

//iconsBoxLayout.insert_child_at_index(iconContainer, 0);


// display icon
let wmClass = icon.wm_class ? icon.wm_class.toLowerCase() : '';
for (let i = 0; i < blacklist.length; i++) {
// loop through the array and hide the extension if extension X is enabled and corresponding application is running
if (ExtensionUtils.extensions[blacklist[i+1]] !== undefined && ExtensionUtils.extensions[blacklist[i+1]].state === 1 && wmClass === blacklist[i]) {
//if (wmClass === "Skype") {
return;
// GLib.timeout_add(GLib.PRIORITY_DEFAULT, delay, Lang.bind(this, function(){
// iconContainer.visible = false;
// iconsContainer.actor.visible = false;
// return GLib.SOURCE_REMOVE;
// }));
}
else {
GLib.timeout_add(GLib.PRIORITY_DEFAULT, delay, Lang.bind(this, function(){
iconContainer.visible = true;
iconsContainer.actor.visible = true;
return GLib.SOURCE_REMOVE;
}));
iconsBoxLayout.insert_child_at_index(iconContainer, 0);
setIcon(icon);
icons.push(icon);
}
}


GLib.timeout_add(GLib.PRIORITY_DEFAULT, delay, Lang.bind(this, function(){
iconContainer.visible = true;
iconsContainer.actor.visible = true;
return GLib.SOURCE_REMOVE;
}));

iconsBoxLayout.insert_child_at_index(iconContainer, 0);
setIcon(icon);
icons.push(icon);

}

Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
"settings-schema": "org.gnome.shell.extensions.topicons",
"url": "https://github.com/phocean/TopIcons-plus",
"uuid": "[email protected]",
"version": 17
"version": 19
}

0 comments on commit 7cd6989

Please sign in to comment.