Skip to content

Instantly share code, notes, and snippets.

@naddeoa
Created May 15, 2017 01:04
Show Gist options
  • Save naddeoa/8cdad4f7fbca869906ac81deee1c3fed to your computer and use it in GitHub Desktop.
Save naddeoa/8cdad4f7fbca869906ac81deee1c3fed to your computer and use it in GitHub Desktop.
Minimal example of a gnome extension that just shows some text in the menu bar
const St = imports.gi.St;
const Lang = imports.lang;
// UI specific components
const Main = imports.ui.main;
const PanelMenu = imports.ui.panelMenu;
const Indicator = new Lang.Class({
Name: 'GnomeBitBarIndicator', // does this even matter?
Extends: PanelMenu.Button,
_init: function() {
this.parent(0.0, "GnomeBitBar", false); // does this even matter?
let text = new St.Label({
text: "Foo"
});
this.actor.add_actor(text);
}
});
let menu;
function init() {
// One time startup initialization
}
function enable() {
menu = new Indicator();
Main.panel.addToStatusArea('indicator', menu);
}
function disable() {
menu.destroy();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment