AppIndicator

Differences between revisions 1 and 2
Revision 1 as of 2010-03-01 18:53:31
Size: 143
Editor: pool-71-182-100-128
Comment:
Revision 2 as of 2010-03-01 19:30:47
Size: 9081
Editor: pool-71-182-100-128
Comment:
Deletions are marked like this. Additions are marked like this.
Line 4: Line 4:
(02:01:05 PM) qense: thank you rickspencer3!
(02:01:09 PM) qense: Hello everyone! I'm Sense Hofstede and during the next hour I hope to learn you a bit about using Application Indicators in your application.
(02:01:28 PM) qense: [SLIDE 1]
(02:01:30 PM) qense: The slides for this session are located at <https://people.ubuntu.com/~qense/appind-session.pdf>.
(02:01:36 PM) qense: If you've got a question, don't hesitate to ask in #ubuntu-classroom-chat. Start your question with 'QUESTION:' so it can be found.
(02:02:00 PM) qense: [SLIDE 2]
(02:02:05 PM) qense: First I'll talk a bit about what Indicator Application is and why you should use it.
(02:02:18 PM) qense: After that we'll take a look at an example in Python, which I'm going to use to tell you about the way AppInd works.
(02:02:28 PM) qense: Then I'll quickly explain the differences for other languages.
(02:02:50 PM) qense: At the end of the session there will be time for questions. If you want to port your or someone else's application to Application Indicator and got a question about that, please save those for then.
(02:03:14 PM) qense: It seems that I gave the wrong URL for the slides, people.ubuntu.comd eosn't suppoprt HTTPS, you want <http://people.ubuntu.com/~qense/appind-session.pdf> instead.
(02:03:39 PM) qense: Everyone can get the slides now?
(02:03:51 PM) qense: [SLIDE 3]
(02:04:09 PM) qense: The purpose of Indicator Application is to give you a clean and consistent system tray.
(02:04:22 PM) qense: This is done by taking the drawing of the status icon and its menu away from the applications and make them request the Indicator Application service to do it for them instead.
(02:04:49 PM) qense: We are very strict, the only action allowed at the moment is the left mouse click, which spawns a menu. That is all, although we might see support for scroll events in the future.
(02:05:27 PM) qense: For more information I would like to point you to the links some of you can already see at the slides:
(02:05:31 PM) qense: https://wiki.ubuntu.com/DesktopExperienceTeam/ApplicationIndicators
(02:05:44 PM) qense: That is the most important source of information.
(02:05:48 PM) qense: And you've got:
(02:05:49 PM) qense: https://wiki.ubuntu.com/CustomStatusMenuDesignGuidelines
(02:05:53 PM) qense: and https://launchpad.net/indicator-application
(02:07:01 PM) qense: [SLIDE 4]
(02:07:16 PM) qense: Why should you all use Indicator Application?
(02:07:24 PM) qense: One of the reasons is that the protocol we use is an implementation of the notification specification as proposed by KDE and as implemented in KNotify.
(02:07:35 PM) qense: This means that KDE applications using KNotify will show up in GNOME with native GTK+ menus and that applications using Indicator Application will show up in KDE with native Qt menus.
(02:07:57 PM) qense: The most important thing, however, is that the tray is now under control of one application, which is much easier to configure and theme.
(02:08:06 PM) qense: The behaviour of the tray icons is now consistent so users know what to expect.
(02:08:18 PM) rickspencer3 left the room.
(02:08:18 PM) qense: If there are any questions about what I've just told, now is the time to ask.
(02:08:56 PM) qense: If I'm going too fast, please let me know as well. ;)
(02:09:27 PM) ClassBot: stefodestructo asked: does this work in windows and osx?
(02:10:24 PM) qense: No, this works only on Ubuntu at the moment, and it could be built on other Linuxes as well. However, there is no port for Windows or Mac OS X and there is nothing like that planned either.
(02:11:20 PM) ClassBot: titeuf_87 asked: is this an applet in the gnome-panel or does it actually use the "normal" system tray to display?
(02:11:51 PM) qense: titeuf_87: AppIndicator uses the Indicator Applet that was introduced in Ubuntu with the Karmic release.
(02:12:32 PM) ClassBot: PaulGit asked: If my application communicates with the indicator applet does it mean it will only run on Ubuntu and not other distros?
(02:13:53 PM) qense: PaulGit: Good question. AppIndicator uses the standard KDE proposed at FreeDesktop. This means that anything implementing that standard will support it. At the moment this just are KDE 4 and Ubuntu Lucid. For other distributions you'll need a fall-back, which is integrated in the library.
(02:14:51 PM) qense: one last question
(02:14:58 PM) ClassBot: liems asked: Is it expected that this will be integrated into other distros?
(02:15:35 PM) qense: This depends on the other distributions. The developers are actively working with GNOME upstream, so we'll have to wait what the outcome of that will be.
(02:15:53 PM) qense: more on fallback, categories and your other questions later this session
(02:15:57 PM) qense: [SLIDE 5]
(02:16:25 PM) qense: We're now going to take a closer look at the way Indicator Applications work.
(02:16:48 PM) qense: Karmic users wanting to see what's coming next in action need to install AppIndicator from a PPA: ppa:indicator-applet-developers/indicator-core-ppa
(02:16:52 PM) qense: https://launchpad.net/~indicator-applet-developers/+archive/indicator-core-ppa/
(02:17:26 PM) qense: We're going to walk through an example to get a better understanding of the applet.
(02:17:29 PM) qense: At the wiki there are several examples in different languages. I've taken the Python example, adapted it a bit and uploaded it to
(02:17:32 PM) qense: http://people.ubuntu.com/~qense/appind-example.py
(02:19:10 PM) qense: First we import appindicator module in Python:
(02:19:10 PM) qense: import appindicator
(02:19:26 PM) qense: The we start with initialising the indicator:
(02:19:27 PM) qense: ind = appindicator.Indicator ("example-simple-client", "indicator-messages", appindicator.CATEGORY_APPLICATION_STATUS)
(02:19:57 PM) qense: The first argument is a unique identifier for the application. It is used in the file ~/.config/indicators/application/lru-file.json -- where a few details of the application are saved -- to identify it.
(02:20:10 PM) qense: The second argument is the name of the icon that's to be used.
(02:20:23 PM) qense: The third argument is a category that at the moment is just saved, but in the future Indicator Application could be extended to present the icons in a better way using that information.
(02:21:18 PM) qense: We could e.g. sort the icons on category. Since we communicate with the applet over DBus other applications can listen in as well and process the tray icons if they would wish to. The categories are a possible filter.
(02:21:36 PM) qense: However, at the moment the category not used.
(02:21:49 PM) qense: You can find a list of possible categories at the wiki page.
(02:22:05 PM) qense: The next line of code sets the status:
(02:22:06 PM) qense: ind.set_status (appindicator.STATUS_ACTIVE)
(02:22:27 PM) qense: There are three possible statuses, STATUS_ACTIVE, STATUS_PASSIVE and STATUS_ATTENTION, their meaning is: show, hide, show with the attention icon, which is set on the next line:
(02:22:55 PM) qense: ind.set_attention_icon ("indicator-messages-new")
(02:23:22 PM) qense: Again we're using an icon name, at the moment it is not yet possible to set the icon path in the Python bindings, but the developers are working on that bug.
(02:24:04 PM) qense: In C# you can provide a path as the fourth argument of the constructor, in C you use the function app_indicator_new_with_path() .
(02:24:15 PM) qense: By default we look in the icon theme for the icon.
(02:24:45 PM) qense: Next thing we do in the code is creating a GtkMenu, we will later give it to the indicator.
(02:25:06 PM) ClassBot: M58 asked: Does it support pixmaps for icons?
(02:25:40 PM) qense: M58: It does not, the design team has chosen not to do so in order to make sure the icons blend nicely with the theme.
(02:26:00 PM) qense: Again we're taking a bit power away from the application to make sure it integrates a bit nicer into the desktop.
(02:26:36 PM) qense: Back to the menu: we tell appindicator about our menu with the following line of code.
(02:26:39 PM) qense: ind.set_menu(menu)
(02:26:45 PM) qense: Simple, not?
(02:26:59 PM) qense: You can reuse existing menus if you want.
(02:27:35 PM) AndChat is now known as Guest59271
(02:27:42 PM) qense: Signals connected to the menu items will be sent to their handlers like they would do when the menu was a part of the application.
(02:28:00 PM) ClassBot: nadako70 asked: is gtkmenu actually used or is it only a sugar for creating some internal menu structure, so it can be recreated in qt by KDE applet?
(02:30:11 PM) qense: nadako70: The menu is sent to libappindicator as GtkMenu and there it is processed as a GtkMenu, but it is sent over DBus in a structure that is toolkit-agnostic so it is drawn by the native GUI toolkit in both GNOME and KDE.
(02:30:26 PM) qense: Don't forget to show() the menu items!
...

Ubuntu Opportunistic Developers Week March 2010 - Building in Application Indicator support - Sense Hofstede - Mar 1 2010

(02:01:05 PM) qense: thank you rickspencer3!
(02:01:09 PM) qense: Hello everyone! I'm Sense Hofstede and during the next hour I hope to learn you a bit about using Application Indicators in your application.
(02:01:28 PM) qense: [SLIDE 1]
(02:01:30 PM) qense: The slides for this session are located at <https://people.ubuntu.com/~qense/appind-session.pdf>.
(02:01:36 PM) qense: If you've got a question, don't hesitate to ask in #ubuntu-classroom-chat. Start your question with 'QUESTION:' so it can be found.
(02:02:00 PM) qense: [SLIDE 2]
(02:02:05 PM) qense: First I'll talk a bit about what Indicator Application is and why you should use it.
(02:02:18 PM) qense: After that we'll take a look at an example in Python, which I'm going to use to tell you about the way AppInd works.
(02:02:28 PM) qense: Then I'll quickly explain the differences for other languages.
(02:02:50 PM) qense: At the end of the session there will be time for questions. If you want to port your or someone else's application to Application Indicator and got a question about that, please save those for then.
(02:03:14 PM) qense: It seems that I gave the wrong URL for the slides, people.ubuntu.comd eosn't suppoprt HTTPS, you want <http://people.ubuntu.com/~qense/appind-session.pdf> instead.
(02:03:39 PM) qense: Everyone can get the slides now?
(02:03:51 PM) qense: [SLIDE 3]
(02:04:09 PM) qense: The purpose of Indicator Application is to give you a clean and consistent system tray.
(02:04:22 PM) qense: This is done by taking the drawing of the status icon and its menu away from the applications and make them request the Indicator Application service to do it for them instead.
(02:04:49 PM) qense: We are very strict, the only action allowed at the moment is the left mouse click, which spawns a menu. That is all, although we might see support for scroll events in the future.
(02:05:27 PM) qense: For more information I would like to point you to the links some of you can already see at the slides:
(02:05:31 PM) qense: https://wiki.ubuntu.com/DesktopExperienceTeam/ApplicationIndicators
(02:05:44 PM) qense: That is the most important source of information.
(02:05:48 PM) qense: And you've got:
(02:05:49 PM) qense: https://wiki.ubuntu.com/CustomStatusMenuDesignGuidelines
(02:05:53 PM) qense: and https://launchpad.net/indicator-application
(02:07:01 PM) qense: [SLIDE 4]
(02:07:16 PM) qense: Why should you all use Indicator Application?
(02:07:24 PM) qense: One of the reasons is that the protocol we use is an implementation of the notification specification as proposed by KDE and as implemented in KNotify.
(02:07:35 PM) qense: This means that  KDE applications using KNotify will show up in GNOME with native GTK+ menus and that applications using Indicator Application will show up in KDE with native Qt menus.
(02:07:57 PM) qense: The most important thing, however, is that the tray is now under control of one application, which is much easier to configure and theme.
(02:08:06 PM) qense: The behaviour of the tray icons is now consistent so users know what to expect.
(02:08:18 PM) rickspencer3 left the room.
(02:08:18 PM) qense: If there are any questions about what I've just told, now is the time to ask.
(02:08:56 PM) qense: If I'm going too fast, please let me know as well. ;)
(02:09:27 PM) ClassBot: stefodestructo asked: does this work in windows and osx?
(02:10:24 PM) qense: No, this works only on Ubuntu at the moment, and it could be built on other Linuxes as well. However, there is no port for Windows or Mac OS X and there is nothing like that planned either.
(02:11:20 PM) ClassBot: titeuf_87 asked: is this an applet in the gnome-panel or does it actually use the "normal" system tray to display?
(02:11:51 PM) qense: titeuf_87: AppIndicator uses the Indicator Applet that was introduced in Ubuntu with the Karmic release.
(02:12:32 PM) ClassBot: PaulGit asked: If my application communicates with the indicator applet does it mean it will only run on Ubuntu and not other distros?
(02:13:53 PM) qense: PaulGit: Good question. AppIndicator uses the standard KDE proposed at FreeDesktop. This means that anything implementing that standard will support it. At the moment this just are KDE 4 and Ubuntu Lucid. For other distributions you'll need a fall-back, which is integrated in the library.
(02:14:51 PM) qense: one last question
(02:14:58 PM) ClassBot: liems asked: Is it expected that this will be integrated into other distros?
(02:15:35 PM) qense: This depends on the other distributions. The developers are actively working with GNOME upstream, so we'll have to wait what the outcome of that will be.
(02:15:53 PM) qense: more on fallback, categories and your other questions later this session
(02:15:57 PM) qense: [SLIDE 5]
(02:16:25 PM) qense: We're now going to take a closer look at the way Indicator Applications work.
(02:16:48 PM) qense: Karmic users wanting to see what's coming next in action need to install AppIndicator from a PPA: ppa:indicator-applet-developers/indicator-core-ppa
(02:16:52 PM) qense: https://launchpad.net/~indicator-applet-developers/+archive/indicator-core-ppa/
(02:17:26 PM) qense: We're going to walk through an example to get a better understanding of the applet.
(02:17:29 PM) qense: At the wiki there are several examples in different languages. I've taken the Python example, adapted it a bit and uploaded it to
(02:17:32 PM) qense: http://people.ubuntu.com/~qense/appind-example.py
(02:19:10 PM) qense: First we import appindicator module in Python:
(02:19:10 PM) qense: import appindicator
(02:19:26 PM) qense: The we start with initialising the indicator:
(02:19:27 PM) qense: ind = appindicator.Indicator ("example-simple-client", "indicator-messages", appindicator.CATEGORY_APPLICATION_STATUS)
(02:19:57 PM) qense: The first argument is a unique identifier for the application. It is used in the file ~/.config/indicators/application/lru-file.json -- where a few details of the application are saved -- to identify it.
(02:20:10 PM) qense: The second argument is the name of the icon that's to be used.
(02:20:23 PM) qense: The third argument is a category that at the moment is just saved, but in the future Indicator Application could be extended to present the icons in a better way using that information.
(02:21:18 PM) qense: We could e.g. sort the icons on category. Since we communicate with the applet over DBus other applications can listen in as well and process the tray icons if they would wish to. The categories are a possible filter.
(02:21:36 PM) qense: However, at the moment the category not used.
(02:21:49 PM) qense: You can find a list of possible categories at the wiki page.
(02:22:05 PM) qense: The next line of code sets the status:
(02:22:06 PM) qense: ind.set_status (appindicator.STATUS_ACTIVE)
(02:22:27 PM) qense: There are three possible statuses, STATUS_ACTIVE, STATUS_PASSIVE and STATUS_ATTENTION, their meaning is: show, hide, show with the attention icon, which is set on the next line:
(02:22:55 PM) qense: ind.set_attention_icon ("indicator-messages-new")
(02:23:22 PM) qense: Again we're using an icon name, at the moment it is not yet possible to set the icon path in the Python bindings, but the developers are working on that bug.
(02:24:04 PM) qense: In C# you can provide a path as the fourth argument of the constructor, in C you use the function app_indicator_new_with_path() .
(02:24:15 PM) qense: By default we look in the icon theme for the icon.
(02:24:45 PM) qense: Next thing we do in the code is creating a GtkMenu, we will later give it to the indicator.
(02:25:06 PM) ClassBot: M58 asked: Does it support pixmaps for icons?
(02:25:40 PM) qense: M58: It does not, the design team has chosen not to do so in order to make sure the icons blend nicely with the theme.
(02:26:00 PM) qense: Again we're taking a bit power away from the application to make sure it integrates a bit nicer into the desktop.
(02:26:36 PM) qense: Back to the menu: we tell appindicator about our menu with the following line of code.
(02:26:39 PM) qense: ind.set_menu(menu)
(02:26:45 PM) qense: Simple, not?
(02:26:59 PM) qense: You can reuse existing menus if you want.
(02:27:35 PM) AndChat is now known as Guest59271
(02:27:42 PM) qense: Signals connected to the menu items will be sent to their handlers like they would do when the menu was a part of the application.
(02:28:00 PM) ClassBot: nadako70 asked: is gtkmenu actually used or is it only a sugar for creating some internal menu structure, so it can be recreated in qt by KDE applet?
(02:30:11 PM) qense: nadako70: The menu is sent to libappindicator as GtkMenu and there it is processed as a GtkMenu, but it is sent over DBus in a structure that is toolkit-agnostic so it is drawn by the native GUI toolkit in both GNOME and KDE.
(02:30:26 PM) qense: Don't forget to show() the menu items!
...

MeetingLogs/OpWeek1003/AppIndicator (last edited 2010-03-01 20:07:03 by pool-71-182-100-128)