Skip to content

Instantly share code, notes, and snippets.

@candidtim
Created February 12, 2015 20:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save candidtim/2cd33ad40016b918ecf9 to your computer and use it in GitHub Desktop.
Save candidtim/2cd33ad40016b918ecf9 to your computer and use it in GitHub Desktop.
Minimal Ubuntu AppIndicator in Python, with support for SIGINT (e.g. Ctrl+C)
import signal
from gi.repository import Gtk as gtk
from gi.repository import AppIndicator3 as appindicator
APPINDICATOR_ID = 'myappindicator'
def main():
indicator = appindicator.Indicator.new(APPINDICATOR_ID, 'whatever', appindicator.IndicatorCategory.SYSTEM_SERVICES)
indicator.set_status(appindicator.IndicatorStatus.ACTIVE)
indicator.set_menu(gtk.Menu())
gtk.main()
if __name__ == "__main__":
signal.signal(signal.SIGINT, signal.SIG_DFL)
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment