I'm writing an application that needs to use an indicator. I've done this in the past using PyGTK and GTK2, using as reference this document: https://wiki.ubuntu.com/DesktopExperienceTeam/ApplicationIndicators#Python_version
However, that only works with PyGTK and GTK2. Things have changed since then, and I need to find some good documentation, a tutorial or a good example to learn how it works.
Also, one thing that the previously mentioned document doesn't describe at all, is how to add sub-menus to an indicator. I hope someone can shed some light on this, as well as how to integrate with category indicators if that's done using the same tool.
Thanks.
This is my trial code for gtk3 and appindicator which creates a indicator for GPaste.
Basically,
in order to use appindicator for gtk3 applications which is provided by package
gir1.2-appindicator3
.Here is the AppIndicator3 documentation.
pygtk will be deprecated for Gtk3 and you have to go through GObject-Introspection route for developing Gtk3 applications in python. You can refer to PyGObject documentation. Instead of
etc you should do
For studying a working code, you could view Kazam which has moved to gtk3 from gtk2 and uses appindicator3.
There is a package
gir1.2-appindicator
as well which seems to be same as usingpython-appindicator
as they both provide usage for gtk2 appplication which is:OR
Some information in this blog post as well.
Here's a stupid simple scaffold application that has a config window, a main window, and an app indicator.
Just in case someone might find it useful, I made a minimal app indicator with Python, GIR and GTK3. It reads CPU speeds from /proc/cpuinfo every few seconds and displays them.
See here: https://bitbucket.org/cpbotha/indicator-cpuspeed/src
Here is an example of reading cpu temperature. copy an icon named temp-icon.png/svg in the script directory