Skip to content

Instantly share code, notes, and snippets.

@yurenju
Created May 28, 2011 18:43
Show Gist options
  • Save yurenju/997116 to your computer and use it in GitHub Desktop.
Save yurenju/997116 to your computer and use it in GitHub Desktop.
PanelButton
const St = imports.gi.St;
const PanelMenu = imports.ui.panelMenu;
const Main = imports.ui.main;
function HelloPanelButton() {
this._init();
}
HelloPanelButton.prototype = {
__proto__: PanelMenu.Button.prototype,
_init: function() {
PanelMenu.Button.prototype._init.call(this, 0.0);
let btn = new St.Label({text: 'hello'});
this.actor.set_child(btn);
},
};
function main() {
let hbtn = new HelloPanelButton();
Main.panel._leftBox.add(hbtn.actor);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment