def initialize_plugin(name): global pid ## check for multihead display = gtk.gdk.display_get_default() screen = display.get_default_screen() if display.get_n_screens() > 1: pretty.print_info(__name__, "Starting Multi X screen support") for idx in xrange(display.get_n_screens()): if idx != screen.get_number(): pretty.print_info(__name__, "Launching keyrelay for screen", idx) screen_x = display.get_screen(idx) # run helper without respawning it pid = utils.start_plugin_helper("kupfer.keyrelay", False, screen_x.make_display_name()) child_pids.append(pid)
def get_plugin_service_obj(plugin_id, activate=True): """Return the dbus proxy object for our plugin if @activate, we will --exec-helper= the service """ plugin_id = plugin_id.split(".")[-1] service_name = "se.kaizer.kupfer.plugin.%s" % plugin_id interface_name = "se.kaizer.kupfer.plugin.%s" % plugin_id object_name = "/se/kaizer/kupfer/plugin/%s" % plugin_id try: bus = dbus.Bus() except dbus.DBusException: return None try: proxy_obj = bus.get_object(service_name, object_name) except dbus.DBusException as exc: if activate: service_id = "kupfer.plugin.%s.service" % plugin_id return utils.start_plugin_helper(service_id, True) return None proxy_iface = dbus.Interface(proxy_obj, interface_name) return proxy_iface