qubesxdg.py 585 B

1234567891011121314151617181920
  1. #!/usr/bin/python
  2. from gi.repository import Gio
  3. import sys
  4. import dbus
  5. def launch(desktop, *files):
  6. launcher = Gio.DesktopAppInfo.new_from_filename(desktop)
  7. if hasattr(launcher, 'get_boolean'):
  8. activatable = launcher.get_boolean('DBusActivatable')
  9. if activatable:
  10. bus = dbus.SessionBus()
  11. service_id = launcher.get_id()
  12. # cut the .desktop suffix
  13. service_id = service_id[:-8]
  14. bus.start_service_by_name(service_id)
  15. launcher.launch(files, None)
  16. if __name__ == "__main__":
  17. launch(*sys.argv[1:])