#!/usr/bin/env python3
import sys
import signal

import gi
gi.require_version('Gtk', '3.0')
gi.require_version('AppIndicator3', '0.1')

from gi.repository import Gtk as gtk
from gi.repository import AppIndicator3 as appindicator

APPINDICATOR_ID = 'sss'

def main():
    icon = gtk.IconTheme().lookup_icon(
            'content-loading-symbolic',
            16,
            gtk.IconLookupFlags.FORCE_SYMBOLIC).get_filename()

    text = f"Uploading {sys.argv[1]}"
    label = gtk.MenuItem(label=text)
    label.set_sensitive(False)

    menu = gtk.Menu()
    menu.append(label)
    menu.show_all()

    indicator = appindicator.Indicator.new(
            APPINDICATOR_ID,
            icon,
            appindicator.IndicatorCategory.SYSTEM_SERVICES)
    indicator.set_status(appindicator.IndicatorStatus.ACTIVE)
    indicator.set_menu(menu)
    gtk.main()

if __name__ == "__main__":
    signal.signal(signal.SIGINT, signal.SIG_DFL)
    main()
