Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Systray zone is now an applet

  • Loading branch information...
commit 18f07df0117dfee205b3ab1ec4a522d7333c7aaa 1 parent a84a24a
@clefebvre clefebvre authored
View
2  data/org.cinnamon.gschema.xml
@@ -13,7 +13,7 @@
</key>
<key type="as" name="enabled-applets">
- <default>['panel1:left:0:menu@cinnamon.org', 'panel1:left:1:show-desktop@cinnamon.org', 'panel1:left:2:panel-launchers@cinnamon.org', 'panel1:left:3:window-list@cinnamon.org', 'panel1:center:0:keyboard@cinnamon.org', 'panel1:center:1:bluetooth@cinnamon.org', 'panel1:center:2:network@cinnamon.org', 'panel1:center:3:sound@cinnamon.org', 'panel1:center:4:power@cinnamon.org', 'panel1:right:0:calendar@cinnamon.org']</default>
+ <default>['panel1:left:0:menu@cinnamon.org', 'panel1:left:1:show-desktop@cinnamon.org', 'panel1:left:2:panel-launchers@cinnamon.org', 'panel1:left:3:window-list@cinnamon.org', 'panel1:center:0:keyboard@cinnamon.org', 'panel1:center:1:bluetooth@cinnamon.org', 'panel1:center:2:network@cinnamon.org', 'panel1:center:3:sound@cinnamon.org', 'panel1:center:4:power@cinnamon.org', 'panel1:right:0:systray@cinnamon.org', 'panel1:right:1:calendar@cinnamon.org']</default>
<summary>Uuids of applets to enable</summary>
<description>Cinnamon applets have a uuid property; this key lists applets which should be loaded.</description>
</key>
View
2  data/org.cinnamon.gschema.xml.in
@@ -22,7 +22,7 @@
</key>
<key name="enabled-applets" type="as">
- <default>['panel1:left:0:menu@cinnamon.org', 'panel1:left:1:show-desktop@cinnamon.org', 'panel1:left:2:panel-launchers@cinnamon.org', 'panel1:left:3:window-list@cinnamon.org', 'panel1:center:0:keyboard@cinnamon.org', 'panel1:center:1:bluetooth@cinnamon.org', 'panel1:center:2:network@cinnamon.org', 'panel1:center:3:sound@cinnamon.org', 'panel1:center:4:power@cinnamon.org', 'panel1:right:0:calendar@cinnamon.org']</default>
+ <default>['panel1:left:0:menu@cinnamon.org', 'panel1:left:1:show-desktop@cinnamon.org', 'panel1:left:2:panel-launchers@cinnamon.org', 'panel1:left:3:window-list@cinnamon.org', 'panel1:center:0:keyboard@cinnamon.org', 'panel1:center:1:bluetooth@cinnamon.org', 'panel1:center:2:network@cinnamon.org', 'panel1:center:3:sound@cinnamon.org', 'panel1:center:4:power@cinnamon.org', 'panel1:right:0:systray@cinnamon.org', 'panel1:right:1:calendar@cinnamon.org']</default>
<_summary>Uuids of applets to enable</_summary>
<_description>
Cinnamon applets have a uuid property; this key lists applets
View
83 files/usr/share/cinnamon/applets/systray@cinnamon.org/applet.js
@@ -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;
+}
View
6 files/usr/share/cinnamon/applets/systray@cinnamon.org/metadata.json
@@ -0,0 +1,6 @@
+{
+ "uuid": "systray@cinnamon.org",
+ "name": "Systrem Tray",
+ "description": "An applet which hosts all the system try icons",
+ "icon": "indicator-applet"
+}
View
4 js/ui/panel.js
@@ -720,8 +720,8 @@ Panel.prototype = {
this._status_area_cinnamon_implementation = STANDARD_STATUS_AREA_CINNAMON_IMPLEMENTATION;
}
- Main.statusIconDispatcher.connect('status-icon-added', Lang.bind(this, this._onTrayIconAdded));
- Main.statusIconDispatcher.connect('status-icon-removed', Lang.bind(this, this._onTrayIconRemoved));
+ //Main.statusIconDispatcher.connect('status-icon-added', Lang.bind(this, this._onTrayIconAdded));
+ //Main.statusIconDispatcher.connect('status-icon-removed', Lang.bind(this, this._onTrayIconRemoved));
this.actor.connect('leave-event', Lang.bind(this, this._leavePanel));
this.actor.connect('enter-event', Lang.bind(this, this._enterPanel));
View
3  js/ui/statusIconDispatcher.js
@@ -48,8 +48,7 @@ StatusIconDispatcher.prototype = {
_onTrayIconAdded: function(o, icon) {
let wmClass = (icon.wm_class || 'unknown').toLowerCase();
let role = STANDARD_TRAY_ICON_IMPLEMENTATIONS[wmClass];
- if (!role) role = wmClass;
- global.log("ROLE: " + wmClass + " --> " + role);
+ if (!role) role = wmClass;
this.emit('status-icon-added', icon, role);
},
Please sign in to comment.
Something went wrong with that request. Please try again.