I have written a simple indicator applet for Ubuntu in python with gi.repository which I had been running successfully on my Ubuntu 14.04 for a long time without any problems. After I updated to Ubuntu 16.04 I started seeing some weird behavior. I tried it on Ubuntu 14.04 again just to be sure and it works fine but on Ubuntu 16.04 my menu events don't get fired and the application sometimes doesn't respond when I'm trying to change the icon.
Some basic code indicator that works on Ubuntu 14.04 but not on Ubuntu 16.04
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk as gtk
gi.require_version('AppIndicator3', '0.1')
from gi.repository import AppIndicator3 as appindicator
def main():
indicator = appindicator.Indicator.new(
'mytestindicator',
gtk.STOCK_INFO,
appindicator.IndicatorCategory.SYSTEM_SERVICES
)
indicator.set_status(appindicator.IndicatorStatus.ACTIVE)
indicator.set_menu(build_menu())
gtk.main()
def quit(source):
gtk.main_quit()
def build_menu():
menu = gtk.Menu()
item_quit = gtk.MenuItem('Quit')
item_quit.connect('activate', quit)
menu.append(item_quit)
menu.show_all()
return menu
if __name__ == '__main__':
main()
So my question is what changed between Ubuntu 14.04 and 16.04 and how can I create a reliable indicator applet that runs smoothly on both systems?
One thing I noticed though, on Ubuntu 14 I have gi.repository version 3.12.0 but on Ubuntu 16 it's 3.20.0, not sure that matters though.
As we discussed: