1Gtk2::AppIndicator(3) User Contributed Perl DocumentationGtk2::AppIndicator(3)
2
3
4

NAME

6       Gtk2::AppIndicator - Perl extension for libappindicator
7

SYNOPSIS

9         use Gtk2 '-init';
10         use Gtk2::AppIndicator;
11         use Cwd;
12
13         # Initialize the status icon. an_icon_name must be present
14         # at the icon theme path location, with an image extension like
15         # .jpg, .png or .svg, etc.
16         $status_icon=Gtk2::AppIndicator->new("AnAppName","an_icon_name");
17
18         # If you want to be in control over your icon location, you
19         # can set it manually. It must be an absolute path, in order
20         # to work.
21         my $absolute_current_working_directory=getcwd();
22         my $acwd=$absolute_current_working_directory;
23         $status_icon->set_icon_theme_path($acwd);
24
25         # Optionally set different icons
26         # $status_icon->set_icon_name_active("an_icon_name");
27         # $status_icon->set_icon_name_attention("an_other_icon_name");
28         # $status_icon->set_icon_name_passive("an_other_icon_name");
29
30         # Add a menu to the indicator
31         my $menu=Gtk2::Menu->new();
32         my $showcp=Gtk2::CheckMenuItem->new_with_mnemonic("_Show My App");
33         $showcp->set_active(1);
34         $showcp->signal_connect("toggled",sub { hide_show($window,$showcp); });
35         my $quit=Gtk2::MenuItem->new_with_mnemonic("_Quit");
36         $quit->signal_connect("activate",sub { Gtk->main_quit(); });
37
38         $menu->append($showcp);
39         $menu->append(Gtk2::SeparatorMenuItem->new());
40         $menu->append($quit);
41         $status_icon->set_menu($menu);
42
43         # Show our icon and set the state
44         $menu->show_all();
45         $status_icon->set_active();
46

DESCRIPTION

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

FUNCTIONS

52        $ind=Gtk2::AppIndicator->new($application_id,$active_icon_name [,$category])
53
54       Creates a new application indicator object with given name (id) and
55       icon name for the active icon.  Category must be one of  {
56       'application-status','communications','system-services','hardware','other'
57       } if set. if not set, it defaults to 'application-status'.
58
59        $ind->set_icon_theme_path($path)
60
61       Set the icon theme path to 'path'. This is where icons should be found
62       with names like <active_icon_name>.png.
63
64        $ind->get_icon_theme_path()
65
66       Returns the (previously written) icon theme path, or undefined if not
67       set.
68
69        $ind->get_category()
70
71       Returns the previously set category with the new function.
72
73        $ind->get_id()
74
75       Returns the application id given to the new function.
76
77        $ind->set_icon_name_active($name)
78
79       Sets the icon name for the active icon.
80
81        $ind->get_icon_name_active()
82
83       Returns the name of the icon for active state.
84
85        $ind->set_icon_name_attention($name)
86
87       Sets the icon name for the attention icon
88
89        $ind->get_icon_name_attention()
90
91       Returns the name of the icon for attention state.
92
93         $ind->set_active()
94
95       Makes the application indicator active.
96
97         $ind->set_attention()
98
99       Makes the application indicator show the attention icon.
100
101         $ind->set_passive()
102
103       Makes the application indicator enter passive state, not showing any
104       icon
105
106         $ind->set_state($state)
107
108       Sets application indicator in the given state, one of
109       {'active','passive','attention'}.
110
111         $ind->get_state()
112
113       Returns the current state of the application indicator.
114
115         $ind->set_menu($menu)
116
117       Sets the popup menu for the indicator icon.
118
119         $ind->get_menu()
120
121       Returns the current menu (not from the C code, but as stored in the
122       perl object)
123
124         $ind->set_secondary_activate_target($widget)
125
126       Sets the secondary active target (under the middle mouse button) to
127       $widget
128
129         $ind->get_secondary_activate_target()
130
131       Returns the current secondary active target (not from the C code, but
132       as stored in the perl object)
133

AUTHOR

135       Hans Oesterholt, <oesterhol@cpan.org>
136
138       Copyright (C) 2012 by Hans Oesterholt <oesterhol@cpan.org>
139
140       This program is free software; you can redistribute it and/or modify it
141       under the terms of the Artistic License, which comes with Perl.
142
143
144
145perl v5.32.0                      2020-07-28             Gtk2::AppIndicator(3)
Impressum