Gtk2::AppIndicator(3)
π Gtk2::AppIndicator(3) π
okay bestie, gather round, because this is the Gtk2::AppIndicator page from the User Contributed Perl Documentation, and it's literally your golden ticket into the Unity libappindicator situation. no cap. π¦
β¨ NAME β¨
Gtk2::AppIndicator β a Perl extension for libappindicator. that's the whole name, that's the whole vibe. π
πΈ SYNOPSIS πΈ
here's the whole thing, character for character, because you're gonna want to run it exactly like this:
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.
$status_icon=Gtk2::AppIndicator->new("AnAppName","an_icon_name");
# 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;
$status_icon->set_icon_theme_path($acwd);
# 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->set_active(1);
$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(); });
$menu->append($showcp);
$menu->append(Gtk2::SeparatorMenuItem->new());
$menu->append($quit);
$status_icon->set_menu($menu);
# Show our icon and set the state
$menu->show_all();
$status_icon->set_active();
pro tip from the comments themselves, bestie: an_icon_name must be present at the icon theme path location, with an image extension like .jpg, .png or .svg, etc. and if you're setting the icon location yourself, it must be an absolute path in order to work. no exceptions, she's strict. π
π DESCRIPTION π
this module hands you an interface to the new ubuntu Unity libappindicator stuff. that's the tea. ββ¨
π FUNCTIONS π
π the constructor
$ind=Gtk2::AppIndicator->new($application_id,$active_icon_name [,$category])β creates a brand new application indicator object with the given name (id) and the icon name for the active icon. now about$category: it must be one of{'application-status','communications','system-services','hardware','other'}if you set it at all. if you don't set it, it defaults to'application-status'. periodt. π
π¦ icon theme path
$ind->set_icon_theme_path($path)β sets the icon theme path to'path'. this is where icons should be found, with names like<active_icon_name>.png.$ind->get_icon_theme_path()β hands back the (previously written) icon theme path, orundefinedif it was never set. she's honest like that.
π identity check
$ind->get_category()β returns the previously set category, the one you gave to thenewfunction.$ind->get_id()β returns the application id you gave to thenewfunction.
β¨ icon names, the main character energy
$ind->set_icon_name_active($name)β sets the icon name for the active icon.$ind->get_icon_name_active()β returns the name of the icon for the active state.$ind->set_icon_name_attention($name)β sets the icon name for the attention icon.$ind->get_icon_name_attention()β returns the name of the icon for the attention state.
π states, because she contains multitudes
$ind->set_active()β makes the application indicator active. β$ind->set_attention()β makes the application indicator show the attention icon. π$ind->set_passive()β makes the application indicator enter passive state, not showing any icon. she's resting, leave her alone. π$ind->set_state($state)β sets the application indicator in the given state, one of{'active','passive','attention'}.$ind->get_state()β returns the current state of the application indicator.
π menus
$ind->set_menu($menu)β sets the popup menu for the indicator icon.$ind->get_menu()β returns the current menu. heads up: not from the C code, but as stored in the perl object. iykyk. π
π«Ά the middle-mouse-button situation
$ind->set_secondary_activate_target($widget)β sets the secondary active target (under the middle mouse button) to$widget.$ind->get_secondary_activate_target()β returns the current secondary active target. again, not from the C code, but as stored in the perl object. keep that in your notes bestie. π
π AUTHOR π
Hans Oesterholt, <oesterhol@cpan.org> β shoutout to the icon who wrote this. π«‘
π COPYRIGHT AND LICENSE π
Copyright (C) 2012 by Hans Oesterholt <oesterhol@cpan.org>
This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License, which comes with Perl.
okay so that's the whole page, and before you go β this one's from the perl v5.42.0 era, dated 2025-07-25, and it lives in Gtk2::AppIndicator(3) under the User Contributed Perl Documentation. slay, go build an indicator icon, you've absolutely got this. π
β¨π¦
π¦ where this page comes from
- fedora 43: perl-Gtk2-AppIndicator 0.15-43.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms