Author image Hans Dijkema


Gtk2::AppIndicator - Perl extension for libappindicator


  use Gtk2 '-init';
  use Gtk2::AppIndicator;
  use Cwd;

  # Initialize the status icon. an_icon_name must be present 
  # at the icon theme path location, with an image extension like
  # .jpg, .png or .svg, etc.
  # If you want to be in control over your icon location, you 
  # can set it manually. It must be an absolute path, in order
  # to work. 
  my $absolute_current_working_directory=getcwd();
  my $acwd=$absolute_current_working_directory;

  # Optionally set different icons 
  # $status_icon->set_icon_name_active("an_icon_name");
  # $status_icon->set_icon_name_attention("an_other_icon_name");
  # $status_icon->set_icon_name_passive("an_other_icon_name");
  # Add a menu to the indicator
  my $menu=Gtk2::Menu->new();
  my $showcp=Gtk2::CheckMenuItem->new_with_mnemonic("_Show My App");
  $showcp->signal_connect("toggled",sub { hide_show($window,$showcp); });
  my $quit=Gtk2::MenuItem->new_with_mnemonic("_Quit");
  $quit->signal_connect("activate",sub { Gtk->main_quit(); });

  # Show our icon and set the state


This module gives an interface to the new ubuntu Unity libappindicator stuff.


 $ind=Gtk2::AppIndicator->new($application_id,$active_icon_name [,$category])

Creates a new application indicator object with given name (id) and icon name for the active icon. Category must be one of { 'application-status','communications','system-services','hardware','other' } if set. if not set, it defaults to 'application-status'.


Set the icon theme path to 'path'. This is where icons should be found with names like <active_icon_name>.png.


Returns the (previously written) icon theme path, or undefined if not set.


Returns the previously set category with the new function.


Returns the application id given to the new function.


Sets the icon name for the active icon.


Returns the name of the icon for active state.


Sets the icon name for the attention icon


Returns the name of the icon for attention state.


Makes the application indicator active.


Makes the application indicator show the attention icon.


Makes the application indicator enter passive state, not showing any icon


Sets application indicator in the given state, one of {'active','passive','attention'}.


Returns the current state of the application indicator.


Sets the popup menu for the indicator icon.


Returns the current menu (not from the C code, but as stored in the perl object)


Sets the secondary active target (under the middle mouse button) to $widget


Returns the current secondary active target (not from the C code, but as stored in the perl object)


Hans Oesterholt, <>


Copyright (C) 2012 by Hans Oesterholt <>

This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License, which comes with Perl.