Last active
December 26, 2015 14:39
-
-
Save mnogu/7167289 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // GNOME extension w/ multiple icons | |
| // | |
| // tested w/ gnome-shell 3.8 | |
| // won't work w/ older versions of gnome-shell | |
| // | |
| const St = imports.gi.St; | |
| const Main = imports.ui.main; | |
| const PopupMenu = imports.ui.popupMenu; | |
| const PanelMenu = imports.ui.panelMenu; | |
| let button, button2; | |
| function init() { | |
| button = new PanelMenu.Button(0.0); | |
| button._icon = new St.Icon({icon_name: 'system-run', | |
| style_class: 'system-status-icon'}); | |
| button.actor.add_actor(button._icon); | |
| button.menu.addMenuItem(new PopupMenu.PopupMenuItem("foo")); | |
| button.menu.addMenuItem(new PopupMenu.PopupMenuItem("bar")); | |
| button2 = new PanelMenu.Button(0.0); | |
| button2._icon = new St.Icon({icon_name: 'system-search', | |
| style_class: 'system-status-icon' }); | |
| button2.actor.add_actor(button2._icon); | |
| button2.menu.addMenuItem(new PopupMenu.PopupMenuItem("hoge")); | |
| button2.menu.addMenuItem(new PopupMenu.PopupMenuItem("moge")); | |
| } | |
| function enable() { | |
| Main.panel._rightBox.insert_child_at_index(button.container, 0); | |
| Main.panel._rightBox.insert_child_at_index(button2.container, 1); | |
| } | |
| function disable() { | |
| Main.panel._rightBox.remove_child(button.container); | |
| Main.panel._rightBox.remove_child(button2.container); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
