#!/bin/bash/python
import os
import signal
import json
import gi
import subprocess
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
gi.require_version('Notify', '0.7')
from gi.repository import Notify as notify
APPINDICATOR_ID = 'myappindicator'
def main():
indicator = appindicator.Indicator.new(APPINDICATOR_ID, os.path.abspath('/home/crivi/Immagini/speech-bubble-with-ellipsis.png'), appindicator.IndicatorCategory.SYSTEM_SERVICES)
indicator.set_status(appindicator.IndicatorStatus.ACTIVE)
indicator.set_menu(build_menu())
notify.init(APPINDICATOR_ID)
gtk.main()
def build_menu():
menu = gtk.Menu()
item_backup = gtk.MenuItem('Gestione Backup')
item_backup.connect('activate', backup)
menu.append(item_backup)
item_libreria = gtk.MenuItem('Gestione Libreria')
item_libreria.connect('activate', libreria)
menu.append(item_libreria)
item_quit = gtk.MenuItem('Esci')
item_quit.connect('activate', quit)
item_quit.show()
menu.append(item_quit)
menu.show_all()
return menu
def backup(_):
subprocess.call('backup')
def libreria(_):
subprocess.call('libreria')
def quit(_):
notify.uninit()
gtk.main_quit()
if __name__ == "__main__":
signal.signal(signal.SIGINT, signal.SIG_DFL)
main()