Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
94 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
files/usr/share/cinnamon/applets/systray@cinnamon.org/applet.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
const Applet = imports.ui.applet; | ||
const Main = imports.ui.main; | ||
const PanelMenu = imports.ui.panelMenu; | ||
const Lang = imports.lang; | ||
|
||
function MyApplet(orientation) { | ||
this._init(orientation); | ||
} | ||
|
||
MyApplet.prototype = { | ||
__proto__: Applet.Applet.prototype, | ||
|
||
_init: function(orientation) { | ||
Applet.Applet.prototype._init.call(this, orientation); | ||
|
||
try { | ||
Main.statusIconDispatcher.connect('status-icon-added', Lang.bind(this, this._onTrayIconAdded)); | ||
Main.statusIconDispatcher.connect('status-icon-removed', Lang.bind(this, this._onTrayIconRemoved)); | ||
} | ||
catch (e) { | ||
global.logError(e); | ||
} | ||
}, | ||
|
||
on_applet_clicked: function(event) { | ||
|
||
}, | ||
|
||
_onTrayIconAdded: function(o, icon, role) { | ||
try { | ||
let hiddenIcons = ["network", "power", "keyboard", "gnome-settings-daemon", "volume", "bluetooth", "battery", "a11y"]; | ||
|
||
if (hiddenIcons.indexOf(role) != -1 ) { | ||
// We've got an applet for that | ||
return; | ||
} | ||
|
||
//icon.height = PANEL_ICON_SIZE; | ||
let buttonBox = new PanelMenu.ButtonBox({ style_class: 'panel-status-button' }); | ||
let box = buttonBox.actor; | ||
box.add_actor(icon); | ||
|
||
this._insertStatusItem(box, -1); | ||
|
||
let themeNode = buttonBox.actor.get_theme_node(); | ||
if (!themeNode.get_length('height')) icon.height = PANEL_ICON_DEFAULT_SIZE; | ||
else icon.height = themeNode.get_length('height'); | ||
} | ||
catch (e) { | ||
global.logError(e); | ||
} | ||
}, | ||
|
||
_onTrayIconRemoved: function(o, icon) { | ||
let box = icon.get_parent(); | ||
if (box && box._delegate instanceof PanelMenu.ButtonBox) | ||
box.destroy(); | ||
}, | ||
|
||
_insertStatusItem: function(actor, position) { | ||
let children = this.actor.get_children(); | ||
let i; | ||
for (i = children.length - 1; i >= 0; i--) { | ||
let rolePosition = children[i]._rolePosition; | ||
if (position > rolePosition) { | ||
this.actor.insert_actor(actor, i + 1); | ||
break; | ||
} | ||
} | ||
if (i == -1) { | ||
// If we didn't find a position, we must be first | ||
this.actor.insert_actor(actor, 0); | ||
} | ||
actor._rolePosition = position; | ||
}, | ||
|
||
|
||
}; | ||
|
||
function main(metadata, orientation) { | ||
let myApplet = new MyApplet(orientation); | ||
return myApplet; | ||
} |
6 changes: 6 additions & 0 deletions
6
files/usr/share/cinnamon/applets/systray@cinnamon.org/metadata.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"uuid": "systray@cinnamon.org", | ||
"name": "Systrem Tray", | ||
"description": "An applet which hosts all the system try icons", | ||
"icon": "indicator-applet" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters