Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm interested in Unity indicators, and wonder if there is any tutorial about how to program them. I can use the sources of the existing ones as last resort, but I'd prefer a more friendly approach because my programming skills are quite limited.

share|improve this question
Related links: – con-f-use Jun 13 '11 at 17:17
up vote 18 down vote accepted

Application Indicator documentation with examples and API docs are available here:

There are not yet tutorials on Application Indicators there yet, but stay tuned for more content on the App Developer site's tutorials section:

share|improve this answer
Just what I needed. Thanks! – rsuarez May 12 '11 at 10:26
Bump. All these links are outdated and lead to 'page not found' messages. Are there any new resources I could find? The official… site links to this question with Is there any tutorial for programming Unity indicators? as title. – Daniel Mar 11 '14 at 23:58
Broken links everywhere, See ApplicationIndicators , its API reference as HTML in libappindicator-doc package. – Sneetsher May 7 '14 at 8:50
There's a bug filed on the missing documentation: – Jorge Castro May 7 '14 at 12:26

Here is an app indicator example in c. This is an "indicator only" version (no window) of the example provided here:

#include <libappindicator/app-indicator.h>

static void activate_action (GtkAction *action);

static GtkActionEntry entries[] = {
    {"New",  "document-new",     "_New",  "<control>N",
        "Create a new file",    G_CALLBACK(activate_action)},
    {"Open", "document-open",    "_Open", "<control>O",
        "Open a file",          G_CALLBACK(activate_action)},
    {"Save", "document-save",    "_Save", "<control>S",
        "Save file",            G_CALLBACK(activate_action)},
    {"Quit", "application-exit", "_Quit", "<control>Q",
        "Exit the application", G_CALLBACK(gtk_main_quit)},
static guint n_entries = G_N_ELEMENTS(entries);

static const gchar *ui_info =
"  <popup name='IndicatorPopup'>"
"    <menuitem action='New' />"
"    <menuitem action='Open' />"
"    <menuitem action='Save' />"
"    <menuitem action='Quit' />"
"  </popup>"

static void activate_action(GtkAction *action)
    const gchar *name = gtk_action_get_name (action);
    GtkWidget *dialog;

    dialog = gtk_message_dialog_new(NULL,
                                    "You activated action: \"%s\"",

    g_signal_connect(dialog, "response", 
                     G_CALLBACK(gtk_widget_destroy), NULL);


int main(int argc, char **argv)
    GtkWidget*      indicator_menu;
    GtkActionGroup* action_group;
    GtkUIManager*   uim;
    AppIndicator* indicator;
    GError* error = NULL;

    gtk_init(&argc, &argv);

    /* Menus */
    action_group = gtk_action_group_new("AppActions");
    gtk_action_group_add_actions(action_group, entries, n_entries,

    uim = gtk_ui_manager_new();
    gtk_ui_manager_insert_action_group(uim, action_group, 0);

    if (!gtk_ui_manager_add_ui_from_string(uim, ui_info, -1, &error)) {
        g_message("Failed to build menus: %s\n", error->message);
        error = NULL;

    /* Indicator */
    indicator = app_indicator_new("example-simple-client",

    indicator_menu = gtk_ui_manager_get_widget(uim, "/ui/IndicatorPopup");

    app_indicator_set_status(indicator, APP_INDICATOR_STATUS_ACTIVE);
    app_indicator_set_attention_icon(indicator, "indicator-messages-new");

    app_indicator_set_menu(indicator, GTK_MENU(indicator_menu));


    return 0;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.