GNOME 3.2 Simple Popup Menu Example

GNOME 3.2 is about to be released. There are major changes in the way GNOME Shell extensions must to be written in order to work with this version of GNOME.

Here is a simple GNOME 3.2 Shell extension which demonstrates a simple popup menu on the right hand side of the panel (top bar.) Once loaded, it can be enabled (displayed) or disabled (removed) without restarting the GNOME Shell. This is a major improvement over GNOME 3.0 and 3.1.

// Copyright (c) 2011 Finnbarr P. Murphy.  All rights reserved.

const St =;
const PanelMenu = imports.ui.panelMenu;
const PopupMenu = imports.ui.popupMenu;
const Panel = imports.ui.panel;
const Main = imports.ui.main;

function DemoButton() {

DemoButton.prototype = {
    __proto__: PanelMenu.SystemStatusButton.prototype,

    _init: function() {, 'folder');

        let item = new PopupMenu.PopupMenuItem(_("Hello"));;
        item = new PopupMenu.PopupMenuItem(_("Goodbye"));;

    enable: function() {
        let _children = Main.panel._rightBox.get_children();
        Main.panel._rightBox.insert_actor(, _children.length - 1);

    disable: function() {

function init() {
    return new DemoButton();

There are no changes to the format or contents of metadata.json. Read my main blog for more information.

A ready-to-use tarball of this extension can be downloaded from here.

Comments are closed.