2015-08-26 02:00:51 +02:00
|
|
|
#!/usr/bin/python
|
2015-08-07 13:50:56 +02:00
|
|
|
|
|
|
|
from gi.repository import Gio
|
2015-08-26 02:00:51 +02:00
|
|
|
import sys
|
2015-08-26 02:03:00 +02:00
|
|
|
import dbus
|
2014-10-27 12:25:45 +01:00
|
|
|
|
|
|
|
def main(myname, desktop, *files):
|
2015-08-26 02:00:51 +02:00
|
|
|
launcher = Gio.DesktopAppInfo.new_from_filename(desktop)
|
2015-08-26 02:03:00 +02:00
|
|
|
activatable = launcher.get_boolean('DBusActivatable')
|
|
|
|
if activatable:
|
|
|
|
bus = dbus.SessionBus()
|
|
|
|
service_id = launcher.get_id()
|
|
|
|
# cut the .desktop suffix
|
|
|
|
service_id = service_id[:-8]
|
|
|
|
bus.start_service_by_name(service_id)
|
2015-08-26 02:00:51 +02:00
|
|
|
launcher.launch(files, None)
|
2014-10-27 12:25:45 +01:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main(*sys.argv)
|